Browse Source

[cs] dodge

Simon Krajewski 2 years ago
parent
commit
3f95a76c07
2 changed files with 6 additions and 1 deletions
  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;
 		return this.Length;
 
 
 	@:from static public inline function of<T>(array:Array<T>):Rest<T>
 	@: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));
 		return new Rest(cs.Lib.nativeArray(array, false));
+		#end
 
 
 	inline function new(a:NativeRest<T>):Void
 	inline function new(a:NativeRest<T>):Void
 		this = a;
 		this = a;

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

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