diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-06-30 01:45:47 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-07-02 13:21:32 +0200 |
commit | 96dd73146f4317feeb59a242d692977f87c5211d (patch) | |
tree | b659995dc470be408db317771d147d1035826384 /src | |
parent | c18414d6e1ba89882ba57266bfe96d85fb57713f (diff) | |
download | scala-96dd73146f4317feeb59a242d692977f87c5211d.tar.gz scala-96dd73146f4317feeb59a242d692977f87c5211d.tar.bz2 scala-96dd73146f4317feeb59a242d692977f87c5211d.zip |
reify no longer dealiases symbols and types
this uncovers a bug in toolboxes: https://issues.scala-lang.org/browse/SI-6007
however that bug is not critical, so it will be dealt with later
Diffstat (limited to 'src')
5 files changed, 12 insertions, 20 deletions
diff --git a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala index 3a98d308a7..9b0777580b 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenSymbols.scala @@ -23,10 +23,8 @@ trait GenSymbols { def symtab: SymbolTable = state.symtab /** Reify a reference to a symbol */ - def reifySymRef(sym0: Symbol): Tree = { - assert(sym0 != null, "sym is null") - val sym = sym0.dealias - + def reifySymRef(sym: Symbol): Tree = { + assert(sym != null, "sym is null") if (sym == NoSymbol) mirrorSelect(nme.NoSymbol) else if (sym.isRootPackage) diff --git a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala index b97bf6b0cd..f48df8df65 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala @@ -161,11 +161,9 @@ trait GenTrees { if (tree.symbol.isLocalToReifee || tree.tpe.isLocalToReifee) reifyProduct(tree) else { - val sym0 = tree.symbol - val sym = sym0.dealias - val tpe0 = tree.tpe - val tpe = tpe0.dealias - if (reifyDebug) println("reifying bound type %s (underlying type is %s, dealiased is %s)".format(sym0, tpe0, tpe)) + val sym = tree.symbol + val tpe = tree.tpe + if (reifyDebug) println("reifying bound type %s (underlying type is %s)".format(sym, tpe)) if (tpe.isSpliceable) { val spliced = spliceType(tpe) @@ -187,7 +185,7 @@ trait GenTrees { if (reifyDebug) println("tpe is locatable: reify as Ident(%s)".format(sym)) mirrorBuildCall(nme.Ident, reify(sym)) } else { - if (reifyDebug) println("tpe is an alias, but not a locatable: reify as TypeTree(%s)".format(tpe)) + if (reifyDebug) println("tpe is not locatable: reify as TypeTree(%s)".format(tpe)) mirrorBuildCall(nme.TypeTree, reify(tpe)) } } diff --git a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala index f7239f9c67..82951a2434 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala @@ -11,9 +11,8 @@ trait GenTypes { * Reify a type. * For internal use only, use ``reified'' instead. */ - def reifyType(tpe0: Type): Tree = { - assert(tpe0 != null, "tpe is null") - val tpe = tpe0.dealias + def reifyType(tpe: Type): Tree = { + assert(tpe != null, "tpe is null") if (tpe.isErroneous) CannotReifyErroneousReifee(tpe) @@ -29,9 +28,9 @@ trait GenTypes { if (spliced != EmptyTree) return spliced - val tsym = tpe.typeSymbol + val tsym = tpe.typeSymbolDirect if (tsym.isClass && tpe == tsym.typeConstructor && tsym.isStatic) - Select(Select(reify(tpe.typeSymbol), nme.asTypeSymbol), nme.asTypeConstructor) + Select(Select(reify(tsym), nme.asTypeSymbol), nme.asTypeConstructor) else tpe match { case tpe @ NoType => reifyMirrorObject(tpe) diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 79041924a8..9018ddacbe 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -900,15 +900,12 @@ trait Symbols extends api.Symbols { self: SymbolTable => if (owner.isTerm) return false if (isLocalDummy) return false + if (isAliasType) return true if (isType && isNonClassType) return false if (isRefinementClass) return false return true } - // [Eugene] is it a good idea to add ``dealias'' to Symbol? - /** Expands type aliases */ - def dealias: Symbol = this - /** The variance of this symbol as an integer */ final def variance: Int = if (isCovariant) 1 @@ -2564,7 +2561,6 @@ trait Symbols extends api.Symbols { self: SymbolTable => extends TypeSymbol(initOwner, initPos, initName) { type TypeOfClonedSymbol = TypeSymbol final override def isAliasType = true - final override def dealias = info.typeSymbol.dealias override def cloneSymbolImpl(owner: Symbol, newFlags: Long): TypeSymbol = owner.newNonClassSymbol(name, pos, newFlags) } diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala index 38d280ec73..41955170bd 100644 --- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala +++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala @@ -972,6 +972,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { self: Sym case ExistentialType(_, rtpe) => typeToJavaClass(rtpe) case TypeRef(_, ArrayClass, List(elemtpe)) => jArrayClass(typeToJavaClass(elemtpe)) case TypeRef(_, sym: ClassSymbol, _) => classToJava(sym.asClassSymbol) + case tpe @ TypeRef(_, sym: AliasTypeSymbol, _) => typeToJavaClass(tpe.dealias) case _ => throw new NoClassDefFoundError("no Java class corresponding to "+tpe+" found") } } |