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.4.0 - 2024-08-02 9 10### Bug Fixes 11 12- Fixed a bug where pipe function arity errors could have an incorrect error 13 message. 14 ([sobolevn](https://github.com/sobolevn)) 15 16- Fixed a bug where the case of type parameters would not be checked. 17 ([Surya Rose](https://github.com/gearsdatapacks)) 18 19- Fixed a bug where the language server would still show completions when inside 20 a comment. 21 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 22 23## v1.4.0-rc1 - 2024-07-29 24 25### Build tool 26 27- `gleam docs build` now takes an optional `--target` flag to specify the target 28 platform for the generated documentation. 29 ([Jiangda Wang](https://github.com/frank-iii)) 30 31- Warnings are now emitted each time the project is built, even if the module 32 the warnings originated from were loaded from the cache rather than 33 recompiling. 34 ([Louis Pilfold](https://github.com/lpil)) 35 36### Compiler 37 38- Labelled arguments can now use the label shorthand syntax. 39 This means that when you're passing a variable as a labelled argument and it 40 happens to have the same name as the label, you can omit the variable name: 41 42 ```gleam 43 pub fn date(day day: Int, month month: Month, year year: Year) -> Date { 44 todo 45 } 46 47 pub fn main() { 48 let day = 11 49 let month = October 50 let year = 1998 51 52 date(year:, month:, day:) 53 // This is the same as writing 54 // date(year: year, month: month, day: day) 55 } 56 ``` 57 58 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 59 60- Labelled pattern variables can now use the label shorthand syntax. 61 This means that when you're pattern matching on a record constructor and 62 binding its labelled fields to variables that happen to have the same name, 63 you can omit the variable name: 64 65 ```gleam 66 pub type Date 67 Date(day: Int, month: Month, year: Year) 68 } 69 70 pub fn main() { 71 case Date(11, October, 1998) { 72 Date(year:, month:, day:) -> todo 73 // This is the same as writing 74 // Date(year: year, month: month, day: day) -> todo 75 } 76 77 } 78 ``` 79 80 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 81 82- The warning for the deprecated `[..]` pattern has been improved. 83 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 84 85- Record accessors are now fault tolerant. This means an invalid label can be 86 properly detected and won't invalidate the rest of the expression. 87 ([Ameen Radwan](https://github.com/Acepie)) 88 89- Erlang type spec generation has been improved to avoid new warnings emitted in 90 OTP27. 91 ([Damir Vandic](https://github.com/dvic)) 92 93- Error messages for invalid record constructors now contain a restructured 94 example of what the user likely intended. This is especially helpful for 95 users coming from other languages, like Rust or Go. 96 97 For example, provided a User type: 98 99 ```gleam 100 pub type User { 101 name: String 102 } 103 ``` 104 105 The compiler errors with the following message: 106 107 ``` 108 error: Syntax error 109 ┌─ /src/parse/error.gleam:3:5 110111 3 │ name: String, 112 │ ^^^^ I was not expecting this 113 114 Each custom type variant must have a constructor: 115 116 pub type User { 117 User( 118 name: String, 119 ) 120 } 121 ``` 122 123 ([Rahul D. Ghosal](https://github.com/rdghosal)) 124 125- The `<>` string concatenation operator can now be used in constant 126 expressions. 127 ([Thomas](https://github.com/DeviousStoat)) 128 129- Function calls are now fault tolerant. This means that errors in the function 130 call arguments won't stop the rest of the call from being analysed. 131 ([Ameen Radwan](https://github.com/Acepie)) 132 133- The error message presented when a function is called in a guard has been 134 improved. 135 ([Thomas](https://github.com/DeviousStoat)) 136 137- Case expressions are now fault tolerant. This means an subject, pattern, 138 guard, or then body can be properly detected and won't invalidate the rest 139 of the expression. 140 ([Ameen Radwan](https://github.com/Acepie)) 141 142- Documentation comments that come before a regular comment are no longer 143 clumped together with the documentation of the following definition. 144 Now commenting out a definition won't result in its documentation merging with 145 the following one's. 146 147 ```gleam 148 /// This doc comment will be ignored! 149 // a commented definition 150 // fn wibble() {} 151 152 /// Wibble's documentation. 153 fn wibble() { todo } 154 ``` 155 156 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 157 158- The `little` and `big` endianness options, the `signed` and `unsigned` integer 159 options, and sized floats (32-bit and 64-bit), can now be used in bit array 160 expressions and patterns on the JavaScript target. 161 ([Richard Viney](https://github.com/richard-viney)) 162 163- The `utf8` option can now be used with constant strings in bit array patterns 164 on the JavaScript target. 165 ([Richard Viney](https://github.com/richard-viney)) 166 167### Formatter 168 169- The formatter will no longer move a documentation comment below a regular 170 comment following it. This snippet of code is left as it is by the formatter: 171 172 ```gleam 173 /// This doc comment will be ignored! 174 // a commented definition 175 // fn wibble() {} 176 177 /// Wibble's documentation. 178 fn wibble() { 179 todo 180 } 181 ``` 182 183 While previously all documentation comments would be merged together into one, 184 ignoring the regular comment separating them: 185 186 ```gleam 187 // a commented definition 188 // fn wibble() {} 189 190 /// This doc comment will be ignored! 191 /// Wibble's documentation. 192 fn wibble() { 193 todo 194 } 195 ``` 196 197 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 198 199### Language Server 200 201- The language server can now show completions for fields if a record access is 202 being attempted. 203 ([Ameen Radwan](https://github.com/Acepie)) 204 205- The language server will now insert a blank line before the first statement 206 when inserting a new import and there are no other imports at the top of the 207 module. 208 ([Zhomart Mukhamejanov](https://github.com/Zhomart)) 209 210- The language server now suggests a code a action to rename variables, types 211 and functions when they don't match the Gleam naming requirements: 212 213 ```gleam 214 let myNumber = 10 215 ``` 216 217 Becomes: 218 219 ```gleam 220 let my_number = 10 221 ``` 222 223 ([Surya Rose](https://github.com/gearsdatapacks)) 224 225- The language server can now suggest a code action to convert `let assert` into 226 a case expression: 227 228 ```gleam 229 let assert Ok(value) = get_result() 230 ``` 231 232 Becomes: 233 234 ```gleam 235 let value = case get_result() { 236 Ok(value) -> value 237 _ -> panic 238 } 239 ``` 240 241 ([Surya Rose](https://github.com/gearsdatapacks)) 242 243- The language server can now show signature help when writing functions. 244 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 245 246- The language server now supports listing document symbols, such as functions 247 and constants, for the current Gleam file. 248 ([PgBiel](https://github.com/PgBiel)) 249 250- The language server can now suggest a code action to automatically use 251 shorthand labels where possible: 252 253 ```gleam 254 case date { 255 Day(day: day, month: month, year: year) -> todo 256 } 257 ``` 258 259 Becomes: 260 261 ```gleam 262 case date { 263 Day(day:, month:, year:) -> todo 264 } 265 ``` 266 267 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 268 269- The language server can now show completions for labels when writing a 270 function call or record construction. 271 ([Ameen Radwan](https://github.com/Acepie)) 272 273- The language server can now suggest a code action to fill in the labels of a 274 function call: 275 276 ```gleam 277 pub type Date { 278 Date(year: Int, month: Int, day: Int) 279 } 280 281 pub fn main() { 282 Date() 283 } 284 ``` 285 286 Becomes: 287 288 ```gleam 289 pub type Date { 290 Date(year: Int, month: Int, day: Int) 291 } 292 293 pub fn main() { 294 Date(year: todo, month: todo, day: todo) 295 } 296 ``` 297 298 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 299 300- Completions are now sorted by priority based on why the completion is in the 301 list. This means that more specific completions like labels and local 302 definitions will be shown before more broad completions like functions from a 303 not yet imported module. 304 ([Ameen Radwan](https://github.com/Acepie)) 305 306### Bug Fixes 307 308- Functions, types and constructors named `module_info` are now escaped 309 in generated Erlang code to avoid conflicts with the builtin 310 `module_info/0` and `module_info/1` functions. 311 ([Juraj Petráš](https://github.com/Hackder)) 312 313- Fixed formatting of comments at the start of a case branch. 314 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 315 316- Fixed a bug where a private type could be leaked from an internal module. 317 ([Ameen Radwan](https://github.com/Acepie)) 318 319- Fixed a bug where certain binops would not wrap their arguments properly 320 thus generating invalid JavaScript. 321 ([Ameen Radwan](https://github.com/Acepie)) 322 323- Fixed formatting of function definitions marked as `@internal` 324 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 325 326- Fixed a bug where importing a record constructor in an unqualified fashion and 327 aliasing it and then using it in a case guard expression would generate 328 invalid JavaScript. 329 ([PgBiel](https://github.com/PgBiel)) 330 331## v1.3.2 - 2024-07-11 332 333### Language Server 334 335- The language server no longer shows completions when inside a literal string. 336 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 337 338### Bug Fixes 339 340- Fixed a bug where the compiler would report errors for duplicate `@external` 341 attributes with inconsistent spans between Erlang and JavaScript. 342 ([Connor Szczepaniak](https://github.com/cszczepaniak)) 343 344- Fixed a bug where `gleam add` would fail to parse version specifiers 345 correctly. 346 ([Louis Pilfold](https://github.com/lpil)) 347 348- Fixed a bug where single clause case expressions could generate JavaScript 349 code with incorrectly rewritten JavaScript variable names. 350 ([Louis Pilfold](https://github.com/lpil)) 351 352## v1.3.1 - 2024-07-10 353 354### Bug Fixes 355 356- Fixes a bug with import cycle detection when there is more than 2 imports in 357 the cycle. 358 ([Ameen Radwan](https://github.com/Acepie))