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

Configure Feed

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

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