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

ErrorType reaches backend without a type error being reported #10207

Closed
scabug opened this issue Feb 24, 2017 · 3 comments
Closed

ErrorType reaches backend without a type error being reported #10207

scabug opened this issue Feb 24, 2017 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 24, 2017

import scala.collection.mutable
class C {
  val m = mutable.Map[Int, mutable.ArrayBuffer[Int]]()
  m(1, {_ => mutable.ArrayBuffer[Int]()}) ++= mutable.ArrayBuffer(1, 2, 3, 4, 5, 6)
}

results in

warning: an unexpected type representation reached the compiler backend while compiling Test.scala: <error>. If possible, please file a bug on issues.scala-lang.org.
scala.MatchError: <error> (of class scala.reflect.internal.Types$ErrorType$)
	at scala.tools.nsc.backend.jvm.BTypesFromSymbols.typeToBType(BTypesFromSymbols.scala:212)

Probably related: adding a type parameter to the function literal (_: Int => ...) causes a crash in the typer

Test.scala:4: error: too many arguments (2) for method apply: (key: Int)scala.collection.mutable.ArrayBuffer[Int] in trait MapLike
  m(1, {_: Int => mutable.ArrayBuffer[Int]()}) ++= mutable.ArrayBuffer(1, 2, 3, 4, 5, 6)
               ^
error: java.lang.NullPointerException
	at scala.tools.nsc.typechecker.Typers$Typer.addLocals$1(Typers.scala:3938)
	at scala.tools.nsc.typechecker.Typers$Typer.packedType(Typers.scala:3964)
	at scala.tools.nsc.ast.TreeGen.mkPackedValDef(TreeGen.scala:189)
	at scala.tools.nsc.ast.TreeGen.$anonfun$evalOnceAll$1(TreeGen.scala:223)
	at scala.tools.nsc.typechecker.Typers$Typer.mkUpdate$1(Typers.scala:4717)
@scabug
Copy link
Author

scabug commented Feb 24, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10207?orig=1
Reporter: Alexandru Stefanica (SAlexandru)
Affected Versions: 2.12.1

@scabug
Copy link
Author

scabug commented Feb 24, 2017

@som-snytt said:
On conversion to update:

scala>   m(1, {_ => mutable.ArrayBuffer[Int]()}) ++= mutable.ArrayBuffer(1, 2, 3, 4, 5, 6)//print

{
  val ev$1: <error> = scala.Tuple2.apply[Int, <error> => scala.collection.mutable.ArrayBuffer[Int]](1, ((x$1: Any) => scala.collection.mutable.ArrayBuffer.apply[scala.Int]()));
  $line4.$read.$iw.$iw.m.update(ev$1, $line4.$read.$iw.$iw.m.apply(ev$1).++(scala.collection.mutable.ArrayBuffer.apply[Int](1, 2, 3, 4, 5, 6)))
} // : Unit

@scabug
Copy link
Author

scabug commented Feb 24, 2017

@som-snytt said:
scala/scala#5743

@scabug scabug closed this as completed Feb 27, 2017
@scabug scabug added this to the 2.12.2 milestone Apr 7, 2017
DieBauer added a commit to DieBauer/flink that referenced this issue Apr 7, 2017
[ERROR] /Users/jens/Development/flink/flink-tests/src/test/java/org/apache/flink/test/javaApiOperators/GroupCombineITCase.java:54: error: not found: type TestExecutionMode
[INFO]  public GroupCombineITCase(TestExecutionMode mode) {

maybe related to scala/bug#10207 ?
DieBauer added a commit to DieBauer/flink that referenced this issue Apr 16, 2017
[ERROR] /Users/jens/Development/flink/flink-tests/src/test/java/org/apache/flink/test/javaApiOperators/GroupCombineITCase.java:54: error: not found: type TestExecutionMode
[INFO]  public GroupCombineITCase(TestExecutionMode mode) {

maybe related to scala/bug#10207 ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants