Skip to content

Commit d83d09d

Browse files
committed
Add doc and use lookup insted of exists
1 parent b53660a commit d83d09d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,11 @@ class Typer extends Namer
396396
}
397397
else if (name.toTermName == nme.ERROR)
398398
UnspecifiedErrorType
399-
else if (ctx.owner.isConstructor && ctx.owner.owner.unforcedDecls.toList.exists(_.name == tree.name))
399+
else if (ctx.owner.isConstructor && ctx.owner.owner.unforcedDecls.lookup(tree.name).exists) {
400+
// If the field existed but was not found we assume that
401+
// we where in the context of an argument of the super constructor
400402
errorType(ex"$tree is not accessible from super constructor arguments", tree.pos)
401-
else
403+
} else
402404
errorType(new MissingIdent(tree, kind, name.show), tree.pos)
403405

404406
val tree1 = ownType match {

0 commit comments

Comments
 (0)