If you remove the ? from the line things work fine. I'm not exactly sure what the issue is specifically, but, the error should probably be clearer as well
Code:
class Test {
static function main() {
var bar = new Bar();
trace(bar.stuff);
}
}
class Bar {
var foo = new Foo();
var values(get, never):Data;
function get_values() {
return foo?.value;
}
public var stuff(get, set):Float;
function get_stuff() {
return values?.stuff;
}
function set_stuff(value:Float) {
return values?.stuff = value; // error here
}
public function new() {}
}
class Foo {
public var value:Data = new Data(32);
public function new() {}
}
class Data {
public var stuff:Float;
public function new(data) {
this.stuff = data;
}
}
Demo: https://try.haxe.org/#871345F4
If you remove the
?
from the line things work fine. I'm not exactly sure what the issue is specifically, but, the error should probably be clearer as wellCode: