Browse Source

make Map abstract transitive, fixes #9874 (#9877)

* make hx.ds.Map transitive

* test for #9874
Peter Achberger 5 years ago
parent
commit
e1d5a96b2d
2 changed files with 15 additions and 0 deletions
  1. 1 0
      std/haxe/ds/Map.hx
  2. 14 0
      tests/unit/src/unit/issues/Issue9874.hx

+ 1 - 0
std/haxe/ds/Map.hx

@@ -46,6 +46,7 @@ import haxe.Constraints.IMap;
 
 	@see https://haxe.org/manual/std-Map.html
 **/
+@:transitive
 @:multiType(@:followWithAbstracts K)
 abstract Map<K, V>(IMap<K, V>) {
 	/**

+ 14 - 0
tests/unit/src/unit/issues/Issue9874.hx

@@ -0,0 +1,14 @@
+package unit.issues;
+
+import haxe.Constraints.IMap;
+
+@:forward abstract ArrayMap<K, V>(IMap<K, Array<V>>) from IMap<K, Array<V>> to IMap<K, Array<V>> {}
+
+class Issue9874 extends unit.Test {
+	function test() {
+		var m:ArrayMap<String, String> = new Map();
+		var m2:ArrayMap<String, String> = new Map<String, Array<String>>();
+		var m3:ArrayMap<String, String> = new haxe.ds.StringMap<Array<String>>();
+		utest.Assert.pass();
+	}
+}