2
0
Эх сурвалжийг харах

default to underlying type if not specialization is available (fixed issue #1569)

Simon Krajewski 12 жил өмнө
parent
commit
06857c7059
1 өөрчлөгдсөн 3 нэмэгдсэн , 2 устгасан
  1. 3 2
      codegen.ml

+ 3 - 2
codegen.ml

@@ -1310,11 +1310,12 @@ module Abstract = struct
 	let find_from ab pl a b = List.find (Type.unify_from_field ab pl a b) ab.a_from
 	let find_from ab pl a b = List.find (Type.unify_from_field ab pl a b) ab.a_from
 
 
 	let get_underlying_type a pl =
 	let get_underlying_type a pl =
-		if Meta.has Meta.MultiType a.a_meta then begin
+		try
+			if not (Meta.has Meta.MultiType a.a_meta) then raise Not_found;
 			let m = mk_mono() in
 			let m = mk_mono() in
 			let _ = find_to a pl m in
 			let _ = find_to a pl m in
 			follow m
 			follow m
-		end else
+		with Not_found ->
 			apply_params a.a_types pl a.a_this
 			apply_params a.a_types pl a.a_this
 
 
 	let rec make_static_call ctx c cf a pl args t p =
 	let rec make_static_call ctx c cf a pl args t p =