From 7e894fce66f7fe265673b964e5b0c8c0f1392a40 Mon Sep 17 00:00:00 2001 From: Carl Eastlund Date: Tue, 2 Jan 2024 15:34:29 -0500 Subject: [PATCH] Update attribute code to ignore changes in loc_ghost. Signed-off-by: Carl Eastlund --- src/attribute.ml | 5 +++-- test/driver/attributes/test.ml | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/attribute.ml b/src/attribute.ml index f13e07cda..4de54a7cc 100644 --- a/src/attribute.ml +++ b/src/attribute.ml @@ -307,8 +307,9 @@ let declare_flag name context = module Attribute_table = Stdlib.Hashtbl.Make (struct type t = string loc - let hash : t -> int = Hashtbl.hash - let equal : t -> t -> bool = Poly.equal + let normalize t = { t with loc = { t.loc with loc_ghost = true } } + let hash t = Hashtbl.hash (normalize t) + let equal x y = Poly.equal (normalize x) (normalize y) end) let not_seen = Attribute_table.create 128 diff --git a/test/driver/attributes/test.ml b/test/driver/attributes/test.ml index d526e75cb..a21605e29 100644 --- a/test/driver/attributes/test.ml +++ b/test/driver/attributes/test.ml @@ -260,6 +260,5 @@ let () = let e = [%flag_ghost "bye" [@flag]] [%%expect{| -Line _, characters 29-33: -Error: Attribute `flag' was silently dropped +val e : string * string = ("bye", "bye") |}]