Browse Source

do not allow Void to unify with anything other than Void

Simon Krajewski 12 years ago
parent
commit
7eb737fcfb
4 changed files with 6 additions and 3 deletions
  1. 1 1
      std/haxe/macro/Compiler.hx
  2. 1 1
      std/haxe/macro/Context.hx
  3. 1 1
      std/neko/_std/haxe/Utf8.hx
  4. 3 0
      type.ml

+ 1 - 1
std/haxe/macro/Compiler.hx

@@ -267,7 +267,7 @@ class Compiler {
 		#if macro
 		return neko.Lib.load("macro", f, nargs);
 		#else
-		return Reflect.makeVarArgs(function(_) throw "Can't be called outside of macro");
+		return Reflect.makeVarArgs(function(_) return throw "Can't be called outside of macro");
 		#end
 	}
 

+ 1 - 1
std/haxe/macro/Context.hx

@@ -274,7 +274,7 @@ class Context {
 		#if macro
 		return neko.Lib.load("macro", f, nargs);
 		#else
-		return Reflect.makeVarArgs(function(_) throw "Can't be called outside of macro");
+		return Reflect.makeVarArgs(function(_) return throw "Can't be called outside of macro");
 		#end
 	}
 

+ 1 - 1
std/neko/_std/haxe/Utf8.hx

@@ -24,7 +24,7 @@ package haxe;
 @:coreApi
 class Utf8 {
 
-	var __b : Void;
+	var __b : Dynamic;
 
 	public function new( ?size : Int ) : Void {
 		__b = utf8_buf_alloc(if( size == null ) 1 else size);

+ 3 - 0
type.ml

@@ -951,6 +951,9 @@ let rec unify a b =
 		unify_types a b tl1 tl2
 	| TAbstract (a1,tl1) , TAbstract (a2,tl2) when a1 == a2 ->
 		unify_types a b tl1 tl2
+	| TAbstract ({a_path=[],"Void"},_) , _
+	| _ , TAbstract ({a_path=[],"Void"},_) ->
+		error [cannot_unify a b]
 	| TAbstract (a1,tl1) , TAbstract (a2,tl2) ->
 		if not (List.exists (fun t ->
 			let t = apply_params a1.a_types tl1 t in