HaxeFoundation / HaxeFoundation/hashlink
Unexpected value conversion when using an abstract class with type param
- Dominant language
- C
- Stars
- 901
- Forks
- 201
- Avg merge
- 18h 9m
- Merged PRs (30d)
- 8
Description
Discovered a value conversion when using an abstract class with a type param (not sure what exactly causes this behavior). If you make the `dispatch` method inline, it will work as expected. `` is also converted - it prints 1074069696 no matter what value is passed.
https://try.haxe.org/#2c563180
```haxe
class Test {
static function main() {
var s = new Signal1();
s.add(cb);
s.dispatch(false); // <--- Test.hx:8: true
}
static function cb(v:Bool) {
trace(v);
}
}
@:forward(length, iterator)
abstract Signal1(ArrayVoid>) {
public inline function new() {
this = new ArrayVoid>();
}
public inline function add(cb:T->Void) {
this.push(cb);
}
public function dispatch(value:T) {
for (cb in this) {
cb(value);
}
}
}
```
Haxe 4.3.4
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.