Skip to content

Commit e4ff76a

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 ba67e55 commit e4ff76a

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)