Synthetic code generation leads to effect annotations in terms
Opened this issue · 0 comments
lrytz commented
Synthetic code (such as the one generated by phase patmat
) is not always type checked, but types are directly assigned (e.g. when using gen.mkAttributedRef
, I think).
This is problematic because the plugin does not get a chance to strip off effect annotations from terms.
The bug is distilled in https://github.com/lrytz/efftp/blob/master/tests/src/test/resources/scala/tools/nsc/effects/io/PatMatSuite-files/patMatPending.scala
A symptomatic error message:
lucmac:sandbox luc$ ~/scala/scala-2.10.1/bin/scalac -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006 -cp /Users/luc/scala/efftp/target/scala-2.10/effects-plugin_2.10-0.1-SNAPSHOT.jar -Xplugin:/Users/luc/scala/efftp/target/scala-2.10/effects-plugin_2.10-0.1-SNAPSHOT.jar -P:effects:domains:io -d out /Users/luc/scala/scala/src/library/scala/collection/immutable/RedBlack.scala
Listening for transport dt_socket at address: 5006
/Users/luc/scala/scala/src/library/scala/collection/immutable/RedBlack.scala:62: error: error during expansion of this match (this is a scalac bug).
The underlying error was: type arguments [RedBlack.this.RedTree[B1] @scala.annotation.effects.noIo] do not conform to method asInstanceOf's type parameter bounds [T0]
private[this] def balanceLeft[B1 >: B](isBlack: Boolean, z: A, zv: B, l: Tree[B1], d: Tree[B1])/*: NonEmpty[B1]*/ = l match {
^
/Users/luc/scala/scala/src/library/scala/collection/immutable/RedBlack.scala:70: error: error during expansion of this match (this is a scalac bug).
The underlying error was: type arguments [RedBlack.this.RedTree[B1] @scala.annotation.effects.noIo] do not conform to method asInstanceOf's type parameter bounds [T0]
private[this] def balanceRight[B1 >: B](isBlack: Boolean, x: A, xv: B, a: Tree[B1], r: Tree[B1])/*: NonEmpty[B1]*/ = r match {
^
two errors found