Skip to content

Commit 933703d

Browse files
committed
Rightful owners for stub symbols
Running: ``` object Test { def main(args: Array[String]): Unit = { import scala.tools.nsc._ val settings = new Settings() settings.Ylogcp.value = true settings.usejavacp.value = false settings.classpath.value = "/code/scala/build/pack/lib/scala-library.jar:/tmp/foo" settings.bootclasspath.value = "" System.setProperty("scala.usejavacp", "false") val g = new Global(settings) import g._ new Run() val DecodeModule = g.rootMirror.getModuleByName(TermName("scala.tools.scalap.Decode")) println(DecodeModule.moduleClass.info) } } ``` Against: ``` $ find /tmp/foo -type f /tmp/foo/scala/tools/scalap/Decode.class ``` Would show up the `NoSymbol` owners of stub symbols in the full names of symbols: ``` AnyRef { def <init>(): scala.tools.scalap.Decode.type private def getAliasSymbol(t: <none>.scalasig.Type): <none>.scalasig.Symbol ... ``` After this patch, we instead see: ``` private def getAliasSymbol(t: scala.tools.scalap.scalax.rules.scalasig.Type): scala.tools.scalap.scalax.rules.scalasig.Symbol ``` This makes it feasible to write tools like scalap in terms of the Unpickler/ClassfileParser.
1 parent cc7ba86 commit 933703d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/reflect/scala/reflect/internal/pickling/UnPickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ abstract class UnPickler {
254254
|A full rebuild may help if '$filename' was compiled against an incompatible version of ${owner.fullName}.$advice""".stripMargin
255255
val stubName = if (tag == EXTref) name else name.toTypeName
256256
// The position of the error message is set by `newStubSymbol`
257-
NoSymbol.newStubSymbol(stubName, missingMessage)
257+
owner.newStubSymbol(stubName, missingMessage)
258258
}
259259
}
260260
}

test/files/neg/t5148.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Make sure that term memberHandlers is in your classpath and check for conflictin
44
A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain.
55
class IMain extends Imports
66
^
7-
t5148.scala:4: error: Symbol 'type <none>.Request.Wrapper' is missing from the classpath.
7+
t5148.scala:4: error: Symbol 'type scala.tools.nsc.interpreter.IMain.Request.Wrapper' is missing from the classpath.
88
This symbol is required by 'value scala.tools.nsc.interpreter.Imports.wrapper'.
99
Make sure that type Wrapper is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
10-
A full rebuild may help if 'Imports.class' was compiled against an incompatible version of <none>.Request.
10+
A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain.Request.
1111
class IMain extends Imports
1212
^
1313
two errors found

0 commit comments

Comments
 (0)