HaxeFoundation / HaxeFoundation/haxe

abstract over generic abstract compound assignment

Open
#9,823 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
abstract TestAbstract(T) {
public var access(get, set):T;
private inline function get_access() return this;
private inline function set_access(value:T) return this = value;
public inline function new(value:T) this = value;
}

abstract TestAbstractOverAbstract(TestAbstract) {
public inline function new(value:Float) this = new TestAbstract(value);
@:op(A+=B) private inline function _additionFloatEqual(val:Float) return new TestAbstractOverAbstract(this.access += val); // works
@:op(A-=B) private inline function _subtractionFloatEqual(val:Float) return new TestAbstractOverAbstract(this.access -= val); // not works?
}
```

it comes to an error on `-=`

```
error: Float should be Int
have: (..., Int) -> ...
want: (..., Float) -> ...
For function argument 'value'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.