Changelog#
Unreleased#
Compiler#
-
The inference of record update expressions is now more fault tolerant: if there's an error in the record being updated, the compiler can still able to analyse the fields that are being provided. (Giacomo Cavalieri)
-
It is now possible to use the
todokeyword in constants, this will result in an helpful error message rather than a syntax error. (Giacomo Cavalieri) -
The compiler now prints correctly qualified or aliased type names when printing warnings. For example:
import user pub fn main() { user.to_string(todo) |> io.println }Will produce the following warning:
warning: Todo found ┌─ /src/warning/wrn.gleam:4:19 │ 4 │ user.to_string(todo) │ ^^^^ This code is incomplete This code will crash if it is run. Be sure to finish it before running your program. Hint: I think its type is `user.User`.Notice how the type hint is correctly qualified for the module the warning is raised in. (Giacomo Cavalieri)
-
The compiler now normalizes remaining-bytes bit-array checks for the JavaScript backend so
(bitSize - c) % 8 === 0becomesbitSize % 8 === 0when the constant offsetcis congruent modulo 8. This produces more uniform generated code for byte-aligned patterns. (Daniele Scaratti) -
The code generated for destructuring exhaustive patterns with
letis now less verbose on the JavaScript target.
Build tool#
-
The
gleam devcommand now accepts the--no-print-progressflag. When this flag is passed, no progress information is printed. (Giacomo Cavalieri) -
Tables in the generated docs now look better on smaller screens. (Giacomo Cavalieri)
-
The comment in
manifest.tomlnow instructs the user to include it in their source control repository. (Louis Pilfold) -
The
gleam deps outdatedcommand now always prints a summary showing how many packages have newer versions available. For example:$ gleam deps outdated 1 of 12 packages have newer versions available. Package Current Latest ------- ------- ------ gleam_stdlib 0.70.0 0.71.0When no packages are outdated, only the summary line is printed:
$ gleam deps outdated 0 of 12 packages have newer versions available. -
The package manager now has a specific error and automatic re-authentication flow for when a Hex session has been revoked or has expired. (Sahil Upasane)
-
New packages are created requesting Erlang/OTP version 29 on GitHub actions. (Louis Pilfold)
Language server#
-
The language server can now help with completions when typing a list's tail:
pub fn main() { let things_i_like = ["Gleam", "Ice Cream"] ["Dogs", ..t|] // ^ Can now suggest a completion for `things_i_like` } -
The language server can now help with completions when typing a record update:
pub type User { User(name: String, likes: List(String)) } pub fn set_name(user: User, name: String) -> User { User(..u|) // ^ Can now suggest a completion for `user` } -
The language server now has a code action to remove a redundant record update. For example:
pub type User { User(name: String, likes: List(String)) } pub fn main() { let lucy = User(name: "Lucy", likes: ["Gleam", "Ice Cream"]) let jak = User(..lucy, name: "Jak", likes: ["Gleam", "Dogs"]) // ^^^^^^ This record update is not needed! }This record update is not actually needed and will raise a warning, all fields are already specified. Triggering the code action anywhere on the expression will remove the unnecessary update:
pub type User { User(name: String, likes: List(String)) } pub fn main() { let lucy = User(name: "Lucy", likes: ["Gleam", "Ice Cream"]) let jak = User(name: "Jak", likes: ["Gleam", "Dogs"]) } -
The language server now presents quick fix code actions before refactoring ones. (Giacomo Cavalieri)
-
The language server no longer shows completions for deprecated values from dependencies. (Andrey Kozhev)
-
The language server now offers a code action to create unknown modules when an import is added for a module that doesn't exist. For example, if
import wobble/woois added tosrc/wiggle.gleam, then a code action to createsrc/wobble/woo.gleamwill be presented when triggered overimport wobble/woo. (Cory Forsstrom) -
The language server now supports finding references when triggered on an aliased import. For example, in the following snippet, moving the cursor over
logand triggering "find references" will show all references ofio.println().import gleam/io.{println as log} fn main() { log("Hello, world!") //^^^ trigger here }
Formatter#
Bug fixes#
-
Fixed a bug where
gleam removewould fail with a confusing File IO error ifmanifest.tomldidn't exist yet (e.g. in a freshly-created project or after the manifest had been deleted). (Charlie Tonneslan) -
Fixed a bug where the build tool would check for new major versions of a local or git dependency on Hex when running
gleam update. (Giacomo Cavalieri) -
Fixed a bug where the "pattern match on value" code action would generate invalid code when used on a
letassignment on the right hand side of anotherletassignment. (Giacomo Cavalieri) -
Fixed a bug where the compiler wouldn't track the minimum required version when using list prepending in constants. (Giacomo Cavalieri)
-
Fixed a bug where the language server wouldn't let one extract record constructors as variables. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest completions for values from the language's prelude, even though their types were incompatible with the current context. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "wrap in anonymous" code action even when not hovering directly over a function. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "wrap in anonymous" code action when hovering over a record update. (Giacomo Cavalieri)
-
Fixed a bug where the compiler would generate invalid code for guards using lists with a tail. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "convert to case" code action even when not explicitly hovering an inexhaustive let assignment. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "add missing pattern" code action even when not explicitly hovering an inexhaustive case expression. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "unqualify" code action even when not explicitly hovering a qualified value. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "qualify" code action even when not explicitly hovering an unqualified type or constructor. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "generate dynamic decoder" code action even when not explicitly hovering a custom type. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "generate json encoder" code action even when not explicitly hovering a custom type. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "missing type parameter" code action even when not explicitly hovering a custom type. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "unwrap anonymous function" code action even when not explicitly hovering a custom type. (Giacomo Cavalieri)
-
Fixed a bug where the language server would suggest the "extract function" code action even when selecting multiple branches of a case expression, or patterns and guards of a case arm. (Giacomo Cavalieri)
-
Fixed a bug where the compiler would not warn for ints over the safe JavaScript limit in
BitArraysegments with a unit option. (Giacomo Cavalieri) -
Fixed a bug where the compiler would incorrectly warn for ints over the safe JavaScript limit in
BitArraybyte segments that aren't ints. (Giacomo Cavalieri) -
Fixed a confusing error message when writing a constant bit array with a size that is not a literal number. (Giacomo Cavalieri)
-
Fixed a confusing error message when writing bit arrays with an invalid unit. (Giacomo Cavalieri)
-
Fixed a confusing error message when writing a constant bit array with an invalid segment. (Giacomo Cavalieri)
-
Fixed a confusing error message when writing
@externalor@deprecatedannotations with arguments that are not string. (Giacomo Cavalieri) -
Fixed a bug where enabling
javascript.typescript_declarationsorjavascript.source_mapswouldn't generate their additional files unless the build directory was manually deleted. The compiler now automatically rebuilds the project when this configuration changes. (daniellionel01) -
Fixed a bug where using the
bytesandunitoptions together on a bit array segment could generate incorrect code on the JavaScript target. (Surya Rose) -
Fixed a bug where the JavaScript code generator could produce duplicate
letdeclarations for internal variables after acaseexpression whose subject directly matches branch when existing variables with same exist in outer scope. (Andrey Kozhev) -
Fixed a bug where
gleam publishwrote the wrong application name into the published package metadata for dependencies whose Hex package name differs from their internal OTP application name. This caused Mix-based projects to fail to build when they depended on Gleam packages with transitive dependencies. (Logan Bresnahan) -
Fixed a bug where cli would fail to complete https connections from behind a proxy with self-signed certificates. The cli now defaults to using system trust stores for trusted CAs, allowing use in proxied network environments. ([apsoras][https://github.com/apsoras])