Skip to content

Commit

Permalink
Add testcase to showcase unused record field false positive
Browse files Browse the repository at this point in the history
Summary:
The test case highlights the fact we don't expand macros when looking for record fields (among other things), as originally reported [here](#51).

This will be fixed later in the stack.

Reviewed By: michalmuskala, alanz

Differential Revision: D62128559

fbshipit-source-id: 43e9fa57b534ecbbb9357d12f91085a37b008993
  • Loading branch information
robertoaloi authored and facebook-github-bot committed Sep 4, 2024
1 parent 79c2299 commit 9ceb0df
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/ide/src/diagnostics/unused_record_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,18 @@ main(#a{a1 = #b{b2 = B2}} = A) ->
"#,
);
}

#[test]
fn test_unused_record_macro_name() {
// https://github.com/WhatsApp/erlang-language-platform/issues/51
check_diagnostics(
r#"
-module(main).
-export([ test/0 ]).
-record(?MODULE, {queue :: term()}).
%% ^^^^^^^^^^^^^^^ warning: Unused record field ([missing name].queue)
test() -> #?MODULE{queue = ok}.
"#,
);
}
}

0 comments on commit 9ceb0df

Please sign in to comment.