Created
October 14, 2014 05:26
-
-
Save retronym/43d887ce374c12cb679d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tail sandbox/test{1,2}.scala | |
==> sandbox/test1.scala <== | |
class C { class Inner } | |
class D { | |
object O { | |
def foo(c: C)(i: c.Inner): c.Inner = ??? | |
} | |
} | |
==> sandbox/test2.scala <== | |
class E { | |
def foo = { | |
(null: D).toString | |
} | |
} | |
% for v in v2.11.2 v2.11.3 quick; do echo $v; scalac-hash $v sandbox/test1.scala && rm C.class && scalac-hash $v sandbox/test2.scala; done | |
v2.11.2 | |
v2.11.3 | |
error: missing or invalid dependency detected while loading class file 'D.class'. | |
Could not access type C in package <empty>, | |
because it (or its dependencies) are missing. Check your build definition for | |
missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) | |
A full rebuild may help if 'D.class' was compiled against an incompatible version of <empty>. | |
one error found | |
quick | |
% git --no-pager diff | |
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala | |
index 4285858..51f7f33 100644 | |
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala | |
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeAsmCommon.scala | |
@@ -32,7 +32,8 @@ final class BCodeAsmCommon[G <: Global](val global: G) { | |
assert(classSym.isClass, s"not a class: $classSym") | |
val res = (classSym.isAnonymousClass || !classSym.originalOwner.isClass) | |
// lambda classes are always top-level classes. | |
- if (res) assert(!classSym.isDelambdafyFunction) | |
+ if (res) | |
+ assert(!classSym.isDelambdafyFunction, s"${classSym.pos } ${classSym.name}") | |
res | |
} | |
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala | |
index b0c23ef..1d986a4 100644 | |
--- a/src/reflect/scala/reflect/internal/Symbols.scala | |
+++ b/src/reflect/scala/reflect/internal/Symbols.scala | |
@@ -2700,6 +2700,9 @@ trait Symbols extends api.Symbols { self: SymbolTable => | |
if (isSingletonExistential && !settings.debug.value) | |
"val " + tpnme.dropSingletonName(name) + ": " + dropSingletonType(info.bounds.hi) | |
else defString | |
+ | |
+ /** The error message describing the provenance of a StubSymbol, or the empty string for other symbols. */ | |
+ def missingMessage: String = "" | |
} | |
implicit val SymbolTag = ClassTag[Symbol](classOf[Symbol]) | |
@@ -3453,8 +3456,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => | |
override def rawInfo = fail(NoType) | |
override def companionSymbol = fail(NoSymbol) | |
} | |
- class StubClassSymbol(owner0: Symbol, name0: TypeName, protected val missingMessage: String) extends ClassSymbol(owner0, owner0.pos, name0) with StubSymbol | |
- class StubTermSymbol(owner0: Symbol, name0: TermName, protected val missingMessage: String) extends TermSymbol(owner0, owner0.pos, name0) with StubSymbol | |
+ class StubClassSymbol(owner0: Symbol, name0: TypeName, override val missingMessage: String) extends ClassSymbol(owner0, owner0.pos, name0) with StubSymbol | |
+ class StubTermSymbol(owner0: Symbol, name0: TermName, override val missingMessage: String) extends TermSymbol(owner0, owner0.pos, name0) with StubSymbol | |
trait FreeSymbol extends Symbol { | |
def origin: String | |
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala | |
index a95f626..02806ab 100644 | |
--- a/src/reflect/scala/reflect/internal/Types.scala | |
+++ b/src/reflect/scala/reflect/internal/Types.scala | |
@@ -1188,9 +1188,14 @@ trait Types | |
object ThisType extends ThisTypeExtractor { | |
def apply(sym: Symbol): Type = ( | |
- if (!phase.erasedTypes) unique(new UniqueThisType(sym)) | |
- else if (sym.isImplClass) sym.typeOfThis | |
- else sym.tpe_* | |
+ sym match { | |
+ case stub: StubTermSymbol => | |
+ apply(sym.owner.newStubSymbol(sym.name.toTypeName, stub.missingMessage)) | |
+ case _ => | |
+ if (!phase.erasedTypes) unique(new UniqueThisType(sym)) | |
+ else if (sym.isImplClass) sym.typeOfThis | |
+ else sym.tpe_* | |
+ } | |
) | |
} | |
diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala | |
index 5433bfa..e50568b 100644 | |
--- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala | |
+++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala | |
@@ -208,9 +208,12 @@ abstract class UnPickler { | |
def adjust(sym: Symbol) = if (tag == EXTref) sym else sym.moduleClass | |
+ def isStub = owner.isInstanceOf[StubSymbol] | |
+ | |
def fromName(name: Name) = name.toTermName match { | |
case nme.ROOT => loadingMirror.RootClass | |
case nme.ROOTPKG => loadingMirror.RootPackage | |
+ case _ if isStub => owner.newStubSymbol(name, owner.missingMessage) | |
case _ => adjust(owner.info.decl(name)) | |
} | |
def nestedObjectSymbol: Symbol = { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment