ponyc
ponyc copied to clipboard
Confusing compiler error when a field's field is assigned within a fun box
when assigning to a variable in a class i recieved: not safe to write right side to left side
which did not make it clear to me that i needed to use a fun ref
.
sample code to reproduce:
class TestClass
var x: USize = 0
actor Main
let my_test_class: TestClass = TestClass
new create(env: Env) =>
None
fun test() =>
my_test_class.x = 1
There was an initial stab at fixing this that was later closed by the author but could serve as the basis for a fix. I don't know that it fixed the issue and didn't break other things but @KittenDeveloper stated that the it changed the error message. I don't know if it change unintended things as well.
https://github.com/ponylang/ponyc/pull/4147