HaxeFoundation / HaxeFoundation/haxe
[display] property to an generic builded abstract cause "Cannot modify the abstract value, store it into a local first"
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
If you write to `this` directly (`this = some_value`)
and you wan't access throug a property (for shortcut reasons)
it throws `Cannot modify the abstract value, store it into a local first`.
But it builds fine.
(Testet with the latest build)
update: i break down the example.
```haxe
abstract ArrayTest(Array) {
public function new() this = [];
public inline function test(str:String) {
this = [str];
}
}
class AClass {
public final gen = new ArrayTest();
public function new() {}
}
class BClass {
public var aclass = new AClass();
public function new() {}
public var gen(get, never):ArrayTest;
private inline function get_gen() return aclass.gen;
public inline function genFn() return aclass.gen;
}
class Test {
public static function main() {
var aClass = new AClass();
aClass.gen.test('test'); // <- works fine
var bClass = new BClass();
bClass.aclass.gen.test('test'); // <- works fine
var gen = bClass.gen;
gen.test('test'); // <- works fine
bClass.gen.test('test'); // <- error
bClass.genFn().test('test'); // <- error
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.