diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-18 15:04:20 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-18 15:07:49 +0200 |
commit | fce3f8b2e351494dd8c110b896f731931ae2805e (patch) | |
tree | 0ba835180642d9e3683fcb2d2531a192a079a900 /test | |
parent | 66603a2c003852d39faec20a9763fb0e25049cf4 (diff) | |
download | scala-fce3f8b2e351494dd8c110b896f731931ae2805e.tar.gz scala-fce3f8b2e351494dd8c110b896f731931ae2805e.tar.bz2 scala-fce3f8b2e351494dd8c110b896f731931ae2805e.zip |
existentially typed expansions now work fine
If one tries to compile the following code with the parent of this commit:
ru.reify(new Object().getClass)
then the following error will occur:
Test.scala:2: error: type mismatch;
found : $u.Expr[Class[_ <: Object]]
required: reflect.runtime.universe.Expr[Class[?0(in value <local Test>)]]
where type ?0(in value <local Test>) <: Object
ru.reify(new Object().getClass)
^
This happens because macro expansions are always typechecked against the
return type of their macro definitions instantiated in the context of expandee.
In this case the expected type contains skolems which are incompatible
with wildcards in the type of the expansion.
I tried all the incantations I could think of - without any success.
Luckily I met Martin who pointed me at the same problem solved in adapt
(see the diff w.r.t Typers.scala).
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t5418a.check | 1 | ||||
-rw-r--r-- | test/files/run/t5418a.scala | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/test/files/run/t5418a.check b/test/files/run/t5418a.check new file mode 100644 index 0000000000..ee0e80e11f --- /dev/null +++ b/test/files/run/t5418a.check @@ -0,0 +1 @@ +Expr[Class[_ <: java.lang.Object]](new Object().getClass())
diff --git a/test/files/run/t5418a.scala b/test/files/run/t5418a.scala new file mode 100644 index 0000000000..90bc542be6 --- /dev/null +++ b/test/files/run/t5418a.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(scala.reflect.runtime.universe.reify(new Object().getClass)) +}
\ No newline at end of file |