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

Configure Feed

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

gleam / CHANGELOG.md
7.9 kB 250 lines
1# Changelog 2 3## Unreleased 4 5### Compiler 6 7- Removed compiler hint about pattern matching a `Result(a, b)` when being used where `a` is expected. 8 ([Kieran O'Reilly](https://github.com/SoTeKie)) 9 10- Optimised code generated for record updates. 11 ([yoshi](https://github.com/joshi-monster)) 12 13- The compiler now allows for record updates to change the generic type 14 parameters of the record: 15 16 ```gleam 17 type Box(value) { 18 Box(password: String, value: value) 19 } 20 21 fn insert(box: Box(a), value: b) -> Box(b) { 22 Box(..box, value:) 23 } 24 ``` 25 26 ([yoshi](https://github.com/joshi-monster)) 27 28- It is now allowed to write a block with no expressions. Like an empty function 29 body, an empty block is considered incomplete as if it contained a `todo` 30 expression. 31 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 32 33- The shorthand names for the two targets, `erl` and `js` are now 34 deprecated in code such as `@target`. 35 36 ([Surya Rose](https://github.com/GearsDatapacks)) 37 38- A custom panic message can now be specified when asserting a value with `let assert`: 39 40 ```gleam 41 let assert Ok(regex) = regex.compile("ab?c+") as "This regex is always valid" 42 ``` 43 44 ([Surya Rose](https://github.com/GearsDatapacks)) 45 46- When targeting JavaScript the compiler now generates faster and smaller code 47 for `Int` values in bit array expressions and patterns by evaluating them at 48 compile time where possible. 49 ([Richard Viney](https://github.com/richard-viney)) 50 51- Qualified records can now be used in clause guards. 52 ([Surya Rose](https://github.com/GearsDatapacks)) 53 54- The compiler now allows deprecating specific custom type variants using the 55 `@deprecated` attribute: 56 57 ```gleam 58 pub type HashAlgorithm { 59 @deprecated("Please upgrade to another algorithm") 60 Md5 61 Sha224 62 Sha512 63 } 64 65 pub fn hash_password(input: String) -> String { 66 hash(input:, algorithm: Md5) // Warning: Deprecated value used 67 } 68 ``` 69 70 ([Iesha](https://github.com/wilbert-mad)) 71 72- On the JavaScript target, taking byte-aligned slices of bit arrays is now an 73 O(1) operation instead of O(N), significantly improving performance. 74 ([Richard Viney](https://github.com/richard-viney)) 75 76- Better error message for existed type constructor being used as value constructor. 77 ([Jiangda Wang](https://github.com/Frank-III)) 78 79### Build tool 80 81- Improved the error message you get when trying to add a package that doesn't 82 exist with `gleam add`. 83 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 84 85- External files (such as `.mjs` and `.erl`) are now permitted in subdirectories 86 of `src/` and `test/`. 87 ([PgBiel](https://github.com/PgBiel)) 88 89- `gleam publish` now requires more verbose confirmation for publishing Gleam 90 team packages and v0 packages. 91 ([Louis Pilfold](https://github.com/lpil)) 92 93- `gleam publish` now warns when publishing packages that define multiple top-level 94 modules, as this can lead to namespace pollution and conflicts for consumers. 95 ([Aleksei Gurianov](https://github.com/guria)) 96 97- New projects now require `gleam_stdlib` v0.44.0. 98 99- `gleam remove` no longer requires a network connection. 100 ([yoshi](https://github.com/joshi-monster)) 101 102- Commands that work with the Hex package manager API now create and store an 103 API key rather than creating a new one each time. This API key is encrypted 104 with a local password, reducing risk of your Hex password being compromised. 105 ([Louis Pilfold](https://github.com/lpil)) 106 107### Language Server 108 109- The language server now provides type information when hovering over argument 110 labels. 111 112 ([Surya Rose](https://github.com/GearsDatapacks)) 113 114- The Language Server now suggests a code action to desugar a use expression 115 into the equivalent function call. For example, this snippet of code: 116 117 ```gleam 118 pub fn main() { 119 use profile <- result.try(fetch_profile(user)) 120 render_welcome(user, profile) 121 } 122 ``` 123 124 Will be turned into: 125 126 ```gleam 127 pub fn main() { 128 result.try(fetch_profile(user), fn(profile) { 129 render_welcome(user, profile) 130 }) 131 } 132 ``` 133 134 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 135 136- The Language Server now suggests a code action to turn a function call into 137 the equivalent use expression. For example, this snippet of code: 138 139 ```gleam 140 pub fn main() { 141 result.try(fetch_profile(user) fn(profile) { 142 render_welcome(user, profile) 143 }) 144 } 145 ``` 146 147 Will be turned into: 148 149 ```gleam 150 pub fn main() { 151 use profile <- result.try(fetch_profile(user)) 152 render_welcome(user, profile) 153 } 154 ``` 155 156 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 157 158- The language server now provides correct information when hovering over 159 patterns in use expressions. 160 161- The language server now suggests a code action to convert an inexhaustive 162 `let` assignment into a `case` expression: 163 164 ```gleam 165 pub fn unwrap_result(result: Result(a, b)) -> a { 166 let Ok(inner) = result 167 inner 168 } 169 ``` 170 171 Becomes: 172 173 ```gleam 174 pub fn unwrap_result(result: Result(a, b)) -> a { 175 let inner = case result { 176 Ok(inner) -> inner 177 Error(_) -> todo 178 } 179 inner 180 } 181 ``` 182 183 ([Surya Rose](https://github.com/GearsDatapacks)) 184 185### Formatter 186 187- The formatter now adds a `todo` inside empty blocks. 188 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 189 190### Bug fixed 191 192- The compiler now throws an error when a float literal ends with an `e` and 193 is missing an exponent. 194 ([Surya Rose](https://github.com/GearsDatapacks)) 195 196- Fixed a crash with ENOTEMPTY (os error 39) when building on NTFS partitions 197 ([Ivan Ermakov](https://github.com/ivanjermakov)) 198 199- Fixed a bug where the compiler would crash when pattern matching on multiple 200 subjects and one of them being a constant record. 201 ([Surya Rose](https://github.com/GearsDatapacks)) 202 203- Variant inference on prelude types now works correctly if the variant is constant. 204 ([Surya Rose](https://github.com/GearsDatapacks)) 205 206- Fixed a bug where patterns in `use` expressions would not be checked to ensure that 207 they were exhaustive. 208 ([Surya Rose](https://github.com/GearsDatapacks)) 209 210- Fixed a bug where a `module.mjs` file would be overwritten by a `module.gleam` 211 file of same name without warning. It now produces an error. 212 ([PgBiel](https://github.com/PgBiel)) 213 214- Modules depending on removed or renamed modules now get automatically recompiled. 215 ([Sakari Bergen](https://github.com/sbergen)) 216 217- The compiler now raises a warning for unused case expressions, code blocks and 218 pipelines that would be safe to remove. 219 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 220 221- Fixed a bug where assigning the prefix of a string pattern to a variable 222 nested inside another pattern would produce invalid code on Javascript. 223 ([yoshi](https://github.com/joshi-monster)) 224 225- Fixed a bug where expressions which use an unsafe integer on JavaScript would 226 not emit a warning if an @external function had been referenced. 227 ([Richard Viney](https://github.com/richard-viney)) 228 229- Fixed a bug where nested tuple access would not be parsed correctly when 230 the left-hand side was a function call. 231 ([Surya Rose](https://github.com/GearsDatapacks)) 232 233- Fixed a bug where Gleam would be unable to compile to BEAM bytecode on older 234 versions of Erlang/OTP. 235 ([yoshi](https://github.com/joshi-monster)) 236 237- Fixed a bug where the inferred variant of values was not properly cached, 238 leading to incorrect errors on incremental builds and in the Language Server. 239 ([Surya Rose](https://github.com/GearsDatapacks)) 240 241 - Fixed a bug where Gleam would be unable to compile to BEAM bytecode if the 242 project path contains a non-ascii character. 243 ([yoshi](https://github.com/joshi-monster)) 244 245## v1.6.1 - 2024-11-19 246 247### Bug fixed 248 249- Fixed a bug where `gleam update` would fail to update versions. 250 ([Jason Sipula](https://github.com/SnakeDoc))