HaxeFoundation / HaxeFoundation/haxe
Uncatchable haxe.macro.Context.typeof() when dealing with TExtend
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
4.0.5
```haxe
// Main.hx
class Main {
static function main()
Macro.run();
}
typedef Obj1 = {foo:Int}
typedef Obj2 = {foo:String}
// Macro.hx
import haxe.macro.Expr;
import haxe.macro.Context;
class Macro {
public static macro function run() {
try {
var ct = TExtend([
{pack: [], name: 'Main', params: [], sub: 'Obj1'},
{pack: [], name: 'Main', params: [], sub: 'Obj2'},
], []);
Context.typeof(macro {
var v:$ct = null;
v;
});
} catch(e:Dynamic) {
trace(e);
}
return macro null;
}
}
```
Compiler halts with `Cannot redefine field foo with different type` and the error is uncatchable
Contributor guide
Assessment
This issue has not been assessed yet.