Skip to content

Commit b347d27

Browse files
oderskysjrd
authored andcommitted
In LinkScala2ImplClass, disregard signatures when looking for constructor.
Dotty treats trait and class constructors as returning the class. But scalac uses Unit for the return type of trait init methods.
1 parent 0ae3ef2 commit b347d27

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/dotty/tools/dotc/transform/LinkScala2ImplClasses.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ class LinkScala2ImplClasses extends MiniPhaseTransform with IdentityDenotTransfo
4848
}
4949
}
5050

51-
private def implMethod(meth: Symbol)(implicit ctx: Context): Symbol =
52-
meth.owner.implClass.info
53-
.decl(if (meth.isConstructor) nme.TRAIT_CONSTRUCTOR else meth.name)
51+
private def implMethod(meth: Symbol)(implicit ctx: Context): Symbol = {
52+
val implInfo = meth.owner.implClass.info
53+
if (meth.isConstructor)
54+
implInfo.decl(nme.TRAIT_CONSTRUCTOR).symbol
55+
else
56+
implInfo.decl(meth.name)
5457
.suchThat(c => FullParameterization.memberSignature(c.info) == meth.signature)
5558
.symbol
59+
}
5660

5761
private val Scala2xTrait = allOf(Scala2x, Trait)
58-
}
62+
}

0 commit comments

Comments
 (0)