Browse Source

[std] make haxe.ds.ReadOnlyArray unify with Iterable (#9102)

Jens Fischer 5 years ago
parent
commit
e73d0d1353
2 changed files with 13 additions and 1 deletions
  1. 1 1
      std/haxe/ds/ReadOnlyArray.hx
  2. 12 0
      tests/unit/src/unit/issues/Issue9102.hx

+ 1 - 1
std/haxe/ds/ReadOnlyArray.hx

@@ -31,7 +31,7 @@ package haxe.ds;
 	and the reference can be obtained with a `cast`.
 **/
 @:forward(concat, copy, filter, indexOf, iterator, join, lastIndexOf, map, slice, toString)
-abstract ReadOnlyArray<T>(Array<T>) from Array<T> {
+abstract ReadOnlyArray<T>(Array<T>) from Array<T> to Iterable<T> {
 	/**
 		The length of `this` Array.
 	**/

+ 12 - 0
tests/unit/src/unit/issues/Issue9102.hx

@@ -0,0 +1,12 @@
+package unit.issues;
+
+import haxe.ds.ReadOnlyArray;
+
+using Lambda;
+
+class Issue9102 extends unit.Test {
+	function test() {
+		var a:ReadOnlyArray<Int> = [1, 2, 3];
+		t(a.exists(i -> i == 1));
+	}
+}