summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-19 01:53:46 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-19 01:53:46 -0700
commitacbb2f668d363f062fdbb951b33b00dbfcca47ad (patch)
tree4b007cbda7ee26a02e848fc0729d2e32c1b82bce /src/compiler
parentc45132363dadb07cf372edc57ca6dbcfa97f1c0e (diff)
parentbec459a554d978f19dc0b40289d9179dbc28de78 (diff)
downloadscala-acbb2f668d363f062fdbb951b33b00dbfcca47ad.tar.gz
scala-acbb2f668d363f062fdbb951b33b00dbfcca47ad.tar.bz2
scala-acbb2f668d363f062fdbb951b33b00dbfcca47ad.zip
Merge pull request #737 from scalamacros/topic/reifyanonymous
enables reification of anonymous classes
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/reflect/reify/Errors.scala5
-rw-r--r--src/compiler/scala/reflect/reify/Reifier.scala14
2 files changed, 0 insertions, 19 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