From 2ba6774766ec695fef36e605472100922b56b91f Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Wed, 8 Aug 2012 12:46:06 +0200 Subject: SI-5756 correctly reifies local module classes Unlike module classes that are going to be pickled (which are reified as `.moduleClass), module classes of local modules need to be reified as symbol defs. Otherwise we get a stack overflow: 1) Local modules are deemed to be free terms, 2) All free symbols are reified together with their type signature (so that they can be a) inspected by anyone interested, b) compiled at runtime), 3) Reifying a type signature of a module involves reifying its module class, 4) Reifying a module class involves reifying a module and calling its module class, This stack overflow doesn't happen for locatable modules, because they don't need to have their type signatures reified (these signatures can later be loaded from pickles if it becomes necessary). --- test/files/pos/t5756.scala | 6 ++++++ test/files/pos/t6204-a.scala | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/files/pos/t5756.scala create mode 100644 test/files/pos/t6204-a.scala (limited to 'test') diff --git a/test/files/pos/t5756.scala b/test/files/pos/t5756.scala new file mode 100644 index 0000000000..45960fa8bd --- /dev/null +++ b/test/files/pos/t5756.scala @@ -0,0 +1,6 @@ +import scala.reflect.runtime.universe._ + +object Test extends App { + def tagme[T: TypeTag](x: T) = typeTag[T] + val foo = tagme{object Bar; Bar} +} \ No newline at end of file diff --git a/test/files/pos/t6204-a.scala b/test/files/pos/t6204-a.scala new file mode 100644 index 0000000000..bd8d5c437e --- /dev/null +++ b/test/files/pos/t6204-a.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ + +object Bish { + def m { + object Bash { + typeOf[Option[_]] + } + } +} \ No newline at end of file -- cgit v1.2.3