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 crashes when evaluating XML element followed by "()" #7185

Closed
scabug opened this issue Feb 26, 2013 · 2 comments
Closed

Compiler crashes when evaluating XML element followed by "()" #7185

scabug opened this issue Feb 26, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Feb 26, 2013

When Scala compiler evaluates XML element followed by "()" (without quotes), it crashes with NullPointerException.

It will be more helpful to generate a compilation error.

Welcome to Scala version 2.10.0 (OpenJDK 64-Bit Server VM, Java 1.7.0_09-icedtea).
Type in expressions to have them evaluated.
Type :help for more information.

scala> <e></e>()
<console>:8: error: overloaded method value apply with alternatives:
  (f: scala.xml.Node => Boolean)scala.xml.NodeSeq <and>
  (i: Int)scala.xml.Node
 cannot be applied to ()
       <e></e>()
        ^
error:
     while compiling: <console>
        during phase: typer
     library version: version 2.10.0
    compiler version: version 2.10.0
  reconstructed args:

  last tree to typer: Apply(constructor Elem)
              symbol: constructor Elem in class Elem (flags: <method>)
   symbol definition: def <init>(prefix: String,label: String,attributes1: scala.xml.MetaData,scope: scala.xml.NamespaceBinding,minimizeEmpty: Boolean,child: scala.xml.Node*): scala.xml.Elem
                 tpe: scala.xml.Elem
       symbol owners: constructor Elem -> class Elem -> package xml
      context owners: value res0 -> object $iw -> object $iw -> object $read -> package $line3

...

TypeRef(TypeSymbol(class Elem extends Node with Serializable))

uncaught exception during compilation: java.lang.NullPointerException
java.lang.NullPointerException
        at scala.reflect.internal.TreeInfo.isExprSafeToInline(TreeInfo.scala:98)
        at scala.reflect.internal.TreeInfo.isExprSafeToInline(TreeInfo.scala:102)
        at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2343)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5387)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4507)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5381)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
        at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5526)
        at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:5621)
        at scala.tools.nsc.typechecker.Namers$Namer.assignTypeToTree(Namers.scala:813)
        at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1319)
        at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1347)
        at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:709)
        at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708)
        at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708)
        at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1385)
        at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:708)
        at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:707)
        at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1496)
        at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1504)
        at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1494)
        at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1217)
        at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1352)
        at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$class.addDerivedTrees(MethodSynthesis.scala:224)
        at scala.tools.nsc.typechecker.Namers$Namer.addDerivedTrees(Namers.scala:55)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1860)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1860)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1798)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1795)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
        at scala.collection.immutable.List.foreach(List.scala:309)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1860)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1769)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5401)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
        at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
        at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
        at scala.collection.immutable.List.loop$1(List.scala:164)
        at scala.collection.immutable.List.mapConserve(List.scala:180)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2870)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1862)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1769)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5401)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
        at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
        at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
        at scala.collection.immutable.List.loop$1(List.scala:164)
        at scala.collection.immutable.List.mapConserve(List.scala:180)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2870)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1862)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1769)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5401)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
        at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
        at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
        at scala.collection.immutable.List.loop$1(List.scala:164)
        at scala.collection.immutable.List.mapConserve(List.scala:180)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2870)
        at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5127)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5404)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
        at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5509)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:98)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:461)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
        at scala.collection.Iterator$class.foreach(Iterator.scala:727)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:90)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1574)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1548)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1544)
        at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:425)
        at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:798)
        at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:758)
        at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:933)
        at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:928)
        at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:600)
        at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:565)
        at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)
        at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)
        at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)
        at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)
        at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)
        at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)
        at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)
        at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
        at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
        at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
        at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
        at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83)
        at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
@scabug
Copy link
Author

@scabug scabug commented Feb 26, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7185?orig=1
Reporter: Howard Guo (howard)
Affected Versions: 2.10.0
Attachments:

  • output.txt (created on Feb 26, 2013 10:42:23 AM UTC, 11417 bytes)

@scabug
Copy link
Author

@scabug scabug commented Feb 26, 2013

@scabug scabug closed this as completed Mar 5, 2013
@scabug scabug added the has PR label Apr 7, 2017
@scabug scabug added this to the 2.10.2-RC1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants