HaxeFoundation / HaxeFoundation/haxe

Multitype abstract from calling to

Open
#8,739 7 comments 0 reactions 0 assignees View on GitHub
feature-abstracts
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
interface IA {}

@:multiType
abstract Above(IA) {
public function new(v);
@:from static inline function fromInt(v:Int) return (v:Above);
@:from static inline function fromFloat(v:Float) return (v:Above);
@:to static inline function toInt(t:IA, v) return {value:v, type:TInt};
@:to static inline function toFloat(t:IA, v) return {value:v, type:TFloat};
}

var a1 = new Above(0);
a1 = 1;
var a2 = new Above(0);
```

Shouldn't (v:Above\) at fromInt call toInt in above example? Instead, a1 = 1 makes a1 an object, casting 1 to object, being not inlined like a2

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.