mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Fix unqualified unused import false positive
If we exposed a symbol in an import and used it both unqualified and qualified, we'd produce an unused warning false positive. This happened because we were using a single bit flag to determine whether a value was used qualified or unqualified.
This commit is contained in:
parent
1f347f6ca1
commit
b56f029a09
2 changed files with 35 additions and 2 deletions
|
@ -1079,6 +1079,38 @@ fn unused_imports() {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn used_exposed_and_qualified() {
|
||||
let modules = vec![
|
||||
(
|
||||
"Dep.roc",
|
||||
indoc!(
|
||||
r#"
|
||||
interface Dep exposes [one] imports []
|
||||
|
||||
one = 1
|
||||
"#
|
||||
),
|
||||
),
|
||||
(
|
||||
"Main.roc",
|
||||
indoc!(
|
||||
r#"
|
||||
interface Main exposes [qualified, exposed] imports []
|
||||
|
||||
import Dep exposing [one]
|
||||
|
||||
qualified = Dep.one
|
||||
exposed = one
|
||||
"#
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
let result = multiple_modules("used_exposed_and_qualified", modules);
|
||||
assert!(result.is_ok())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn import_with_alias() {
|
||||
let modules = vec![
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue