Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

1<!-- 2 SPDX-License-Identifier: Apache-2.0 3 SPDX-FileCopyrightText: 2020 The Gleam contributors 4--> 5 6# Changelog 7 8## v1.14.0 - 2025-12-25 🎁 9 10### Bug fixes 11 12- Fixed a bug where using bit array segments in guard clauses could cause 13 incorrect code to be generated on the JavaScript target. 14 ([Surya Rose](https://github.com/GearsDatapacks)) 15 16## v1.14.0-rc3 - 2025-12-21 17 18### Bug fixes 19 20- Fixed a bug where checking for equality with a variant with no fields using 21 qualified syntax would generate invalid code on the JavaScript target. 22 ([Surya Rose](https://github.com/GearsDatapacks)) 23 24## v1.14.0-rc2 - 2025-12-19 25 26### Bug fixes 27 28- Fixed a bug where the formatter would remove `@external` attributes from 29 custom types. 30 ([Surya Rose](https://github.com/GearsDatapacks)) 31 32- Fixed a bug where updating records with unlabelled fields would result in 33 invalid code. 34 ([Surya Rose](https://github.com/GearsDatapacks)) 35 36## v1.14.0-rc1 - 2025-12-15 37 38### Compiler 39 40- The output of `echo` when printing atoms has been updated to use 41 `atom.create("...")` instead of `atom.create_from_string("...")`. 42 ([Patrick Dewey](https://github.com/ptdewey)) 43 44- Patterns aliasing a string prefix have been optimised to generate faster code 45 on the Erlang target. 46 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 47 48- Type inference for constants is now fault tolerant, meaning the compiler won't 49 stop at the first error as it is typing constants. 50 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 51 52- Analysis is now fault tolerant in the presence of errors in field definitions 53 of custom type variants. 54 ([Adi Salimgereyev](https://github.com/abs0luty)) 55 56- The compiler now emits a warning when a module contains no public definitions 57 and prevents publishing packages with empty modules to Hex. 58 ([Vitor Souza](https://github.com/vit0rr)) 59 60- The `@external` annotation is now supported for external types. It allows 61 users to point an external type definition to a specific Erlang or TypeScript 62 type. For example, the `dict.Dict` type from the standard library can now be 63 written as the following: 64 65 ```gleam 66 @external(erlang, "erlang", "map") 67 @external(javascript, "../dict.d.mts", "Dict") 68 pub type Dict(key, value) 69 ``` 70 71 ([Surya Rose](https://github.com/GearsDatapacks)) 72 73- When matching the wrong number of subjects, the compiler now pinpoints the 74 error location instead of marking the entire branch. 75 76 ```gleam 77 case wibble { 78 0, _ -> 1 79 ^^^^ Expected 1 pattern, got 2 80 0 | -> 1 81 ^ I was expecting a pattern after this 82 } 83 ``` 84 85 ([fruno](https://github.com/fruno-bulax/)) 86 87- Missing patterns in error messages and the "Add missing patterns" code action 88 are no longer sorted lexicographically. Instead, they now consider the order 89 in which variants were defined. As programmers often group "related" variants 90 together, this should mean less reshuffling after inserting missing patterns! 91 ([fruno](https://github.com/fruno-bulax/)) 92 93- The performance of `==` and `!=` has been improved for fieldless custom type 94 variants when compiling to JavaScript. This was done by generating comparison 95 code specific to the custom type rather than using the generic equality check 96 code. 97 ([Nafi](https://github.com/re-masashi)) 98 99- The lowercase bool pattern error is no longer a syntax error, but instead a 100 part of the analysis step. This allows the entire module to be analyzed, 101 rather than stopping at the syntax error. 102 ([mxtthias](https://github.com/mxtthias)) 103 104- Exhaustiveness checks for ints and floats now correctly handle unreachable 105 cases in which the numbers contain underscores (i.e. `10` and `1_0`). 106 Float exhaustiveness checks also now correctly identify unreachable cases 107 containing scientific notation or trailing zeros (i.e. `100` and `1e2`). 108 ([ptdewey](https://github.com/ptdewey)) 109 110- The compiler now emits a warning when a doc comment is not attached to a 111 definition due to a regular comment in between. For example, in the following 112 code: 113 114 ```gleam 115 /// This documentation is not attached 116 // This is not a doc comment 117 /// This is actual documentation 118 pub fn wibble() { 119 todo 120 } 121 ``` 122 123 Will now produce the following warning: 124 125 ```txt 126 warning: Detached doc comment 127 ┌─ src/main.gleam:1:4 128129 1 │ /// This documentation is not attached 130 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is not attached to a definition 131 132 This doc comment is followed by a regular comment so it is not attached to 133 any definition. 134 Hint: Move the comment above the doc comment 135 ``` 136 137 ([Surya Rose](https://github.com/GearsDatapacks)) 138 139- The [interference-based pruning](https://gleam.run/news/formalising-external-apis/#Improved-bit-array-exhaustiveness-checking) 140 from 1.13 has been extended to int segments! 141 Aside from the various performance improvements, this allows the compiler to 142 mark more branches as unreachable. 143 144 ```gleam 145 case bits { 146 <<"a">> -> 0 147 <<97>> -> 1 148 // ^- This branch is unreachable because it's equal to "a". 149 150 <<0b1:1, _:1>> -> 2 151 <<0b11:2>> -> 3 152 // ^- This branch is unreachable because the branch before it already covers it. 153 154 _ -> 99 155 } 156 ``` 157 158 ([fruno](https://github.com/fruno-bulax/)) 159 160- Comparison of record constructors with non-zero arity always produces `False`, 161 because under the hood during code generation they become anonymous functions: 162 163 ```gleam 164 pub type Wibble { 165 Wobble(String) 166 } 167 168 pub fn main() { 169 echo Wobble == Wobble // False 170 } 171 ``` 172 173 Previously compiler produced false-positive redundant comparison warning, which 174 is now removed: 175 176 ([Adi Salimgereyev](https://github.com/abs0luty)) 177 178- Record update syntax can now be used in constant definitions. For example: 179 180 ```gleam 181 pub const base_http_config = HttpConfig( 182 host: "0.0.0.0", 183 port: 8080, 184 use_tls: False, 185 log_level: Info, 186 ) 187 188 pub const dev_http_config = HttpConfig( 189 ..base_http_config, 190 port: 4000, 191 log_level: Debug, 192 ) 193 194 pub const prod_http_config = HttpConfig( 195 ..base_http_config, 196 port: 80, 197 use_tls: True, 198 log_level: Warn, 199 ) 200 ``` 201 202 ([Adi Salimgereyev](https://github.com/abs0luty)) 203 204### Build tool 205 206- The help text displayed by `gleam dev --help`, `gleam test --help`, and 207 `gleam run --help` has been improved: now each one states which function it's 208 going to run. 209 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 210 211- The `--invert` and `--package` options of `gleam deps tree` are now mutually 212 exclusive; if both options are given the command will fail. Previously, 213 `--invert` would be silently ignored if given together with `--package`. 214 ([Evan Silberman](https://github.com/silby)) 215 216- Updated to use the latest Elixir API, so a warning would not be shown when 217 compiling Elixir file in a Gleam project. 218 ([Andrey Kozhev](https://github.com/ankddev)) 219 220- The build tool now has a new `gleam deps outdated` command that shows outdated 221 versions for dependencies. For example: 222 223 ```sh 224 $ gleam deps outdated 225 Package Current Latest 226 ------- ------- ------ 227 wibble 1.4.0 1.4.1 228 wobble 1.0.1 2.3.0 229 ``` 230 231 ([Vladislav Shakitskiy](https://github.com/vshakitskiy)) 232 233- The format used for `gleam deps list` and the notice of available major 234 version upgrades has been improved. 235 ([Louis Pilfold](https://github.com/lpil)) 236 237- `gleam new` now creates the project directory using the confirmed project 238 name when a suggested rename is accepted. 239 ([Adi Salimgereyev](https://github.com/abs0luty)) 240 241- The build tool now provides better error message when trying to build Git 242 dependencies without Git installed. Previously, it would show this error: 243 244 ```txt 245 error: Shell command failure 246 247 There was a problem when running the shell command `git`. 248 249 The error from the shell command library was: 250 251 Could not find the stdio stream 252 ``` 253 254 Now it will show: 255 256 ```txt 257 error: Program not found 258 259 The program `git` was not found. Is it installed? 260 261 Documentation for installing Git can be viewed here: 262 https://git-scm.com/book/en/v2/Getting-Started-Installing-Git 263 ``` 264 265 ([Andrey Kozhev](https://github.com/ankddev)) 266 267### Language server 268 269- The language server can now offer a code action to merge case clauses with 270 the same body. For example: 271 272 ```gleam 273 case user { 274 Admin(name:, ..) -> todo 275 //^^^^^^^^^^^^^^^^^^^^^^^^ 276 Guest(name:, ..) -> todo 277 //^^^^^^^^^^^^^^^^ Selecting these two branches you can 278 // trigger the "Merge case branches" code action 279 _ -> todo 280 } 281 ``` 282 283 Triggering the code action would result in the following code: 284 285 ```gleam 286 case user { 287 Admin(name:, ..) | Guest(name:, ..) -> todo 288 _ -> todo 289 } 290 ``` 291 292 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 293 294- The "generate function" code action can now pick better names for arguments 295 that use the record access syntax. For example: 296 297 ```gleam 298 pub type User { 299 User(id: Int, name: String) 300 } 301 302 pub fn go(user: User) { 303 authenticate(user.id, user.name) 304 todo 305 } 306 ``` 307 308 Having the language server generate the missing `authenticate` function will 309 produce the following code: 310 311 ```gleam 312 pub fn authenticate(id: Int, name: String) { 313 todo 314 } 315 ``` 316 317 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 318 319- The "inline variable" code action can now trigger when used over the `let` 320 keyword of a variable to inline. 321 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 322 323- The "add omitted labels" code action can now be used in function calls where 324 some of the labels have been provided already. 325 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 326 327- The "generate function" code action can now trigger when used over constant 328 values as well. 329 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 330 331- Grouping of related diagnostics should now work across more editors. 332 Warnings will display together with their hints and you no longer have 333 "go to next diagnostic" twice in a row. Zedlings rejoice! 334 ([fruno](https://github.com/fruno-bulax/)) 335 336- The "pattern match on variable" code action can now pick better names when 337 used on tuples. 338 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 339 340- When renaming, if the new name is invalid, the language server will produce an 341 error message instead of silently doing nothing. 342 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 343 344- When providing autocomplete suggestions, the language server will now 345 prioritise values which match the expected type of the value being completed. 346 ([Surya Rose](https://github.com/GearsDatapacks)) 347 348- The language server now offers code action to add type annotations to all 349 functions and constants. For example, 350 351 ```gleam 352 pub const answer = 42 353 354 pub fn add(x, y) { 355 x + y 356 } 357 358 pub fn add_one(thing) { 359 // ^ Triggering "Annotate all top level definitions" code action here 360 let result = add(thing, 1) 361 result 362 } 363 ``` 364 365 Triggering the "Annotate all top level definitions" code action over 366 the name of function `add_one` would result in following code: 367 368 ```gleam 369 pub const answer: Int = 42 370 371 pub fn add(x: Int, y: Int) -> Int { 372 x + y 373 } 374 375 pub fn add_one(thing: Int) -> Int { 376 let result = add(thing, 1) 377 result 378 } 379 ``` 380 381 ([Andrey Kozhev](https://github.com/ankddev)) 382 383- Qualify and unqualify code actions can now trigger when used over constant 384 values as well. 385 ([Vladislav Shakitskiy](https://github.com/vshakitskiy)) 386 387### Formatter 388 389### Bug fixes 390 391- Fixed two bugs that made gleam not update the manifest correctly, causing 392 it to hit hex for version resolution on every operation and quickly reach 393 request limits in large projects. 394 ([fruno](https://github.com/fruno-bulax/)) 395 396- Fixed a bug where renaming a variable from an alternative pattern would not 397 rename all its occurrences. 398 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 399 400- The compiler now reports an error for literal floats that are outside the 401 floating point representable range on both targets. Previously it would only 402 do that when compiling on the Erlang target. 403 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 404 405- Fixed a typo in the error message emitted when trying to run a module that 406 does not have a main function. 407 ([Louis Pilfold](https://github.com/lpil)) 408 409- Fixed a bug where the "Generate function" code action would be incorrectly 410 offered when calling a function unsupported by the current target, leading to 411 invalid code if the code action was accepted. 412 ([Surya Rose](https://github.com/GearsDatapacks)) 413 414- Fixed a bug where the formatter would not remove the right number of double 415 negations from literal integers. 416 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 417 418- Fixed a typo for the "Invalid number of patterns" error. 419 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 420 421- Fixed a stack overflow when type checking some case expressions with 422 thousands of branches. 423 ([fruno](https://github.com/fruno-bulax/)) 424 425- The "add omitted label" code action no longer adds labels to arguments 426 being piped in or the callbacks of `use`. 427 ([fruno](https://github.com/fruno-bulax)) 428 429- Fixed a bug that caused the compiler to incorrectly optimise away runtime 430 size checks in bit array patterns on the javascript target if they used 431 calculations in the size of a segment (`_:size(wibble - wobble)`). 432 ([fruno](https://github.com/fruno-bulax/)) 433 434- Add a missing BitArray constructor return type in the prelude's TypeScript 435 definitions. 436 ([Richard Viney](https://github.com/richard-viney)) 437 438- Fixed a bug where the BEAM would be shut down abruptly once the program had 439 successfully finished running. 440 ([Louis Pilfold](https://github.com/lpil)) 441 442- Fixed a bug where the "pattern match on variable" code action would generate 443 invalid code when applied on a list's tail. 444 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 445 446- Fixed a bug where the "pattern match on variable" code action would generate 447 invalid patterns by repeating a variable name already used in the same 448 pattern. 449 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 450 451- Fixed a bug where the "generate function" code action would pop up for 452 variants. 453 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 454 455- Fixed a bug where useless comparison warnings for floats compared literal 456 strings, claiming for example that `1.0 == 1.` was always false. 457 ([fruno](https://github.com/fruno-bulax/)) 458 459- Fixed a bug where pattern variables in case clause guards would incorrectly 460 shadow outer scope variables in other branches when compiling to JavaScript. 461 ([Elias Haider](https://github.com/EliasDerHai)) 462 463- Fix invalid TypeScript definition being generated for variant constructors 464 with long names that take no arguments. 465 ([Richard Viney](https://github.com/richard-viney)) 466 467- Fixed a bug where the formatter would remove the `@deprecated` attribute from 468 constants. 469 ([Surya Rose](https://github.com/GearsDatapacks)) 470 471- Fixed a bug where invalid code would be generated on the JavaScript target in 472 cases where an underscore followed the decimal point in a float literal. 473 ([Patrick Dewey](https://github.com/ptdewey)) 474 475- Typos in the error message shown when trying to install a non-existent package 476 have been fixed. 477 ([Ioan Clarke](https://github.com/ioanclarke)) 478 479- Fixed a bug where the compiler would generate invalid Erlang and TypeScript 480 code for unused opaque types referencing private types. 481 ([Surya Rose](https://github.com/GearsDatapacks)) 482 483- Fixed a bug where the type checker would allow invalid programs when a large 484 group of functions were all mutually recursive. 485 ([Surya Rose](https://github.com/GearsDatapacks)) 486 487- The compiler now provides a clearer error message when a function's return 488 type is mistakenly declared using `:` instead of `->`. 489 ([Gurvir Singh](https://github.com/baraich)) 490 491- Fixed a bug where the data generated for searching documentation was in the 492 wrong format, preventing it from being used by Hexdocs search. 493 ([Surya Rose](https://github.com/GearsDatapacks)) 494 495- Fixed a bug where the "collapse nested case" code action would produce invalid 496 code on a list tail pattern. 497 ([Matias Carlander](https://github.com/matiascr)) 498 499- Fixed two bugs that made gleam not update the manifest correctly, causing 500 it to hit hex for version resolution on every operation and quickly reach 501 request limits in large projects. 502 ([fruno](https://github.com/fruno-bulax/))