go2hx
go2hx copied to clipboard
Support Slices stdlib
Stdlib slices is a new go 1.21.0 package that uses an extensive amount of generics. It is also being used in the internals now of sort.
Here is a test case that is currently not working with the latest go2hx version:
func Min[S ~[]E, E cmp.Ordered](x S) E {
if len(x) < 1 {
panic("slices.Min: empty list")
}
m := x[0]
for i := 1; i < len(x); i++ {
m = min(m, x[i])
}
return m
}
The haxe version is missing the E typeParam.
macro function min<S>(_x:haxe.macro.Expr.ExprOf<S>):haxe.macro.Expr.ExprOf<E>;
I will add commits in connection to this issue.