aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-02 10:21:12 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-09 09:43:08 +0100
commitec4a3a0f4d0b8cccf636d1608896e7cafba9dec0 (patch)
tree9b732c1937b3d781b117a445a95c7f5e6ffb8bbf /src/dotty/tools/dotc/typer/Typer.scala
parentd34256c14a507dbdaea10bd83e8006cdafb9c799 (diff)
downloaddotty-ec4a3a0f4d0b8cccf636d1608896e7cafba9dec0.tar.gz
dotty-ec4a3a0f4d0b8cccf636d1608896e7cafba9dec0.tar.bz2
dotty-ec4a3a0f4d0b8cccf636d1608896e7cafba9dec0.zip
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.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala9
1 files changed, 2 insertions, 7 deletions
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)
}