Fork of daniellemaywood.uk/gleam — Wasm codegen work
1<!--
2 SPDX-License-Identifier: Apache-2.0
3 SPDX-FileCopyrightText: 2020 The Gleam contributors
4-->
5
6# Changelog
7
8## v1.3.0 - 2024-07-09
9
10## v1.3.0-rc3 - 2024-07-08
11
12- Fixed a bug where not all pure function calls in constant definitions would be
13 annotated as `@__PURE__` when compiling to JavaScript.
14 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
15
16## v1.3.0-rc2 - 2024-07-06
17
18### Formatter
19
20- Fixed a bug when multiple subjects in a case would be split even if not
21 necessary.
22 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
23
24## v1.3.0-rc1 - 2024-06-30
25
26### Build tool
27
28- `gleam remove` will now present an error if a package being removed does not
29 exist as a dependency in the project.
30 ([Changfeng Lou](https://github.com/hnlcf))
31
32- `gleam add` now takes an optional package version specifier,
33 separated by a `@`, that resolves as follows:
34
35 ```sh
36 gleam add lustre@1.2.3 # "1.2.3"
37 gleam add lustre@1.2 # ">= 1.2.0 and < 2.0.0"
38 gleam add lustre@1 # ">= 1.0.0 and < 2.0.0"
39 ```
40
41 ([Rahul D. Ghosal](https://github.com/rdghosal))
42
43### Compiler
44
45- Added more an informative error message for when attempting to use the `..`
46 syntax to append to a list rather than prepend.
47
48 ```
49 error: Syntax error
50 ┌─ /src/parse/error.gleam:4:14
51 │
52 4 │ [..rest, last] -> 1
53 │ ^^^^^^ I wasn't expecting elements after this
54
55 Lists are immutable and singly-linked, so to match on the end
56 of a list would require the whole list to be traversed. This
57 would be slow, so there is no built-in syntax for it. Pattern
58 match on the start of the list instead.
59 ```
60
61 ([Antonio Iaccarino](https://github.com/eingin))
62
63- The compiler now emits a warning for redundant function captures in a
64 pipeline:
65
66 ```
67 warning: Redundant function capture
68 ┌─ /src/warning/wrn.gleam:5:17
69 │
70 5 │ 1 |> wibble(_, 2) |> wibble(2)
71 │ ^ You can safely remove this
72
73 This function capture is redundant since the value is already piped as the
74 first argument of this call.
75
76 See: https://tour.gleam.run/functions/pipelines/
77 ```
78
79 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
80
81- The syntax `[a..b]` is now deprecated in favour of the `[a, ..b]` syntax.
82 This was to avoid it being mistaken for a range syntax, which Gleam does
83 not have.
84 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
85
86- Functions etc named `maybe` are now escaped in generated Erlang as it is now a
87 reserved word in Erlang/OTP 27.
88 ([Jake Barszcz](https://github.com/barszcz))
89
90- Functions, types and constructors named `maybe` and `else` are now
91 escaped in generated Erlang to avoid clashing with Erlang's keywords.
92 ([Jake Barszcz](https://github.com/barszcz)) and
93 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
94
95- Non byte aligned arrays that use literals for size are now marked as an
96 Unsupported feature for Javascript since they would already cause
97 a runtime error on Javascript.
98
99 This means if you compile specifically for Javascript you will now receive
100 this error:
101
102 ```
103 error: Unsupported feature for compilation target
104 ┌─ /src/test/gleam_test.gleam:6:5
105 │
106 6 │ <<1:size(5)>>
107 │ ^^^^^^^^^
108
109 Non byte aligned array is not supported for JavaScript compilation.
110 ```
111
112 Else any functions which rely on this will not be compiled into Javascript.
113 ([Pi-Cla](https://github.com/Pi-Cla))
114
115- Compilation fault tolerance is now at a statement level instead of a function
116 level. This means that the compiler will attempt to infer the rest of the
117 statements in a function when there is an error in a previous one.
118 ([Ameen Radwan](https://github.com/Acepie))
119
120- The JavaScript prelude is no-longer rewritten each time a project is compiled
121 to JavaScript.
122 ([Ofek Doitch](https://github.com/ofekd))
123
124- Compiler now supports arithmetic operations in guards.
125 ([Danielle Maywood](https://github.com/DanielleMaywood))
126
127- Import cycles now show the location where the import occur.
128 ([Ameen Radwan](https://github.com/Acepie))
129
130- Error messages resulting from unexpected tokens now include information on
131 the found token's type. This updated message explains how the lexer handled
132 the token, so as to guide the user towards providing correct syntax.
133
134 Following is an example, where the error message indicates that the name of
135 the provided field conflicts with a keyword:
136
137 ```
138 3 │ A(type: String)
139 │ ^^^^ I was not expecting this
140
141 Found the keyword `type`, expected one of:
142 - `)`
143 - a constructor argument name
144 ```
145
146 ([Rahul D. Ghosal](https://github.com/rdghosal))
147
148- When compiling to JavaScript constants will now be annotated as `@__PURE__`.
149 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
150
151### Formatter
152
153### Language Server
154
155- The language server will now suggest the "Remove redundant tuple" action even
156 if the case expression contains some catch all patterns:
157
158 ```
159 case #(a, b) {
160 #(1, 2) -> todo
161 _ -> todo
162 }
163 ```
164
165 Becomes:
166
167 ```
168 case a, b {
169 1, 2 -> todo
170 _, _ -> todo
171 }
172 ```
173
174 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
175
176- LSP can now suggest completions for values and types from importable modules
177 and adds the import to the top of the file.
178 ([Ameen Radwan](https://github.com/Acepie))
179
180- Diagnostics with extra labels now show the diagnostic in all locations
181 including across multiple files.
182 ([Ameen Radwan](https://github.com/Acepie))
183
184- LSP completions now use the "text_edit" language server API resulting in
185 better/more accurate insertions.
186 ([Ameen Radwan](https://github.com/Acepie))
187
188- Completions are no longer provided inside comments.
189 ([Nicky Lim](https://github.com/nicklimmm))
190
191- The language server will now show all the ignored fields when hovering over
192 `..` in a record pattern.
193 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
194
195### Bug Fixes
196
197- Fixed a bug where the compiler would output a confusing error message when
198 trying to use the spread syntax to append to a list.
199 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
200
201- Fixed a bug where the formatter would strip empty lines out of the body of an
202 anonymous function passed as an argument.
203 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
204
205- Fixed a bug where the compiler would crash when a type was defined with
206 the same name as an imported type.
207 ([Gears](https://github.com/gearsdatapacks))
208
209- Fixed a bug where a horizontal scrollbar would appear on code blocks in built
210 documentation when they contained lines 79 or 80 characters long.
211 ([Richard Viney](https://github.com/richard-viney))
212
213- Fixed a bug where importing a record constructor in an unqualified fashion and
214 aliasing it and then using it in a constant expression would generate invalid
215 JavaScript.
216 ([Louis Pilfold](https://github.com/lpil))
217
218- Fixed a bug where the compiler would crash because types weren't registered if
219 they referenced a non-existent type.
220 ([Gears](https://github.com/gearsdatapacks))
221
222- Fixed a bug where the compiler would generate invalid Erlang when pattern
223 matching on strings with an `as` pattern.
224 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
225
226- Fixed a bug where the compiler would warn that a module alias was unused when
227 it was only used in case patterns.
228 ([Michael Jones](https://github.com/michaeljones))
229
230## v1.2.1 - 2024-05-30
231
232### Bug Fixes
233
234- Fixed a bug where the compiler could fail to detect modules that would clash
235 with Erlang modules.
236 ([Louis Pilfold](https://github.com/lpil))
237
238- Fixed a bug where dependency version resolution could crash for certain
239 release candidate versions.
240 ([Marshall Bowers](https://github.com/maxdeviant))
241
242- Fixed a bug where trailing comments would be moved out of a bit array.
243 ([Giacomo Cavalieri](https://github.com/giacomocavalieri))