Browse Source

do not let Not_found fall through when finding toplevel @:enum constructors (closes #3012)

Simon Krajewski 11 years ago
parent
commit
3825517e71
1 changed files with 9 additions and 5 deletions
  1. 9 5
      typer.ml

+ 9 - 5
typer.ml

@@ -1257,12 +1257,16 @@ let rec type_ident_raise ?(imported_enums=true) ctx i p mode =
 			| t :: l ->
 			| t :: l ->
 				match t with
 				match t with
  				| TAbstractDecl ({a_impl = Some c} as a) when Meta.has Meta.Enum a.a_meta ->
  				| TAbstractDecl ({a_impl = Some c} as a) when Meta.has Meta.Enum a.a_meta ->
-					let cf = PMap.find i c.cl_statics in
-					if not (Meta.has Meta.Enum cf.cf_meta) then
+ 					begin try
+						let cf = PMap.find i c.cl_statics in
+						if not (Meta.has Meta.Enum cf.cf_meta) then
+							loop l
+						else begin
+							let et = type_module_type ctx (TClassDecl c) None p in
+							AKInline(et,cf,FStatic(c,cf),monomorphs cf.cf_params cf.cf_type)
+						end
+					with Not_found ->
 						loop l
 						loop l
-					else begin
-						let et = type_module_type ctx (TClassDecl c) None p in
-						AKInline(et,cf,FStatic(c,cf),monomorphs cf.cf_params cf.cf_type)
 					end
 					end
 				| TClassDecl _ | TAbstractDecl _ ->
 				| TClassDecl _ | TAbstractDecl _ ->
 					loop l
 					loop l