Преглед изворни кода

prevent some empty error messages in type_expr_with_type

Nicolas Cannasse пре 13 година
родитељ
комит
d381802e32
3 измењених фајлова са 4 додато и 1 уклоњено
  1. 1 0
      type.ml
  2. 2 0
      typecore.ml
  3. 1 1
      typer.ml

+ 1 - 0
type.ml

@@ -633,6 +633,7 @@ type unify_error =
 	| Cant_force_optional
 	| Invariant_parameter of t * t
 	| Constraint_failure of string
+	| Unify_custom of string
 
 exception Unify_error of unify_error list
 

+ 2 - 0
typecore.ml

@@ -141,6 +141,8 @@ let unify_error_msg ctx = function
 		"Type parameters are invariant"
 	| Constraint_failure name ->
 		"Constraint check failure for " ^ name
+	| Unify_custom msg ->
+		msg
 
 let rec error_msg = function
 	| Module_not_found m -> "Class not found : " ^ Ast.s_type_path m

+ 1 - 1
typer.ml

@@ -1429,7 +1429,7 @@ and type_ident ctx i p mode =
 and type_expr_with_type_raise ?(print_error=true) ctx e t =
 	let p = snd e in
 	let error msg p =
-		if print_error then display_error ctx msg p else raise (Error (Unify [],p))
+		if print_error then display_error ctx msg p else raise (Error (Unify [Unify_custom msg],p))
 	in
 	match fst e with
 	| EParenthesis e ->