Skip to content

Commit

Permalink
Update attribute code to ignore changes in loc_ghost.
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Eastlund <[email protected]>
  • Loading branch information
ceastlund committed Jan 2, 2024
1 parent 0cd0151 commit 7e894fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/attribute.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions test/driver/attributes/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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")
|}]

0 comments on commit 7e894fc

Please sign in to comment.