HaxeFoundation / HaxeFoundation/haxe

Implicit cast declarations for abstracts from T

Open
#6,929 1 comment 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

Imagine that you have such kind of code: https://try.haxe.org/#57017
Should compiler complain about implicit casting declarations for abstract where underlying type is type variable without constraints? IMO only `@:from` `@:to` declarations with explicit type transformation must be permitted for this case.

Code:
```haxe
class Test {
static function main() {
trace("Haxe is great!");
var x:MyType = 0.1;
var y:Bool = x;
trace(x, y);
}
}

abstract MyType(T) from Float from String to Int to Bool {

}
```

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.