haxe icon indicating copy to clipboard operation
haxe copied to clipboard

"Field needed by Interface is missing" has unknown position when defining from Context.defineType and then using Context.typeof

Open Speedphoenix opened this issue 1 year ago • 3 comments

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

Speedphoenix avatar Aug 30 '24 13:08 Speedphoenix