Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Lioncat2002 authored Mar 4, 2025
2 parents 4f2f1b3 + 7088612 commit 777d19b
Show file tree
Hide file tree
Showing 258 changed files with 8,143 additions and 2,031 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ jobs:
mix local.hex --force
if: ${{ runner.os == 'macOS' }} # setup-beam does not support macOS

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.2"

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.2"

- name: Handle Rust dependencies caching
uses: Swatinem/rust-cache@v2
with:
Expand All @@ -116,7 +131,7 @@ jobs:
uses: clechasseur/rs-cargo@v3
with:
command: install
args: "--path compiler-cli --target ${{ matrix.target }} --debug --locked --force"
args: "--path gleam-bin --target ${{ matrix.target }} --debug --locked --force"
tool: ${{ matrix.cargo-tool }}
if: ${{ matrix.run-integration-tests }}

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

- name: test/project_erlang (non-windows)
Expand Down Expand Up @@ -293,7 +318,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "20"
node-version: "22"

- name: Install wasm-pack
run: |
Expand Down
89 changes: 85 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,51 @@
# Changelog

## Unreleased
## v1.9.0-rc1 - 2025-03-04

### Compiler

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

- You can now use the `echo` keyword to debug print any value: `echo` can be
followed by any expression and it will print it to stderr alongside the module
it comes from and its line number. This:

```gleam
pub fn main() {
echo [1, 2, 3]
}
```

Will output to stderr:

```txt
/src/module.gleam:2
[1, 2, 3]
```

`echo` can also be used in the middle of a pipeline. This:

```gleam
pub fn main() {
[1, 2, 3]
|> echo
|> list.map(fn(x) { x * 2 })
|> echo
}
```

Will output to stderr:

```txt
/src/module.gleam:3
[1, 2, 3]
/src/module.gleam:5
[2, 4, 6]
```

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

- Generated Erlang `.app` files now include external modules written in Elixir
and Erlang.
([LostKobrakai](https://github.com/lostkobrakai))
Expand All @@ -17,7 +56,8 @@
([Diemo Gebhardt](https://github.com/diemogebhardt))

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

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

- On the JavaScript target, bit array patterns can now match segments of dynamic
size.
([Surya Rose](https://github.com/GearsDatapacks))

### Build tool

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

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

- The build tool now refuses to publish any incomplete package that has any
`echo` debug printing left.
([Giacomo Cavalieri](https://github.com/giacomocavalieri))

### Language server

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

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

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

```gleam
Expand Down Expand Up @@ -144,7 +192,7 @@

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

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

```gleam
Expand Down Expand Up @@ -231,8 +279,27 @@

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

- The language server now shows module documentation when hovering over a module
name.
([Surya Rose](https://github.com/GearsDatapacks))

### Formatter

- Redundant function captures that take no additional arguments are now
rewritten to not use the function capture syntax.

```gleam
some_module.some_function(_)
```

This code is reformatted like so:

```gleam
some_module.some_function
```

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

### Bug fixes

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

- Fixed a bug where `gleam export package-interface` would not properly generate
the package interface file if some modules were cached.
([Pedro Francisco](https://github.com/mine-tech-oficial)) and
([Surya Rose](https://github.com/GearsDatapacks))

- Fixed a bug where pattern matching using a UTF-8 string constant would not
work correctly on the JavaScript target when the string contained escape
characters.
([Richard Viney](https://github.com/richard-viney))

- Fixed a bug where `gleam publish` wouldn't include gitignored or nested native
files.
([PgBiel](https://github.com/PgBiel))

## v1.8.1 - 2025-02-11

### Bug fixes
Expand Down
42 changes: 30 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[workspace]
resolver = "2"
members = [
"compiler-cli",
"compiler-core",
"compiler-wasm",
"test-helpers-rs",
"test-package-compiler",
"test-project-compiler",
"gleam-bin",
"compiler-cli",
"compiler-core",
"compiler-wasm",
"test-helpers-rs",
"test-output",
"test-package-compiler",
"test-project-compiler",
]

# common dependencies
Expand Down Expand Up @@ -59,7 +61,7 @@ thiserror = "1"
# Test assertion errors with diffs
pretty_assertions = "1"
# Snapshot testing to make test maintenance easier
insta = {version = "1", features = ["glob"]}
insta = { version = "1", features = ["glob"] }
# A transitive dependency needed to compile into wasm32-unknown-unknown
# See https://docs.rs/getrandom/latest/getrandom/index.html#webassembly-support
getrandom = { version = "0", features = ["js"] }
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build: ## Build the compiler

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

.PHONY: test
test: ## Run the compiler unit tests
Expand Down
Loading

0 comments on commit 777d19b

Please sign in to comment.