haxe
haxe copied to clipboard
"Field needed by Interface is missing" has unknown position when defining from Context.defineType and then using Context.typeof
Try haxe: https://try.haxe.org/#15BeB54A
var pos = Context.currentPos();
var tfields = (macro class {
public var bit:Int;
}).fields;
var t:TypeDefinition = {
pos: pos,
pack: [],
meta: [{name: ":structInit", pos: pos}],
name: "TestType",
kind: TDClass([{pack: [], name: "Test", sub: "TestInterface"},]),
fields: tfields,
};
Context.defineType(t);
var complex:ComplexType = TPath({pack: [], name: "Macro", sub: "TestType"});
var type = Context.typeof(macro(null : $complex));
this yields
[ERROR] (unknown position)
| Field bit2 needed by TestInterface is missing