Skip to content

Commit 777d19b

Browse files
authored
Merge branch 'main' into main
2 parents 4f2f1b3 + 7088612 commit 777d19b

File tree

258 files changed

+8143
-2031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+8143
-2031
lines changed

.github/workflows/ci.yaml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,21 @@ jobs:
107107
mix local.hex --force
108108
if: ${{ runner.os == 'macOS' }} # setup-beam does not support macOS
109109

110+
- name: Setup Node
111+
uses: actions/setup-node@v4
112+
with:
113+
node-version: "22"
114+
115+
- name: Setup Deno
116+
uses: denoland/setup-deno@v2
117+
with:
118+
deno-version: "2.2"
119+
120+
- name: Setup Bun
121+
uses: oven-sh/setup-bun@v2
122+
with:
123+
bun-version: "1.2"
124+
110125
- name: Handle Rust dependencies caching
111126
uses: Swatinem/rust-cache@v2
112127
with:
@@ -116,7 +131,7 @@ jobs:
116131
uses: clechasseur/rs-cargo@v3
117132
with:
118133
command: install
119-
args: "--path compiler-cli --target ${{ matrix.target }} --debug --locked --force"
134+
args: "--path gleam-bin --target ${{ matrix.target }} --debug --locked --force"
120135
tool: ${{ matrix.cargo-tool }}
121136
if: ${{ matrix.run-integration-tests }}
122137

@@ -141,7 +156,17 @@ jobs:
141156
uses: clechasseur/rs-cargo@v3
142157
with:
143158
command: test
144-
args: "--workspace --target ${{ matrix.target }}"
159+
# We only want to run the `test-output` when running integration tests.
160+
# There's a caveat though: when `cargo-tool` is `cross` it uses a container
161+
# and would result in these integration tests failing due to not finding
162+
# the escript binary. So, in case `cargo-tool != cargo` we'll skip the
163+
# `test-output` tests as well.
164+
args: >-
165+
--workspace
166+
--target ${{ matrix.target }}
167+
${{ ((matrix.run-integration-tests && matrix.cargo-tool == 'cargo')
168+
&& ' ')
169+
|| '--exclude test-output' }}
145170
tool: ${{ matrix.cargo-tool }}
146171

147172
- name: test/project_erlang (non-windows)
@@ -293,7 +318,7 @@ jobs:
293318

294319
- uses: actions/setup-node@v4
295320
with:
296-
node-version: "20"
321+
node-version: "22"
297322

298323
- name: Install wasm-pack
299324
run: |

CHANGELOG.md

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,51 @@
11
# Changelog
22

3-
## Unreleased
3+
## v1.9.0-rc1 - 2025-03-04
44

55
### Compiler
66

77
- Gleam will now warn when running a deprecated or internal module main function
88
([Lioncat2002](https://github.com/Lioncat2002))
99

10+
- You can now use the `echo` keyword to debug print any value: `echo` can be
11+
followed by any expression and it will print it to stderr alongside the module
12+
it comes from and its line number. This:
13+
14+
```gleam
15+
pub fn main() {
16+
echo [1, 2, 3]
17+
}
18+
```
19+
20+
Will output to stderr:
21+
22+
```txt
23+
/src/module.gleam:2
24+
[1, 2, 3]
25+
```
26+
27+
`echo` can also be used in the middle of a pipeline. This:
28+
29+
```gleam
30+
pub fn main() {
31+
[1, 2, 3]
32+
|> echo
33+
|> list.map(fn(x) { x * 2 })
34+
|> echo
35+
}
36+
```
37+
38+
Will output to stderr:
39+
40+
```txt
41+
/src/module.gleam:3
42+
[1, 2, 3]
43+
/src/module.gleam:5
44+
[2, 4, 6]
45+
```
46+
47+
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
48+
1049
- Generated Erlang `.app` files now include external modules written in Elixir
1150
and Erlang.
1251
([LostKobrakai](https://github.com/lostkobrakai))
@@ -17,7 +56,8 @@
1756
([Diemo Gebhardt](https://github.com/diemogebhardt))
1857

1958
- Improved the styling of constructor argument descriptions in the generated
20-
documentation. ([Nicd](https://git.ahlcode.fi/nicd))
59+
documentation.
60+
([Nicd](https://git.ahlcode.fi/nicd))
2161

2262
- Allow users to set the `GLEAM_CACERTS_PATH` environment variable to specify a
2363
path to a directory containing CA certificates to install Hex packages.
@@ -32,6 +72,10 @@
3272
now be up to twice as fast.
3373
([yoshi~](https://github.com/yoshi-monster))
3474

75+
- On the JavaScript target, bit array patterns can now match segments of dynamic
76+
size.
77+
([Surya Rose](https://github.com/GearsDatapacks))
78+
3579
### Build tool
3680

3781
- The build tool now supports Git dependencies. For example:
@@ -43,6 +87,10 @@
4387

4488
([Surya Rose](https://github.com/GearsDatapacks))
4589

90+
- The build tool now refuses to publish any incomplete package that has any
91+
`echo` debug printing left.
92+
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
93+
4694
### Language server
4795

4896
- The language server now has the ability to jump to the type definition of any
@@ -116,7 +164,7 @@
116164

117165
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
118166

119-
- The Language Server now suggests a code action to generate a function to
167+
- The language server now suggests a code action to generate a function to
120168
encode a custom type as JSON using the `gleam_json` package. For example:
121169

122170
```gleam
@@ -144,7 +192,7 @@
144192

145193
([Surya Rose](https://github.com/GearsDatapacks))
146194

147-
- The Language Server now suggests a code action to inline a variable
195+
- The language server now suggests a code action to inline a variable
148196
which is only used once. For example, this code:
149197

150198
```gleam
@@ -231,8 +279,27 @@
231279

232280
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
233281

282+
- The language server now shows module documentation when hovering over a module
283+
name.
284+
([Surya Rose](https://github.com/GearsDatapacks))
285+
234286
### Formatter
235287

288+
- Redundant function captures that take no additional arguments are now
289+
rewritten to not use the function capture syntax.
290+
291+
```gleam
292+
some_module.some_function(_)
293+
```
294+
295+
This code is reformatted like so:
296+
297+
```gleam
298+
some_module.some_function
299+
```
300+
301+
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
302+
236303
### Bug fixes
237304

238305
- Fixed a bug where division and remainder operators would not work correctly
@@ -248,6 +315,20 @@
248315
private type used in the same module it's defined in.
249316
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
250317

318+
- Fixed a bug where `gleam export package-interface` would not properly generate
319+
the package interface file if some modules were cached.
320+
([Pedro Francisco](https://github.com/mine-tech-oficial)) and
321+
([Surya Rose](https://github.com/GearsDatapacks))
322+
323+
- Fixed a bug where pattern matching using a UTF-8 string constant would not
324+
work correctly on the JavaScript target when the string contained escape
325+
characters.
326+
([Richard Viney](https://github.com/richard-viney))
327+
328+
- Fixed a bug where `gleam publish` wouldn't include gitignored or nested native
329+
files.
330+
([PgBiel](https://github.com/PgBiel))
331+
251332
## v1.8.1 - 2025-02-11
252333

253334
### Bug fixes

Cargo.lock

Lines changed: 30 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
[workspace]
22
resolver = "2"
33
members = [
4-
"compiler-cli",
5-
"compiler-core",
6-
"compiler-wasm",
7-
"test-helpers-rs",
8-
"test-package-compiler",
9-
"test-project-compiler",
4+
"gleam-bin",
5+
"compiler-cli",
6+
"compiler-core",
7+
"compiler-wasm",
8+
"test-helpers-rs",
9+
"test-output",
10+
"test-package-compiler",
11+
"test-project-compiler",
1012
]
1113

1214
# common dependencies
@@ -59,7 +61,7 @@ thiserror = "1"
5961
# Test assertion errors with diffs
6062
pretty_assertions = "1"
6163
# Snapshot testing to make test maintenance easier
62-
insta = {version = "1", features = ["glob"]}
64+
insta = { version = "1", features = ["glob"] }
6365
# A transitive dependency needed to compile into wasm32-unknown-unknown
6466
# See https://docs.rs/getrandom/latest/getrandom/index.html#webassembly-support
6567
getrandom = { version = "0", features = ["js"] }

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build: ## Build the compiler
1212

1313
.PHONY: install
1414
install: ## Build the Gleam compiler and place it on PATH
15-
cd compiler-cli && cargo install --path . --force --locked
15+
cd gleam-bin && cargo install --path . --force --locked
1616

1717
.PHONY: test
1818
test: ## Run the compiler unit tests

0 commit comments

Comments
 (0)