From 379fd874eb9620a9df74bd395cea32698e94acc9 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 24 Feb 2015 22:41:37 +0100 Subject: [PATCH 1/2] Fix for #371 This causes backend to fail with ambiguous reference when loading member "equals" of object "BoxesRuntime". The reference is indeed ambiguous. BoxesRunTime has a two paremeter equals method and, with the fix, inherits the one-parameter method from Object. The backend needs to disambiguate, e.g. by demanding the `decl` equals in BoxesRunTime instead of the member. --- src/dotty/tools/dotc/core/pickling/UnPickler.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala index 160bf620c895..170ebd28bc91 100644 --- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala +++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala @@ -106,7 +106,8 @@ object UnPickler { case TempPolyType(tps, cinfo) => (tps, cinfo) case cinfo => (Nil, cinfo) } - val parentRefs = ctx.normalizeToClassRefs(parents, cls, decls) + var parentRefs = ctx.normalizeToClassRefs(parents, cls, decls) + if (parentRefs.isEmpty) parentRefs = defn.ObjectClass.typeRef :: Nil for (tparam <- tparams) { val tsym = decls.lookup(tparam.name) if (tsym.exists) tsym.setFlag(TypeParam) From 78243125e9d193d3b4990ad8138257c2c0fbf70d Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Wed, 25 Feb 2015 09:08:29 +0100 Subject: [PATCH 2/2] fix ambiguous reference when loading "equals" of object "BoxesRuntime" --- src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 14408ce7d691..09d0452cfe66 100644 --- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -130,7 +130,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ val externalEqualsNumNum: Symbol = ctx.requiredMethod(BoxesRunTimeClass, nme.equalsNumNum) lazy val externalEqualsNumChar: Symbol = ??? // ctx.requiredMethod(BoxesRunTimeClass, nme.equalsNumChar) // this method is private val externalEqualsNumObject: Symbol = ctx.requiredMethod(BoxesRunTimeClass, nme.equalsNumObject) - val externalEquals: Symbol = ctx.requiredMethod(BoxesRunTimeClass, nme.equals_) + val externalEquals: Symbol = BoxesRunTimeClass.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol val MaxFunctionArity: Int = Definitions.MaxFunctionArity val FunctionClass: Array[Symbol] = defn.FunctionClass.asInstanceOf[Array[Symbol]] val AbstractFunctionClass: Array[Symbol] = defn.AbstractFunctionClass.asInstanceOf[Array[Symbol]]