Skip to content

Commit 22aacd6

Browse files
committed
Merge remote-tracking branch 'upstream/main' into main
2 parents 44df934 + 372e09e commit 22aacd6

File tree

151 files changed

+2790
-1108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+2790
-1108
lines changed

CHANGELOG.md

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
### Compiler
66

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+
712
- The code generated for a `case` expression on the JavaScript target is now
813
reduced in size in many cases.
914
([Surya Rose](https://github.com/GearsDatapacks))
@@ -12,6 +17,94 @@
1217
definitions are not longer generated.
1318
([Louis Pilfold](https://github.com/lpil))
1419

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+
15108
### Build tool
16109

17110
- `gleam update`, `gleam deps update`, and `gleam deps download` will now print
@@ -28,8 +121,7 @@
28121
lustre 3.1.4 -> 5.1.1
29122
```
30123

31-
([Amjad Mohamed ](https://github.com/andho))
32-
124+
([Amjad Mohamed](https://github.com/andho))
33125

34126
### Language server
35127

@@ -49,6 +141,10 @@
49141
correctly to variables using label shorthand syntax.
50142
([Surya Rose](https://github.com/GearsDatapacks))
51143

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+
52148
## v1.11.1 - 2025-06-05
53149

54150
### Compiler

0 commit comments

Comments
 (0)