@@ -210,13 +210,20 @@ let check_erasable env quals (r:Range.range) se =
210210 let has_iface_val = match DsEnv. iface_decls ( Env. dsenv env ) ( Env. current_module env ) with
211211 | Some iface_decls -> iface_decls |> BU. for_some ( Parser.AST. decl_is_val ( ident_of_lid lbname . fv_name . v ))
212212 | None -> false in
213- let _ , body , _ = U. abs_formals lb . lbdef in
214- if has_iface_val && Some ? ( non_info_norm_weak env body ) then log_issue lbname Error_MustEraseMissing [
215- text ( BU. format1 " Values of type `%s` will be erased during extraction, \
216- but its interface hides this fact." ( show lbname ));
217- text ( BU. format1 " Add the `erasable` \
218- attribute to the `val %s` declaration for this symbol in the interface" ( show lbname ));
219- ]
213+ let val_decl = Env. try_lookup_val_decl env lbname . fv_name . v in
214+ if has_iface_val && Some ? val_decl then
215+ let _ , body , _ = U. abs_formals lb . lbdef in
216+ let Some (( us , t ), _ ) = val_decl in
217+ let known_to_be_erasable =
218+ let env = Env. push_univ_vars env us in
219+ N. non_info_sort_norm env t in
220+ if not known_to_be_erasable && Some ? ( non_info_norm_weak env body ) then
221+ log_issue lbname Error_MustEraseMissing [
222+ text ( BU. format1 " Values of type `%s` will be erased during extraction, \
223+ but its interface hides this fact." ( show lbname ));
224+ text ( BU. format1 " Add the `erasable` \
225+ attribute to the `val %s` declaration for this symbol in the interface" ( show lbname ));
226+ ]
220227 | _ -> ()
221228 end ;
222229 if se_has_erasable_attr
0 commit comments