Skip to content

Commit

Permalink
Update to Gleam 1.7.0 (#39)
Browse files Browse the repository at this point in the history
* detect clashing gleam and javascript modules

* undo erlang-gleam conflict check

Ideally, `src/abc.gleam` and `src/abc.erl` would cause an error. However, this can actually occur legitimately when downloading a Hex package with precompiled `.erl` source files, which would trigger false positives. Wonder what would be the best way to detect this situation, but doesn't seem trivial to solve.

* separate .gleam codepath

* add subdir_ffi integration tests

* add subdir_ffi test to ci

* use EcoString, add subdir Erlang file tests

* more robust subdir_ffi tests

- Test header file in separate subdir
- Test parent folder ffi in Erlang

* use walkdir for native file search

- Prevent problems with infinite symlink loops

* add module and native file clash error

* add error for duplicate native erlang module

* update changelog with ffi subdir info

add mjs bug fix to changelog

update changelog to include erl ffi files

update changelog with js ffi change

* final nested ffi improvements

* custom dirwalker

* fix test project compiler

* dir walker: don't canonicalize returned paths

* replace reader methods by dirwalker

* add dir walking test

* fix phony in subdir_ffi test

* add trace back to gleam_source_files

* improve dir walker comments

* use imfs subpaths for initial files in tests

We were previously including all paths in the filesystem, which
included, in particular, the root. Therefore, the "initial files"
included the root directory, causing everything to be deleted, not only
the initial files.

* add note about root path

* ensure imfs has root

* cannot delete root from imfs

* fix tests by using 'files'

* Remove some indentation

* code action to turn into use

* CHANGELOG

* fix small indentation bug

* rename action

* rebase gone wrong

* fix code generated for nested record updates on erlang.

* run cargo fmt

* glistix/nix: add nested record update test

* Reintroduce exhaustiveness checking for `use` (#3880)

* Fix changelog

* update CODE_OF_CONDUCT.md

* Update email

* Allow qualified records in clause guards

* Changes!

* Improve unused value reporting

* CHANGELOG!

* rename function

* use

* address review comments

* more tests for use

* Implement `let assert ... as` syntax

* Implement formatting for `let assert ... as`

* Add tests

* Changelog

* Version tracking

* Integrate code action

* Feature will appear in 1.7

* Fix rebase

* Implement code action to convert inexhaustive `let` to `case`

* Clippy

* Fix tests after rebase

* Clippy

* Remove comment

* Make checks harder to ignore

* Update required stdlib version

* Oops

* Run gleam format on language_test.gleam

* fix string prefix assignments in nested patterns

* update CHANGELOG.md

* remove debug println

* Mark removed modules as stale

* Use iterator instead of collect()

* rebase fix

* fix typo

* fix typo

* fix incorrection

* more testing with attrs in variants and error message

* shorter error span

* all variants error in analyse phase

* remove removed snapshot test in parser that was moved to analysis

* adjust formater

* fix formatting

* lsp & cleanup

* tests

* version tracking

* suggested fixes

* fix

* fix

* fix comments

* fix: suggested fixes

* fix

* fix

* feature increase version

* Use correct naming convention

* Formatter tests

* Fix clippy warnings for 1.83

* fix: typo in indexing tuple error

* update tests

* Update capnp

* Replaced textwrap package with custom implementation

* glistix/nix: update tests with new textwrap impl

* Update deps

* Handle files correctly in LS

Closes gleam#3882

* Fix unsafe ints on JS not warning if an @external fn is called prior

* fix typo in all_direct_dependencies

* move dependencies tests to separate module

* implement remove by using the new dependency unlocking mechanism

fix #3887

* refactor the new remove to be able to test it

* tests!

* update CHANGELOG.md

* refactor(error): Remove potentially confusing hint about unwrapping results

* chore: Update CHANGELOG.mb

* Improve performance of bit array slices on JavaScript

* feat: check for exposing multiple modules on publish

* Fix nested tuple access bug

* Format

* gleam hex create-key

* Store a key locally

* Start using local token

* Plumbing!

* Nice errors

* Update yanked dep

* Permit unicode licence

* Changes!

* Use format

* Avoid requiring the old local password

* chore: Update CHANGELOG

* fix: do not use code:del_paths since that function is not available on older versions of Erlang.

* feat: check if module have type with the same name

* fix: test snapshot

* differentiate usage or import

* test snapshot

* refactor: keep context and type_with_same_name

* changlog!

* fix naming

* fix spelling

* Fix caching issue with variant inference

* Changelog

* fix unicode bugs

* add a test project with a unicode symbol to ci

* Improve clarity of error messages for unknown record fields.

* Remove extra logging

* Try and make message clearer

* Update deps

* Add canonical link

* Add snapshots

* Add host, add page canonical

* Updated snapshot

* Remove typo snapshot

* Remove duplicate host

* Add no hex publish test. Add project name to docs tests

* Update CHANGELOG

* Move docs head block to docs layout

* Complete project_name updates

* chore: format lists the same in constants as in expressions

* changelog!

* chore: fix test

* Fix typo in error message for 'use'

* Improve unused variable warnings

* Use option

* extract into variable

* CHANGELOG

* expand function capture

* changelog

* LSP: Include braces in type import completions

* update test case

* changelog!

* Fix bug with extract variable top level statements

* Fix bug extracting module selects

* Tweak code actions

* Add GitHub workflows to verify binary architecture matches target architecture

* Refactor and extract bash script verifying that binary architecture matches target architecture

* Run GitHub workflows to verify binary architecture manually instead of on push

* Add GitHub workflow steps to verify that binary architecture matches target architecture

* Fix formatting

* Refactor binary architecture verification script to use file command on Windows

* Refactor binary architecture verification script and reverse architecture normalization logic

* Refactor binary architecture verfifcation script and extract matching patterns for better understanding

* Refactor binary architecture verification script and extract functions for better understanding

* Add debug information in case of failure of binary architecture verification script

* Reuse same architecture parsing and normalization logic for target and binary architectures in verification script

* Extract architecture patterns in binary verification script

* Simplify binary architecture verification script

* Improve structure of binary architecture verification script

* Change wording to align more closely to rest of Gleam

* Remove GitHub workflows for testing binary architecture script

* Refactored by duplicating expected binary architectures and verification script accross all three GitHub workflows as per Louis preference

* Fix formatting of GitHub workflows

* glistix: fix binary names in workflows

* Add better help texts for Error::ShellProgramNotFound

add bun, deno, elixir and split the matching logic into different OS

* Append erlang installation help for ubuntu/debian

* Pass OS info from cli when shell program cannot be found

* Add snapshot tests for shell command not found

* changelog

* Refactor OS and distro retrieval functions for better clarity and consistency

* Refactor OS and distro handling to use enums for clarity

* Update shell program not found test snapshots

* Rewrite get_os_distro(), get_os() and OS enum struct

* split get_linux_distro_str() to obtain the distro str only

* add tests for extract_distro_id()

* Update ShellProgramNotFound error diagnostics format and snapshots

* Correct capitalization in installation documentation for Bun and Rebar3

* Update age dep

* Update .gitignore files to exclude build artifacts and remove existing build folders in repo

* Implement code action to generate dynamic decoder

* Import decode module when running generate decoder action

* Add support for generating decoders for types with parameters

* Add support for generic types when generating decoders

* Add tests

* Changelog

* Add support for decoding tuples

* Add tests for tuple decoding

* Add support for recursive decoders

* Clippy

* Remove empty line

* set REBAR_SKIP_PROJECT_PLUGINS when running rebar3

This env var was added for tools like `gleam` to tell rebar3
they are using it just to build a dep and want to skip any
project_plugins that might be in the configuration. Those
were added specifically to not be pulled in when building a
project as a dep.

* Changes!

* Fix CI

* Remove incorrect argument

* Update default Elixir version in test.yml

The prior Elixir version was not compatible with the default Erlang OTP version

* Update changelog

* v1.7.0-rc1

* Fix trailing :bytes pattern on JS giving incorrect result

* v1.7.0-rc2

* Correct changelog

* Changes!

* fix capture formatting

* add test directly from the issue

* CHANGELOG!

* missing test

* fix missing test

* clippy I missed you

* Fix private type bug

* Fix bug with "convert from use" code action and labelled arguments (#4131)

* 1.7.0-rc3

* Changes!

* format record updates like call arguments

* CHANGELOG

* Clippy

* CHANGELOG

* Correct changelog

* v1.7.0

* v1.7.0

* rename and fix tests

* glistix/nix: implement 'let assert ... as'

* glistix/nix: test 'let assert .. as'

* glistix: bump gleam version in version.rs

* glistix: update flake hash

* Fix clippy warnings

* glistix: add nix in subdir test to subdir_ffi

* glistix: add tests for nix files in subfolders

* glistix/nix: fix nix syntax in a comment

* glistix: forgot to add external_nix fix to parse

* glistix: add parser test for @external(nix) on variant

---------

Co-authored-by: Louis Pilfold <[email protected]>
Co-authored-by: Giacomo Cavalieri <[email protected]>
Co-authored-by: Joshi Reusch <[email protected]>
Co-authored-by: Gears <[email protected]>
Co-authored-by: yoshi~ <[email protected]>
Co-authored-by: GearsDatapacks <[email protected]>
Co-authored-by: Sakari Bergen <[email protected]>
Co-authored-by: Wilbert-mad <[email protected]>
Co-authored-by: keiidev <[email protected]>
Co-authored-by: Ross Byrne <[email protected]>
Co-authored-by: Richard Viney <[email protected]>
Co-authored-by: Kieran O'Reilly <[email protected]>
Co-authored-by: Aleksei Gurianov <[email protected]>
Co-authored-by: Frank Wang <[email protected]>
Co-authored-by: jknight-developer <[email protected]>
Co-authored-by: Roberto Trevisan <[email protected]>
Co-authored-by: rockerBOO <[email protected]>
Co-authored-by: Diemo Gebhardt <[email protected]>
Co-authored-by: Ankit Goel <[email protected]>
Co-authored-by: wheatfox <[email protected]>
Co-authored-by: Tristan Sloughter <[email protected]>
Co-authored-by: John Strunk <[email protected]>
  • Loading branch information
1 parent a6e416d commit 0295a45
Show file tree
Hide file tree
Showing 418 changed files with 25,220 additions and 6,557 deletions.
38 changes: 37 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,45 @@ jobs:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: x86-64
use-cross: false
run-integration-tests: true
supports-nix: true
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
binary: x86-64
use-cross: true
run-integration-tests: true
supports-nix: true
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary: aarch64
use-cross: true
run-integration-tests: false # Cannot run aarch64 binaries on x86_64
supports-nix: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
binary: aarch64
use-cross: true
run-integration-tests: false # Cannot run aarch64 binaries on x86_64
supports-nix: true
# macos>=14 runs exclusively on aarch64 and will thus fail to execute properly for x64
- os: macos-13 # intel
target: x86_64-apple-darwin
binary: x86_64
use-cross: false
run-integration-tests: true
supports-nix: true
- os: macos-latest # aarch64
toolchain: stable
target: aarch64-apple-darwin
binary: arm64
use-cross: false
run-integration-tests: true
supports-nix: true
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: x86-64
use-cross: false
run-integration-tests: true
supports-nix: false
Expand Down Expand Up @@ -124,10 +131,27 @@ jobs:
uses: clechasseur/rs-cargo@v2
with:
command: install
args: "--path compiler-cli --target ${{ matrix.target }} --debug --locked"
args: "--path compiler-cli --target ${{ matrix.target }} --debug --locked --force"
use-cross: ${{ matrix.use-cross }}
if: ${{ matrix.run-integration-tests }}

- name: Verify binary architecture
shell: bash
run: |
BINARY_PATH="${CARGO_HOME}/bin/glistix"
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
BINARY_PATH="${BINARY_PATH}.exe"
fi
if ! file -b "$BINARY_PATH" | grep -q "${{ matrix.binary }}"; then
echo "error: Architecture mismatch"
echo "Expected architecture: '${{ matrix.binary }}'"
echo "Found binary type: '$(file -b "$BINARY_PATH")'"
exit 1
fi
echo "ok: Architecture match"
if: ${{ matrix.run-integration-tests }}

- name: Run tests
uses: clechasseur/rs-cargo@v2
with:
Expand Down Expand Up @@ -608,3 +632,15 @@ jobs:
- name: Test running modules
run: make test
working-directory: ./test/running_modules

- name: test/multi_namespace
run: ./test.sh
working-directory: ./test/multi_namespace

- name: Test FFI in subdirectories
run: make
working-directory: ./test/subdir_ffi

- name: test/unicode_path
run: make
working-directory: ./test/unicode_path ⭐
21 changes: 21 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,24 @@ jobs:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
binary: x86-64
use-cross: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
binary: aarch64
use-cross: true
# macos>=14 runs exclusively on aarch64 and will thus fail to execute properly for x64
- os: macos-13
target: x86_64-apple-darwin
binary: x86_64
use-cross: false
- os: macos-latest
target: aarch64-apple-darwin
binary: arm64
use-cross: false
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: x86-64
use-cross: false
steps:
- name: Checkout repository
Expand All @@ -64,6 +69,22 @@ jobs:
args: --release --target ${{ matrix.target }}
use-cross: ${{ matrix.use-cross }}

- name: Verify binary architecture
shell: bash
run: |
BINARY_PATH="target/${{ matrix.target }}/release/glistix"
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
BINARY_PATH="${BINARY_PATH}.exe"
fi
if ! file -b "$BINARY_PATH" | grep -q "${{ matrix.binary }}"; then
echo "error: Architecture mismatch"
echo "Expected architecture: '${{ matrix.binary }}'"
echo "Found binary type: '$(file -b "$BINARY_PATH")'"
exit 1
fi
echo "ok: Architecture match"
- name: Build archive
shell: bash
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ erl_crash.dump
*.lock
!flake.lock
node_modules/
compiler-cli/build/
28 changes: 2 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
# Gleam's Changelog


## Unreleased

### Compiler

### Build tool

### Language Server
### Language server

### Formatter

### Bug fix

## v1.6.3 - 2024-12-03

### Bug fixed

- Fixed a bug where Gleam would be unable to compile to BEAM bytecode on older
versions of Erlang/OTP.
([yoshi](https://github.com/joshi-monster))

## v1.6.2 - 2024-11-23

### Bug fixed

- Fixed a bug where patterns in `use` expressions would not be checked to ensure that
they were exhaustive.
([Surya Rose](https://github.com/GearsDatapacks))

## v1.6.1 - 2024-11-19

### Bug fix

- Fixed a bug where `gleam update` would fail to update versions.
([Jason Sipula](https://github.com/SnakeDoc))
### Bug fixes
149 changes: 105 additions & 44 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,134 @@

# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:
Examples of behavior that contributes to a positive environment for our
community include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior by participants include:
Examples of unacceptable behavior include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
## Enforcement Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at (email TBD). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
reported to the community leaders responsible for enforcement at
(email TBD).
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

Loading

0 comments on commit 0295a45

Please sign in to comment.