Closed romanmikhailov closed 3 months ago
Minimal reproducible example without maps and generics (using the same build.hxml
):
Main.hx
package;
interface IInterface {
function interfaceMethod1():Void;
function interfaceMethod2():Void;
}
class InterfaceImplementation implements IInterface {
public function new() {}
public function interfaceMethod1():Void {
trace('interfaceMethod1');
}
public function interfaceMethod2():Void {
trace('interfaceMethod2');
}
}
@:multiType
abstract AbstractOnInterface(IInterface) {
public function new();
public inline function abstractMethod1():Void {
abstractMethod2();
this.interfaceMethod1();
}
public inline function abstractMethod2():Void {
this.interfaceMethod2();
}
@:to static inline function toObject(t:IInterface):InterfaceImplementation {
return new InterfaceImplementation();
}
}
class Main {
private static var abstractOnInterface:AbstractOnInterface = new AbstractOnInterface();
public static function main():Void {
abstractOnInterface.abstractMethod1();
}
}
Console output:
$ haxe build.hxml
haxelib run hxcs hxcs_build.txt --haxe-version 3402 --feature-level 1
Note: dmcs is deprecated, please use mcs instead!
src/Main.cs(133,9): error CS1061: Type `IInterface' does not contain a definition for `interfaceMethod2' and no extension method `interfaceMethod2' of type `IInterface' could be found. Are you missing an assembly reference?
src/Main.cs(4,18): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
Compilation error
Native compilation failed
Error: Build failed
I also encountered this when doing my Reflaxe/Dart target (although tbf it could be me implementing it wrong) having to add @:keep to IMap to stop it from DCEing the fields.
Hmm, seems like we missed some C# issues. See #11551 (or provide a way to reproduce this on other targets and reopen)
I met compilation error (
error CS1061: Type `haxe.IMap<object,int>' does not contain a definition for `keys' and no extension method `keys' of type `haxe.IMap<object,int>' could be found. Are you missing an assembly reference?
) when try to compile next code:This can be workarounded one of next ways:
inline
fromEquatableMap#tryGetKey
--macro keep("haxe.Constraints.IMap")
inbuild.hxml
Main#fooMap
tomain
Main.hx
build.hxml
Console output