diff options
author | Martin Odersky <odersky@gmail.com> | 2015-05-24 13:50:32 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-06 11:04:53 +0200 |
commit | 3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9 (patch) | |
tree | c2b31cca0fe9f6f05769c2dd6298f0d20c403257 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | c8a479255745d7de391f386bbf8946233ff46f7d (diff) | |
download | dotty-3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9.tar.gz dotty-3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9.tar.bz2 dotty-3352ffc97f3577fd6de5c22a22c7c7c887e9b1f9.zip |
Tighten isStable predicate
A term ref is stable only if its prefix is also stable. At the same time, we
drop stability requirements where they no longer make sense (e.g. in isLegalPrefix).
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index acf4f3845..fd1d034fd 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -312,13 +312,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit if (ctx.compilationUnit.isJava && tree.name.isTypeName) { // SI-3120 Java uses the same syntax, A.B, to express selection from the // value A and from the type A. We have to try both. - tryEither(tryCtx => asSelect(tryCtx))((_,_) => asJavaSelectFromTypeTree(ctx)) + tryEither(tryCtx => asSelect(tryCtx))((_, _) => asJavaSelectFromTypeTree(ctx)) } else asSelect(ctx) } def typedSelectFromTypeTree(tree: untpd.SelectFromTypeTree, pt: Type)(implicit ctx: Context): Tree = track("typedSelectFromTypeTree") { val qual1 = typedType(tree.qualifier, selectionProto(tree.name, pt, this)) - checkLegalPrefix(qual1.tpe, tree.name, qual1.pos) assignType(cpy.SelectFromTypeTree(tree)(qual1, tree.name), qual1) } @@ -347,8 +346,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val clsDef = TypeDef(x, templ).withFlags(Final) typed(cpy.Block(tree)(clsDef :: Nil, New(Ident(x), Nil)), pt) case _ => - val tpt1 = typedType(tree.tpt) - checkClassTypeWithStablePrefix(tpt1.tpe, tpt1.pos, traitReq = false) + val tpt1 = typedType(tree.tpt) + checkClassTypeWithStablePrefix(tpt1.tpe, tpt1.pos, traitReq = false) assignType(cpy.New(tree)(tpt1), tpt1) // todo in a later phase: checkInstantiatable(cls, tpt1.pos) } @@ -524,7 +523,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit */ var fnBody = tree.body - /** If function is of the form * (x1, ..., xN) => f(x1, ..., XN) * the type of `f`, otherwise NoType. (updates `fnBody` as a side effect). |