Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler NPE with Ordering.Implicits+concurrent.spawn+while+toString #5316

Closed
scabug opened this issue Dec 15, 2011 · 3 comments
Closed

Compiler NPE with Ordering.Implicits+concurrent.spawn+while+toString #5316

scabug opened this issue Dec 15, 2011 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Dec 15, 2011

Jason Zaugg tested it on 2.10 and it works there, but on 2.9.1...

naftoli@naftoli-PC-kubuntu ~/chavrusa$ scala
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.

scala> concurrent.ops spawn {
  val cal = new {}
  while (true) {
    import Ordering.Implicits._
    cal.toString
  }
}

java.lang.NullPointerException
        at scala.tools.nsc.typechecker.Contexts$ImportInfo.importedSymbol(Contexts.scala:636)
        at scala.tools.nsc.typechecker.Typers$Typer.typedIdent$1(Typers.scala:3737)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4176)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:4350)
        at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:4356)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4144)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedApply$1$1.apply(Typers.scala:3353)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedApply$1$1.apply(Typers.scala:3353)
        at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:624)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3353)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4104)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1920)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3951)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.collection.immutable.List.loop$1(List.scala:117)
        at scala.collection.immutable.List.mapConserve(List.scala:133)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1919)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3951)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4344)
        at scala.tools.nsc.typechecker.Typers$Typer.typedIf$1(Typers.scala:3158)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3987)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4331)
        at scala.tools.nsc.typechecker.Typers$Typer.typedLabelDef(Typers.scala:1842)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3925)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1920)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3951)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4344)
        at scala.tools.nsc.typechecker.Typers$Typer.typedFunction(Typers.scala:2042)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3978)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4331)
        at scala.tools.nsc.typechecker.NamesDefaults$$anonfun$argValDefs$1$1.apply(NamesDefaults.scala:276)
        at scala.tools.nsc.typechecker.NamesDefaults$$anonfun$argValDefs$1$1.apply(NamesDefaults.scala:272)
        at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:65)
        at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:63)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.Tuple2$Zipped.map(Tuple2.scala:63)
        at scala.tools.nsc.typechecker.NamesDefaults$class.argValDefs$1(NamesDefaults.scala:272)
        at scala.tools.nsc.typechecker.NamesDefaults$class.transformNamedApplication(NamesDefaults.scala:313)
        at scala.tools.nsc.Global$analyzer$.transformNamedApplication(Global.scala:351)
        at scala.tools.nsc.typechecker.Typers$Typer.tryNamesDefaults$1(Typers.scala:2373)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2411)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3371)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4104)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:761)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4280)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4344)
        at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:4421)
        at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1207)
        at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:551)
        at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:549)
        at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1385)
        at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1381)
        at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:727)
        at scala.tools.nsc.symtab.Symbols$Symbol.initialize(Symbols.scala:839)
        at scala.tools.nsc.symtab.Symbols$Symbol.annotations(Symbols.scala:73)
        at scala.tools.nsc.typechecker.Typers$Typer.addGetterSetter(Typers.scala:1342)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$13.apply(Typers.scala:1510)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$13.apply(Typers.scala:1510)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:200)
        at scala.collection.immutable.List.flatMap(List.scala:45)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1510)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1320)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3913)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.collection.immutable.List.loop$1(List.scala:117)
        at scala.collection.immutable.List.mapConserve(List.scala:133)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1512)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1320)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3913)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.collection.immutable.List.loop$1(List.scala:117)
        at scala.collection.immutable.List.mapConserve(List.scala:133)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1512)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1320)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3913)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
        at scala.collection.immutable.List.loop$1(List.scala:117)
        at scala.collection.immutable.List.mapConserve(List.scala:133)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3906)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4331)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:94)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:329)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:86)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:86)
        at scala.collection.Iterator$class.foreach(Iterator.scala:660)
        at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:316)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:86)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:953)
        at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:756)
        at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:731)
        at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:873)
        at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:576)
        at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)
        at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)
        at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)
        at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)
        at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)
        at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)
        at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
        at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:67)
        at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 15, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5316?orig=1
Reporter: Naftoli Gugenheim (naftoligug)
Affected Versions: 2.9.1
Other Milestones: 2.10.0

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Dec 15, 2011

@retronym said:
Minimized a bit further:

def foo(p: => Any)(implicit x: Nothing): Unit = ()

object X

foo {
  val a = 0
  
  {
    import X._
    a
  }
}

The bug hits in erroneous code, when an implicit parameter cannot be found.

Like the original example, this works with 2.10. So a test case would close this.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Feb 22, 2012

@khernyo said (edited on Feb 22, 2012 8:52:22 PM UTC):
Fixed by b732859

@scabug scabug closed this Feb 22, 2012
@scabug scabug added the implicit label Apr 7, 2017
@scabug scabug added this to the 2.10.0-M2 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.