You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The diff is that two distinct type alias symbols for Predef.String are part of the symbol graph of scala.Symbol if it precedes Predef.class in the list of compilation units. One of these is from the Predef.class:
type String#4614
java.lang.Throwable
at scala.reflect.internal.Symbols$AliasTypeSymbol.<init>(Symbols.scala:3059)
at scala.reflect.internal.Symbols$Symbol.createAliasTypeSymbol(Symbols.scala:1331)
at scala.reflect.internal.Symbols$Symbol.newNonClassSymbol(Symbols.scala:1397)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbol(UnPickler.scala:346)
at scala.reflect.internal.pickling.UnPickler$Scan.$anonfun$run$1(UnPickler.scala:98)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.reflect.internal.pickling.UnPickler$Scan.runAtIndex(UnPickler.scala:90)
at scala.reflect.internal.pickling.UnPickler$Scan.run(UnPickler.scala:98)
at scala.reflect.internal.pickling.UnPickler.unpickle(UnPickler.scala:47)
at scala.tools.nsc.symtab.classfile.ClassfileParser.unpickleOrParseInnerClasses(ClassfileParser.scala:1182)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass(ClassfileParser.scala:466)
at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$2(ClassfileParser.scala:160)
at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$2$adapted(ClassfileParser.scala:146)
at scala.reflect.internal.util.ReusableInstance.using(ReusableInstance.scala:30)
at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$1(ClassfileParser.scala:146)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.tools.nsc.symtab.classfile.ClassfileParser.pushBusy(ClassfileParser.scala:129)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parse(ClassfileParser.scala:145)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader.doComplete(SymbolLoaders.scala:333)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:240)
at scala.reflect.internal.Symbols$Symbol.completeInfo(Symbols.scala:1542)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1514)
at scala.reflect.internal.Symbols$Symbol.tpeHK(Symbols.scala:1468)
at scala.reflect.internal.Types$Type.computeMemberType(Types.scala:735)
at scala.reflect.internal.Types$Type.memberType(Types.scala:732)
at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:248)
at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:174)
at scala.reflect.internal.TreeGen.mkAttributedStableRef(TreeGen.scala:209)
at scala.tools.nsc.ast.TreeGen.mkImportFromSelector(TreeGen.scala:43)
at scala.tools.nsc.ast.TreeGen.mkWildcardImport(TreeGen.scala:33)
at scala.tools.nsc.typechecker.Contexts.$anonfun$rootContext$1(Contexts.scala:111)
at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
at scala.collection.immutable.List.foldLeft(List.scala:91)
at scala.collection.TraversableOnce.$div$colon(TraversableOnce.scala:179)
at scala.collection.TraversableOnce.$div$colon$(TraversableOnce.scala:179)
at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:108)
at scala.tools.nsc.typechecker.Contexts.rootContext(Contexts.scala:111)
at scala.tools.nsc.typechecker.Contexts.rootContext$(Contexts.scala:110)
at scala.tools.nsc.Global$$anon$5.rootContext(Global.scala:483)
at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:50)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:402)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
at scala.tools.nsc.DeterminismTester.compile$1(DeterminismTester.scala:56)
at scala.tools.nsc.DeterminismTester.$anonfun$test$7(DeterminismTester.scala:97)
at scala.tools.nsc.DeterminismTester.$anonfun$test$7$adapted(DeterminismTester.scala:94)
at scala.collection.immutable.List.foreach(List.scala:431)
at scala.tools.nsc.DeterminismTester.test(DeterminismTester.scala:94)
at scala.tools.nsc.DeterminismTester$.main(DeterminismTester.scala:34)
at scala.tools.nsc.DeterminismTester.main(DeterminismTester.scala)
The other is from the Namers / Predef.scala:
java.lang.Throwable
at scala.reflect.internal.Symbols$AliasTypeSymbol.<init>(Symbols.scala:3059)
at scala.reflect.internal.Symbols$Symbol.createAliasTypeSymbol(Symbols.scala:1331)
at scala.reflect.internal.Symbols$Symbol.newNonClassSymbol(Symbols.scala:1397)
at scala.reflect.internal.Symbols$Symbol.newTypeSymbol(Symbols.scala:1401)
at scala.tools.nsc.typechecker.Namers$Namer.createMemberSymbol(Namers.scala:342)
at scala.tools.nsc.typechecker.Namers$Namer.assignMemberSymbol(Namers.scala:311)
at scala.tools.nsc.typechecker.Namers$Namer.assignAndEnterFinishedSymbol(Namers.scala:318)
at scala.tools.nsc.typechecker.Namers$Namer.enterTypeDef(Namers.scala:773)
at scala.tools.nsc.typechecker.Namers$Namer.dispatch$1(Namers.scala:293)
at scala.tools.nsc.typechecker.Namers$Namer.standardEnterSym(Namers.scala:301)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsEnterSym(AnalyzerPlugins.scala:479)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsEnterSym$(AnalyzerPlugins.scala:478)
at scala.tools.nsc.Global$$anon$5.pluginsEnterSym(Global.scala:483)
at scala.tools.nsc.typechecker.Namers$Namer.enterSym(Namers.scala:279)
at scala.tools.nsc.typechecker.Namers$Namer.$anonfun$enterSyms$1(Namers.scala:495)
at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
at scala.collection.immutable.List.foldLeft(List.scala:91)
at scala.tools.nsc.typechecker.Namers$Namer.enterSyms(Namers.scala:494)
at scala.tools.nsc.typechecker.Namers$Namer.templateSig(Namers.scala:1180)
at scala.tools.nsc.typechecker.Namers$Namer.moduleSig(Namers.scala:1250)
at scala.tools.nsc.typechecker.Namers$Namer.memberSig(Namers.scala:1907)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1869)
at scala.tools.nsc.typechecker.Namers$Namer$MonoTypeCompleter.completeImpl(Namers.scala:876)
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete(Namers.scala:2066)
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete$(Namers.scala:2064)
at scala.tools.nsc.typechecker.Namers$TypeCompleterBase.complete(Namers.scala:2059)
at scala.reflect.internal.Symbols$Symbol.completeInfo(Symbols.scala:1542)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1514)
at scala.reflect.internal.Symbols$Symbol.tpeHK(Symbols.scala:1468)
at scala.reflect.internal.Types$Type.computeMemberType(Types.scala:735)
at scala.reflect.internal.Types$Type.memberType(Types.scala:732)
at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:248)
at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:174)
at scala.reflect.internal.TreeGen.mkAttributedStableRef(TreeGen.scala:209)
at scala.tools.nsc.ast.TreeGen.mkImportFromSelector(TreeGen.scala:43)
at scala.tools.nsc.ast.TreeGen.mkWildcardImport(TreeGen.scala:33)
at scala.tools.nsc.typechecker.Contexts.$anonfun$rootContext$1(Contexts.scala:111)
at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
at scala.collection.immutable.List.foldLeft(List.scala:91)
at scala.collection.TraversableOnce.$div$colon(TraversableOnce.scala:179)
at scala.collection.TraversableOnce.$div$colon$(TraversableOnce.scala:179)
at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:108)
at scala.tools.nsc.typechecker.Contexts.rootContext(Contexts.scala:111)
at scala.tools.nsc.typechecker.Contexts.rootContext$(Contexts.scala:110)
at scala.tools.nsc.Global$$anon$5.rootContext(Global.scala:483)
at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:50)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:402)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1511)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1495)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1488)
at scala.tools.nsc.DeterminismTester.compile$1(DeterminismTester.scala:56)
at scala.tools.nsc.DeterminismTester.$anonfun$test$7(DeterminismTester.scala:97)
at scala.tools.nsc.DeterminismTester.$anonfun$test$7$adapted(DeterminismTester.scala:94)
at scala.collection.immutable.List.foreach(List.scala:431)
at scala.tools.nsc.DeterminismTester.test(DeterminismTester.scala:94)
at scala.tools.nsc.DeterminismTester$.main(DeterminismTester.scala:34)
at scala.tools.nsc.DeterminismTester.main(DeterminismTester.scala)
I'm looking at:
def enterClassSymbol(tree: ClassDef): Symbol = {
val existing = context.scope.lookup(tree.name)
val isRedefinition = (
existing.isType
&& existing.isTopLevel
&& context.scope == existing.owner.info.decls
&& currentRun.canRedefine(existing)
)
val clazz: Symbol = {
if (isRedefinition) {
updatePosFlags(existing, tree.pos, tree.mods.flags)
setPrivateWithin(tree, existing)
clearRenamedCaseAccessors(existing)
existing
}
else enterInScope(assignMemberSymbol(tree)) setFlag inConstructorFlag
}
clazz match {
case csym: ClassSymbol if csym.isTopLevel => enterClassSymbol(tree, csym)
case _ => clazz
}
}
In which a the source file loader takes over the scala.Predef symbol. As I understand it, laziness of typechecking should prevent code from referring to members of the scala.Predef.class before this happens...
I think this is due to typechecking of package objects being insufficiently lazy to prevent references to Foo.class members before Foo.scala is attaches its source file completer. An AliasTypeRef is created for Predef.class#String in:
java.lang.Throwable
at scala.reflect.internal.Types$AliasTypeRef.$init$(Types.scala:1957)
at scala.reflect.internal.Types$AliasNoArgsTypeRef.<init>(Types.scala:2411)
at scala.reflect.internal.Types$TypeRef$.apply(Types.scala:2423)
at scala.reflect.internal.pickling.UnPickler$Scan.readType(UnPickler.scala:415)
at scala.reflect.internal.pickling.UnPickler$Scan.$anonfun$readTypeRef$1(UnPickler.scala:656)
at scala.reflect.internal.pickling.UnPickler$Scan.at(UnPickler.scala:190)
at scala.reflect.internal.pickling.UnPickler$Scan.readTypeRef(UnPickler.scala:656)
at scala.reflect.internal.pickling.UnPickler$Scan.readNonEmptyTree(UnPickler.scala:605)
at scala.reflect.internal.pickling.UnPickler$Scan.readTree(UnPickler.scala:619)
at scala.reflect.internal.pickling.UnPickler$Scan.$anonfun$readAnnotArg$1(UnPickler.scala:467)
at scala.reflect.internal.pickling.UnPickler$Scan.at(UnPickler.scala:190)
at scala.reflect.internal.pickling.UnPickler$Scan.readAnnotArg(UnPickler.scala:467)
at scala.reflect.internal.pickling.UnPickler$Scan.readAnnotationInfo(UnPickler.scala:501)
at scala.reflect.internal.pickling.UnPickler$Scan.readSymbolAnnotation(UnPickler.scala:513)
at scala.reflect.internal.pickling.UnPickler$Scan.$anonfun$run$2(UnPickler.scala:108)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.reflect.internal.pickling.UnPickler$Scan.runAtIndex(UnPickler.scala:90)
at scala.reflect.internal.pickling.UnPickler$Scan.run(UnPickler.scala:108)
at scala.reflect.internal.pickling.UnPickler.unpickle(UnPickler.scala:47)
at scala.tools.nsc.symtab.classfile.ClassfileParser.unpickleOrParseInnerClasses(ClassfileParser.scala:1182)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass(ClassfileParser.scala:466)
at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$2(ClassfileParser.scala:160)
at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$2$adapted(ClassfileParser.scala:146)
at scala.reflect.internal.util.ReusableInstance.using(ReusableInstance.scala:30)
at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$1(ClassfileParser.scala:146)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.tools.nsc.symtab.classfile.ClassfileParser.pushBusy(ClassfileParser.scala:129)
at scala.tools.nsc.symtab.classfile.ClassfileParser.parse(ClassfileParser.scala:145)
at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader.doComplete(SymbolLoaders.scala:333)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:240)
at scala.reflect.internal.Symbols$Symbol.completeInfo(Symbols.scala:1542)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1514)
at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:355)
at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:410)
at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:303)
at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:240)
at scala.reflect.internal.Symbols$Symbol.completeInfo(Symbols.scala:1542)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1514)
at scala.reflect.internal.Types$TypeRef.decls(Types.scala:2285)
at scala.tools.nsc.typechecker.Namers$Namer.enterPackage(Namers.scala:765)
at scala.tools.nsc.typechecker.Namers$Namer.dispatch$1(Namers.scala:288)
at scala.tools.nsc.typechecker.Namers$Namer.standardEnterSym(Namers.scala:301)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsEnterSym(AnalyzerPlugins.scala:479)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsEnterSym$(AnalyzerPlugins.scala:478)
at scala.tools.nsc.Global$$anon$5.pluginsEnterSym(Global.scala:483)
at scala.tools.nsc.typechecker.Namers$Namer.enterSym(Namers.scala:279)
at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:50)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:402)
I've always wanted to make PackageClassSymbols a bit lazier so that we defer calling forcing the info of the package objet until someone actually needed to perform a lookup in the package. We would not need to do this while entering symbols from sources or from the classpath -- these could be kept in a temporary Scope, and then this would be merged with the forced info of the package object the first time a package lookup was done.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.