From ec4a3a0f4d0b8cccf636d1608896e7cafba9dec0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 2 Feb 2016 10:21:12 +0100 Subject: Big realizability refactoring Move logic from TypeOps to new file CheckRealizable.scala. Also check realizable fields under strict mode. Check at phase PostTyper rather than Typer to avoid cycles. New tests for imports and deep paths. --- src/dotty/tools/dotc/typer/Typer.scala | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 7894a5b5f..542f78f94 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -274,7 +274,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val tree1 = ownType match { case ownType: NamedType if !prefixIsElidable(ownType) => - checkRealizable(ownType.prefix, tree.pos) ref(ownType).withPos(tree.pos) case _ => tree.withType(ownType) @@ -309,10 +308,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedSelect(tree: untpd.Select, pt: Type)(implicit ctx: Context): Tree = track("typedSelect") { def asSelect(implicit ctx: Context): Tree = { val qual1 = typedExpr(tree.qualifier, selectionProto(tree.name, pt, this)) - if (tree.name.isTypeName) { - checkStable(qual1.tpe, qual1.pos) - checkRealizable(qual1.tpe, qual1.pos) - } + if (tree.name.isTypeName) checkStable(qual1.tpe, qual1.pos) typedSelect(tree, pt, qual1) } @@ -346,7 +342,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedSelectFromTypeTree(tree: untpd.SelectFromTypeTree, pt: Type)(implicit ctx: Context): Tree = track("typedSelectFromTypeTree") { val qual1 = typedType(tree.qualifier, selectionProto(tree.name, pt, this)) - checkRealizable(qual1.tpe, qual1.pos) assignType(cpy.SelectFromTypeTree(tree)(qual1, tree.name), qual1) } @@ -828,7 +823,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedSingletonTypeTree(tree: untpd.SingletonTypeTree)(implicit ctx: Context): SingletonTypeTree = track("typedSingletonTypeTree") { val ref1 = typedExpr(tree.ref) checkStable(ref1.tpe, tree.pos) - checkRealizable(ref1.tpe, tree.pos) assignType(cpy.SingletonTypeTree(tree)(ref1), ref1) } @@ -1064,6 +1058,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedImport(imp: untpd.Import, sym: Symbol)(implicit ctx: Context): Import = track("typedImport") { val expr1 = typedExpr(imp.expr, AnySelectionProto) checkStable(expr1.tpe, imp.expr.pos) + checkRealizable(expr1.tpe, imp.expr.pos) assignType(cpy.Import(imp)(expr1, imp.selectors), sym) } -- cgit v1.2.3