diff options
author | Your Name <entcrd@gmail.com> | 2012-11-22 20:45:50 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-11-23 08:17:29 +0100 |
commit | 548a54d708d8aaceea6abe0931aabaa70b2cd925 (patch) | |
tree | b19851d1264adea4a6cff3dbfd117cd89383d1a8 /test/files | |
parent | a0e642b7fe608b869071b690e7907b934b10db5a (diff) | |
download | scala-548a54d708d8aaceea6abe0931aabaa70b2cd925.tar.gz scala-548a54d708d8aaceea6abe0931aabaa70b2cd925.tar.bz2 scala-548a54d708d8aaceea6abe0931aabaa70b2cd925.zip |
SI-6023 reify abstract vals
Type trees created by MethodSynthesis for abstract val getters carry symless originals,
which are unusable for reification purposes
(or the result of reification will be unhygienic).
To combat this, type trees for such getters are now created empty,
i.e. without any `tpe` set, just having an original assigned.
Subsequent `typedTypeTree` invocations fill in the `tpe` and
update the original to be symful.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t6023.check | 12 | ||||
-rw-r--r-- | test/files/run/t6023.scala | 17 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/t6023.check b/test/files/run/t6023.check new file mode 100644 index 0000000000..ee93565234 --- /dev/null +++ b/test/files/run/t6023.check @@ -0,0 +1,12 @@ +{ + abstract trait Foo extends AnyRef { + <stable> <accessor> def a: Int + }; + () +} +{ + abstract trait Foo extends AnyRef { + <stable> <accessor> def a: Int + }; + () +} diff --git a/test/files/run/t6023.scala b/test/files/run/t6023.scala new file mode 100644 index 0000000000..07af3685a5 --- /dev/null +++ b/test/files/run/t6023.scala @@ -0,0 +1,17 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + // test 1: reify + val tree = reify{ trait Foo { val a: Int } }.tree + println(tree.toString) + + // test 2: import and typecheck + val toolbox = cm.mkToolBox() + val ttree = toolbox.typeCheck(tree) + println(ttree.toString) + + // test 3: import and compile + toolbox.eval(tree) +} |