scala / bug

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

Type alias for tuple > 22 crashes compiler #9340

Closed scabug closed 8 years ago

scabug commented 9 years ago

Compiling a file with type = (tuple with more than 22 fields) causes the compiler to crash. I've attached a simple scalatest test.

Here is top of the stack trace: java.lang.AssertionError: assertion failed: scala. at scala.reflect.internal.Trees$AppliedTypeTree.(Trees.scala:579) at scala.reflect.internal.TreeGen.mkTupleType(TreeGen.scala:293) at scala.tools.nsc.ast.parser.TreeBuilder.makeTupleType(TreeBuilder.scala:44) at scala.tools.nsc.ast.parser.Parsers$Parser$PatternContextSensitive$class.scala$tools$nsc$ast$parser$Parsers$Parser$PatternContextSensitive$$tupleInfixType(Parsers.scala:873) at scala.tools.nsc.ast.parser.Parsers$Parser$PatternContextSensitive$$anonfun$typ$1.apply(Parsers.scala:906) at scala.tools.nsc.ast.parser.Parsers$Parser$PatternContextSensitive$$anonfun$typ$1.apply(Parsers.scala:903) at scala.tools.nsc.ast.parser.Parsers$Parser.placeholderTypeBoundary(Parsers.scala:485) at scala.tools.nsc.ast.parser.Parsers$Parser$PatternContextSensitive$class.typ(Parsers.scala:903) at scala.tools.nsc.ast.parser.Parsers$Parser$outPattern$.typ(Parsers.scala:1993) at scala.tools.nsc.ast.parser.Parsers$Parser.typ(Parsers.scala:2013) at scala.tools.nsc.ast.parser.Parsers$Parser.typeDefOrDcl(Parsers.scala:2679) at scala.tools.nsc.ast.parser.Parsers$Parser.defOrDcl(Parsers.scala:2463) at scala.tools.nsc.ast.parser.Parsers$Parser.nonLocalDefOrDcl(Parsers.scala:2473) at scala.tools.nsc.ast.parser.Parsers$Parser$$anonfun$templateStat$1$$anonfun$applyOrElse$3.apply(Parsers.scala:3030) at scala.tools.nsc.ast.parser.Parsers$Parser$$anonfun$templateStat$1$$anonfun$applyOrElse$3.apply(Parsers.scala:3030)

scabug commented 9 years ago

Imported From: https://issues.scala-lang.org/browse/SI-9340?orig=1 Reporter: Joe F (fullness) Affected Versions: 2.11.6 Attachments:

scabug commented 8 years ago

@szeiger said: This was fixed by https://github.com/scala/scala/pull/4927:

$ ../scala/build/quick/bin/scalac BigTupleSpec.scala
BigTupleSpec.scala:7: error: too many elements for tuple: 23, allowed: 22
  type Big = (
             ^
BigTupleSpec.scala:17: error: too many elements for tuple: 23, allowed: 22
      val foo: Big = (
                     ^
two errors found