8000 Remove misleading attribute hint by ceastlund · Pull Request #425 · ocaml-ppx/ppxlib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove misleading attribute hint #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
unreleased
------------------

- Clean up misleading attribute hints when declared for proper context. (#425, @ceastlund)

- Ast_pattern now has ebool, pbool helper, and a new map.(#402, @burnleydev1)

- multiple errors are now reported in `metaquot`. (#397, @burnleydev1)
Expand Down
5 changes: 3 additions & 2 deletions src/name.ml
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,13 @@ module Registrar = struct
String.Map.add name t acc)

let spellcheck t context ?(allowlist = []) name =
let all_for_context = get_all_for_context t context in
let all =
let all = get_all_for_context t context in
String.Map.fold (fun key _ acc -> key :: acc) all.all []
String.Map.fold (fun key _ acc -> key :: acc) all_for_context.all []
in
match Spellcheck.spellcheck (all @ allowlist) name with
| Some _ as x -> x
| None when String.Map.mem name all_for_context.all -> None
| None -> (
let other_contexts =
Hashtbl.fold
Expand Down
6 changes: 6 additions & 0 deletions test/driver/attributes/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ Error: Attribute `blah' was not used.
Did you put it at the wrong level?
|}]

let _ = () [@blah]
[%%expect{|
Line _, characters 13-17:
Error: Attribute `blah' was not used
|}]

(* Attribute drops *)

let faulty_transformation = object
Expand Down
0