Bläddra i källkod

use abstract types for basic types (Int,Float,Bool,Void) and for Class,Enum,EnumValue

Nicolas Cannasse 13 år sedan
förälder
incheckning
29a2bced88

+ 1 - 1
codegen.ml

@@ -222,7 +222,7 @@ let make_generic ctx ps pt p =
 			let path = (match follow t with
 				| TInst (ct,_) -> ct.cl_path
 				| TEnum (e,_) -> e.e_path
-				| TAbstract (a,_) when has_meta ":runtime_value" a.a_meta -> a.a_path
+				| TAbstract (a,_) when has_meta ":runtimeValue" a.a_meta -> a.a_path
 				| TMono _ -> raise (Generic_Exception (("Could not determine type for parameter " ^ s), p))
 				| t -> raise (Generic_Exception (("Type parameter must be a class or enum instance (found " ^ (s_type (print_context()) t) ^ ")"), p))
 			) in

+ 4 - 1
gencs.ml

@@ -549,7 +549,8 @@ let configure gen =
       | TType ({ t_path = ["cs"],"Ref" },_)
       | TType ({ t_path = ["cs"],"Out" },_)
       | TType ({ t_path = [],"Single" },[]) -> Some t
-			| TInst( { cl_path = ([], "EnumValue") }, _  ) -> Some t_dynamic
+	  | TAbstract( { a_path = ([], "EnumValue") }, _  ) -> Some t_dynamic
+      | TInst( { cl_path = ([], "EnumValue") }, _  ) -> Some t_dynamic
       | _ -> None);
   
   let path_s path = match path with
@@ -569,6 +570,8 @@ let configure gen =
     let ret = match t with
       | TInst( { cl_path = (["haxe"], "Int32") }, [] ) -> gen.gcon.basic.tint
       | TInst( { cl_path = (["haxe"], "Int64") }, [] ) -> ti64
+	  | TAbstract( { a_path = [],"Class" }, _ )
+	  | TAbstract( { a_path = [],"Enum" }, _ ) -> TInst(ttype,[])
       | TInst( { cl_path = ([], "Class") }, _ )
       | TInst( { cl_path = ([], "Enum") }, _ ) -> TInst(ttype,[])
       | TEnum(_, [])

+ 5 - 1
genjava.ml

@@ -704,7 +704,8 @@ let configure gen =
       | TType ({ t_path = ["java"],"Char16" },[])
       | TType ({ t_path = [],"Single" },[])
       | TType ({ t_path = [],"Null" },[_]) -> Some t
-			| TInst( { cl_path = ([], "EnumValue") }, _  ) -> Some t_dynamic
+	  | TAbstract( { a_path = ([], "EnumValue") }, _  ) -> Some t_dynamic
+      | TInst( { cl_path = ([], "EnumValue") }, _  ) -> Some t_dynamic
       | _ -> None);
 
   let change_path path = (change_ns (fst path), change_clname (snd path)) in
@@ -720,6 +721,8 @@ let configure gen =
     match t with
       | TInst( { cl_path = (["haxe"], "Int32") }, [] ) -> gen.gcon.basic.tint
       | TInst( { cl_path = (["haxe"], "Int64") }, [] ) -> ti64
+      | TAbstract( { a_path = ([], "Class") }, p  )
+      | TAbstract( { a_path = ([], "Enum") }, p  ) -> TInst(cl_cl,[t_dynamic])
       | TInst( { cl_path = ([], "Class") }, p  )
       | TInst( { cl_path = ([], "Enum") }, p  ) -> TInst(cl_cl,[t_dynamic])
       | TEnum _
@@ -774,6 +777,7 @@ let configure gen =
       | TInst ({ cl_kind = KTypeParameter _; cl_path=p }, []) -> snd p
       | TMono r -> (match !r with | None -> "java.lang.Object" | Some t -> t_s (run_follow gen t))
       | TInst ({ cl_path = [], "String" }, []) -> "java.lang.String"
+	  | TAbstract ({ a_path = [], "Class" }, _) | TAbstract ({ a_path = [], "Enum" }, _) -> assert false (* should have been converted earlier *)
       | TInst ({ cl_path = [], "Class" }, _) | TInst ({ cl_path = [], "Enum" }, _) -> assert false (* should have been converted earlier *)
       | TEnum (({e_path = p;} as e), params) -> (path_param_s (TEnumDecl e) p params)
       | TInst (({cl_path = p;} as cl), params) -> (path_param_s (TClassDecl cl) p params)

+ 1 - 1
std/Class.hx

@@ -27,5 +27,5 @@
 	An abstract type that represents a Class.
 	See [Type] for the haXe Reflection API.
 **/
-extern class Class<T> {
+@:runtimeValue abstract Class<T> {
 }

+ 1 - 1
std/Enum.hx

@@ -3,5 +3,5 @@
 	An abstract type that represents an Enum.
 	See [Type] for the haXe Reflection API.
 **/
-extern class Enum<T> {
+@:runtimeValue abstract Enum<T> {
 }

+ 1 - 1
std/EnumValue.hx

@@ -3,5 +3,5 @@
 	An abstract type that represents any enum value.
 	See [Type] for the haXe Reflection API.
 **/
-extern class EnumValue {
+abstract EnumValue {
 }

+ 7 - 9
std/StdTypes.hx

@@ -28,28 +28,28 @@
 /**
 	The standard Void type. Only [null] values can be of the type [Void].
 **/
-extern enum Void { }
+abstract Void { }
 
 /**
 	The standard Float type, this is a double-precision IEEE 64bit float.
 **/
-extern class Float { }
+@:notNull @:runtimeValue abstract Float { }
 
 /**
 	The standard Int type. Its precision depends on the platform.
 **/
-extern class Int extends Float { }
+@:notNull @:runtimeValue abstract Int <= Float { }
 
 #if (flash9 || flash9doc || cs)
 /**
 	The unsigned Int type is only defined for Flash9. It's currently
 	handled the same as a normal Int.
 **/
-typedef UInt = Int
+@:notNull @:runtimeValue abstract UInt => Int, <= Int { }
 #end
 
 #if (java || cs)
-typedef Single = Float;
+@:notNull @:runtimeValue abstract Single => Float, <= Float {}
 #end
 
 /**
@@ -63,16 +63,14 @@ typedef Null<T> = T
 /**
 	The standard Boolean type is represented as an enum with two choices.
 **/
-extern enum Bool {
-	true;
-	false;
+@:notNull @:runtimeValue abstract Bool {
 }
 
 /**
 	Dynamic is an internal compiler type which has special behavior.
 	See the haXe language reference for more informations.
 **/
-extern class Dynamic<T> {
+@:runtimeValue abstract Dynamic<T> {
 }
 
 /**

+ 4 - 4
std/cs/Pointer.hx

@@ -3,7 +3,7 @@ package cs;
 /**
 	This type represents pointer types for C# function parameters. It should only
 	be used inside an unsafe context (not checked by the Haxe compiler)
-	
+
 	C# code:
 		int[] src;
 		fixed (int* pSrc = src)
@@ -16,13 +16,13 @@ package cs;
 		{
 			...
 		});
-	
+
 **/
 #if !unsafe
 #error "You need to define 'unsafe' to be able to use unsafe code in hxcs"
 #else
-extern class Pointer<T> extends Int, implements ArrayAccess<T>
+extern class Pointer<T> /*extends Int,*/ implements ArrayAccess<T>
 {
-	
+
 }
 #end

+ 4 - 4
std/cs/_std/Type.hx

@@ -114,11 +114,11 @@ import cs.internal.Runtime;
 		{
 			switch(name)
 			{
-				case #if no-root "haxe.root.Int" #else "Int" #end: return Int;
-				case #if no-root "haxe.root.Float" #else "Float" #end: return Float;
-				case #if no-root "haxe.root.Class" #else "Class" #end: return Class;
+				//case #if no-root "haxe.root.Int" #else "Int" #end: return Int;
+				//case #if no-root "haxe.root.Float" #else "Float" #end: return Float;
+				//case #if no-root "haxe.root.Class" #else "Class" #end: return Class;
+				//case #if no-root "haxe.root.Dynamic" #else "Dynamic" #end: return Dynamic;
 				case #if no-root "haxe.root.String" #else "String" #end: return String;
-				case #if no-root "haxe.root.Dynamic" #else "Dynamic" #end: return Dynamic;
 				default: return null;
 			}
 		} else if (t.IsInterface && cast(untyped __typeof__(IGenericObject), cs.system.Type).IsAssignableFrom(t)) {

+ 29 - 29
std/cs/_std/haxe/Int64.hx

@@ -30,43 +30,43 @@ private typedef NativeUInt64 = Int;
 @:coreApi
 @:nativegen class Int64
 {
-	@:extern private static inline function asNative(i:haxe.Int64):NativeInt64 return untyped i
-	@:extern private static inline function ofNative(i:NativeInt64):haxe.Int64 return untyped i
+	@:extern private static inline function asNative(i:Int64):NativeInt64 return untyped i
+	@:extern private static inline function ofNative(i:NativeInt64):Int64 return untyped i
 	@:extern private static inline function mkNative(i:Dynamic):NativeInt64 return i
 
 	#if haxe3
 
-	public static inline function make( high : Int, low : Int ) : haxe.Int64
+	public static inline function make( high : Int, low : Int ) : Int64
 	{
 		return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
 	}
 
-	public static inline function getLow( x : haxe.Int64 ) : Int
+	public static inline function getLow( x : Int64 ) : Int
 	{
 		return cast (x.asNative() & 0xFFFFFFFF.mkNative());
 	}
 
-	public static inline function getHigh( x : haxe.Int64 ) : Int {
+	public static inline function getHigh( x : Int64 ) : Int {
 		return cast(x,NativeUInt64) >> 32;
 	}
 
 	#else
 
-	public static inline function make( high : Int32, low : Int32 ) : haxe.Int64
+	public static inline function make( high : Int32, low : Int32 ) : Int64
 	{
 		return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
 	}
 
-	public static inline function ofInt32( x : Int32 ) : haxe.Int64 {
+	public static inline function ofInt32( x : Int32 ) : Int64 {
 		return cast x;
 	}
 
-	public static inline function getLow( x : haxe.Int64 ) : Int32
+	public static inline function getLow( x : Int64 ) : Int32
 	{
 		return cast (x.asNative() & 0xFFFFFFFF.mkNative());
 	}
 
-	public static inline function getHigh( x : haxe.Int64 ) : Int32
+	public static inline function getHigh( x : Int64 ) : Int32
 	{
 		return cast(cast(x,NativeUInt64) >> 32,Int32);
 	}
@@ -74,87 +74,87 @@ private typedef NativeUInt64 = Int;
 
 	#end
 
-	public static inline function ofInt( x : Int ) : haxe.Int64 {
+	public static inline function ofInt( x : Int ) : Int64 {
 		return cast x;
 	}
 
-	public static inline function toInt( x : haxe.Int64 ) : Int
+	public static inline function toInt( x : Int64 ) : Int
 	{
 		return cast x;
 	}
 
-	public static inline function add( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function add( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() + b.asNative()).ofNative();
 	}
 
-	public static inline function sub( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function sub( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() - b.asNative()).ofNative();
 	}
 
-	public static inline function mul( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
+	public static inline function mul( a : Int64, b : Int64 ) : Int64 {
 		return (a.asNative() * b.asNative()).ofNative();
 	}
 
-	static function divMod( modulus : haxe.Int64, divisor : haxe.Int64 )
+	static function divMod( modulus : Int64, divisor : Int64 ) : { quotient : Int64, modulus : Int64 }
 	{
 		var q:Int64 = (modulus.asNative() / divisor.asNative()).mkNative().ofNative();
 		var m:Int64 = (modulus.asNative() % divisor.asNative()).mkNative().ofNative();
 		return { quotient : q, modulus : m };
 	}
 
-	public static inline function div( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
+	public static inline function div( a : Int64, b : Int64 ) : Int64 {
 		return (a.asNative() / b.asNative()).mkNative().ofNative();
 	}
 
-	public static inline function mod( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
+	public static inline function mod( a : Int64, b : Int64 ) : Int64 {
 		return (a.asNative() % b.asNative()).mkNative().ofNative();
 	}
 
-	public static inline function shl( a : haxe.Int64, b : Int ) : haxe.Int64 {
+	public static inline function shl( a : Int64, b : Int ) : Int64 {
 		return (a.asNative() << b).ofNative();
 	}
 
-	public static inline function shr( a : haxe.Int64, b : Int ) : haxe.Int64 {
+	public static inline function shr( a : Int64, b : Int ) : Int64 {
 		return (a.asNative() >> b).ofNative();
 	}
 
-	public static inline function ushr( a : haxe.Int64, b : Int ) : haxe.Int64 {
+	public static inline function ushr( a : Int64, b : Int ) : Int64 {
 		return ( cast(a, NativeUInt64) >> b).ofNative();
 	}
 
-	public static inline function and( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function and( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() & b.asNative()).ofNative();
 	}
 
-	public static inline function or( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function or( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() | b.asNative()).ofNative();
 	}
 
-	public static inline function xor( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function xor( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() ^ b.asNative()).ofNative();
 	}
 
-	public static inline function neg( a : haxe.Int64 ) : haxe.Int64
+	public static inline function neg( a : Int64 ) : Int64
 	{
 		return (~a.asNative()).ofNative();
 	}
 
-	public static inline function isNeg( a : haxe.Int64 ) : Bool
+	public static inline function isNeg( a : Int64 ) : Bool
 	{
 		return (a.asNative() < 0.mkNative());
 	}
 
-	public static inline function isZero( a : haxe.Int64 ) : Bool
+	public static inline function isZero( a : Int64 ) : Bool
 	{
 		return (a.asNative() == 0.mkNative());
 	}
 
-	public static inline function compare( a : haxe.Int64, b : haxe.Int64 ) : Int
+	public static inline function compare( a : Int64, b : Int64 ) : Int
 	{
 		return cast (a.asNative() - b.asNative());
 	}
@@ -162,14 +162,14 @@ private typedef NativeUInt64 = Int;
 	/**
 		Compare two Int64 in unsigned mode.
 	**/
-	public static function ucompare( a : haxe.Int64, b : haxe.Int64 ) : Int
+	public static function ucompare( a : Int64, b : Int64 ) : Int
 	{
 		if (a.asNative() < 0.mkNative())
 			return (b.asNative() < 0.mkNative()) ? compare( (~a.asNative()).ofNative(), (~b.asNative()).ofNative()) : 1;
 		return (b.asNative() < 0.mkNative()) ? -1 : compare(a, b);
 	}
 
-	public static inline function toStr( a : haxe.Int64 ) : String {
+	public static inline function toStr( a : Int64 ) : String {
 		return a + "";
 	}
 }

+ 2 - 2
std/flash/_std/haxe/Resource.hx

@@ -47,7 +47,7 @@ class Resource {
 		return untyped __new__(n);
 	}
 
-	static function __init__() {
+	static function __init__() : Void {
 		untyped __resources__.__init__();
 	}
 }
@@ -83,7 +83,7 @@ class Resource {
 		}
 	}
 
-	static function __init__() {
+	static function __init__() : Void {
 		content = untyped __resources__();
 	}
 }

+ 29 - 29
std/java/_std/haxe/Int64.hx

@@ -29,131 +29,131 @@ private typedef NativeInt64 = Int;
 @:coreApi
 @:nativegen class Int64
 {
-	@:extern private static inline function asNative(i:haxe.Int64):NativeInt64 return untyped i
-	@:extern private static inline function ofNative(i:NativeInt64):haxe.Int64 return untyped i
+	@:extern private static inline function asNative(i:Int64):NativeInt64 return untyped i
+	@:extern private static inline function ofNative(i:NativeInt64):Int64 return untyped i
 	@:extern private static inline function mkNative(i:Dynamic):NativeInt64 return i
 
 	#if haxe3
 
-	public static inline function make( high : Int, low : Int ) : haxe.Int64
+	public static inline function make( high : Int, low : Int ) : Int64
 	{
 		return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
 	}
 
-	public static inline function getLow( x : haxe.Int64 ) : Int
+	public static inline function getLow( x : Int64 ) : Int
 	{
 		return cast (x.asNative() & 0xFFFFFFFF.mkNative());
 	}
 
-	public static inline function getHigh( x : haxe.Int64 ) : Int
+	public static inline function getHigh( x : Int64 ) : Int
 	{
 		return cast(x,NativeInt64) >>> 32;
 	}
 
 	#else
 
-	public static inline function make( high : Int32, low : Int32 ) : haxe.Int64
+	public static inline function make( high : Int32, low : Int32 ) : Int64
 	{
 		return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
 	}
 
-	public static inline function ofInt32( x : Int32 ) : haxe.Int64 {
+	public static inline function ofInt32( x : Int32 ) : Int64 {
 		return cast x;
 	}
 
-	public static inline function getLow( x : haxe.Int64 ) : Int32
+	public static inline function getLow( x : Int64 ) : Int32
 	{
 		return cast (x.asNative() & 0xFFFFFFFF.mkNative());
 	}
 
-	public static inline function getHigh( x : haxe.Int64 ) : Int32
+	public static inline function getHigh( x : Int64 ) : Int32
 	{
 		return cast(cast(x,NativeInt64) >>> 32, Int32);
 	}
 
 	#end
 
-	public static inline function ofInt( x : Int ) : haxe.Int64 {
+	public static inline function ofInt( x : Int ) : Int64 {
 		return cast x;
 	}
 
-	public static inline function toInt( x : haxe.Int64 ) : Int
+	public static inline function toInt( x : Int64 ) : Int
 	{
 		return cast x;
 	}
 
-	public static inline function add( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function add( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() + b.asNative()).ofNative();
 	}
 
-	public static inline function sub( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function sub( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() - b.asNative()).ofNative();
 	}
 
-	public static inline function mul( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
+	public static inline function mul( a : Int64, b : Int64 ) : Int64 {
 		return (a.asNative() * b.asNative()).ofNative();
 	}
 
-	static function divMod( modulus : haxe.Int64, divisor : haxe.Int64 )
+	static function divMod( modulus : Int64, divisor : Int64 ) : { quotient : Int64, modulus : Int64 }
 	{
 		var q:Int64 = (modulus.asNative() / divisor.asNative()).mkNative().ofNative();
 		var m:Int64 = (modulus.asNative() % divisor.asNative()).mkNative().ofNative();
 		return { quotient : q, modulus : m };
 	}
 
-	public static inline function div( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
+	public static inline function div( a : Int64, b : Int64 ) : Int64 {
 		return (a.asNative() / b.asNative()).mkNative().ofNative();
 	}
 
-	public static inline function mod( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
+	public static inline function mod( a : Int64, b : Int64 ) : Int64 {
 		return (a.asNative() % b.asNative()).mkNative().ofNative();
 	}
 
-	public static inline function shl( a : haxe.Int64, b : Int ) : haxe.Int64 {
+	public static inline function shl( a : Int64, b : Int ) : Int64 {
 		return (a.asNative() << b).ofNative();
 	}
 
-	public static inline function shr( a : haxe.Int64, b : Int ) : haxe.Int64 {
+	public static inline function shr( a : Int64, b : Int ) : Int64 {
 		return (a.asNative() >> b).ofNative();
 	}
 
-	public static inline function ushr( a : haxe.Int64, b : Int ) : haxe.Int64 {
+	public static inline function ushr( a : Int64, b : Int ) : Int64 {
 		return (a.asNative() >>> b).ofNative();
 	}
 
-	public static inline function and( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function and( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() & b.asNative()).ofNative();
 	}
 
-	public static inline function or( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function or( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() | b.asNative()).ofNative();
 	}
 
-	public static inline function xor( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
+	public static inline function xor( a : Int64, b : Int64 ) : Int64
 	{
 		return (a.asNative() ^ b.asNative()).ofNative();
 	}
 
-	public static inline function neg( a : haxe.Int64 ) : haxe.Int64
+	public static inline function neg( a : Int64 ) : Int64
 	{
 		return (~a.asNative()).ofNative();
 	}
 
-	public static inline function isNeg( a : haxe.Int64 ) : Bool
+	public static inline function isNeg( a : Int64 ) : Bool
 	{
 		return (a.asNative() < 0.mkNative());
 	}
 
-	public static inline function isZero( a : haxe.Int64 ) : Bool
+	public static inline function isZero( a : Int64 ) : Bool
 	{
 		return (a.asNative() == 0.mkNative());
 	}
 
-	public static inline function compare( a : haxe.Int64, b : haxe.Int64 ) : Int
+	public static inline function compare( a : Int64, b : Int64 ) : Int
 	{
 		return cast (a.asNative() - b.asNative());
 	}
@@ -161,14 +161,14 @@ private typedef NativeInt64 = Int;
 	/**
 		Compare two Int64 in unsigned mode.
 	**/
-	public static function ucompare( a : haxe.Int64, b : haxe.Int64 ) : Int
+	public static function ucompare( a : Int64, b : Int64 ) : Int
 	{
 		if (a.asNative() < 0.mkNative())
 			return (b.asNative() < 0.mkNative()) ? compare( (~a.asNative()).ofNative(), (~b.asNative()).ofNative()) : 1;
 		return (b.asNative() < 0.mkNative()) ? -1 : compare(a, b);
 	}
 
-	public static inline function toStr( a : haxe.Int64 ) : String {
+	public static inline function toStr( a : Int64 ) : String {
 		return a + "";
 	}
 }

+ 4 - 4
std/java/lang/Number.hx

@@ -16,7 +16,7 @@ private typedef StdFloat = Float;
 
 }
 
-@:final extern class Byte extends Number, implements Int
+@:final extern class Byte extends Number/*, implements Int */
 {
 	static var MAX_VALUE(default, null):Int8;
 	static var MIN_VALUE(default, null):Int8;
@@ -27,7 +27,7 @@ private typedef StdFloat = Float;
 	static function parseByte(s:String, radix:Int):Int8;
 }
 
-@:hack @:final extern class Double extends Number, implements StdFloat
+@:hack @:final extern class Double extends Number/* , implements StdFloat */
 {
 	static var MAX_VALUE(default, null):StdFloat;
 	static var MIN_VALUE(default, null):StdFloat;
@@ -56,7 +56,7 @@ private typedef StdFloat = Float;
 	function new(value:Single):Void;
 }
 
-@:final extern class Integer extends Number, implements Int
+@:final extern class Integer extends Number/*, implements Int */
 {
 	static var MAX_VALUE(default, null):Int;
 	static var MIN_VALUE(default, null):Int;
@@ -80,7 +80,7 @@ private typedef StdFloat = Float;
 	static function parseLong(s:String, radix:Int):Int64;
 }
 
-@:final extern class Short extends Number, implements Int
+@:final extern class Short extends Number/*, implements Int */
 {
 	static var MAX_VALUE(default, null):Int16;
 	static var MIN_VALUE(default, null):Int16;

+ 4 - 0
std/neko/_std/haxe/Int32.hx

@@ -24,6 +24,8 @@
  */
 package haxe;
 
+#if !haxe3
+
 @:coreApi class Int32 {
 
 	public static inline function make( a : Int, b : Int ) : Int32 {
@@ -133,3 +135,5 @@ package haxe;
 	}
 
 }
+
+#end

+ 1 - 0
tests/unit/Test.hx

@@ -1,5 +1,6 @@
 package unit;
 
+@:expose
 @:keepSub class Test #if swf_mark implements mt.Protect #end #if as3 implements haxe.Public #end {
 
 	public function new() {

+ 9 - 3
type.ml

@@ -1050,15 +1050,15 @@ let rec unify a b =
 			| _ -> ())
 		with
 			Unify_error l -> error (cannot_unify a b :: l))
-	| TAnon an, TInst ({ cl_path = [],"Class" },[pt]) ->
+	| TAnon an, TAbstract ({ a_path = [],"Class" },[pt]) ->
 		(match !(an.a_status) with
 		| Statics cl -> unify (TInst (cl,List.map snd cl.cl_types)) pt
 		| _ -> error [cannot_unify a b])
-	| TAnon an, TInst ({ cl_path = [],"Enum" },[pt]) ->
+	| TAnon an, TAbstract ({ a_path = [],"Enum" },[pt]) ->
 		(match !(an.a_status) with
 		| EnumStatics e -> unify (TEnum (e,List.map snd e.e_types)) pt
 		| _ -> error [cannot_unify a b])
-	| TEnum _, TInst ({ cl_path = [],"EnumValue" },[]) ->
+	| TEnum _, TAbstract ({ a_path = [],"EnumValue" },[]) ->
 		()
 	| TDynamic t , _ ->
 		if t == a then
@@ -1103,6 +1103,12 @@ let rec unify a b =
 			let t = apply_params aa.a_types tl t in
 			try unify t b; true with Unify_error _ -> false
 		) aa.a_super) then error [cannot_unify a b];
+	| TInst ({ cl_kind = KTypeParameter ctl } as c,pl), TAbstract _ ->
+		(* one of the constraints must satisfy the abstract *)
+		if not (List.exists (fun t ->
+			let t = apply_params c.cl_types pl t in
+			try unify t b; true with Unify_error _ -> false
+		) ctl) then error [cannot_unify a b];
 	| _, TAbstract (bb,tl) ->
 		if not (List.exists (fun t ->
 			let t = apply_params bb.a_types tl t in

+ 2 - 0
typeload.ml

@@ -850,6 +850,7 @@ let init_core_api ctx c =
 			Common.define com2 Define.CoreApi;
 			Common.define com2 Define.Sys;
 			if ctx.in_macro then Common.define com2 Define.Macro;
+			if Common.defined ctx.com Define.Haxe3 then Common.define com2 Define.Haxe3;
 			com2.class_path <- ctx.com.std_path;
 			let ctx2 = ctx.g.do_create com2 in
 			ctx.g.core_api <- Some ctx2;
@@ -905,6 +906,7 @@ let init_core_api ctx c =
 		check_fields ccore.cl_statics c.cl_statics;
 		(match ccore.cl_constructor, c.cl_constructor with
 		| None, None -> ()
+		| Some { cf_public = false }, _ -> ()
 		| Some f, Some f2 -> compare_fields f f2
 		| None, Some { cf_public = false } -> ()
 		| _ -> error "Constructor differs from core type" c.cl_pos)

+ 6 - 0
typer.ml

@@ -82,6 +82,7 @@ let rec classify t =
 	| TInst ({ cl_path = ([],"String") },[]) -> KString
 	| TAbstract ({ a_path = [],"Int" },[]) -> KInt
 	| TAbstract ({ a_path = [],"Float" },[]) -> KFloat
+	| TAbstract (a,[]) when List.exists (fun t -> match classify t with KInt | KFloat -> true | _ -> false) a.a_super -> KParam t
 	| TInst ({ cl_kind = KTypeParameter ctl },_) when List.exists (fun t -> match classify t with KInt | KFloat -> true | _ -> false) ctl -> KParam t
 	| TMono r when !r = None -> KUnk
 	| TDynamic _ -> KDyn
@@ -2246,6 +2247,11 @@ and type_expr ctx ?(need_val=true) (e,p) =
 				TClassDecl c
 			| TEnum (e,_) -> TEnumDecl e
 			| _ -> assert false);
+		| TAbstract (a,params) when has_meta ":runtimeValue" a.a_meta ->
+			List.iter (fun pt ->
+				if follow pt != t_dynamic then error "Cast type parameters must be Dynamic" p;
+			) params;
+			TAbstractDecl a
 		| _ ->
 			error "Cast type must be a class or an enum" p
 		) in