diff options
Diffstat (limited to 'src/compiler')
4 files changed, 9 insertions, 5 deletions
diff --git a/src/compiler/scala/reflect/reify/Errors.scala b/src/compiler/scala/reflect/reify/Errors.scala index 5e15c5ad3a..73c13901b6 100644 --- a/src/compiler/scala/reflect/reify/Errors.scala +++ b/src/compiler/scala/reflect/reify/Errors.scala @@ -27,8 +27,8 @@ trait Errors { throw new ReificationError(defaultErrorPosition, msg) } - def CannotReifyTypeTagHavingUnresolvedTypeParameters(tpe: Type) = { - val msg = "cannot reify TypeTag having unresolved type parameter %s".format(tpe) + def CannotReifyWeakType(details: Any) = { + val msg = "cannot create a TypeTag" + details throw new ReificationError(defaultErrorPosition, msg) } diff --git a/src/compiler/scala/reflect/reify/States.scala b/src/compiler/scala/reflect/reify/States.scala index a01cfe5d74..58455c9f3c 100644 --- a/src/compiler/scala/reflect/reify/States.scala +++ b/src/compiler/scala/reflect/reify/States.scala @@ -34,9 +34,11 @@ trait States { def reificationIsConcrete_=(value: Boolean): Unit = { _reificationIsConcrete = value if (!value && concrete) { - assert(current.isInstanceOf[Type], current) - val offender = current.asInstanceOf[Type] - CannotReifyTypeTagHavingUnresolvedTypeParameters(offender) + current match { + case tpe: Type => CannotReifyWeakType(s" having unresolved type parameter $tpe") + case sym: Symbol => CannotReifyWeakType(s" referring to local ${sym.kindString} ${sym.fullName}") + case _ => CannotReifyWeakType("") + } } } var reifyStack = reifee :: Nil diff --git a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala index be138c7bfa..c4b674955a 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala @@ -112,6 +112,7 @@ trait GenSymbols { def reifyFreeType(binding: Tree): Tree = reifyIntoSymtab(binding.symbol) { sym => if (reifyDebug) println("Free type: %s (%s)".format(sym, sym.accurateKindString)) + state.reificationIsConcrete = false val name = newTermName(nme.REIFY_FREE_PREFIX + sym.name) Reification(name, binding, mirrorBuildCall(nme.newFreeType, reify(sym.name.toString), mirrorBuildCall(nme.flagsFromBits, reify(sym.flags)), reify(origin(sym)))) } diff --git a/src/compiler/scala/reflect/reify/utils/SymbolTables.scala b/src/compiler/scala/reflect/reify/utils/SymbolTables.scala index 30ec6e8d52..2e17558f54 100644 --- a/src/compiler/scala/reflect/reify/utils/SymbolTables.scala +++ b/src/compiler/scala/reflect/reify/utils/SymbolTables.scala @@ -17,6 +17,7 @@ trait SymbolTables { private[SymbolTable] val original: Option[List[Tree]] = None) { def syms: List[Symbol] = symtab.keys.toList + def isConcrete: Boolean = symtab.values forall (sym => !FreeTypeDef.unapply(sym).isDefined) // def aliases: Map[Symbol, List[TermName]] = aliases.distinct groupBy (_._1) mapValues (_ map (_._2)) |