Răsfoiți Sursa

throw returns unknown instead of dynamic

Nicolas Cannasse 16 ani în urmă
părinte
comite
9cee2fcc78
2 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 1 0
      doc/CHANGES.txt
  2. 1 1
      typer.ml

+ 1 - 0
doc/CHANGES.txt

@@ -18,6 +18,7 @@ TODO :
 	fix with inline functions : position is now the inserted position and not the original one (better error reporting)
 	fix with inline functions : position is now the inserted position and not the original one (better error reporting)
 	added SWC output support
 	added SWC output support
 	fixed issues with unset of values in for loops and executing blocks that return functions (haXe/PHP)
 	fixed issues with unset of values in for loops and executing blocks that return functions (haXe/PHP)
+	"throw" type is now Unknown instead of Dynamic (prevent type-hole in "if A else if B else throw")
 
 
 2008-11-23: 2.02
 2008-11-23: 2.02
 	Std.is(MyInterface, Class) now returns true (haXe/PHP)
 	Std.is(MyInterface, Class) now returns true (haXe/PHP)

+ 1 - 1
typer.ml

@@ -1213,7 +1213,7 @@ and type_expr ctx ?(need_val=true) (e,p) =
 		mk (TTry (e1,catches)) (if not need_val then ctx.api.tvoid else e1.etype) p
 		mk (TTry (e1,catches)) (if not need_val then ctx.api.tvoid else e1.etype) p
 	| EThrow e ->
 	| EThrow e ->
 		let e = type_expr ctx e in
 		let e = type_expr ctx e in
-		mk (TThrow e) t_dynamic p
+		mk (TThrow e) (mk_mono()) p
 	| ECall (e,el) ->
 	| ECall (e,el) ->
 		type_call ctx e el p
 		type_call ctx e el p
 	| ENew (t,el) ->
 	| ENew (t,el) ->