HaxeFoundation / HaxeFoundation/haxe
Generic and call-site inlining
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
class Some {
var v:Int;
public function new() {}
public function something(v:Int) { this.v = v; }
}
@:generic
class Generic {
var t:T;
public function new(t:T) this.t = t;
public function something(v:Int) { inline t.something(v); }
}
```
.Generic.hx:12: characters 47-58 : Generic.T has no field something
Haxe expects a type parameter constraint:
```haxe
@:generic
class Generic {
```
however, this causes t.something(v) to not be inline (cpp code)
```cpp
this->t->something(v);
```
versus explicit cast
```haxe
public function something(v:Int) { inline (cast t:Some).something(v); }
```
```cpp
this->t->v = v;
```
Why Generic.T doesn't resolve to Some type when it's clear that it is of a Some type in Generic_Some.cpp? Because Generic.T is a TLazy?
Contributor guide
Assessment
This issue has not been assessed yet.