HaxeFoundation / HaxeFoundation/haxe

Default comparison operator is following too much

Open
#12,884 2 comments 0 reactions 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
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

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.