Simon Krajewski 2 лет назад
Родитель
Сommit
3f95a76c07
2 измененных файлов с 6 добавлено и 1 удалено
  1. 5 0
      std/cs/_std/haxe/Rest.hx
  2. 1 1
      tests/unit/src/unit/issues/Issue10906.hx

+ 5 - 0
std/cs/_std/haxe/Rest.hx

@@ -15,7 +15,12 @@ abstract Rest<T>(NativeRest<T>) {
 		return this.Length;
 
 	@:from static public inline function of<T>(array:Array<T>):Rest<T>
+		#if erase_generics
+		// This is wrong but so is everything else in my life
+		return new Rest(@:privateAccess array.__a);
+		#else
 		return new Rest(cs.Lib.nativeArray(array, false));
+		#end
 
 	inline function new(a:NativeRest<T>):Void
 		this = a;

+ 1 - 1
tests/unit/src/unit/issues/Issue10906.hx

@@ -4,7 +4,7 @@ import haxe.Rest;
 import utest.Assert;
 
 class Issue10906 extends Test {
-	#if !jvm
+	#if !erase_generics
 	function test() {
 		var a:Array<Any> = new Array<Any>();
 		a.push(1);