scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Misplaced parens cause compiler to throw exception #1523

Closed scabug closed 13 years ago

scabug commented 15 years ago

I am not really sure if this is a bug or not, but another programmer said it was and told me to report it here.

I had a missing ) and several lines later an extra ). This was in Lift code. I got the following:

[INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [scala:compile {execution: default}] [INFO] suggestion: remove the scalaVersion from pom.xml [INFO] Compiling 28 source files to /private/var/www/mine/mine-app/target/classes [WARNING] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 30 [WARNING] at scala.tools.nsc.ast.TreeGen.mkTuple(TreeGen.scala:227) [WARNING] at scala.tools.nsc.typechecker.Infer$$class.actualArgs(Infer.scala:62) [WARNING] at scala.tools.nsc.Global$$analyzer$$.actualArgs(Global.scala:284) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.doTypedApply(Typers.scala:1733) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$tryTypedApply$$1$$1.apply(Typers.scala:2566) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$tryTypedApply$$1$$1.apply(Typers.scala:2566) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.silent(Typers.scala:588) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.tryTypedApply$$1(Typers.scala:2566) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedApply$$1(Typers.scala:2617) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3219) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedArg(Typers.scala:1621) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedArgToPoly$$1(Typers.scala:1789) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$27.apply(Typers.scala:1798) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$27.apply(Typers.scala:1798) [WARNING] at scala.List$$.map2(List.scala:326) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.doTypedApply(Typers.scala:1798) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedApply$$1(Typers.scala:2619) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3219) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedArg(Typers.scala:1621) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$1.apply(Typers.scala:1624) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedArgs$$1.apply(Typers.scala:1624) [WARNING] at scala.List$$.loop$$1(List.scala:293) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedArgs(Typers.scala:1624) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.doTypedApply(Typers.scala:1727) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$tryTypedApply$$1$$1.apply(Typers.scala:2566) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$tryTypedApply$$1$$1.apply(Typers.scala:2566) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.silent(Typers.scala:583) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.tryTypedApply$$1(Typers.scala:2566) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedApply$$1(Typers.scala:2617) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3219) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3371) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3143) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedBlock(Typers.scala:1405) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3083) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3371) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.transformedOrTyped(Typers.scala:3429) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedDefDef(Typers.scala:1342) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3059) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3360) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1570) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.List$$.loop$$1(List.scala:293) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedTemplate(Typers.scala:1193) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedClassDef(Typers.scala:1062) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3050) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3360) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1570) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.List$$.loop$$1(List.scala:293) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.List$$.loop$$1(List.scala:297) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3046) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3360) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1570) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.List$$.loop$$1(List.scala:293) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3046) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3360) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1570) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.List$$.loop$$1(List.scala:293) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3046) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3360) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1570) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1615) [WARNING] at scala.List$$.loop$$1(List.scala:293) [WARNING] at scala.List$$.mapConserve(List.scala:310) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1615) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3046) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3323) [WARNING] at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3360) [WARNING] at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.apply(Analyzer.scala:40) [WARNING] at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:268) [WARNING] at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$run$$1.apply(Global.scala:247) [WARNING] at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$run$$1.apply(Global.scala:247) [WARNING] at scala.Iterator$$class.foreach(Iterator.scala:410) [WARNING] at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:266) [WARNING] at scala.tools.nsc.Global$$GlobalPhase.run(Global.scala:247) [WARNING] at scala.tools.nsc.Global$$Run.compileSources(Global.scala:579) [WARNING] at scala.tools.nsc.Global$$Run.compile(Global.scala:663) [WARNING] at scala.tools.nsc.Main$$.process(Main.scala:84) [WARNING] at scala.tools.nsc.Main$$.main(Main.scala:98) [WARNING] at scala.tools.nsc.Main.main(Main.scala) [INFO]

[ERROR] BUILD FAILURE

scabug commented 15 years ago

Imported From: https://issues.scala-lang.org/browse/SI-1523?orig=1 Reporter: Charles F. Munat (chasm) Assignee: Mohsen Lesani [X] (lesani)

scabug commented 15 years ago

Anders Bach Nielsen [X] (nielsen) said: Can you please supply a small example program and instructions how to reproduce this error?

scabug commented 15 years ago

Mohsen Lesani [X] (lesani) said: As said before, we need the example.

scabug commented 15 years ago

@paulp said: I was able to see what was happening from the stack trace. Scala tries to be clever about inferring tuplehood so you don't have to say ((x)) all the time when you could only mean a tuple. To that end, if you call a one-argument method with multiple arguments, it figures you must mean it's a tuple and attempts to create it without verifying there aren't more than 22 elements.

Fixed in r17083.