summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-18 14:11:00 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-18 17:33:21 +0200
commitbec459a554d978f19dc0b40289d9179dbc28de78 (patch)
tree2cbdb165d33907a40a70a6529f87007b39c3831e
parent9a28ee1ffc085bc680c48b12ad632b9133adf020 (diff)
downloadscala-bec459a554d978f19dc0b40289d9179dbc28de78.tar.gz
scala-bec459a554d978f19dc0b40289d9179dbc28de78.tar.bz2
scala-bec459a554d978f19dc0b40289d9179dbc28de78.zip
enables reification of anonymous classes
-rw-r--r--src/compiler/scala/reflect/reify/Errors.scala5
-rw-r--r--src/compiler/scala/reflect/reify/Reifier.scala14
-rw-r--r--test/files/neg/t5334_1.check4
-rw-r--r--test/files/neg/t5334_2.check4
-rw-r--r--test/pending/run/t5334_1.scala (renamed from test/files/neg/t5334_1.scala)0
-rw-r--r--test/pending/run/t5334_2.scala (renamed from test/files/neg/t5334_2.scala)0
6 files changed, 0 insertions, 27 deletions
diff --git a/src/compiler/scala/reflect/reify/Errors.scala b/src/compiler/scala/reflect/reify/Errors.scala
index 714795503b..1b72b3075b 100644
--- a/src/compiler/scala/reflect/reify/Errors.scala
+++ b/src/compiler/scala/reflect/reify/Errors.scala
@@ -17,11 +17,6 @@ trait Errors {
// expected errors: these can happen if the user casually writes whatever.reify(...)
// hence we don't crash here, but nicely report a typechecking error and bail out asap
- def CannotReifyReifeeThatHasTypeLocalToReifee(tree: Tree) = {
- val msg = "implementation restriction: cannot reify block of type %s that involves a type declared inside the block being reified. consider casting the return value to a suitable type".format(tree.tpe)
- throw new ReificationError(tree.pos, msg)
- }
-
def CannotReifyType(tpe: Type) = {
val msg = "implementation restriction: cannot reify type %s (%s)".format(tpe, tpe.kind)
throw new ReificationError(defaultErrorPosition, msg)
diff --git a/src/compiler/scala/reflect/reify/Reifier.scala b/src/compiler/scala/reflect/reify/Reifier.scala
index 00f25f0d8b..8fba7274be 100644
--- a/src/compiler/scala/reflect/reify/Reifier.scala
+++ b/src/compiler/scala/reflect/reify/Reifier.scala
@@ -68,20 +68,6 @@ abstract class Reifier extends States
val pipeline = mkReificationPipeline
val rtree = pipeline(tree)
- // consider the following code snippet
- //
- // val x = reify { class C; new C }
- //
- // inferred type for x will be C
- // but C ceases to exist after reification so this type is clearly incorrect
- // however, reify is "just" a library function, so it cannot affect type inference
- //
- // hence we crash here even though the reification itself goes well
- // fortunately, all that it takes to fix the error is to cast "new C" to Object
- // so I'm not very much worried about introducing this restriction
- if (tree.tpe exists (sub => sub.typeSymbol.isLocalToReifee))
- CannotReifyReifeeThatHasTypeLocalToReifee(tree)
-
val tpe = typer.packedType(tree, NoSymbol)
val ReifiedType(_, _, tpeSymtab, _, rtpe, tpeReificationIsConcrete) = `package`.reifyType(global)(typer, universe, mirror, tpe, concrete = false)
state.reificationIsConcrete &= tpeReificationIsConcrete
diff --git a/test/files/neg/t5334_1.check b/test/files/neg/t5334_1.check
deleted file mode 100644
index eca854964a..0000000000
--- a/test/files/neg/t5334_1.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t5334_1.scala:5: error: implementation restriction: cannot reify block of type C that involves a type declared inside the block being reified. consider casting the return value to a suitable type
- reify {
- ^
-one error found
diff --git a/test/files/neg/t5334_2.check b/test/files/neg/t5334_2.check
deleted file mode 100644
index e21f0d5967..0000000000
--- a/test/files/neg/t5334_2.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t5334_2.scala:5: error: implementation restriction: cannot reify block of type List[(C, C)] that involves a type declared inside the block being reified. consider casting the return value to a suitable type
- reify {
- ^
-one error found
diff --git a/test/files/neg/t5334_1.scala b/test/pending/run/t5334_1.scala
index b75badb145..b75badb145 100644
--- a/test/files/neg/t5334_1.scala
+++ b/test/pending/run/t5334_1.scala
diff --git a/test/files/neg/t5334_2.scala b/test/pending/run/t5334_2.scala
index e082e3b8e3..e082e3b8e3 100644
--- a/test/files/neg/t5334_2.scala
+++ b/test/pending/run/t5334_2.scala