diff options
author | Martin Odersky <odersky@gmail.com> | 2016-11-10 11:54:27 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-12-01 13:55:12 +0100 |
commit | 2b12868070be50fb70c687bcd8a415acbe398e3e (patch) | |
tree | f3977e7e9408ff6adc14f4ef6e685e710f310410 /compiler/src/dotty/tools/dotc/typer/Typer.scala | |
parent | 4ae76f2164e91d6a26519304b5ac5df527ae9207 (diff) | |
download | dotty-2b12868070be50fb70c687bcd8a415acbe398e3e.tar.gz dotty-2b12868070be50fb70c687bcd8a415acbe398e3e.tar.bz2 dotty-2b12868070be50fb70c687bcd8a415acbe398e3e.zip |
New phase for entering annotations
If we want to do annotation macros right, we need to add
annotations before completing definitions. This commit achieves
that by adding a new "phase" between index and typecheck.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Typer.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 165d2e266..7b079d1ed 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -192,12 +192,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } def selection(name: Name) = - if (unimported.contains(imp.site.termSymbol)) - NoType - else if (imp.sym.isCompleting) { + if (imp.sym.isCompleting) { ctx.warning(i"cyclic ${imp.sym}, ignored", tree.pos) NoType } + else if (unimported.nonEmpty && unimported.contains(imp.site.termSymbol)) + NoType else { // Pass refctx so that any errors are reported in the context of the // reference instead of the @@ -588,7 +588,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } def typedBlockStats(stats: List[untpd.Tree])(implicit ctx: Context): (Context, List[tpd.Tree]) = - (index(stats), typedStats(stats, ctx.owner)) + (indexAndAnnotate(stats), typedStats(stats, ctx.owner)) def typedBlock(tree: untpd.Block, pt: Type)(implicit ctx: Context) = track("typedBlock") { val (exprCtx, stats1) = typedBlockStats(tree.stats) @@ -1070,7 +1070,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def typedPolyTypeTree(tree: untpd.PolyTypeTree)(implicit ctx: Context): Tree = track("typedPolyTypeTree") { val PolyTypeTree(tparams, body) = tree - index(tparams) + indexAndAnnotate(tparams) val tparams1 = tparams.mapconserve(typed(_).asInstanceOf[TypeDef]) val body1 = typedType(tree.body) assignType(cpy.PolyTypeTree(tree)(tparams1, body1), tparams1, body1) |