File tree 2 files changed +2
-2
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -785,10 +785,9 @@ trait Checking {
785
785
|its constructor cannot be called again """ , call.sourcePos)
786
786
787
787
if (caller.is(Module )) {
788
- val objRef = caller.sourceModule.termRef
789
788
val traverser = new TreeTraverser {
790
789
def traverse (tree : Tree )(implicit ctx : Context ) = tree match {
791
- case tree : RefTree if tree.isTerm && tree.tpe <:< objRef =>
790
+ case tree : RefTree if tree.isTerm && ( tree.tpe.widen.classSymbol eq caller) =>
792
791
ctx.error(" super constructor cannot be passed a self reference" , tree.sourcePos)
793
792
case _ =>
794
793
traverseChildren(tree)
Original file line number Diff line number Diff line change 1
1
case class SourcePosition (outer : SourcePosition = (NoSourcePosition : SourcePosition ))
2
2
3
+ // The code should not compile -- currently out of reach
3
4
object NoSourcePosition extends SourcePosition ()
4
5
5
6
object Test extends App {
You can’t perform that action at this time.
0 commit comments