File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -785,10 +785,9 @@ trait Checking {
785785 |its constructor cannot be called again """ , call.sourcePos)
786786
787787 if (caller.is(Module )) {
788- val objRef = caller.sourceModule.termRef
789788 val traverser = new TreeTraverser {
790789 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) =>
792791 ctx.error(" super constructor cannot be passed a self reference" , tree.sourcePos)
793792 case _ =>
794793 traverseChildren(tree)
Original file line number Diff line number Diff line change 11case class SourcePosition (outer : SourcePosition = (NoSourcePosition : SourcePosition ))
22
3+ // The code should not compile -- currently out of reach
34object NoSourcePosition extends SourcePosition ()
45
56object Test extends App {
You can’t perform that action at this time.
0 commit comments