nushell/crates/nu-protocol/src
WindSoilder fb3350ebc3
Error on use path item1 item2, if item1 is not a module (#11183)
# Description
Fixes: #11143

# User-Facing Changes
Take the following as example:
```nushell
module foo { export def bar [] {}; export def baz [] {} }
```

`use foo bar baz` will be error:
```
❯ use foo c d
Error: nu::parser::wrong_import_pattern

  × Wrong import pattern structure.
   ╭─[entry #2:1:1]
 1 │ use foo c d
   ·           ┬
   ·           ╰── Trying to import something but the parent `c` is not a module, maybe you want to try `use <module> [<name1>, <name2>]`
   ╰────
```

# Tests + Formatting
Done
2023-12-05 11:38:45 +01:00
..
ast Error on use path item1 item2, if item1 is not a module (#11183) 2023-12-05 11:38:45 +01:00
config Convert more ShellError variants to named fields (#11222) 2023-12-04 10:19:32 +01:00
engine Add special error for calling metadata on $env and $nu (#11228) 2023-12-04 12:49:36 -06:00
value Convert more ShellError variants to named fields (#11222) 2023-12-04 10:19:32 +01:00
alias.rs Refactor scope commands (#10023) 2023-08-17 11:58:38 +03:00
cli_error.rs Refactor and fix Config<->Value mechanism (#10896) 2023-11-08 20:31:30 +01:00
did_you_mean.rs Improve case insensitivity consistency (#10884) 2023-11-08 23:58:54 +01:00
eval_base.rs Reduce code duplication in eval.rs and eval_const.rs (#11192) 2023-12-04 21:13:47 +02:00
eval_const.rs Reduce code duplication in eval.rs and eval_const.rs (#11192) 2023-12-04 21:13:47 +02:00
example.rs remove unused imports: Deserialize, Serialize compiler warning for nu-protocol/src/example.rs (#8514) 2023-03-18 11:45:12 -07:00
exportable.rs Module: support defining const and use const variables inside of function (#9773) 2023-08-01 07:09:52 +08:00
id.rs Add virtual path abstraction layer (#9245) 2023-05-23 23:48:50 +03:00
lev_distance.rs Suggest existing variables on not found (#8902) 2023-05-02 18:17:14 +03:00
lib.rs Reduce code duplication in eval.rs and eval_const.rs (#11192) 2023-12-04 21:13:47 +02:00
module.rs Error on use path item1 item2, if item1 is not a module (#11183) 2023-12-05 11:38:45 +01:00
parse_error.rs Error on use path item1 item2, if item1 is not a module (#11183) 2023-12-05 11:38:45 +01:00
pipeline_data.rs Finish removing profile command and related data (#10807) 2023-10-22 14:06:53 +03:00
plugin_signature.rs Rename main to script name when running scripts (#9948) 2023-08-12 05:58:49 +12:00
shell_error.rs Convert more ShellError variants to named fields (#11222) 2023-12-04 10:19:32 +01:00
signature.rs Explicitly indicate duplicate flags (#11226) 2023-12-04 22:06:27 +08:00
span.rs Use variable names directly in the format strings (#7906) 2023-01-29 19:37:54 -06:00
syntax_shape.rs Rename SyntaxShape::Custom to CompleterWrapper (#10548) 2023-09-29 19:22:58 +02:00
ty.rs change Type::Float => SyntaxShape::Number to SyntaxShape::Float (#10689) 2023-10-11 12:27:09 -05:00
util.rs Convert more ShellError variants to named fields (#11173) 2023-11-28 06:43:51 -06:00
variable.rs Fix broken constants in scopes (#9679) 2023-07-14 00:02:05 +03:00