Browse Source

workaround #5506 for now

Dan Korostelev 9 years ago
parent
commit
aa0e31381f
2 changed files with 6 additions and 1 deletions
  1. 2 1
      std/Any.hx
  2. 4 0
      tests/unit/src/unit/issues/Issue5322.hx

+ 2 - 1
std/Any.hx

@@ -31,6 +31,7 @@
 	to work with the actual value, it needs to be explicitly promoted
 	to work with the actual value, it needs to be explicitly promoted
 	to another type.
 	to another type.
 **/
 **/
-abstract Any(Dynamic) from Dynamic {
+abstract Any(Dynamic) {
 	@:noCompletion @:extern @:to inline function __promote<T>():T return this;
 	@:noCompletion @:extern @:to inline function __promote<T>():T return this;
+	@:noCompletion @:extern @:from inline static function __cast<T>(value:T):Any return cast value;
 }
 }

+ 4 - 0
tests/unit/src/unit/issues/Issue5322.hx

@@ -3,6 +3,8 @@ package unit.issues;
 import unit.TestType.typeErrorText;
 import unit.TestType.typeErrorText;
 import unit.TestType.typedAs;
 import unit.TestType.typedAs;
 
 
+private abstract A(String) from String {}
+
 class Issue5322 extends unit.Test {
 class Issue5322 extends unit.Test {
 	function test() {
 	function test() {
 		// unifies!
 		// unifies!
@@ -26,6 +28,8 @@ class Issue5322 extends unit.Test {
 		// can be used for array of mixed types!
 		// can be used for array of mixed types!
 		var a:Array<Any> = [1,false,"hey",{}];
 		var a:Array<Any> = [1,false,"hey",{}];
 		eq("hey", (a[2] : String));
 		eq("hey", (a[2] : String));
+
+		eq("hello", ((("hello" : A) : Any) : String));
 	}
 	}
 
 
 	function something():Any return "hello";
 	function something():Any return "hello";