mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Explicit builtin import warning
We will now show a warning if a builtin is imported explicitly, since this is unncessary. We will not show the warning if they expose functions from the builtin: import Dict exposing [isEmpty] However, we will show a special warning if they expose types from it: import Dict exposing [Dict, isEmpty]
This commit is contained in:
parent
3217e5a3f0
commit
979aff8bf7
6 changed files with 144 additions and 8 deletions
|
@ -47,6 +47,8 @@ pub enum Problem {
|
|||
new_import_region: Region,
|
||||
existing_import: ScopeModuleSource,
|
||||
},
|
||||
ExplicitBuiltinImport(ModuleId, Region),
|
||||
ExplicitBuiltinTypeImport(Symbol, Region),
|
||||
/// First symbol is the name of the closure with that argument
|
||||
/// Bool is whether the closure is anonymous
|
||||
/// Second symbol is the name of the argument that is unused
|
||||
|
@ -229,6 +231,8 @@ impl Problem {
|
|||
Problem::UnusedImport(_, _) => Warning,
|
||||
Problem::UnusedModuleImport(_, _) => Warning,
|
||||
Problem::ImportNameConflict { .. } => RuntimeError,
|
||||
Problem::ExplicitBuiltinImport(_, _) => Warning,
|
||||
Problem::ExplicitBuiltinTypeImport(_, _) => Warning,
|
||||
Problem::ExposedButNotDefined(_) => RuntimeError,
|
||||
Problem::UnknownGeneratesWith(_) => RuntimeError,
|
||||
Problem::UnusedArgument(_, _, _, _) => Warning,
|
||||
|
@ -307,6 +311,8 @@ impl Problem {
|
|||
new_import_region: region,
|
||||
..
|
||||
}
|
||||
| Problem::ExplicitBuiltinImport(_, region)
|
||||
| Problem::ExplicitBuiltinTypeImport(_, region)
|
||||
| Problem::UnknownGeneratesWith(Loc { region, .. })
|
||||
| Problem::UnusedArgument(_, _, _, region)
|
||||
| Problem::UnusedBranchDef(_, region)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue