ソースを参照

throw returns unknown instead of dynamic

Nicolas Cannasse 16 年 前
コミット
9cee2fcc78
2 ファイル変更2 行追加1 行削除
  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)
 	added SWC output support
 	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
 	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
 	| EThrow e ->
 		let e = type_expr ctx e in
-		mk (TThrow e) t_dynamic p
+		mk (TThrow e) (mk_mono()) p
 	| ECall (e,el) ->
 		type_call ctx e el p
 	| ENew (t,el) ->