diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-02 15:33:46 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-02 15:39:41 +0100 |
commit | 83c74a5e4a75f2973554a17fcbc31e18f3aa229f (patch) | |
tree | 592a1167532c97187391a721f45408b07df74c85 | |
parent | 2ee34efcb8ae2e8604b96de6824d4b55ce583e7d (diff) | |
download | dotty-83c74a5e4a75f2973554a17fcbc31e18f3aa229f.tar.gz dotty-83c74a5e4a75f2973554a17fcbc31e18f3aa229f.tar.bz2 dotty-83c74a5e4a75f2973554a17fcbc31e18f3aa229f.zip |
Fixing problems with wrong owner
... which were introduced when trying to avoid NoSymbol owners.
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index ed35db0b3..92ef0a266 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -586,10 +586,10 @@ class Typer extends Namer with Applications with Implicits { cpy.ValDef(param, param.mods, param.name, paramTpt, param.rhs) } - val resultTpt = + /*val resultTpt = if (isFullyDefined(protoResult, ForceDegree.none)) untpd.TypeTree(protoResult) - else untpd.TypeTree() - typed(desugar.makeClosure(inferredParams, fnBody, resultTpt), pt) + else untpd.TypeTree()*/ + typed(desugar.makeClosure(inferredParams, fnBody/*, resultTpt*/), pt) } } @@ -888,7 +888,7 @@ class Typer extends Namer with Applications with Implicits { ctx.error(i"$pkg is not a packge", tree.pos) ctx } - val stats1 = typedStats(tree.stats, pkg)(packageContext) + val stats1 = typedStats(tree.stats, pkg.moduleClass)(packageContext) cpy.PackageDef(tree, pid1.asInstanceOf[RefTree], stats1) withType pkg.valRef } @@ -901,7 +901,11 @@ class Typer extends Namer with Applications with Implicits { val sym = symOfTree.getOrElse(xtree, NoSymbol) sym.ensureCompleted() symOfTree.remove(xtree) - def localContext = ctx.fresh.withOwner(sym).withTree(xtree) + def localContext = { + val freshCtx = ctx.fresh.withTree(xtree) + if (sym.exists) freshCtx.withOwner(sym) + else freshCtx // can happen for self defs + } def typedNamed(tree: untpd.NameTree): Tree = tree match { case tree: untpd.Ident => typedIdent(tree, pt) @@ -910,7 +914,7 @@ class Typer extends Namer with Applications with Implicits { case tree: untpd.Bind => typedBind(tree, pt) case tree: untpd.ValDef => if (tree.isEmpty) tpd.EmptyValDef - else typedValDef(tree, sym)(ctx.fresh.withTree(tree).withNewScope) + else typedValDef(tree, sym)(localContext.withNewScope) case tree: untpd.DefDef => val typer1 = nestedTyper.remove(sym).get typer1.typedDefDef(tree, sym)(localContext.withTyper(typer1)) |