-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
Compiler version
Minimized code
//> using options -Xprint:typer,getters
import scala.language.experimental.captureChecking
trait Foo extends caps.Mutable:
var x: IntOutput
[[syntax trees at end of typer]] // test.scala
package <empty> {
import scala.language.experimental.captureChecking
trait Foo() extends Object, caps.Mutable {
var x: Int
update def x_=(x$1: Int): Unit
}
}
[[syntax trees at end of MegaPhase{pruneErasedDefs, uninitialized, inlinePatterns, vcInlineMethods, seqLiterals, intercepted, getters, specializeFunctions, specializeTuples, collectNullableFields, elimOuterSelect, resolveSuper, functionXXLForwarders, paramForwarding, genericTuples, letOverApply, arrayConstructors}]] // test.scala
package <empty> {
import scala.language.experimental.captureChecking
@SourceFile("test.scala") trait Foo() extends Object, scala.caps.Mutable {
update def x: Int
update def x_=(x$1: Int): Unit
}
}Expectation
The generated getter should not pass the Mutability.isUpdateMethod since it should not be an update method. This would be a big restriction if the getter is an update def.
Note
This does not affect cc since we generate the getter after all the cc phases. The point of this issue is to prevent in the future from a bad usage of Mutability.isUpdateMethod in the compiler's code base and for correctness.