HaxeFoundation / HaxeFoundation/haxe

Classes that derive from abstract classes don't pass expected type equality checks on some targets.

Open
#10,731 3 comments 1 reaction 1 assignee Claimed by @Simn View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Haxe Version: 4.2.5

Minimum reproduction
```haxe
class Main {
static function main() {
var a = new A();
var b = new B();

trace(a is A);
trace(a is B);
trace(b is A);
trace(b is B);
trace('---------------');
var d = new D();
trace(d is D);
trace(d is C);

}
}

class A {
public function new() {}
}
class B extends A {}

abstract class C {
public function new(){}
}
class D extends C {}
```

When running this on cpp/Windows the output is
```
src/Main.hx:8: true
src/Main.hx:9: false
src/Main.hx:10: true
src/Main.hx:11: true
src/Main.hx:12: ---------------
src/Main.hx:14: true
src/Main.hx:15: false
```
We expect
```
src/Main.hx:8: true
src/Main.hx:9: false
src/Main.hx:10: true
src/Main.hx:11: true
src/Main.hx:12: ---------------
src/Main.hx:14: true
src/Main.hx:15: true
```

On hashlink this works as expected. Also see https://try.haxe.org/#C3420eA3

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.