HaxeFoundation / HaxeFoundation/haxe
Monomorph constraints for operators
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
With the new fancy constrained monomorph, I believe it is possible to support this:
```haxe
abstract A({}) {
@:op([]) function get(index:Int):A return null;
@:op(a+b) function add(other:A):A return null;
}
function main() {
var x = null;
var y = x + x;
(x : A); // Int should be A
var x = null;
x[0];
(x : A); // Array> should be A
}
```
Contributor guide
Research direction
No files, tests, or entry points are named. Start by reproducing the constrained-monomorph operator examples from the issue and trace how the compiler handles the null variables, operator calls, and casts. Done means both examples infer the stated types and support the requested operator constraints.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100