diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Codification.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 3 | ||||
-rw-r--r-- | test/files/pos/bug531.scala | 10 | ||||
-rw-r--r-- | test/files/pos/bug532.scala | 2 |
4 files changed, 16 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Codification.scala b/src/compiler/scala/tools/nsc/typechecker/Codification.scala index d9c345f5fb..b7383fce5b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Codification.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Codification.scala @@ -102,6 +102,8 @@ mixin class Codification requires Analyzer { case None => if (sym.isRoot || sym.isRootPackage || sym.isEmptyPackageClass || sym.isEmptyPackage) reflect.RootSymbol + else if (sym.owner.isTerm) + reflect.NoSymbol else reify(sym.owner) match { case reflect.NoSymbol => reflect.NoSymbol; @@ -197,7 +199,7 @@ mixin class Codification requires Analyzer { def inject(value: Any): Tree = value match { case FreeValue(tree) => - tree + New(Ident(definitions.getClass("scala.reflect.Literal")), List(List(tree))) case () => Literal(Constant(())) case x: String => Literal(Constant(x)) case x: Boolean => Literal(Constant(x)) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index da4a8c2e8a..72fb0e264b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1181,6 +1181,7 @@ mixin class Typers requires Analyzer { error(arg.pos, "attribute argument needs to be a constant; found: "+arg) null }) + //case Block( } if (attrInfo != null) { val attributed = @@ -1463,7 +1464,7 @@ mixin class Typers requires Analyzer { try { if (settings.debug.value) { assert(pt != null, tree);//debug - //System.out.println("typing "+tree);//DEBUG + System.out.println("typing "+tree);//DEBUG } val tree1 = if (tree.tpe != null) tree else typed1(tree, mode, pt) //System.out.println("typed "+tree1+":"+tree1.tpe);//debug diff --git a/test/files/pos/bug531.scala b/test/files/pos/bug531.scala new file mode 100644 index 0000000000..858a46d374 --- /dev/null +++ b/test/files/pos/bug531.scala @@ -0,0 +1,10 @@ +object Test extends Application { + import scala.reflect._; + def titi = { + var truc = 0 + val tata: TypedCode[()=>Unit] = () => { + truc = 6 + } + () + } +} diff --git a/test/files/pos/bug532.scala b/test/files/pos/bug532.scala index 82da9c817f..bd6a4cae93 100644 --- a/test/files/pos/bug532.scala +++ b/test/files/pos/bug532.scala @@ -3,7 +3,7 @@ object Test extends Application { def titi: Unit = { var truc = 0 val tata: TypedCode[()=>Unit] = () => { - truc = 6 + truc = truc + 6 } () } |