|
4 | 4 |
|
5 | 5 | ### Compiler
|
6 | 6 |
|
| 7 | +- Generated JavaScript functions, constants, and custom type constructors now |
| 8 | + include any doc comment as a JSDoc comment, making it easier to use the |
| 9 | + generated code and browse its documentation from JavaScript. |
| 10 | + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
| 11 | + |
7 | 12 | - The code generated for a `case` expression on the JavaScript target is now
|
8 | 13 | reduced in size in many cases.
|
9 | 14 | ([Surya Rose](https://github.com/GearsDatapacks))
|
|
12 | 17 | definitions are not longer generated.
|
13 | 18 | ([Louis Pilfold](https://github.com/lpil))
|
14 | 19 |
|
| 20 | +- `echo` now has better support for character lists, JavaScript errors, and |
| 21 | + JavaScript circular references. |
| 22 | + ([Louis Pilfold](https://github.com/lpil)) |
| 23 | + |
| 24 | +- The look of errors and warnings has been improved. Additional labels providing |
| 25 | + context for the error message are no longer highlighted with the same style as |
| 26 | + the source of the problem. |
| 27 | + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
| 28 | + |
| 29 | +- Gleam will now emit a helpful message when attempting to import modules using |
| 30 | + `.` instead of `/`. |
| 31 | + |
| 32 | + ```gleam |
| 33 | + error: Syntax error |
| 34 | + ┌─ /src/parse/error.gleam:1:11 |
| 35 | + │ |
| 36 | + 1 │ import one.two.three |
| 37 | + │ ^ I was expecting either `/` or `.{` here. |
| 38 | +
|
| 39 | + Perhaps you meant one of: |
| 40 | +
|
| 41 | + import one/two |
| 42 | + import one.{item} |
| 43 | + ``` |
| 44 | + |
| 45 | + ([Zij-IT](https://github.com/zij-it)) |
| 46 | + |
| 47 | +- The compiler now emits a warning when a top-level constant or function |
| 48 | + declaration shadows an imported name in the current module. |
| 49 | + ([Aayush Tripathi](https://github.com/aayush-tripathi)) |
| 50 | + |
| 51 | +- The compiler can now tell when an unknown variable might be referring to an |
| 52 | + ignored variable and provide an helpful error message highlighting it. For |
| 53 | + example, this piece of code: |
| 54 | + |
| 55 | + ```gleam |
| 56 | + pub fn go() { |
| 57 | + let _x = 1 |
| 58 | + x + 1 |
| 59 | + } |
| 60 | + ``` |
| 61 | + |
| 62 | + Now results in the following error: |
| 63 | + |
| 64 | + ``` |
| 65 | + error: Unknown variable |
| 66 | + ┌─ /src/one/two.gleam:4:3 |
| 67 | + │ |
| 68 | + 3 │ let _x = 1 |
| 69 | + │ -- This value is discarded |
| 70 | + 4 │ x + 1 |
| 71 | + │ ^ So it is not in scope here. |
| 72 | +
|
| 73 | + Hint: Change `_x` to `x` or reference another variable |
| 74 | + ``` |
| 75 | + |
| 76 | + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
| 77 | + |
| 78 | +- When using two spreads, trying to concatenate lists, the compiler will now |
| 79 | + show a nicer error message. For example, this snippet of code: |
| 80 | + |
| 81 | + ```gleam |
| 82 | + pub fn main() -> Nil { |
| 83 | + let xs = [1, 2, 3] |
| 84 | + let ys = [5, 6, 7] |
| 85 | + [1, ..xs, ..ys] |
| 86 | + } |
| 87 | + ``` |
| 88 | + |
| 89 | + Would result in the following error: |
| 90 | + |
| 91 | + ``` |
| 92 | + error: Syntax error |
| 93 | + ┌─ /src/parse/error.gleam:5:13 |
| 94 | + │ |
| 95 | + 5 │ [1, ..xs, ..ys] |
| 96 | + │ -- ^^ I wasn't expecting a second spread here |
| 97 | + │ │ |
| 98 | + │ You're using a spread here |
| 99 | +
|
| 100 | + Lists are immutable and singly-linked, so to join two or more lists |
| 101 | + all the elements of the lists would need to be copied into a new list. |
| 102 | + This would be slow, so there is no built-in syntax for it. |
| 103 | + ``` |
| 104 | + |
| 105 | + ([Carl Bordum Hansen](https://github.com/carlbordum)) and |
| 106 | + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
| 107 | + |
15 | 108 | ### Build tool
|
16 | 109 |
|
17 | 110 | - `gleam update`, `gleam deps update`, and `gleam deps download` will now print
|
|
28 | 121 | lustre 3.1.4 -> 5.1.1
|
29 | 122 | ```
|
30 | 123 |
|
31 |
| - ([Amjad Mohamed ](https://github.com/andho)) |
32 |
| - |
| 124 | + ([Amjad Mohamed](https://github.com/andho)) |
33 | 125 |
|
34 | 126 | ### Language server
|
35 | 127 |
|
|
49 | 141 | correctly to variables using label shorthand syntax.
|
50 | 142 | ([Surya Rose](https://github.com/GearsDatapacks))
|
51 | 143 |
|
| 144 | +- Fixed a bug where the compiler would emit the same error twice for patterns |
| 145 | + with the wrong number of labels. |
| 146 | + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
| 147 | + |
52 | 148 | ## v1.11.1 - 2025-06-05
|
53 | 149 |
|
54 | 150 | ### Compiler
|
|
0 commit comments