HaxeFoundation / HaxeFoundation/haxe
Default comparison operator is following too much
Open
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
abstract X(haxe.Int64) {
@:op(a>b) function compare( v : X ) : Bool;
}
abstract A(Int) {
// not comparable
}
abstract Y(A) {
@:op(a>b) function compare( v : X ) : Bool; // should error
}
class Test {
static function main() {
var a : X = cast 0;
var b : X = cast 1;
trace(a > b);
}
}
```
| Cannot compare haxe._Int64.___Int64 and haxe._Int64.___Int64
(or other errors depending on platform).
The default operator should only try to compare the underlying type without following. It should error if the underlying type is not comparable even the underlying-underlying is.
Contributor guide
Assessment
This issue has not been assessed yet.