Hard to explain, but here’s my code I’m trying to get working:
@:generic
class Foo<T> {
public function new() {
}
}
class TestFoo {
public static function test(): Void {
var f: Foo<String> = createFoo<String>("foo");
trace(f);
}
@:generic
public static inline function createFoo<T>(v: T): Foo<T> {
return new Foo<T>();
}
}
When running the compiler, I get:
characters 25-41 : Cannot compare v : Unknown<0> -> Foo<Unknown<0>> and Class<String>
I figured this would work, but it doesn’t. Can anyone explain to me why it won’t work and how I can work around it (without using a macro)?
Thank you so much!