| @@ -13,39 +13,39 @@ import std/http/cookie //~ WARN W0102 `std/http/cookie` is imported but never us |
| 13 | 13 | // A parameter named like an imported module shadows it; the field access |
| 14 | 14 | // that follows fails, with a note pointing at the parameter. |
| 15 | 15 | fn total(list: List<Int>) -> Int { |
| 16 | | − //~^ WARN W0101 shadows the imported module |
| 17 | | − list.length(list) //~ ERROR E0206 several constructors |
| 16 | + //~^ WARN W0101 shadows the imported module |
| 17 | + list.length(list) //~ ERROR E0206 several constructors |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // Shadowing warns even without a qualified access. |
| 21 | 21 | fn head_or_zero(list: List<Int>) -> Int { //~ WARN W0101 shadows |
| 22 | | − match list { |
| 23 | | − [] -> 0, |
| 24 | | − [x, ..] -> x, |
| 25 | | − } |
| 22 | + match list { |
| 23 | + [] -> 0, |
| 24 | + [x, ..] -> x, |
| 25 | + } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // A local whose name no import bears shadows nothing; an import renamed |
| 29 | 29 | // with `as` binds only its alias (`d`, not `dict`). |
| 30 | 30 | fn describe(server: String, dict: d.Dict<Int, Int>) -> String { |
| 31 | | − server |
| 31 | + server |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // A module used only in types and effect rows is used. |
| 35 | 35 | fn with_clock(f: fn() -> Int / <time.clock>) -> Int / <time.clock> { |
| 36 | | − f() |
| 36 | + f() |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // An item imported by name and used by name: the import is used. |
| 40 | 40 | fn present(x: Option<Int>) -> Bool { |
| 41 | | − is_some(x) |
| 41 | + is_some(x) |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // The prelude needs no import. |
| 45 | 45 | fn shown() -> String { |
| 46 | | − show(1) |
| 46 | + show(1) |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | pub fn main() -> () / <io> { |
| 50 | | − io.println(show(total(list.range(1, 3)))) |
| 50 | + io.println(show(total(list.range(1, 3)))) |
| 51 | 51 | } |