mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Merge remote-tracking branch 'origin/main' into remove-nat
This commit is contained in:
commit
3e27e18566
73 changed files with 732 additions and 514 deletions
51
.github/workflows/basic_cli_build_release.yml
vendored
51
.github/workflows/basic_cli_build_release.yml
vendored
|
@ -6,7 +6,7 @@ on:
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# use .tar.gz for quick testing
|
# use .tar.gz for quick testing
|
||||||
ARCHIVE_FORMAT: .tar.br
|
ARCHIVE_FORMAT: .tar.br
|
||||||
|
@ -17,7 +17,7 @@ jobs:
|
||||||
prepare:
|
prepare:
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: roc-lang/basic-cli
|
repository: roc-lang/basic-cli
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ jobs:
|
||||||
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
|
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
|
||||||
|
|
||||||
- name: Save roc_nightly archives
|
- name: Save roc_nightly archives
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: roc_nightly-*
|
path: roc_nightly-*
|
||||||
|
|
||||||
|
@ -48,18 +48,18 @@ jobs:
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
needs: [prepare]
|
needs: [prepare]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: build basic-cli with surgical linker and also with legacy linker
|
- name: build basic-cli with surgical linker and also with legacy linker
|
||||||
env:
|
env:
|
||||||
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
|
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
|
||||||
run: ./ci/build_basic_cli.sh linux_x86_64 "--linker legacy"
|
run: ./ci/build_basic_cli.sh linux_x86_64 "--linker legacy"
|
||||||
|
|
||||||
- name: Save .rh, .rm and .o file
|
- name: Save .rh, .rm and .o file
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: linux-x86_64-files
|
name: linux-x86_64-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -72,10 +72,10 @@ jobs:
|
||||||
runs-on: [self-hosted, Linux, ARM64]
|
runs-on: [self-hosted, Linux, ARM64]
|
||||||
needs: [prepare]
|
needs: [prepare]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: build basic-cli
|
- name: build basic-cli
|
||||||
env:
|
env:
|
||||||
|
@ -85,8 +85,8 @@ jobs:
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-Clink-self-contained=yes -Clinker=rust-lld"
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-Clink-self-contained=yes -Clinker=rust-lld"
|
||||||
run: ./ci/build_basic_cli.sh linux_arm64
|
run: ./ci/build_basic_cli.sh linux_arm64
|
||||||
|
|
||||||
- name: Save .o file
|
- name: Save .o file
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: linux-arm64-files
|
name: linux-arm64-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -96,15 +96,15 @@ jobs:
|
||||||
runs-on: [macos-11] # I expect the generated files to work on macOS 12 and up
|
runs-on: [macos-11] # I expect the generated files to work on macOS 12 and up
|
||||||
needs: [prepare]
|
needs: [prepare]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- run: ./ci/build_basic_cli.sh macos_x86_64
|
- run: ./ci/build_basic_cli.sh macos_x86_64
|
||||||
|
|
||||||
- name: Save .o files
|
- name: Save .o files
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: macos-x86_64-files
|
name: macos-x86_64-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -115,15 +115,15 @@ jobs:
|
||||||
runs-on: [self-hosted, macOS, ARM64]
|
runs-on: [self-hosted, macOS, ARM64]
|
||||||
needs: [prepare]
|
needs: [prepare]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- run: ./ci/build_basic_cli.sh macos_apple_silicon
|
- run: ./ci/build_basic_cli.sh macos_apple_silicon
|
||||||
|
|
||||||
- name: Save macos-arm64.o file
|
- name: Save macos-arm64.o file
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: macos-apple-silicon-files
|
name: macos-apple-silicon-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -134,13 +134,13 @@ jobs:
|
||||||
name: create release archive
|
name: create release archive
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: remove all folders except the ci folder
|
- name: remove all folders except the ci folder
|
||||||
run: ls | grep -v ci | xargs rm -rf
|
run: ls | grep -v ci | xargs rm -rf
|
||||||
|
|
||||||
- name: Download the previously uploaded files
|
- name: Download the previously uploaded files
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: mv roc nightly and simplify name
|
- name: mv roc nightly and simplify name
|
||||||
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz
|
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz
|
||||||
|
@ -157,7 +157,7 @@ jobs:
|
||||||
- run: git clone https://github.com/roc-lang/basic-cli.git
|
- run: git clone https://github.com/roc-lang/basic-cli.git
|
||||||
|
|
||||||
- run: cp macos-apple-silicon-files/* ./basic-cli/platform
|
- run: cp macos-apple-silicon-files/* ./basic-cli/platform
|
||||||
|
|
||||||
- run: cp linux-x86_64-files/* ./basic-cli/platform
|
- run: cp linux-x86_64-files/* ./basic-cli/platform
|
||||||
|
|
||||||
- run: cp linux-arm64-files/* ./basic-cli/platform
|
- run: cp linux-arm64-files/* ./basic-cli/platform
|
||||||
|
@ -177,14 +177,14 @@ jobs:
|
||||||
- run: echo "TAR_FILENAME=$(ls -d basic-cli/platform/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV
|
- run: echo "TAR_FILENAME=$(ls -d basic-cli/platform/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Upload platform archive
|
- name: Upload platform archive
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: basic-cli-platform
|
name: basic-cli-platform
|
||||||
path: |
|
path: |
|
||||||
${{ env.TAR_FILENAME }}
|
${{ env.TAR_FILENAME }}
|
||||||
|
|
||||||
- name: Upload docs archive
|
- name: Upload docs archive
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: release-assets-docs
|
name: release-assets-docs
|
||||||
path: |
|
path: |
|
||||||
|
@ -196,7 +196,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Download the previously uploaded files
|
- name: Download the previously uploaded files
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: mv roc nightly and simplify name
|
- name: mv roc nightly and simplify name
|
||||||
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz
|
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz
|
||||||
|
@ -232,7 +232,7 @@ jobs:
|
||||||
mkdir platform
|
mkdir platform
|
||||||
# move all files to platform dir
|
# move all files to platform dir
|
||||||
find . -maxdepth 1 -type f -exec mv {} platform/ \;
|
find . -maxdepth 1 -type f -exec mv {} platform/ \;
|
||||||
|
|
||||||
mkdir temp-basic-cli
|
mkdir temp-basic-cli
|
||||||
cd temp-basic-cli
|
cd temp-basic-cli
|
||||||
git clone https://github.com/roc-lang/basic-cli.git
|
git clone https://github.com/roc-lang/basic-cli.git
|
||||||
|
@ -242,9 +242,8 @@ jobs:
|
||||||
cp -r ci ../..
|
cp -r ci ../..
|
||||||
cp -r LICENSE ../..
|
cp -r LICENSE ../..
|
||||||
# LICENSE is necessary for command test
|
# LICENSE is necessary for command test
|
||||||
|
|
||||||
- name: run tests
|
- name: run tests
|
||||||
run: |
|
run: |
|
||||||
cd basic-cli-platform
|
cd basic-cli-platform
|
||||||
ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ROC_BUILD_FLAGS=--prebuilt-platform ./ci/all_tests.sh
|
ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ROC_BUILD_FLAGS=--prebuilt-platform ./ci/all_tests.sh
|
||||||
|
|
||||||
|
|
12
.github/workflows/basic_cli_test_arm64.yml
vendored
12
.github/workflows/basic_cli_test_arm64.yml
vendored
|
@ -11,7 +11,7 @@ jobs:
|
||||||
runs-on: [self-hosted, Linux, ARM64]
|
runs-on: [self-hosted, Linux, ARM64]
|
||||||
steps:
|
steps:
|
||||||
- name: clone basic-cli repo
|
- name: clone basic-cli repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: roc-lang/basic-cli
|
repository: roc-lang/basic-cli
|
||||||
ref: main
|
ref: main
|
||||||
|
@ -19,7 +19,7 @@ jobs:
|
||||||
- name: get latest roc nightly
|
- name: get latest roc nightly
|
||||||
run: |
|
run: |
|
||||||
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
|
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
|
||||||
|
|
||||||
- name: rename nightly tar
|
- name: rename nightly tar
|
||||||
run: mv $(ls | grep "roc_nightly.*tar\.gz") roc_nightly.tar.gz
|
run: mv $(ls | grep "roc_nightly.*tar\.gz") roc_nightly.tar.gz
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ jobs:
|
||||||
|
|
||||||
- run: expect -v
|
- run: expect -v
|
||||||
|
|
||||||
# Run all tests
|
# Run all tests
|
||||||
- run: ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ./ci/all_tests.sh
|
- run: ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ./ci/all_tests.sh
|
||||||
|
|
||||||
######
|
######
|
||||||
|
@ -44,7 +44,7 @@ jobs:
|
||||||
|
|
||||||
- name: Remove roc_nightly folder to keep things simple (we'll download it again later)
|
- name: Remove roc_nightly folder to keep things simple (we'll download it again later)
|
||||||
run: rm -rf roc_nightly
|
run: rm -rf roc_nightly
|
||||||
|
|
||||||
- name: Get the repo of the latest basic-cli release
|
- name: Get the repo of the latest basic-cli release
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 https://github.com/roc-lang/basic-cli
|
git clone --depth 1 https://github.com/roc-lang/basic-cli
|
||||||
|
@ -53,10 +53,6 @@ jobs:
|
||||||
latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||||
git checkout $latestTag
|
git checkout $latestTag
|
||||||
|
|
||||||
# temp issue with new string interpolation syntax
|
|
||||||
# TODO undo when 0.7.2 or 0.8.0 is released
|
|
||||||
- run: sed -i 's/\$//g' basic-cli/examples/tcp-client.roc
|
|
||||||
|
|
||||||
- name: Run all tests with latest roc nightly and latest basic-cli release
|
- name: Run all tests with latest roc nightly and latest basic-cli release
|
||||||
run: |
|
run: |
|
||||||
sed -i 's/x86_64/arm64/g' ./ci/test_latest_release.sh
|
sed -i 's/x86_64/arm64/g' ./ci/test_latest_release.sh
|
||||||
|
|
|
@ -6,7 +6,7 @@ on:
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# use .tar.gz for quick testing
|
# use .tar.gz for quick testing
|
||||||
ARCHIVE_FORMAT: .tar.br
|
ARCHIVE_FORMAT: .tar.br
|
||||||
|
@ -16,7 +16,7 @@ jobs:
|
||||||
fetch-releases:
|
fetch-releases:
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
|
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
|
||||||
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
|
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
|
||||||
|
@ -24,7 +24,7 @@ jobs:
|
||||||
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
|
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
|
||||||
|
|
||||||
- name: Save roc_nightly archives
|
- name: Save roc_nightly archives
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: roc_nightly-*
|
path: roc_nightly-*
|
||||||
|
|
||||||
|
@ -32,18 +32,18 @@ jobs:
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
needs: [fetch-releases]
|
needs: [fetch-releases]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: build basic-webserver with legacy linker
|
- name: build basic-webserver with legacy linker
|
||||||
env:
|
env:
|
||||||
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
|
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
|
||||||
run: ./ci/build_basic_webserver.sh linux_x86_64 "--linker legacy"
|
run: ./ci/build_basic_webserver.sh linux_x86_64 "--linker legacy"
|
||||||
|
|
||||||
- name: Save .rh, .rm and .o file
|
- name: Save .rh, .rm and .o file
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: linux-x86_64-files
|
name: linux-x86_64-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -56,10 +56,10 @@ jobs:
|
||||||
runs-on: [self-hosted, Linux, ARM64]
|
runs-on: [self-hosted, Linux, ARM64]
|
||||||
needs: [fetch-releases]
|
needs: [fetch-releases]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: build basic-webserver
|
- name: build basic-webserver
|
||||||
env:
|
env:
|
||||||
|
@ -69,8 +69,8 @@ jobs:
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-Clink-self-contained=yes -Clinker=rust-lld"
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: "-Clink-self-contained=yes -Clinker=rust-lld"
|
||||||
run: ./ci/build_basic_webserver.sh linux_arm64
|
run: ./ci/build_basic_webserver.sh linux_arm64
|
||||||
|
|
||||||
- name: Save .o file
|
- name: Save .o file
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: linux-arm64-files
|
name: linux-arm64-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -80,15 +80,15 @@ jobs:
|
||||||
runs-on: [macos-11] # I expect the generated files to work on macOS 12 and 13
|
runs-on: [macos-11] # I expect the generated files to work on macOS 12 and 13
|
||||||
needs: [fetch-releases]
|
needs: [fetch-releases]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- run: ./ci/build_basic_webserver.sh macos_x86_64
|
- run: ./ci/build_basic_webserver.sh macos_x86_64
|
||||||
|
|
||||||
- name: Save .o files
|
- name: Save .o files
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: macos-x86_64-files
|
name: macos-x86_64-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -99,15 +99,15 @@ jobs:
|
||||||
runs-on: [self-hosted, macOS, ARM64]
|
runs-on: [self-hosted, macOS, ARM64]
|
||||||
needs: [fetch-releases]
|
needs: [fetch-releases]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download the previously uploaded roc_nightly archives
|
- name: Download the previously uploaded roc_nightly archives
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- run: ./ci/build_basic_webserver.sh macos_apple_silicon
|
- run: ./ci/build_basic_webserver.sh macos_apple_silicon
|
||||||
|
|
||||||
- name: Save macos-arm64.o file
|
- name: Save macos-arm64.o file
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: macos-apple-silicon-files
|
name: macos-apple-silicon-files
|
||||||
path: |
|
path: |
|
||||||
|
@ -118,13 +118,13 @@ jobs:
|
||||||
name: create release archive
|
name: create release archive
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: remove all folders except the ci folder
|
- name: remove all folders except the ci folder
|
||||||
run: ls | grep -v ci | xargs rm -rf
|
run: ls | grep -v ci | xargs rm -rf
|
||||||
|
|
||||||
- name: Download the previously uploaded files
|
- name: Download the previously uploaded files
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- name: mv roc nightly and simplify name
|
- name: mv roc nightly and simplify name
|
||||||
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz
|
run: mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "linux_x86_64") ./roc_nightly.tar.gz
|
||||||
|
@ -145,7 +145,7 @@ jobs:
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
- run: cp macos-apple-silicon-files/* ./basic-webserver/platform
|
- run: cp macos-apple-silicon-files/* ./basic-webserver/platform
|
||||||
|
|
||||||
- run: cp linux-x86_64-files/* ./basic-webserver/platform
|
- run: cp linux-x86_64-files/* ./basic-webserver/platform
|
||||||
|
|
||||||
- run: cp linux-arm64-files/* ./basic-webserver/platform
|
- run: cp linux-arm64-files/* ./basic-webserver/platform
|
||||||
|
@ -157,7 +157,7 @@ jobs:
|
||||||
- run: echo "TAR_FILENAME=$(ls -d basic-webserver/platform/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV
|
- run: echo "TAR_FILENAME=$(ls -d basic-webserver/platform/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Upload platform archive
|
- name: Upload platform archive
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: basic-webserver-platform
|
name: basic-webserver-platform
|
||||||
path: |
|
path: |
|
||||||
|
|
4
.github/workflows/benchmarks.yml
vendored
4
.github/workflows/benchmarks.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
FORCE_COLOR: 1
|
FORCE_COLOR: 1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: "main"
|
ref: "main"
|
||||||
clean: "true"
|
clean: "true"
|
||||||
|
@ -23,7 +23,7 @@ jobs:
|
||||||
- name: on main; prepare a self-contained benchmark folder
|
- name: on main; prepare a self-contained benchmark folder
|
||||||
run: nix develop -c ./ci/benchmarks/prep_folder.sh main
|
run: nix develop -c ./ci/benchmarks/prep_folder.sh main
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
clean: "false" # we want to keep the benchmark folder
|
clean: "false" # we want to keep the benchmark folder
|
||||||
|
|
||||||
|
|
6
.github/workflows/ci_manager.yml
vendored
6
.github/workflows/ci_manager.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
run_tests: ${{ steps.filecheck.outputs.run_tests }}
|
run_tests: ${{ steps.filecheck.outputs.run_tests }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Check if only css, html or md files changed
|
- name: Check if only css, html or md files changed
|
||||||
id: filecheck
|
id: filecheck
|
||||||
|
@ -112,7 +112,3 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- run: echo "Workflow succeeded :)"
|
- run: echo "Workflow succeeded :)"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
name: devtools nix files test - linux
|
name: devtools nix files test - linux
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
@ -13,7 +13,7 @@ jobs:
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Only run all steps if a nix file changed
|
- name: Only run all steps if a nix file changed
|
||||||
run: |
|
run: |
|
||||||
|
@ -25,7 +25,7 @@ jobs:
|
||||||
echo "A nix file was changed. No need to run tests."
|
echo "A nix file was changed. No need to run tests."
|
||||||
echo "nix_changed=false" >> $GITHUB_ENV
|
echo "nix_changed=false" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v23
|
- uses: cachix/install-nix-action@v23
|
||||||
if: env.nix_changed == 'true'
|
if: env.nix_changed == 'true'
|
||||||
|
@ -53,6 +53,3 @@ jobs:
|
||||||
echo "locally deleting devtools/flake.lock and following the"
|
echo "locally deleting devtools/flake.lock and following the"
|
||||||
echo "instructions in devtools/README.md. This will create a"
|
echo "instructions in devtools/README.md. This will create a"
|
||||||
echo "new flake.lock you should use to replace the old devtools/flake.lock"
|
echo "new flake.lock you should use to replace the old devtools/flake.lock"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ jobs:
|
||||||
runs-on: [self-hosted, macOS, ARM64]
|
runs-on: [self-hosted, macOS, ARM64]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Only run all steps if a nix file changed
|
- name: Only run all steps if a nix file changed
|
||||||
run: |
|
run: |
|
||||||
|
@ -47,6 +47,3 @@ jobs:
|
||||||
echo "locally deleting devtools/flake.lock and following the"
|
echo "locally deleting devtools/flake.lock and following the"
|
||||||
echo "instructions in devtools/README.md. This will create a"
|
echo "instructions in devtools/README.md. This will create a"
|
||||||
echo "new flake.lock you should use to replace the old devtools/flake.lock"
|
echo "new flake.lock you should use to replace the old devtools/flake.lock"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
13
.github/workflows/docker.yml
vendored
13
.github/workflows/docker.yml
vendored
|
@ -9,7 +9,7 @@ jobs:
|
||||||
runs-on: [ubuntu-22.04]
|
runs-on: [ubuntu-22.04]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Copy example docker file
|
- name: Copy example docker file
|
||||||
run: cp docker/nightly-ubuntu-latest/docker-compose.example.yml docker/nightly-ubuntu-latest/docker-compose.yml
|
run: cp docker/nightly-ubuntu-latest/docker-compose.example.yml docker/nightly-ubuntu-latest/docker-compose.yml
|
||||||
|
@ -26,7 +26,7 @@ jobs:
|
||||||
runs-on: [ubuntu-22.04]
|
runs-on: [ubuntu-22.04]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Copy example docker file
|
- name: Copy example docker file
|
||||||
run: cp docker/nightly-ubuntu-2204/docker-compose.example.yml docker/nightly-ubuntu-2204/docker-compose.yml
|
run: cp docker/nightly-ubuntu-2204/docker-compose.example.yml docker/nightly-ubuntu-2204/docker-compose.yml
|
||||||
|
@ -42,7 +42,7 @@ jobs:
|
||||||
runs-on: [ubuntu-22.04]
|
runs-on: [ubuntu-22.04]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Copy example docker file
|
- name: Copy example docker file
|
||||||
run: cp docker/nightly-ubuntu-2004/docker-compose.example.yml docker/nightly-ubuntu-2004/docker-compose.yml
|
run: cp docker/nightly-ubuntu-2004/docker-compose.example.yml docker/nightly-ubuntu-2004/docker-compose.yml
|
||||||
|
@ -58,7 +58,7 @@ jobs:
|
||||||
runs-on: [ubuntu-22.04]
|
runs-on: [ubuntu-22.04]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Copy example docker file
|
- name: Copy example docker file
|
||||||
run: cp docker/nightly-debian-latest/docker-compose.example.yml docker/nightly-debian-latest/docker-compose.yml
|
run: cp docker/nightly-debian-latest/docker-compose.example.yml docker/nightly-debian-latest/docker-compose.yml
|
||||||
|
@ -74,7 +74,7 @@ jobs:
|
||||||
runs-on: [ubuntu-22.04]
|
runs-on: [ubuntu-22.04]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Copy example docker file
|
- name: Copy example docker file
|
||||||
run: cp docker/nightly-debian-bookworm/docker-compose.example.yml docker/nightly-debian-bookworm/docker-compose.yml
|
run: cp docker/nightly-debian-bookworm/docker-compose.example.yml docker/nightly-debian-bookworm/docker-compose.yml
|
||||||
|
@ -90,7 +90,7 @@ jobs:
|
||||||
runs-on: [ubuntu-22.04]
|
runs-on: [ubuntu-22.04]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Copy example docker file
|
- name: Copy example docker file
|
||||||
run: cp docker/nightly-debian-buster/docker-compose.example.yml docker/nightly-debian-buster/docker-compose.yml
|
run: cp docker/nightly-debian-buster/docker-compose.example.yml docker/nightly-debian-buster/docker-compose.yml
|
||||||
|
@ -100,4 +100,3 @@ jobs:
|
||||||
|
|
||||||
- name: Run hello world test
|
- name: Run hello world test
|
||||||
run: docker-compose -f docker/nightly-debian-buster/docker-compose.yml run roc examples/helloWorld.roc
|
run: docker-compose -f docker/nightly-debian-buster/docker-compose.yml run roc examples/helloWorld.roc
|
||||||
|
|
||||||
|
|
2
.github/workflows/macos_x86_64.yml
vendored
2
.github/workflows/macos_x86_64.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
RUSTC_WRAPPER: /Users/username1/.cargo/bin/sccache
|
RUSTC_WRAPPER: /Users/username1/.cargo/bin/sccache
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: set LLVM_SYS_160_PREFIX
|
- name: set LLVM_SYS_160_PREFIX
|
||||||
run: echo "LLVM_SYS_160_PREFIX=$(brew --prefix llvm@16)" >> $GITHUB_ENV
|
run: echo "LLVM_SYS_160_PREFIX=$(brew --prefix llvm@16)" >> $GITHUB_ENV
|
||||||
|
|
2
.github/workflows/markdown_link_check.yml
vendored
2
.github/workflows/markdown_link_check.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
markdown-link-check:
|
markdown-link-check:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: gaurav-nelson/github-action-markdown-link-check@v1
|
- uses: gaurav-nelson/github-action-markdown-link-check@v1
|
||||||
with:
|
with:
|
||||||
use-quiet-mode: 'yes'
|
use-quiet-mode: 'yes'
|
||||||
|
|
14
.github/workflows/nightly_linux_arm64.yml
vendored
14
.github/workflows/nightly_linux_arm64.yml
vendored
|
@ -5,7 +5,7 @@ on:
|
||||||
- cron: '0 9 * * *'
|
- cron: '0 9 * * *'
|
||||||
|
|
||||||
name: Nightly Release Linux arm64/aarch64
|
name: Nightly Release Linux arm64/aarch64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build and package nightly release
|
name: build and package nightly release
|
||||||
|
@ -13,12 +13,12 @@ jobs:
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update PATH to use zig 11
|
- name: Update PATH to use zig 11
|
||||||
run: |
|
run: |
|
||||||
echo "PATH=/home/username/Downloads/zig-linux-aarch64-0.11.0:$PATH" >> $GITHUB_ENV
|
echo "PATH=/home/username/Downloads/zig-linux-aarch64-0.11.0:$PATH" >> $GITHUB_ENV
|
||||||
|
|
||||||
- run: zig version
|
- run: zig version
|
||||||
|
|
||||||
- name: create version.txt
|
- name: create version.txt
|
||||||
|
@ -29,10 +29,10 @@ jobs:
|
||||||
|
|
||||||
- name: get commit SHA
|
- name: get commit SHA
|
||||||
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: get date
|
- name: get date
|
||||||
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: build file name
|
- name: build file name
|
||||||
env:
|
env:
|
||||||
DATE: ${{ env.DATE }}
|
DATE: ${{ env.DATE }}
|
||||||
|
@ -42,12 +42,12 @@ jobs:
|
||||||
# this makes the roc binary a lot smaller
|
# this makes the roc binary a lot smaller
|
||||||
- name: strip debug info
|
- name: strip debug info
|
||||||
run: strip ./target/release-with-lto/roc
|
run: strip ./target/release-with-lto/roc
|
||||||
|
|
||||||
- name: Make nightly release tar archive
|
- name: Make nightly release tar archive
|
||||||
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
|
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
|
||||||
|
|
||||||
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
|
|
18
.github/workflows/nightly_linux_x86_64.yml
vendored
18
.github/workflows/nightly_linux_x86_64.yml
vendored
|
@ -5,20 +5,20 @@ on:
|
||||||
- cron: '0 9 * * *'
|
- cron: '0 9 * * *'
|
||||||
|
|
||||||
name: Nightly Release Linux x86_64
|
name: Nightly Release Linux x86_64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build and package nightly release
|
name: build and package nightly release
|
||||||
runs-on: [self-hosted, i7-6700K]
|
runs-on: [self-hosted, i7-6700K]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update PATH to use zig 11
|
- name: Update PATH to use zig 11
|
||||||
run: |
|
run: |
|
||||||
echo "PATH=/home/big-ci-user/Downloads/zig-linux-x86_64-0.11.0:$PATH" >> $GITHUB_ENV
|
echo "PATH=/home/big-ci-user/Downloads/zig-linux-x86_64-0.11.0:$PATH" >> $GITHUB_ENV
|
||||||
|
|
||||||
- run: zig version
|
- run: zig version
|
||||||
|
|
||||||
- name: create version.txt
|
- name: create version.txt
|
||||||
|
@ -30,7 +30,7 @@ jobs:
|
||||||
|
|
||||||
- name: get commit SHA
|
- name: get commit SHA
|
||||||
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: get date
|
- name: get date
|
||||||
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ jobs:
|
||||||
run: ./ci/www-repl.sh
|
run: ./ci/www-repl.sh
|
||||||
|
|
||||||
- name: Upload wasm repl tar. Actually uploading to github releases has to be done manually.
|
- name: Upload wasm repl tar. Actually uploading to github releases has to be done manually.
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: roc_repl_wasm.tar.gz
|
name: roc_repl_wasm.tar.gz
|
||||||
path: roc_repl_wasm.tar.gz
|
path: roc_repl_wasm.tar.gz
|
||||||
retention-days: 4
|
retention-days: 4
|
||||||
|
|
||||||
- name: build file name
|
- name: build file name
|
||||||
env:
|
env:
|
||||||
DATE: ${{ env.DATE }}
|
DATE: ${{ env.DATE }}
|
||||||
|
@ -53,12 +53,12 @@ jobs:
|
||||||
# this makes the roc binary a lot smaller
|
# this makes the roc binary a lot smaller
|
||||||
- name: strip debug info
|
- name: strip debug info
|
||||||
run: strip ./target/release-with-lto/roc
|
run: strip ./target/release-with-lto/roc
|
||||||
|
|
||||||
- name: Make nightly release tar archive
|
- name: Make nightly release tar archive
|
||||||
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
|
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
|
||||||
|
|
||||||
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
|
|
|
@ -16,8 +16,8 @@ jobs:
|
||||||
runs-on: [self-hosted, macOS, ARM64]
|
runs-on: [self-hosted, macOS, ARM64]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- run: zig version
|
- run: zig version
|
||||||
|
|
||||||
- name: llvm version
|
- name: llvm version
|
||||||
|
@ -25,18 +25,18 @@ jobs:
|
||||||
|
|
||||||
- name: run tests
|
- name: run tests
|
||||||
run: cargo test --locked --release
|
run: cargo test --locked --release
|
||||||
|
|
||||||
- name: get commit SHA
|
- name: get commit SHA
|
||||||
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: get date
|
- name: get date
|
||||||
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: build file name
|
- name: build file name
|
||||||
env:
|
env:
|
||||||
DATE: ${{ env.DATE }}
|
DATE: ${{ env.DATE }}
|
||||||
SHA: ${{ env.SHA }}
|
SHA: ${{ env.SHA }}
|
||||||
run: echo "RELEASE_FOLDER_NAME=roc_nightly-macos_apple_silicon-$DATE-$SHA" >> $GITHUB_ENV
|
run: echo "RELEASE_FOLDER_NAME=roc_nightly-macos_apple_silicon-$DATE-$SHA" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: write version to file
|
- name: write version to file
|
||||||
run: ./ci/write_version.sh
|
run: ./ci/write_version.sh
|
||||||
|
@ -61,7 +61,7 @@ jobs:
|
||||||
- name: print date
|
- name: print date
|
||||||
run: date
|
run: date
|
||||||
- name: Upload artifact Actually uploading to github releases has to be done manually
|
- name: Upload artifact Actually uploading to github releases has to be done manually
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
|
|
4
.github/workflows/nightly_macos_x86_64.yml
vendored
4
.github/workflows/nightly_macos_x86_64.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
runs-on: [self-hosted, macOS, X64]
|
runs-on: [self-hosted, macOS, X64]
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Update PATH to use zig 11
|
- name: Update PATH to use zig 11
|
||||||
run: |
|
run: |
|
||||||
|
@ -55,7 +55,7 @@ jobs:
|
||||||
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
|
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
|
||||||
|
|
||||||
- name: Upload artifact. Actually uploading to github releases has to be done manually.
|
- name: Upload artifact. Actually uploading to github releases has to be done manually.
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
|
|
10
.github/workflows/nightly_old_linux_arm64.yml
vendored
10
.github/workflows/nightly_old_linux_arm64.yml
vendored
|
@ -5,21 +5,21 @@ on:
|
||||||
- cron: '0 9 * * *'
|
- cron: '0 9 * * *'
|
||||||
|
|
||||||
name: Nightly Release Old Linux arm64 using Earthly
|
name: Nightly Release Old Linux arm64 using Earthly
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build and package nightly release
|
name: build and package nightly release
|
||||||
runs-on: [self-hosted, Linux, ARM64]
|
runs-on: [self-hosted, Linux, ARM64]
|
||||||
timeout-minutes: 180
|
timeout-minutes: 180
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: get commit SHA
|
- name: get commit SHA
|
||||||
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: get date
|
- name: get date
|
||||||
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: build file name
|
- name: build file name
|
||||||
env:
|
env:
|
||||||
DATE: ${{ env.DATE }}
|
DATE: ${{ env.DATE }}
|
||||||
|
@ -32,7 +32,7 @@ jobs:
|
||||||
run: earthly +build-nightly-release --RELEASE_FOLDER_NAME=${{ env.RELEASE_FOLDER_NAME }} --ZIG_ARCH=aarch64
|
run: earthly +build-nightly-release --RELEASE_FOLDER_NAME=${{ env.RELEASE_FOLDER_NAME }} --ZIG_ARCH=aarch64
|
||||||
|
|
||||||
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
|
|
14
.github/workflows/nightly_old_linux_x86_64.yml
vendored
14
.github/workflows/nightly_old_linux_x86_64.yml
vendored
|
@ -5,37 +5,37 @@ on:
|
||||||
- cron: '0 9 * * *'
|
- cron: '0 9 * * *'
|
||||||
|
|
||||||
name: Nightly Release Old Linux x86_64 using Earthly
|
name: Nightly Release Old Linux x86_64 using Earthly
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build and package nightly release
|
name: build and package nightly release
|
||||||
runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: get commit SHA
|
- name: get commit SHA
|
||||||
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: get date
|
- name: get date
|
||||||
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: build file name
|
- name: build file name
|
||||||
env:
|
env:
|
||||||
DATE: ${{ env.DATE }}
|
DATE: ${{ env.DATE }}
|
||||||
SHA: ${{ env.SHA }}
|
SHA: ${{ env.SHA }}
|
||||||
run: echo "RELEASE_FOLDER_NAME=roc_nightly-old_linux_x86_64-$DATE-$SHA" >> $GITHUB_ENV
|
run: echo "RELEASE_FOLDER_NAME=roc_nightly-old_linux_x86_64-$DATE-$SHA" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: install earthly
|
- name: install earthly
|
||||||
run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
|
run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
|
||||||
|
|
||||||
- run: earthly --version
|
- run: earthly --version
|
||||||
|
|
||||||
- name: build release with earthly
|
- name: build release with earthly
|
||||||
run: earthly +build-nightly-release --RELEASE_FOLDER_NAME=${{ env.RELEASE_FOLDER_NAME }} --RUSTFLAGS="-C target-cpu=x86-64"
|
run: earthly +build-nightly-release --RELEASE_FOLDER_NAME=${{ env.RELEASE_FOLDER_NAME }} --RUSTFLAGS="-C target-cpu=x86-64"
|
||||||
|
|
||||||
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
- name: Upload roc nightly tar. Actually uploading to github releases has to be done manually.
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
|
||||||
|
|
6
.github/workflows/nix_linux_arm64_cargo.yml
vendored
6
.github/workflows/nix_linux_arm64_cargo.yml
vendored
|
@ -1,6 +1,6 @@
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
name: test cargo build on linux arm64 inside nix
|
name: test cargo build on linux arm64 inside nix
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
@ -12,11 +12,11 @@ jobs:
|
||||||
runs-on: [self-hosted, Linux, ARM64]
|
runs-on: [self-hosted, Linux, ARM64]
|
||||||
timeout-minutes: 150
|
timeout-minutes: 150
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: test release build
|
- name: test release build
|
||||||
run: nix develop -c cargo build --release --locked
|
run: nix develop -c cargo build --release --locked
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
#- name: build tests without running
|
#- name: build tests without running
|
||||||
# run: cargo test --no-run --release
|
# run: cargo test --no-run --release
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
name: test default.nix on linux arm64
|
name: test default.nix on linux arm64
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
@ -12,7 +12,7 @@ jobs:
|
||||||
runs-on: [self-hosted, Linux, ARM64]
|
runs-on: [self-hosted, Linux, ARM64]
|
||||||
timeout-minutes: 150
|
timeout-minutes: 150
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: test building default.nix
|
- name: test building default.nix
|
||||||
run: nix-build
|
run: nix-build
|
||||||
|
|
6
.github/workflows/nix_linux_x86_64.yml
vendored
6
.github/workflows/nix_linux_x86_64.yml
vendored
|
@ -12,10 +12,10 @@ jobs:
|
||||||
runs-on: [self-hosted, i5-4690K]
|
runs-on: [self-hosted, i5-4690K]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: test building default.nix
|
- name: test building default.nix
|
||||||
run: nix-build
|
run: nix-build
|
||||||
|
|
||||||
- name: execute tests with --release
|
- name: execute tests with --release
|
||||||
run: nix develop -c cargo test --locked --release
|
run: nix develop -c cargo test --locked --release
|
||||||
|
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
runs-on: [self-hosted, macOS, ARM64]
|
runs-on: [self-hosted, macOS, ARM64]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
# These started to accumulate quickly since #5990, not sure why
|
# These started to accumulate quickly since #5990, not sure why
|
||||||
- name: Clean up old nix shells
|
- name: Clean up old nix shells
|
||||||
|
|
2
.github/workflows/nix_macos_x86_64.yml
vendored
2
.github/workflows/nix_macos_x86_64.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
||||||
runs-on: [macos-12]
|
runs-on: [macos-12]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v22
|
- uses: cachix/install-nix-action@v22
|
||||||
|
|
||||||
|
|
2
.github/workflows/spellcheck.yml
vendored
2
.github/workflows/spellcheck.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
FORCE_COLOR: 1
|
FORCE_COLOR: 1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- run: cargo install typos-cli --version 1.0.11
|
- run: cargo install typos-cli --version 1.0.11
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ jobs:
|
||||||
runs-on: [self-hosted, macOS, ARM64]
|
runs-on: [self-hosted, macOS, ARM64]
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: get the latest release archive
|
- name: get the latest release archive
|
||||||
run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
|
run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
|
||||||
|
@ -45,6 +45,3 @@ jobs:
|
||||||
cp target/release/repl_basic_test ../../roc_nightly
|
cp target/release/repl_basic_test ../../roc_nightly
|
||||||
cd ../../roc_nightly
|
cd ../../roc_nightly
|
||||||
./repl_basic_test
|
./repl_basic_test
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
8
.github/workflows/test_nightly_many_os.yml
vendored
8
.github/workflows/test_nightly_many_os.yml
vendored
|
@ -13,14 +13,14 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: goto-bus-stop/setup-zig@v2
|
- uses: goto-bus-stop/setup-zig@v2
|
||||||
with:
|
with:
|
||||||
version: 0.11.0
|
version: 0.11.0
|
||||||
|
|
||||||
- name: get the latest release archive for linux (x86_64)
|
- name: get the latest release archive for linux (x86_64)
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
run: |
|
run: |
|
||||||
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
|
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,3 @@ jobs:
|
||||||
rm -rf roc_nightly
|
rm -rf roc_nightly
|
||||||
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-old_linux_x86_64-latest.tar.gz
|
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-old_linux_x86_64-latest.tar.gz
|
||||||
./ci/basic_nightly_test.sh
|
./ci/basic_nightly_test.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
.github/workflows/ubuntu_x86_64.yml
vendored
6
.github/workflows/ubuntu_x86_64.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
RUSTC_WRAPPER: /home/big-ci-user/.cargo/bin/sccache
|
RUSTC_WRAPPER: /home/big-ci-user/.cargo/bin/sccache
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Check for duplicate AUTHORS
|
- name: Check for duplicate AUTHORS
|
||||||
run: diff <(sort AUTHORS) <(sort AUTHORS | uniq) # The < operator treats a string as a file. diff 'succeeds' if no difference.
|
run: diff <(sort AUTHORS) <(sort AUTHORS | uniq) # The < operator treats a string as a file. diff 'succeeds' if no difference.
|
||||||
|
@ -22,7 +22,7 @@ jobs:
|
||||||
- name: Update PATH to use zig 11
|
- name: Update PATH to use zig 11
|
||||||
run: |
|
run: |
|
||||||
echo "PATH=/home/big-ci-user/Downloads/zig-linux-x86_64-0.11.0:$PATH" >> $GITHUB_ENV
|
echo "PATH=/home/big-ci-user/Downloads/zig-linux-x86_64-0.11.0:$PATH" >> $GITHUB_ENV
|
||||||
|
|
||||||
- run: zig version
|
- run: zig version
|
||||||
|
|
||||||
- name: zig fmt check, zig tests
|
- name: zig fmt check, zig tests
|
||||||
|
@ -40,7 +40,7 @@ jobs:
|
||||||
|
|
||||||
- name: check that the platform`s produced dylib is loadable
|
- name: check that the platform`s produced dylib is loadable
|
||||||
run: cd examples/platform-switching/rust-platform && LD_LIBRARY_PATH=. cargo test --release --locked
|
run: cd examples/platform-switching/rust-platform && LD_LIBRARY_PATH=. cargo test --release --locked
|
||||||
|
|
||||||
- name: test the dev backend # these tests require an explicit feature flag
|
- name: test the dev backend # these tests require an explicit feature flag
|
||||||
run: cargo test --locked --release --package test_gen --no-default-features --features gen-dev && sccache --show-stats
|
run: cargo test --locked --release --package test_gen --no-default-features --features gen-dev && sccache --show-stats
|
||||||
|
|
||||||
|
|
6
.github/workflows/windows_release_build.yml
vendored
6
.github/workflows/windows_release_build.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
|
|
||||||
timeout-minutes: 150
|
timeout-minutes: 150
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- run: Add-Content -Path "$env:GITHUB_ENV" -Value "GITHUB_RUNNER_CPU=$((Get-CimInstance Win32_Processor).Name)"
|
- run: Add-Content -Path "$env:GITHUB_ENV" -Value "GITHUB_RUNNER_CPU=$((Get-CimInstance Win32_Processor).Name)"
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ jobs:
|
||||||
- name: zig version
|
- name: zig version
|
||||||
run: zig version
|
run: zig version
|
||||||
|
|
||||||
- name: install rust nightly 1.71.0
|
- name: install rust nightly 1.72.0
|
||||||
run: rustup install nightly-2023-05-28
|
run: rustup install nightly-2023-07-09
|
||||||
|
|
||||||
- name: set up llvm 16
|
- name: set up llvm 16
|
||||||
run: |
|
run: |
|
||||||
|
|
19
.github/workflows/windows_tests.yml
vendored
19
.github/workflows/windows_tests.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
|
|
||||||
timeout-minutes: 150
|
timeout-minutes: 150
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- run: Add-Content -Path "$env:GITHUB_ENV" -Value "GITHUB_RUNNER_CPU=$((Get-CimInstance Win32_Processor).Name)"
|
- run: Add-Content -Path "$env:GITHUB_ENV" -Value "GITHUB_RUNNER_CPU=$((Get-CimInstance Win32_Processor).Name)"
|
||||||
|
|
||||||
|
@ -37,29 +37,26 @@ jobs:
|
||||||
cd crates\compiler\builtins\bitcode\
|
cd crates\compiler\builtins\bitcode\
|
||||||
zig build test
|
zig build test
|
||||||
|
|
||||||
- name: install rust nightly 1.71.0
|
- name: install rust nightly 1.72.0
|
||||||
run: rustup install nightly-2023-05-28
|
run: rustup install nightly-2023-07-09
|
||||||
|
|
||||||
- name: set up llvm 16
|
- name: set up llvm 16
|
||||||
run: |
|
run: |
|
||||||
curl.exe -f -L -O -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://github.com/roc-lang/llvm-package-windows/releases/download/v16.0.6/LLVM-16.0.6-win64.7z
|
curl.exe -f -L -O -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://github.com/roc-lang/llvm-package-windows/releases/download/v16.0.6/LLVM-16.0.6-win64.7z
|
||||||
7z x LLVM-16.0.6-win64.7z -oC:\LLVM-16.0.6-win64
|
7z x LLVM-16.0.6-win64.7z -oC:\LLVM-16.0.6-win64
|
||||||
|
|
||||||
- name: Build tests --release without running.
|
- name: Build tests --release without running.
|
||||||
run: cargo test --locked --release --no-run
|
run: cargo test --locked --release --no-run
|
||||||
|
|
||||||
# Why are these tests not build with previous command? => fingerprint error. Use `CARGO_LOG=cargo::core::compiler::fingerprint=info` to investigate
|
# Why are these tests not build with previous command? => fingerprint error. Use `CARGO_LOG=cargo::core::compiler::fingerprint=info` to investigate
|
||||||
- name: Build specific tests without running.
|
- name: Build specific tests without running.
|
||||||
run: cargo test --locked --release --no-run -p roc_ident -p roc_region -p roc_collections -p roc_can -p roc_types -p roc_solve -p roc_mono -p roc_gen_dev -p roc_gen_wasm -p roc_serialize -p roc_linker -p roc_cli -p test_gen
|
run: cargo test --locked --release --no-run -p roc_ident -p roc_region -p roc_collections -p roc_can -p roc_types -p roc_solve -p roc_mono -p roc_gen_dev -p roc_gen_wasm -p roc_serialize -p roc_linker -p roc_cli -p test_gen
|
||||||
|
|
||||||
- name: Test setjmp/longjmp logic
|
- name: Test setjmp/longjmp logic
|
||||||
run: cargo test-gen-dev --locked --release nat_alias && cargo test-gen-dev --locked --release a_crash
|
run: cargo test-gen-dev --locked --release nat_alias && cargo test-gen-dev --locked --release a_crash
|
||||||
|
|
||||||
- name: Run gen tests
|
- name: Run gen tests
|
||||||
run: cargo test-gen-llvm --locked --release gen_str
|
run: cargo test-gen-llvm --locked --release gen_str
|
||||||
|
|
||||||
- name: Actually run the tests.
|
- name: Actually run the tests.
|
||||||
run: cargo test --locked --release -p roc_ident -p roc_region -p roc_collections -p roc_can -p roc_types -p roc_solve -p roc_mono -p roc_gen_dev -p roc_gen_wasm -p roc_serialize -p roc_linker -p roc_cli
|
run: cargo test --locked --release -p roc_ident -p roc_region -p roc_collections -p roc_can -p roc_types -p roc_solve -p roc_mono -p roc_gen_dev -p roc_gen_wasm -p roc_serialize -p roc_linker -p roc_cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
VERSION 0.6
|
VERSION 0.6
|
||||||
FROM rust:1.71.1-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version
|
FROM rust:1.72.1-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version
|
||||||
WORKDIR /earthbuild
|
WORKDIR /earthbuild
|
||||||
|
|
||||||
prep-debian:
|
prep-debian:
|
||||||
|
|
|
@ -537,7 +537,7 @@ pub fn rebuild_host(
|
||||||
// on windows, we need the nightly toolchain so we can use `-Z export-executable-symbols`
|
// on windows, we need the nightly toolchain so we can use `-Z export-executable-symbols`
|
||||||
// using `+nightly` only works when running cargo through rustup
|
// using `+nightly` only works when running cargo through rustup
|
||||||
let mut cmd = rustup();
|
let mut cmd = rustup();
|
||||||
cmd.args(["run", "nightly-2023-05-28", "cargo"]);
|
cmd.args(["run", "nightly-2023-07-09", "cargo"]);
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
} else {
|
} else {
|
||||||
|
@ -848,6 +848,17 @@ fn strs_to_path(strs: &[&str]) -> PathBuf {
|
||||||
strs.iter().collect()
|
strs.iter().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn extra_link_flags() -> Vec<String> {
|
||||||
|
match env::var("ROC_LINK_FLAGS") {
|
||||||
|
Ok(flags) => {
|
||||||
|
println!("⚠️ CAUTION: The ROC_LINK_FLAGS environment variable is a temporary workaround, and will no longer do anything once surgical linking lands! If you're concerned about what this means for your use case, please ask about it on Zulip.");
|
||||||
|
|
||||||
|
flags
|
||||||
|
}
|
||||||
|
Err(_) => "".to_string(),
|
||||||
|
}.split_whitespace().map(|x| x.to_owned()).collect()
|
||||||
|
}
|
||||||
|
|
||||||
fn link_linux(
|
fn link_linux(
|
||||||
target: &Triple,
|
target: &Triple,
|
||||||
output_path: PathBuf,
|
output_path: PathBuf,
|
||||||
|
@ -1037,6 +1048,7 @@ fn link_linux(
|
||||||
.args(&base_args)
|
.args(&base_args)
|
||||||
.args(["-dynamic-linker", ld_linux])
|
.args(["-dynamic-linker", ld_linux])
|
||||||
.args(input_paths)
|
.args(input_paths)
|
||||||
|
.args(extra_link_flags())
|
||||||
// ld.lld requires this argument, and does not accept --arch
|
// ld.lld requires this argument, and does not accept --arch
|
||||||
// .args(&["-L/usr/lib/x86_64-linux-gnu"])
|
// .args(&["-L/usr/lib/x86_64-linux-gnu"])
|
||||||
.args([
|
.args([
|
||||||
|
@ -1108,7 +1120,8 @@ fn link_macos(
|
||||||
"-macos_version_min",
|
"-macos_version_min",
|
||||||
&get_macos_version(),
|
&get_macos_version(),
|
||||||
])
|
])
|
||||||
.args(input_paths);
|
.args(input_paths)
|
||||||
|
.args(extra_link_flags());
|
||||||
|
|
||||||
let sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib";
|
let sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib";
|
||||||
if Path::new(sdk_path).exists() {
|
if Path::new(sdk_path).exists() {
|
||||||
|
@ -1116,18 +1129,6 @@ fn link_macos(
|
||||||
ld_command.arg(format!("-L{sdk_path}/swift"));
|
ld_command.arg(format!("-L{sdk_path}/swift"));
|
||||||
};
|
};
|
||||||
|
|
||||||
let roc_link_flags = match env::var("ROC_LINK_FLAGS") {
|
|
||||||
Ok(flags) => {
|
|
||||||
println!("⚠️ CAUTION: The ROC_LINK_FLAGS environment variable is a temporary workaround, and will no longer do anything once surgical linking lands! If you're concerned about what this means for your use case, please ask about it on Zulip.");
|
|
||||||
|
|
||||||
flags
|
|
||||||
}
|
|
||||||
Err(_) => "".to_string(),
|
|
||||||
};
|
|
||||||
for roc_link_flag in roc_link_flags.split_whitespace() {
|
|
||||||
ld_command.arg(roc_link_flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
ld_command.args([
|
ld_command.args([
|
||||||
// Libraries - see https://github.com/roc-lang/roc/pull/554#discussion_r496392274
|
// Libraries - see https://github.com/roc-lang/roc/pull/554#discussion_r496392274
|
||||||
// for discussion and further references
|
// for discussion and further references
|
||||||
|
|
|
@ -117,6 +117,9 @@ comptime {
|
||||||
num.exportCeiling(f32, T, ROC_BUILTINS ++ "." ++ NUM ++ ".ceiling_f32.");
|
num.exportCeiling(f32, T, ROC_BUILTINS ++ "." ++ NUM ++ ".ceiling_f32.");
|
||||||
num.exportCeiling(f64, T, ROC_BUILTINS ++ "." ++ NUM ++ ".ceiling_f64.");
|
num.exportCeiling(f64, T, ROC_BUILTINS ++ "." ++ NUM ++ ".ceiling_f64.");
|
||||||
|
|
||||||
|
num.exportNumToFloatCast(T, f32, ROC_BUILTINS ++ "." ++ NUM ++ ".num_to_float_cast_f32.");
|
||||||
|
num.exportNumToFloatCast(T, f64, ROC_BUILTINS ++ "." ++ NUM ++ ".num_to_float_cast_f64.");
|
||||||
|
|
||||||
num.exportAddWithOverflow(T, ROC_BUILTINS ++ "." ++ NUM ++ ".add_with_overflow.");
|
num.exportAddWithOverflow(T, ROC_BUILTINS ++ "." ++ NUM ++ ".add_with_overflow.");
|
||||||
num.exportAddOrPanic(T, ROC_BUILTINS ++ "." ++ NUM ++ ".add_or_panic.");
|
num.exportAddOrPanic(T, ROC_BUILTINS ++ "." ++ NUM ++ ".add_or_panic.");
|
||||||
num.exportAddSaturatedInt(T, ROC_BUILTINS ++ "." ++ NUM ++ ".add_saturated.");
|
num.exportAddSaturatedInt(T, ROC_BUILTINS ++ "." ++ NUM ++ ".add_saturated.");
|
||||||
|
|
|
@ -86,6 +86,15 @@ pub fn exportParseFloat(comptime T: type, comptime name: []const u8) void {
|
||||||
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });
|
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn exportNumToFloatCast(comptime T: type, comptime F: type, comptime name: []const u8) void {
|
||||||
|
comptime var f = struct {
|
||||||
|
fn func(x: T) callconv(.C) F {
|
||||||
|
return @floatFromInt(x);
|
||||||
|
}
|
||||||
|
}.func;
|
||||||
|
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });
|
||||||
|
}
|
||||||
|
|
||||||
pub fn exportPow(comptime T: type, comptime name: []const u8) void {
|
pub fn exportPow(comptime T: type, comptime name: []const u8) void {
|
||||||
comptime var f = struct {
|
comptime var f = struct {
|
||||||
fn func(base: T, exp: T) callconv(.C) T {
|
fn func(base: T, exp: T) callconv(.C) T {
|
||||||
|
|
|
@ -838,7 +838,7 @@ removeBucketHelper = \buckets, bucketIndex ->
|
||||||
nextIndex = nextBucketIndex bucketIndex (List.len buckets)
|
nextIndex = nextBucketIndex bucketIndex (List.len buckets)
|
||||||
nextBucket = listGetUnsafe buckets nextIndex
|
nextBucket = listGetUnsafe buckets nextIndex
|
||||||
# shift down until either empty or an element with correct spot is found
|
# shift down until either empty or an element with correct spot is found
|
||||||
if nextBucket.distAndFingerprint >= distInc * 2 then
|
if nextBucket.distAndFingerprint >= Num.mulWrap distInc 2 then
|
||||||
List.set buckets bucketIndex { nextBucket & distAndFingerprint: decrementDist nextBucket.distAndFingerprint }
|
List.set buckets bucketIndex { nextBucket & distAndFingerprint: decrementDist nextBucket.distAndFingerprint }
|
||||||
|> removeBucketHelper nextIndex
|
|> removeBucketHelper nextIndex
|
||||||
else
|
else
|
||||||
|
@ -1410,7 +1410,7 @@ wymix = \a, b ->
|
||||||
|
|
||||||
wymum : U64, U64 -> { lower : U64, upper : U64 }
|
wymum : U64, U64 -> { lower : U64, upper : U64 }
|
||||||
wymum = \a, b ->
|
wymum = \a, b ->
|
||||||
r = Num.toU128 a * Num.toU128 b
|
r = Num.mulWrap (Num.toU128 a) (Num.toU128 b)
|
||||||
lower = Num.toU64 r
|
lower = Num.toU64 r
|
||||||
upper = Num.shiftRightZfBy r 64 |> Num.toU64
|
upper = Num.shiftRightZfBy r 64 |> Num.toU64
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,10 @@ pub const NUM_FLOOR_F32: IntrinsicName = int_intrinsic!("roc_builtins.num.floor_
|
||||||
pub const NUM_FLOOR_F64: IntrinsicName = int_intrinsic!("roc_builtins.num.floor_f64");
|
pub const NUM_FLOOR_F64: IntrinsicName = int_intrinsic!("roc_builtins.num.floor_f64");
|
||||||
pub const NUM_ROUND_F32: IntrinsicName = int_intrinsic!("roc_builtins.num.round_f32");
|
pub const NUM_ROUND_F32: IntrinsicName = int_intrinsic!("roc_builtins.num.round_f32");
|
||||||
pub const NUM_ROUND_F64: IntrinsicName = int_intrinsic!("roc_builtins.num.round_f64");
|
pub const NUM_ROUND_F64: IntrinsicName = int_intrinsic!("roc_builtins.num.round_f64");
|
||||||
|
pub const INT_TO_FLOAT_CAST_F32: IntrinsicName =
|
||||||
|
int_intrinsic!("roc_builtins.num.num_to_float_cast_f32");
|
||||||
|
pub const INT_TO_FLOAT_CAST_F64: IntrinsicName =
|
||||||
|
int_intrinsic!("roc_builtins.num.num_to_float_cast_f64");
|
||||||
|
|
||||||
pub const NUM_ADD_OR_PANIC_INT: IntrinsicName = int_intrinsic!("roc_builtins.num.add_or_panic");
|
pub const NUM_ADD_OR_PANIC_INT: IntrinsicName = int_intrinsic!("roc_builtins.num.add_or_panic");
|
||||||
pub const NUM_ADD_SATURATED_INT: IntrinsicName = int_intrinsic!("roc_builtins.num.add_saturated");
|
pub const NUM_ADD_SATURATED_INT: IntrinsicName = int_intrinsic!("roc_builtins.num.add_saturated");
|
||||||
|
|
|
@ -594,7 +594,7 @@ pub fn desugar_expr<'a>(
|
||||||
|
|
||||||
// line_info is an option so that we can lazily calculate it.
|
// line_info is an option so that we can lazily calculate it.
|
||||||
// That way it there are no `dbg` statements, we never pay the cast of scanning the source an extra time.
|
// That way it there are no `dbg` statements, we never pay the cast of scanning the source an extra time.
|
||||||
if matches!(line_info, None) {
|
if line_info.is_none() {
|
||||||
*line_info = Some(LineInfo::new(src));
|
*line_info = Some(LineInfo::new(src));
|
||||||
}
|
}
|
||||||
let line_col = line_info.as_ref().unwrap().convert_pos(region.start());
|
let line_col = line_info.as_ref().unwrap().convert_pos(region.start());
|
||||||
|
|
|
@ -154,7 +154,9 @@ fn fmt_comment(buf: &mut Buf, comment: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.push('#');
|
buf.push('#');
|
||||||
if !comment.starts_with(' ') {
|
// Add a space between the starting `#` and the rest of the comment,
|
||||||
|
// unless there already is a space or the comment is of the form `#### something`.
|
||||||
|
if !comment.starts_with(' ') && !comment.starts_with('#') {
|
||||||
buf.spaces(1);
|
buf.spaces(1);
|
||||||
}
|
}
|
||||||
buf.push_str(comment.trim_end());
|
buf.push_str(comment.trim_end());
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#![allow(clippy::redundant_closure_call)]
|
||||||
|
//|> clippy false positive: https://github.com/rust-lang/rust-clippy/issues/1553
|
||||||
|
|
||||||
use crate::generic64::{storage::StorageManager, Assembler, CallConv, RegTrait};
|
use crate::generic64::{storage::StorageManager, Assembler, CallConv, RegTrait};
|
||||||
use crate::{
|
use crate::{
|
||||||
pointer_layouts, single_register_floats, single_register_int_builtins,
|
pointer_layouts, single_register_floats, single_register_int_builtins,
|
||||||
|
@ -1668,6 +1671,11 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
|
||||||
Self::mov_freg64_mem64_offset32(buf, dst, AArch64GeneralReg::FP, offset)
|
Self::mov_freg64_mem64_offset32(buf, dst, AArch64GeneralReg::FP, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
fn mov_freg32_base32(buf: &mut Vec<'_, u8>, dst: AArch64FloatReg, offset: i32) {
|
||||||
|
Self::mov_freg32_mem32_offset32(buf, dst, AArch64GeneralReg::FP, offset)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn mov_reg_mem_offset32(
|
fn mov_reg_mem_offset32(
|
||||||
buf: &mut Vec<'_, u8>,
|
buf: &mut Vec<'_, u8>,
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#![allow(clippy::redundant_closure_call)]
|
||||||
|
//|> clippy false positive: https://github.com/rust-lang/rust-clippy/issues/1553
|
||||||
|
|
||||||
pub fn merge_instructions_without_line_numbers(instructions: capstone::Instructions) -> String {
|
pub fn merge_instructions_without_line_numbers(instructions: capstone::Instructions) -> String {
|
||||||
instructions
|
instructions
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -358,6 +358,7 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
|
||||||
|
|
||||||
// base32 is similar to stack based instructions but they reference the base/frame pointer.
|
// base32 is similar to stack based instructions but they reference the base/frame pointer.
|
||||||
fn mov_freg64_base32(buf: &mut Vec<'_, u8>, dst: FloatReg, offset: i32);
|
fn mov_freg64_base32(buf: &mut Vec<'_, u8>, dst: FloatReg, offset: i32);
|
||||||
|
fn mov_freg32_base32(buf: &mut Vec<'_, u8>, dst: FloatReg, offset: i32);
|
||||||
|
|
||||||
fn mov_reg_base32(
|
fn mov_reg_base32(
|
||||||
buf: &mut Vec<'_, u8>,
|
buf: &mut Vec<'_, u8>,
|
||||||
|
@ -2154,6 +2155,30 @@ impl<
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn build_int_to_float_cast(
|
||||||
|
&mut self,
|
||||||
|
dst: &Symbol,
|
||||||
|
src: &Symbol,
|
||||||
|
int_width: IntWidth,
|
||||||
|
float_width: FloatWidth,
|
||||||
|
) {
|
||||||
|
use roc_builtins::bitcode::{INT_TO_FLOAT_CAST_F32, INT_TO_FLOAT_CAST_F64};
|
||||||
|
|
||||||
|
self.build_fn_call(
|
||||||
|
dst,
|
||||||
|
match float_width {
|
||||||
|
FloatWidth::F32 => INT_TO_FLOAT_CAST_F32[int_width].to_string(),
|
||||||
|
FloatWidth::F64 => INT_TO_FLOAT_CAST_F64[int_width].to_string(),
|
||||||
|
},
|
||||||
|
&[*src],
|
||||||
|
&[Layout::from_int_width(int_width)],
|
||||||
|
match float_width {
|
||||||
|
FloatWidth::F32 => &Layout::F32,
|
||||||
|
FloatWidth::F64 => &Layout::F64,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn build_num_cmp(
|
fn build_num_cmp(
|
||||||
&mut self,
|
&mut self,
|
||||||
dst: &Symbol,
|
dst: &Symbol,
|
||||||
|
@ -2924,7 +2949,11 @@ impl<
|
||||||
self.load_layout_alignment(list_layout, Symbol::DEV_TMP);
|
self.load_layout_alignment(list_layout, Symbol::DEV_TMP);
|
||||||
|
|
||||||
// Load element_width argument (usize).
|
// Load element_width argument (usize).
|
||||||
self.load_layout_stack_size(*ret_layout, Symbol::DEV_TMP2);
|
let element_layout = match self.interner().get_repr(*ret_layout) {
|
||||||
|
LayoutRepr::Builtin(Builtin::List(e)) => e,
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
self.load_layout_stack_size(element_layout, Symbol::DEV_TMP2);
|
||||||
|
|
||||||
// Load UpdateMode.Immutable argument (0u8)
|
// Load UpdateMode.Immutable argument (0u8)
|
||||||
let u8_layout = Layout::U8;
|
let u8_layout = Layout::U8;
|
||||||
|
@ -4846,14 +4875,28 @@ impl<
|
||||||
|
|
||||||
// move a zero into the lower 8 bytes
|
// move a zero into the lower 8 bytes
|
||||||
ASM::mov_reg64_imm64(buf, tmp_reg, 0x0);
|
ASM::mov_reg64_imm64(buf, tmp_reg, 0x0);
|
||||||
ASM::mov_base32_reg64(buf, base_offset, tmp_reg);
|
ASM::mov_base32_reg64(buf, base_offset + 8, tmp_reg);
|
||||||
|
|
||||||
ASM::mov_base32_reg64(buf, base_offset + 8, src_reg);
|
ASM::mov_base32_reg64(buf, base_offset, src_reg);
|
||||||
|
|
||||||
self.free_symbol(&tmp);
|
self.free_symbol(&tmp);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
(U128, I128) | (I128, U128) => {
|
||||||
|
let to_offset = self.storage_manager.claim_stack_area_layout(
|
||||||
|
self.layout_interner,
|
||||||
|
*dst,
|
||||||
|
Layout::from_int_width(target),
|
||||||
|
);
|
||||||
|
|
||||||
|
let (from_offset, size) = self.storage_manager.stack_offset_and_size(src);
|
||||||
|
|
||||||
|
self.storage_manager
|
||||||
|
.copy_to_stack_offset(buf, size, from_offset, to_offset);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -4977,39 +5020,51 @@ impl<
|
||||||
}
|
}
|
||||||
|
|
||||||
fn num_to_f32(&mut self, dst: &Symbol, src: &Symbol, arg_layout: &InLayout<'a>) {
|
fn num_to_f32(&mut self, dst: &Symbol, src: &Symbol, arg_layout: &InLayout<'a>) {
|
||||||
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
|
||||||
match self.layout_interner.get_repr(*arg_layout) {
|
match self.layout_interner.get_repr(*arg_layout) {
|
||||||
LayoutRepr::Builtin(Builtin::Int(IntWidth::I32 | IntWidth::I64)) => {
|
LayoutRepr::Builtin(Builtin::Int(IntWidth::I32 | IntWidth::I64)) => {
|
||||||
|
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
||||||
let src_reg = self.storage_manager.load_to_general_reg(&mut self.buf, src);
|
let src_reg = self.storage_manager.load_to_general_reg(&mut self.buf, src);
|
||||||
ASM::to_float_freg32_reg64(&mut self.buf, dst_reg, src_reg);
|
ASM::to_float_freg32_reg64(&mut self.buf, dst_reg, src_reg);
|
||||||
}
|
}
|
||||||
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F64)) => {
|
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F64)) => {
|
||||||
|
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
||||||
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
||||||
ASM::to_float_freg32_freg64(&mut self.buf, dst_reg, src_reg);
|
ASM::to_float_freg32_freg64(&mut self.buf, dst_reg, src_reg);
|
||||||
}
|
}
|
||||||
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
|
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
|
||||||
|
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
||||||
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
||||||
ASM::mov_freg64_freg64(&mut self.buf, dst_reg, src_reg);
|
ASM::mov_freg64_freg64(&mut self.buf, dst_reg, src_reg);
|
||||||
}
|
}
|
||||||
|
LayoutRepr::Builtin(Builtin::Int(_)) => {
|
||||||
|
let int_width = arg_layout.to_int_width();
|
||||||
|
self.build_int_to_float_cast(dst, src, int_width, FloatWidth::F32);
|
||||||
|
}
|
||||||
arg => todo!("NumToFrac: layout, arg {arg:?}, ret {:?}", Layout::F32),
|
arg => todo!("NumToFrac: layout, arg {arg:?}, ret {:?}", Layout::F32),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn num_to_f64(&mut self, dst: &Symbol, src: &Symbol, arg_layout: &InLayout<'a>) {
|
fn num_to_f64(&mut self, dst: &Symbol, src: &Symbol, arg_layout: &InLayout<'a>) {
|
||||||
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
|
||||||
match self.layout_interner.get_repr(*arg_layout) {
|
match self.layout_interner.get_repr(*arg_layout) {
|
||||||
LayoutRepr::Builtin(Builtin::Int(IntWidth::I32 | IntWidth::I64)) => {
|
LayoutRepr::Builtin(Builtin::Int(IntWidth::I32 | IntWidth::I64)) => {
|
||||||
|
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
||||||
let src_reg = self.storage_manager.load_to_general_reg(&mut self.buf, src);
|
let src_reg = self.storage_manager.load_to_general_reg(&mut self.buf, src);
|
||||||
ASM::to_float_freg64_reg64(&mut self.buf, dst_reg, src_reg);
|
ASM::to_float_freg64_reg64(&mut self.buf, dst_reg, src_reg);
|
||||||
}
|
}
|
||||||
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
|
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
|
||||||
|
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
||||||
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
||||||
ASM::to_float_freg64_freg32(&mut self.buf, dst_reg, src_reg);
|
ASM::to_float_freg64_freg32(&mut self.buf, dst_reg, src_reg);
|
||||||
}
|
}
|
||||||
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F64)) => {
|
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F64)) => {
|
||||||
|
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
|
||||||
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
|
||||||
ASM::mov_freg64_freg64(&mut self.buf, dst_reg, src_reg);
|
ASM::mov_freg64_freg64(&mut self.buf, dst_reg, src_reg);
|
||||||
}
|
}
|
||||||
|
LayoutRepr::Builtin(Builtin::Int(_)) => {
|
||||||
|
let int_width = arg_layout.to_int_width();
|
||||||
|
self.build_int_to_float_cast(dst, src, int_width, FloatWidth::F64);
|
||||||
|
}
|
||||||
arg => todo!("NumToFrac: layout, arg {arg:?}, ret {:?}", Layout::F64),
|
arg => todo!("NumToFrac: layout, arg {arg:?}, ret {:?}", Layout::F64),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,17 +448,26 @@ impl<
|
||||||
}
|
}
|
||||||
Stack(ReferencedPrimitive {
|
Stack(ReferencedPrimitive {
|
||||||
base_offset, size, ..
|
base_offset, size, ..
|
||||||
}) if base_offset % 8 == 0 && size == 8 => {
|
}) => {
|
||||||
// The primitive is aligned and the data is exactly 8 bytes, treat it like regular stack.
|
if base_offset % 8 == 0 && size == 8 {
|
||||||
let reg = self.get_float_reg(buf);
|
// The primitive is aligned and the data is exactly 8 bytes, treat it like regular stack.
|
||||||
ASM::mov_freg64_base32(buf, reg, base_offset);
|
let reg = self.get_float_reg(buf);
|
||||||
self.float_used_regs.push((reg, *sym));
|
ASM::mov_freg64_base32(buf, reg, base_offset);
|
||||||
self.symbol_storage_map.insert(*sym, Reg(Float(reg)));
|
self.float_used_regs.push((reg, *sym));
|
||||||
self.free_reference(sym);
|
self.symbol_storage_map.insert(*sym, Reg(Float(reg)));
|
||||||
reg
|
self.free_reference(sym);
|
||||||
}
|
reg
|
||||||
Stack(ReferencedPrimitive { .. }) => {
|
} else if base_offset % 4 == 0 && size == 4 {
|
||||||
todo!("loading referenced primitives")
|
// The primitive is aligned and the data is exactly 8 bytes, treat it like regular stack.
|
||||||
|
let reg = self.get_float_reg(buf);
|
||||||
|
ASM::mov_freg32_base32(buf, reg, base_offset);
|
||||||
|
self.float_used_regs.push((reg, *sym));
|
||||||
|
self.symbol_storage_map.insert(*sym, Reg(Float(reg)));
|
||||||
|
self.free_reference(sym);
|
||||||
|
reg
|
||||||
|
} else {
|
||||||
|
todo!("loading referenced primitives")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Stack(Complex { .. }) => {
|
Stack(Complex { .. }) => {
|
||||||
internal_error!("Cannot load large values into float registers: {}", sym)
|
internal_error!("Cannot load large values into float registers: {}", sym)
|
||||||
|
@ -570,12 +579,15 @@ impl<
|
||||||
}
|
}
|
||||||
Stack(ReferencedPrimitive {
|
Stack(ReferencedPrimitive {
|
||||||
base_offset, size, ..
|
base_offset, size, ..
|
||||||
}) if base_offset % 8 == 0 && *size == 8 => {
|
}) => {
|
||||||
// The primitive is aligned and the data is exactly 8 bytes, treat it like regular stack.
|
if base_offset % 8 == 0 && *size == 8 {
|
||||||
ASM::mov_freg64_base32(buf, reg, *base_offset);
|
// The primitive is aligned and the data is exactly 8 bytes, treat it like regular stack.
|
||||||
}
|
ASM::mov_freg64_base32(buf, reg, *base_offset);
|
||||||
Stack(ReferencedPrimitive { .. }) => {
|
} else if base_offset % 4 == 0 && *size == 4 {
|
||||||
todo!("loading referenced primitives")
|
ASM::mov_freg32_base32(buf, reg, *base_offset);
|
||||||
|
} else {
|
||||||
|
todo!("loading referenced primitives")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Stack(Complex { .. }) => {
|
Stack(Complex { .. }) => {
|
||||||
internal_error!("Cannot load large values into float registers: {}", sym)
|
internal_error!("Cannot load large values into float registers: {}", sym)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#![allow(clippy::redundant_closure_call)]
|
||||||
|
//|> clippy false positive: https://github.com/rust-lang/rust-clippy/issues/1553
|
||||||
|
|
||||||
use crate::generic64::{storage::StorageManager, Assembler, CallConv, RegTrait};
|
use crate::generic64::{storage::StorageManager, Assembler, CallConv, RegTrait};
|
||||||
use crate::{
|
use crate::{
|
||||||
pointer_layouts, single_register_floats, single_register_int_builtins,
|
pointer_layouts, single_register_floats, single_register_int_builtins,
|
||||||
|
@ -2433,6 +2436,11 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
|
||||||
movsd_freg64_base64_offset32(buf, dst, X86_64GeneralReg::RBP, offset)
|
movsd_freg64_base64_offset32(buf, dst, X86_64GeneralReg::RBP, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
fn mov_freg32_base32(buf: &mut Vec<'_, u8>, dst: X86_64FloatReg, offset: i32) {
|
||||||
|
movss_freg32_base32_offset32(buf, dst, X86_64GeneralReg::RBP, offset)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn mov_reg_base32(
|
fn mov_reg_base32(
|
||||||
buf: &mut Vec<'_, u8>,
|
buf: &mut Vec<'_, u8>,
|
||||||
|
|
|
@ -2019,6 +2019,23 @@ trait Backend<'a> {
|
||||||
self.build_num_cmp(sym, &args[0], &args[1], &arg_layouts[0]);
|
self.build_num_cmp(sym, &args[0], &args[1], &arg_layouts[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LowLevel::NumToFloatCast => {
|
||||||
|
let float_width = match *ret_layout {
|
||||||
|
Layout::F64 => FloatWidth::F64,
|
||||||
|
Layout::F32 => FloatWidth::F32,
|
||||||
|
_ => unreachable!("invalid return layout for NumToFloatCast"),
|
||||||
|
};
|
||||||
|
|
||||||
|
match arg_layouts[0].try_to_int_width() {
|
||||||
|
Some(int_width) => {
|
||||||
|
self.build_int_to_float_cast(sym, &args[0], int_width, float_width);
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
self.build_num_to_frac(sym, &args[0], &arg_layouts[0], ret_layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
x => todo!("low level, {:?}", x),
|
x => todo!("low level, {:?}", x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2135,6 +2152,14 @@ trait Backend<'a> {
|
||||||
target: IntWidth,
|
target: IntWidth,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fn build_int_to_float_cast(
|
||||||
|
&mut self,
|
||||||
|
dst: &Symbol,
|
||||||
|
src: &Symbol,
|
||||||
|
int_width: IntWidth,
|
||||||
|
float_width: FloatWidth,
|
||||||
|
);
|
||||||
|
|
||||||
/// build_num_abs stores the absolute value of src into dst.
|
/// build_num_abs stores the absolute value of src into dst.
|
||||||
fn build_num_abs(&mut self, dst: &Symbol, src: &Symbol, layout: &InLayout<'a>);
|
fn build_num_abs(&mut self, dst: &Symbol, src: &Symbol, layout: &InLayout<'a>);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,28 @@ pub fn build_module<'a, 'r>(
|
||||||
layout_interner: &'r mut STLayoutInterner<'a>,
|
layout_interner: &'r mut STLayoutInterner<'a>,
|
||||||
target: &Triple,
|
target: &Triple,
|
||||||
procedures: MutMap<(symbol::Symbol, ProcLayout<'a>), Proc<'a>>,
|
procedures: MutMap<(symbol::Symbol, ProcLayout<'a>), Proc<'a>>,
|
||||||
|
) -> Object<'a> {
|
||||||
|
let module_object = build_module_help(env, interns, layout_interner, target, procedures);
|
||||||
|
|
||||||
|
if std::env::var("ROC_DEV_WRITE_OBJ").is_ok() {
|
||||||
|
let module_out = module_object
|
||||||
|
.write()
|
||||||
|
.expect("failed to build output object");
|
||||||
|
|
||||||
|
let file_path = std::env::temp_dir().join("app.o");
|
||||||
|
println!("gen-test object file written to {}", file_path.display());
|
||||||
|
std::fs::write(&file_path, module_out).expect("failed to write object to file");
|
||||||
|
}
|
||||||
|
|
||||||
|
module_object
|
||||||
|
}
|
||||||
|
|
||||||
|
fn build_module_help<'a, 'r>(
|
||||||
|
env: &'r Env<'a>,
|
||||||
|
interns: &'r mut Interns,
|
||||||
|
layout_interner: &'r mut STLayoutInterner<'a>,
|
||||||
|
target: &Triple,
|
||||||
|
procedures: MutMap<(symbol::Symbol, ProcLayout<'a>), Proc<'a>>,
|
||||||
) -> Object<'a> {
|
) -> Object<'a> {
|
||||||
match target {
|
match target {
|
||||||
Triple {
|
Triple {
|
||||||
|
|
|
@ -4903,10 +4903,8 @@ fn expose_function_to_host_help_c_abi_v2<'a, 'ctx>(
|
||||||
Attribute::get_named_enum_kind_id("byval"),
|
Attribute::get_named_enum_kind_id("byval"),
|
||||||
c_abi_type.as_any_type_enum(),
|
c_abi_type.as_any_type_enum(),
|
||||||
);
|
);
|
||||||
let nonnull = context.create_type_attribute(
|
let nonnull = context
|
||||||
Attribute::get_named_enum_kind_id("nonnull"),
|
.create_enum_attribute(Attribute::get_named_enum_kind_id("nonnull"), 0);
|
||||||
c_abi_type.as_any_type_enum(),
|
|
||||||
);
|
|
||||||
// C return pointer goes at the beginning of params, and we must skip it if it exists.
|
// C return pointer goes at the beginning of params, and we must skip it if it exists.
|
||||||
let returns_pointer = matches!(cc_return, CCReturn::ByPointer);
|
let returns_pointer = matches!(cc_return, CCReturn::ByPointer);
|
||||||
let param_index = i as u32 + returns_pointer as u32;
|
let param_index = i as u32 + returns_pointer as u32;
|
||||||
|
|
|
@ -128,7 +128,7 @@ macro_rules! run_jit_function {
|
||||||
Err((error_msg, _)) => {
|
Err((error_msg, _)) => {
|
||||||
eprintln!("This Roc code crashed with: \"{error_msg}\"");
|
eprintln!("This Roc code crashed with: \"{error_msg}\"");
|
||||||
|
|
||||||
Expr::MalformedClosure
|
Expr::REPL_RUNTIME_CRASH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
|
@ -165,10 +165,10 @@ macro_rules! run_jit_function_dynamic_type {
|
||||||
let result = Result::from(call_result);
|
let result = Result::from(call_result);
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(()) => $transform(output.add(CALL_RESULT_WIDTH) as usize),
|
Ok(()) => Some($transform(output.add(CALL_RESULT_WIDTH) as usize)),
|
||||||
Err((msg, _crash_tag)) => {
|
Err((error_msg, _)) => {
|
||||||
eprintln!("{}", msg);
|
eprintln!("This Roc code crashed with: \"{error_msg}\"");
|
||||||
panic!("Roc hit an error");
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,13 @@ macro_rules! impl_to_from_int_width {
|
||||||
_ => roc_error_macros::internal_error!("not an integer layout!")
|
_ => roc_error_macros::internal_error!("not an integer layout!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn try_to_int_width(&self) -> Option<IntWidth> {
|
||||||
|
match self {
|
||||||
|
$(&$layout => Some($int_width),)*
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1296,6 +1296,16 @@ impl<'a> Spaceable<'a> for ImplementsAbilities<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Expr<'a> {
|
impl<'a> Expr<'a> {
|
||||||
|
pub const REPL_OPAQUE_FUNCTION: Self = Expr::Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "<function>",
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const REPL_RUNTIME_CRASH: Self = Expr::Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "*",
|
||||||
|
};
|
||||||
|
|
||||||
pub fn loc_ref(&'a self, region: Region) -> Loc<&'a Self> {
|
pub fn loc_ref(&'a self, region: Region) -> Loc<&'a Self> {
|
||||||
Loc {
|
Loc {
|
||||||
region,
|
region,
|
||||||
|
|
|
@ -173,6 +173,8 @@ pub fn parse_str_like_literal<'a>() -> impl Parser<'a, StrLikeLiteral<'a>, EStri
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut preceded_by_dollar = false;
|
||||||
|
|
||||||
while let Some(&byte) = bytes.next() {
|
while let Some(&byte) = bytes.next() {
|
||||||
// This is for the byte we just grabbed from the iterator.
|
// This is for the byte we just grabbed from the iterator.
|
||||||
segment_parsed_bytes += 1;
|
segment_parsed_bytes += 1;
|
||||||
|
@ -349,68 +351,6 @@ pub fn parse_str_like_literal<'a>() -> impl Parser<'a, StrLikeLiteral<'a>, EStri
|
||||||
return Err((MadeProgress, EString::EndlessSingleLine(start_state.pos())));
|
return Err((MadeProgress, EString::EndlessSingleLine(start_state.pos())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b'$' if !is_single_quote => {
|
|
||||||
// This is for the byte we're about to parse.
|
|
||||||
segment_parsed_bytes += 1;
|
|
||||||
|
|
||||||
// iff the '$' is followed by '(', this is string interpolation.
|
|
||||||
if let Some(b'(') = bytes.next() {
|
|
||||||
// We're about to begin string interpolation!
|
|
||||||
//
|
|
||||||
// End the previous segment so we can begin a new one.
|
|
||||||
// Retroactively end it right before the `$` char we parsed.
|
|
||||||
// (We can't use end_segment! here because it ends it right after
|
|
||||||
// the just-parsed character, which here would be '(' rather than '$')
|
|
||||||
// Don't push anything if the string would be empty.
|
|
||||||
if segment_parsed_bytes > 2 {
|
|
||||||
// exclude the 2 chars we just parsed, namely '$' and '('
|
|
||||||
let string_bytes = &state.bytes()[0..(segment_parsed_bytes - 2)];
|
|
||||||
|
|
||||||
match std::str::from_utf8(string_bytes) {
|
|
||||||
Ok(string) => {
|
|
||||||
state.advance_mut(string.len());
|
|
||||||
|
|
||||||
segments.push(StrSegment::Plaintext(string));
|
|
||||||
}
|
|
||||||
Err(_) => {
|
|
||||||
return Err((
|
|
||||||
MadeProgress,
|
|
||||||
EString::Space(BadInputError::BadUtf8, state.pos()),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Advance past the `$(`
|
|
||||||
state.advance_mut(2);
|
|
||||||
|
|
||||||
let original_byte_count = state.bytes().len();
|
|
||||||
|
|
||||||
// Parse an arbitrary expression, followed by ')'
|
|
||||||
let (_progress, loc_expr, new_state) = skip_second!(
|
|
||||||
specialize_ref(
|
|
||||||
EString::Format,
|
|
||||||
loc(allocated(reset_min_indent(expr::expr_help())))
|
|
||||||
),
|
|
||||||
word1(b')', EString::FormatEnd)
|
|
||||||
)
|
|
||||||
.parse(arena, state, min_indent)?;
|
|
||||||
|
|
||||||
// Advance the iterator past the expr we just parsed.
|
|
||||||
for _ in 0..(original_byte_count - new_state.bytes().len()) {
|
|
||||||
bytes.next();
|
|
||||||
}
|
|
||||||
|
|
||||||
segments.push(StrSegment::Interpolated(loc_expr));
|
|
||||||
|
|
||||||
// Reset the segment
|
|
||||||
segment_parsed_bytes = 0;
|
|
||||||
state = new_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the '$' wasn't followed by '(', then this wasn't interpolation,
|
|
||||||
// and we don't need to do anything special.
|
|
||||||
}
|
|
||||||
b'\\' => {
|
b'\\' => {
|
||||||
// We're about to begin an escaped segment of some sort!
|
// We're about to begin an escaped segment of some sort!
|
||||||
//
|
//
|
||||||
|
@ -510,10 +450,67 @@ pub fn parse_str_like_literal<'a>() -> impl Parser<'a, StrLikeLiteral<'a>, EStri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
b'(' if preceded_by_dollar && !is_single_quote => {
|
||||||
|
// We're about to begin string interpolation!
|
||||||
|
//
|
||||||
|
// End the previous segment so we can begin a new one.
|
||||||
|
// Retroactively end it right before the `$` char we parsed.
|
||||||
|
// (We can't use end_segment! here because it ends it right after
|
||||||
|
// the just-parsed character, which here would be '(' rather than '$')
|
||||||
|
// Don't push anything if the string would be empty.
|
||||||
|
if segment_parsed_bytes > 2 {
|
||||||
|
// exclude the 2 chars we just parsed, namely '$' and '('
|
||||||
|
let string_bytes = &state.bytes()[0..(segment_parsed_bytes - 2)];
|
||||||
|
|
||||||
|
match std::str::from_utf8(string_bytes) {
|
||||||
|
Ok(string) => {
|
||||||
|
state.advance_mut(string.len());
|
||||||
|
|
||||||
|
segments.push(StrSegment::Plaintext(string));
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
return Err((
|
||||||
|
MadeProgress,
|
||||||
|
EString::Space(BadInputError::BadUtf8, state.pos()),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Advance past the `$(`
|
||||||
|
state.advance_mut(2);
|
||||||
|
|
||||||
|
let original_byte_count = state.bytes().len();
|
||||||
|
|
||||||
|
// Parse an arbitrary expression, followed by ')'
|
||||||
|
let (_progress, loc_expr, new_state) = skip_second!(
|
||||||
|
specialize_ref(
|
||||||
|
EString::Format,
|
||||||
|
loc(allocated(reset_min_indent(expr::expr_help())))
|
||||||
|
),
|
||||||
|
word1(b')', EString::FormatEnd)
|
||||||
|
)
|
||||||
|
.parse(arena, state, min_indent)?;
|
||||||
|
|
||||||
|
// Advance the iterator past the expr we just parsed.
|
||||||
|
for _ in 0..(original_byte_count - new_state.bytes().len()) {
|
||||||
|
bytes.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
segments.push(StrSegment::Interpolated(loc_expr));
|
||||||
|
|
||||||
|
// Reset the segment
|
||||||
|
segment_parsed_bytes = 0;
|
||||||
|
state = new_state;
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
// All other characters need no special handling.
|
// All other characters need no special handling.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// iff the '$' is followed by '(', this is string interpolation.
|
||||||
|
// We'll check for the '(' on the next iteration of the loop.
|
||||||
|
preceded_by_dollar = byte == b'$';
|
||||||
}
|
}
|
||||||
|
|
||||||
// We ran out of characters before finding a closed quote
|
// We ran out of characters before finding a closed quote
|
||||||
|
|
|
@ -200,6 +200,36 @@ mod test_parse {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn string_of_just_dollar_sign() {
|
||||||
|
let arena = Bump::new();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
Ok(Expr::Str(PlainLine("$"))),
|
||||||
|
parse_expr_with(&arena, arena.alloc(r#""$""#))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn string_beginning_with_dollar() {
|
||||||
|
let arena = Bump::new();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
Ok(Expr::Str(PlainLine("$foo"))),
|
||||||
|
parse_expr_with(&arena, arena.alloc(r#""$foo""#))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn string_ending_with_dollar() {
|
||||||
|
let arena = Bump::new();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
Ok(Expr::Str(PlainLine("foo$"))),
|
||||||
|
parse_expr_with(&arena, arena.alloc(r#""foo$""#))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn string_with_interpolation_in_back() {
|
fn string_with_interpolation_in_back() {
|
||||||
assert_segments(r#""Hello $(name)""#, |arena| {
|
assert_segments(r#""Hello $(name)""#, |arena| {
|
||||||
|
|
|
@ -821,6 +821,30 @@ fn list_append_longer_list() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||||
|
fn list_append_record() {
|
||||||
|
assert_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
[
|
||||||
|
{ name: "foo", content: "cfoo" },
|
||||||
|
{ name: "bar", content: "cbar" },
|
||||||
|
{ name: "baz", content: "cbaz" },
|
||||||
|
]
|
||||||
|
|> List.append { name: "spam", content: "cspam" }
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
RocList::from_slice(&[
|
||||||
|
(RocStr::from("cfoo"), RocStr::from("foo"),),
|
||||||
|
(RocStr::from("cbar"), RocStr::from("bar"),),
|
||||||
|
(RocStr::from("cbaz"), RocStr::from("baz"),),
|
||||||
|
(RocStr::from("cspam"), RocStr::from("spam"),),
|
||||||
|
]),
|
||||||
|
RocList<(RocStr, RocStr)>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||||
fn list_prepend() {
|
fn list_prepend() {
|
||||||
|
|
|
@ -15,7 +15,7 @@ use roc_std::{RocDec, RocOrder, RocResult};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
|
||||||
fn nat_alias() {
|
fn u64_alias() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
r"
|
r"
|
||||||
|
@ -2313,7 +2313,7 @@ num_conversion_tests! {
|
||||||
to_i64_truncate_wraps, "10_000_000_000_000_000_000i128", -8446744073709551616
|
to_i64_truncate_wraps, "10_000_000_000_000_000_000i128", -8446744073709551616
|
||||||
)
|
)
|
||||||
"Num.toI128", i128, (
|
"Num.toI128", i128, (
|
||||||
to_i128_same_width, "15u128", 15
|
to_i128_same_width, "15u128", 15, ["gen-dev"]
|
||||||
to_i128_extend, "15i8", 15
|
to_i128_extend, "15i8", 15
|
||||||
)
|
)
|
||||||
"Num.toU8", u8, (
|
"Num.toU8", u8, (
|
||||||
|
@ -2340,36 +2340,37 @@ num_conversion_tests! {
|
||||||
to_u64_truncate_wraps, "10_000_000_000_000_000_000_000i128", 1864712049423024128
|
to_u64_truncate_wraps, "10_000_000_000_000_000_000_000i128", 1864712049423024128
|
||||||
)
|
)
|
||||||
"Num.toU128", u128, (
|
"Num.toU128", u128, (
|
||||||
to_u128_same_width, "15i128", 15
|
to_u128_same_width, "15i128", 15, ["gen-dev"]
|
||||||
to_u128_extend, "15i8", 15
|
to_u128_extend, "15i8", 15
|
||||||
|
to_u128_big, "11562537357600483583u64", 11562537357600483583, ["gen-dev"]
|
||||||
)
|
)
|
||||||
"Num.toF32", f32, (
|
"Num.toF32", f32, (
|
||||||
to_f32_from_i8, "15i8", 15.0
|
to_f32_from_i8, "15i8", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_i16, "15i16", 15.0
|
to_f32_from_i16, "15i16", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_i32, "15i32", 15.0
|
to_f32_from_i32, "15i32", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_i64, "15i64", 15.0
|
to_f32_from_i64, "15i64", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_i128, "15i128", 15.0
|
to_f32_from_i128, "15i128", 15.0, ["gen-dev"]
|
||||||
to_f32_from_u8, "15u8", 15.0
|
to_f32_from_u8, "15u8", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_u16, "15u16", 15.0
|
to_f32_from_u16, "15u16", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_u32, "15u32", 15.0
|
to_f32_from_u32, "15u32", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_u64, "15u64", 15.0
|
to_f32_from_u64, "15u64", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_u128, "15u128", 15.0
|
to_f32_from_u128, "15u128", 15.0, ["gen-dev"]
|
||||||
to_f32_from_f32, "1.5f32", 1.5
|
to_f32_from_f32, "1.5f32", 1.5, ["gen-wasm", "gen-dev"]
|
||||||
to_f32_from_f64, "1.5f64", 1.5
|
to_f32_from_f64, "1.5f64", 1.5, ["gen-wasm", "gen-dev"]
|
||||||
)
|
)
|
||||||
"Num.toF64", f64, (
|
"Num.toF64", f64, (
|
||||||
to_f64_from_i8, "15i8", 15.0
|
to_f64_from_i8, "15i8", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_i16, "15i16", 15.0
|
to_f64_from_i16, "15i16", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_i32, "15i32", 15.0
|
to_f64_from_i32, "15i32", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_i64, "15i64", 15.0
|
to_f64_from_i64, "15i64", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_i128, "15i128", 15.0
|
to_f64_from_i128, "15i128", 15.0, ["gen-dev"]
|
||||||
to_f64_from_u8, "15u8", 15.0
|
to_f64_from_u8, "15u8", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_u16, "15u16", 15.0
|
to_f64_from_u16, "15u16", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_u32, "15u32", 15.0
|
to_f64_from_u32, "15u32", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_u64, "15u64", 15.0
|
to_f64_from_u64, "15u64", 15.0, ["gen-wasm", "gen-dev"]
|
||||||
to_f64_from_u128, "15u128", 15.0
|
to_f64_from_u128, "15u128", 15.0, ["gen-dev"]
|
||||||
to_f64_from_f32, "1.5f32", 1.5
|
to_f64_from_f32, "1.5f32", 1.5, ["gen-dev"]
|
||||||
to_f64_from_f64, "1.5f64", 1.5
|
to_f64_from_f64, "1.5f64", 1.5, ["gen-wasm", "gen-dev"]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3103,7 +3104,7 @@ fn monomorphized_ints_aliased() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||||
fn to_float_f32() {
|
fn to_float_f32() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
|
@ -3122,7 +3123,7 @@ fn to_float_f32() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||||
fn to_float_f64() {
|
fn to_float_f64() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
|
|
|
@ -1741,11 +1741,11 @@ fn str_walk_utf8() {
|
||||||
assert_evals_to!(
|
assert_evals_to!(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
Str.walkUtf8WithIndex "abcd" [] (\list, byte, index -> List.append list (Pair index byte))
|
Str.walkUtf8 "abcd" [] (\list, byte -> List.prepend list byte)
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
RocList::from_slice(&[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd')]),
|
RocList::from_slice(&[b'd', b'c', b'b', b'a']),
|
||||||
RocList<(u32, char)>
|
RocList<u8>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,12 +215,6 @@ pub fn helper(
|
||||||
let builtins_host_tempfile =
|
let builtins_host_tempfile =
|
||||||
roc_bitcode::host_tempfile().expect("failed to write host builtins object to tempfile");
|
roc_bitcode::host_tempfile().expect("failed to write host builtins object to tempfile");
|
||||||
|
|
||||||
if std::env::var("ROC_DEV_WRITE_OBJ").is_ok() {
|
|
||||||
let file_path = std::env::temp_dir().join("app.o");
|
|
||||||
println!("gen-test object file written to {}", file_path.display());
|
|
||||||
std::fs::copy(&app_o_file, file_path).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
let (mut child, dylib_path) = link(
|
let (mut child, dylib_path) = link(
|
||||||
&target,
|
&target,
|
||||||
app_o_file.clone(),
|
app_o_file.clone(),
|
||||||
|
|
|
@ -45,8 +45,8 @@ procedure Dict.1 (Dict.723):
|
||||||
|
|
||||||
procedure Dict.10 (Dict.724, Dict.179, Dict.180):
|
procedure Dict.10 (Dict.724, Dict.179, Dict.180):
|
||||||
let Dict.178 : List {Str, I64} = StructAtIndex 1 Dict.724;
|
let Dict.178 : List {Str, I64} = StructAtIndex 1 Dict.724;
|
||||||
let #Derived_gen.71 : List {U32, U32} = StructAtIndex 0 Dict.724;
|
let #Derived_gen.66 : List {U32, U32} = StructAtIndex 0 Dict.724;
|
||||||
dec #Derived_gen.71;
|
dec #Derived_gen.66;
|
||||||
let Dict.1101 : {Str, Int1} = CallByName List.18 Dict.178 Dict.179 Dict.180;
|
let Dict.1101 : {Str, Int1} = CallByName List.18 Dict.178 Dict.179 Dict.180;
|
||||||
ret Dict.1101;
|
ret Dict.1101;
|
||||||
|
|
||||||
|
@ -79,10 +79,10 @@ procedure Dict.181 (Dict.182, Dict.1103, Dict.180):
|
||||||
|
|
||||||
procedure Dict.20 (Dict.720):
|
procedure Dict.20 (Dict.720):
|
||||||
let Dict.148 : U64 = StructAtIndex 2 Dict.720;
|
let Dict.148 : U64 = StructAtIndex 2 Dict.720;
|
||||||
let #Derived_gen.69 : List {U32, U32} = StructAtIndex 0 Dict.720;
|
let #Derived_gen.70 : List {U32, U32} = StructAtIndex 0 Dict.720;
|
||||||
|
dec #Derived_gen.70;
|
||||||
|
let #Derived_gen.69 : List {Str, I64} = StructAtIndex 1 Dict.720;
|
||||||
dec #Derived_gen.69;
|
dec #Derived_gen.69;
|
||||||
let #Derived_gen.68 : List {Str, I64} = StructAtIndex 1 Dict.720;
|
|
||||||
dec #Derived_gen.68;
|
|
||||||
ret Dict.148;
|
ret Dict.148;
|
||||||
|
|
||||||
procedure Dict.22 (#Attr.2, #Attr.3):
|
procedure Dict.22 (#Attr.2, #Attr.3):
|
||||||
|
@ -105,7 +105,7 @@ procedure Dict.36 (Dict.119):
|
||||||
let Dict.1093 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Inspect.30 Dict.119;
|
let Dict.1093 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Inspect.30 Dict.119;
|
||||||
ret Dict.1093;
|
ret Dict.1093;
|
||||||
|
|
||||||
procedure Dict.38 (#Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8, #Derived_gen.9, #Derived_gen.10):
|
procedure Dict.38 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8):
|
||||||
joinpoint Dict.736 Dict.221 Dict.222 Dict.223 Dict.224 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229:
|
joinpoint Dict.736 Dict.221 Dict.222 Dict.223 Dict.224 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229:
|
||||||
let Dict.230 : {U32, U32} = CallByName Dict.22 Dict.221 Dict.223;
|
let Dict.230 : {U32, U32} = CallByName Dict.22 Dict.221 Dict.223;
|
||||||
let Dict.783 : U32 = StructAtIndex 1 Dict.230;
|
let Dict.783 : U32 = StructAtIndex 1 Dict.230;
|
||||||
|
@ -148,7 +148,7 @@ procedure Dict.38 (#Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.
|
||||||
let Dict.239 : U32 = CallByName Dict.48 Dict.224;
|
let Dict.239 : U32 = CallByName Dict.48 Dict.224;
|
||||||
jump Dict.736 Dict.221 Dict.222 Dict.238 Dict.239 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229;
|
jump Dict.736 Dict.221 Dict.222 Dict.238 Dict.239 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229;
|
||||||
in
|
in
|
||||||
jump Dict.736 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10;
|
jump Dict.736 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8;
|
||||||
|
|
||||||
procedure Dict.398 (Dict.399, Dict.840, Dict.401, Dict.397):
|
procedure Dict.398 (Dict.399, Dict.840, Dict.401, Dict.397):
|
||||||
let Dict.400 : Str = StructAtIndex 0 Dict.840;
|
let Dict.400 : Str = StructAtIndex 0 Dict.840;
|
||||||
|
@ -163,8 +163,8 @@ procedure Dict.398 (Dict.399, Dict.840, Dict.401, Dict.397):
|
||||||
|
|
||||||
procedure Dict.4 (Dict.729):
|
procedure Dict.4 (Dict.729):
|
||||||
let Dict.156 : List {Str, I64} = StructAtIndex 1 Dict.729;
|
let Dict.156 : List {Str, I64} = StructAtIndex 1 Dict.729;
|
||||||
let #Derived_gen.66 : List {U32, U32} = StructAtIndex 0 Dict.729;
|
let #Derived_gen.67 : List {U32, U32} = StructAtIndex 0 Dict.729;
|
||||||
dec #Derived_gen.66;
|
dec #Derived_gen.67;
|
||||||
let Dict.882 : U64 = CallByName List.6 Dict.156;
|
let Dict.882 : U64 = CallByName List.6 Dict.156;
|
||||||
dec Dict.156;
|
dec Dict.156;
|
||||||
ret Dict.882;
|
ret Dict.882;
|
||||||
|
@ -217,8 +217,8 @@ procedure Dict.59 (Dict.719):
|
||||||
let Dict.377 : U64 = StructAtIndex 2 Dict.719;
|
let Dict.377 : U64 = StructAtIndex 2 Dict.719;
|
||||||
let Dict.378 : Float32 = StructAtIndex 3 Dict.719;
|
let Dict.378 : Float32 = StructAtIndex 3 Dict.719;
|
||||||
let Dict.379 : U8 = StructAtIndex 4 Dict.719;
|
let Dict.379 : U8 = StructAtIndex 4 Dict.719;
|
||||||
let #Derived_gen.67 : List {U32, U32} = StructAtIndex 0 Dict.719;
|
let #Derived_gen.68 : List {U32, U32} = StructAtIndex 0 Dict.719;
|
||||||
dec #Derived_gen.67;
|
dec #Derived_gen.68;
|
||||||
let Dict.877 : U64 = CallByName Dict.47;
|
let Dict.877 : U64 = CallByName Dict.47;
|
||||||
let Dict.836 : Int1 = CallByName Bool.7 Dict.377 Dict.877;
|
let Dict.836 : Int1 = CallByName Bool.7 Dict.377 Dict.877;
|
||||||
if Dict.836 then
|
if Dict.836 then
|
||||||
|
@ -283,7 +283,7 @@ procedure Dict.65 (Dict.404, Dict.405, Dict.406):
|
||||||
let Dict.846 : {U64, U32} = CallByName Dict.66 Dict.404 Dict.409 Dict.408;
|
let Dict.846 : {U64, U32} = CallByName Dict.66 Dict.404 Dict.409 Dict.408;
|
||||||
ret Dict.846;
|
ret Dict.846;
|
||||||
|
|
||||||
procedure Dict.66 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13):
|
procedure Dict.66 (#Derived_gen.9, #Derived_gen.10, #Derived_gen.11):
|
||||||
joinpoint Dict.847 Dict.410 Dict.411 Dict.412:
|
joinpoint Dict.847 Dict.410 Dict.411 Dict.412:
|
||||||
let Dict.413 : {U32, U32} = CallByName Dict.22 Dict.410 Dict.411;
|
let Dict.413 : {U32, U32} = CallByName Dict.22 Dict.410 Dict.411;
|
||||||
let Dict.854 : U32 = StructAtIndex 1 Dict.413;
|
let Dict.854 : U32 = StructAtIndex 1 Dict.413;
|
||||||
|
@ -298,9 +298,9 @@ procedure Dict.66 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13):
|
||||||
let Dict.848 : {U64, U32} = Struct {Dict.411, Dict.412};
|
let Dict.848 : {U64, U32} = Struct {Dict.411, Dict.412};
|
||||||
ret Dict.848;
|
ret Dict.848;
|
||||||
in
|
in
|
||||||
jump Dict.847 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13;
|
jump Dict.847 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11;
|
||||||
|
|
||||||
procedure Dict.67 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32):
|
procedure Dict.67 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27):
|
||||||
joinpoint Dict.753 Dict.414 Dict.415 Dict.416:
|
joinpoint Dict.753 Dict.414 Dict.415 Dict.416:
|
||||||
let Dict.417 : {U32, U32} = CallByName Dict.22 Dict.414 Dict.416;
|
let Dict.417 : {U32, U32} = CallByName Dict.22 Dict.414 Dict.416;
|
||||||
let Dict.763 : U32 = StructAtIndex 1 Dict.417;
|
let Dict.763 : U32 = StructAtIndex 1 Dict.417;
|
||||||
|
@ -319,7 +319,7 @@ procedure Dict.67 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32):
|
||||||
let Dict.754 : List {U32, U32} = CallByName List.3 Dict.414 Dict.416 Dict.415;
|
let Dict.754 : List {U32, U32} = CallByName List.3 Dict.414 Dict.416 Dict.415;
|
||||||
ret Dict.754;
|
ret Dict.754;
|
||||||
in
|
in
|
||||||
jump Dict.753 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32;
|
jump Dict.753 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27;
|
||||||
|
|
||||||
procedure Dict.68 (Dict.419, Dict.420):
|
procedure Dict.68 (Dict.419, Dict.420):
|
||||||
let Dict.749 : U64 = 1i64;
|
let Dict.749 : U64 = 1i64;
|
||||||
|
@ -500,7 +500,7 @@ procedure Dict.82 (Dict.702, Dict.480):
|
||||||
let Dict.917 : {U64, U64, U64} = CallByName Dict.83 Dict.478 Dict.478 Dict.478 Dict.480 Dict.919 Dict.481;
|
let Dict.917 : {U64, U64, U64} = CallByName Dict.83 Dict.478 Dict.478 Dict.478 Dict.480 Dict.919 Dict.481;
|
||||||
jump Dict.918 Dict.917;
|
jump Dict.918 Dict.917;
|
||||||
|
|
||||||
procedure Dict.83 (#Derived_gen.58, #Derived_gen.59, #Derived_gen.60, #Derived_gen.61, #Derived_gen.62, #Derived_gen.63):
|
procedure Dict.83 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37, #Derived_gen.38):
|
||||||
joinpoint Dict.920 Dict.486 Dict.487 Dict.488 Dict.489 Dict.490 Dict.491:
|
joinpoint Dict.920 Dict.486 Dict.487 Dict.488 Dict.489 Dict.490 Dict.491:
|
||||||
inc 6 Dict.489;
|
inc 6 Dict.489;
|
||||||
let Dict.1027 : U64 = CallByName Dict.91 Dict.489 Dict.490;
|
let Dict.1027 : U64 = CallByName Dict.91 Dict.489 Dict.490;
|
||||||
|
@ -562,9 +562,9 @@ procedure Dict.83 (#Derived_gen.58, #Derived_gen.59, #Derived_gen.60, #Derived_g
|
||||||
let Dict.921 : {U64, U64, U64} = Struct {Dict.922, Dict.923, Dict.498};
|
let Dict.921 : {U64, U64, U64} = Struct {Dict.922, Dict.923, Dict.498};
|
||||||
ret Dict.921;
|
ret Dict.921;
|
||||||
in
|
in
|
||||||
jump Dict.920 #Derived_gen.58 #Derived_gen.59 #Derived_gen.60 #Derived_gen.61 #Derived_gen.62 #Derived_gen.63;
|
jump Dict.920 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38;
|
||||||
|
|
||||||
procedure Dict.84 (#Derived_gen.49, #Derived_gen.50, #Derived_gen.51, #Derived_gen.52):
|
procedure Dict.84 (#Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44):
|
||||||
joinpoint Dict.973 Dict.499 Dict.500 Dict.501 Dict.502:
|
joinpoint Dict.973 Dict.499 Dict.500 Dict.501 Dict.502:
|
||||||
inc 2 Dict.500;
|
inc 2 Dict.500;
|
||||||
let Dict.993 : U64 = CallByName Dict.91 Dict.500 Dict.501;
|
let Dict.993 : U64 = CallByName Dict.91 Dict.500 Dict.501;
|
||||||
|
@ -596,7 +596,7 @@ procedure Dict.84 (#Derived_gen.49, #Derived_gen.50, #Derived_gen.51, #Derived_g
|
||||||
else
|
else
|
||||||
jump Dict.973 Dict.503 Dict.500 Dict.505 Dict.504;
|
jump Dict.973 Dict.503 Dict.500 Dict.505 Dict.504;
|
||||||
in
|
in
|
||||||
jump Dict.973 #Derived_gen.49 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52;
|
jump Dict.973 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44;
|
||||||
|
|
||||||
procedure Dict.85 ():
|
procedure Dict.85 ():
|
||||||
let Dict.910 : U64 = 11562461410679940143i64;
|
let Dict.910 : U64 = 11562461410679940143i64;
|
||||||
|
@ -624,7 +624,7 @@ procedure Dict.89 (Dict.506, Dict.507):
|
||||||
procedure Dict.90 (Dict.510, Dict.511):
|
procedure Dict.90 (Dict.510, Dict.511):
|
||||||
let Dict.902 : U128 = CallByName Num.135 Dict.510;
|
let Dict.902 : U128 = CallByName Num.135 Dict.510;
|
||||||
let Dict.903 : U128 = CallByName Num.135 Dict.511;
|
let Dict.903 : U128 = CallByName Num.135 Dict.511;
|
||||||
let Dict.512 : U128 = CallByName Num.21 Dict.902 Dict.903;
|
let Dict.512 : U128 = CallByName Num.78 Dict.902 Dict.903;
|
||||||
let Dict.513 : U64 = CallByName Num.133 Dict.512;
|
let Dict.513 : U64 = CallByName Num.133 Dict.512;
|
||||||
let Dict.901 : U8 = 64i64;
|
let Dict.901 : U8 = 64i64;
|
||||||
let Dict.900 : U128 = CallByName Num.74 Dict.512 Dict.901;
|
let Dict.900 : U128 = CallByName Num.74 Dict.512 Dict.901;
|
||||||
|
@ -905,8 +905,8 @@ procedure List.3 (List.114, List.115, List.116):
|
||||||
procedure List.3 (List.114, List.115, List.116):
|
procedure List.3 (List.114, List.115, List.116):
|
||||||
let List.599 : {List {Str, I64}, {Str, I64}} = CallByName List.64 List.114 List.115 List.116;
|
let List.599 : {List {Str, I64}, {Str, I64}} = CallByName List.64 List.114 List.115 List.116;
|
||||||
let List.598 : List {Str, I64} = StructAtIndex 0 List.599;
|
let List.598 : List {Str, I64} = StructAtIndex 0 List.599;
|
||||||
let #Derived_gen.70 : {Str, I64} = StructAtIndex 1 List.599;
|
let #Derived_gen.71 : {Str, I64} = StructAtIndex 1 List.599;
|
||||||
dec #Derived_gen.70;
|
dec #Derived_gen.71;
|
||||||
ret List.598;
|
ret List.598;
|
||||||
|
|
||||||
procedure List.4 (List.122, List.123):
|
procedure List.4 (List.122, List.123):
|
||||||
|
@ -981,7 +981,7 @@ procedure List.83 (List.167, List.168, List.169):
|
||||||
let List.610 : List {U32, U32} = CallByName List.91 List.167 List.168 List.169 List.611 List.612;
|
let List.610 : List {U32, U32} = CallByName List.91 List.167 List.168 List.169 List.611 List.612;
|
||||||
ret List.610;
|
ret List.610;
|
||||||
|
|
||||||
procedure List.88 (#Derived_gen.53, #Derived_gen.54, #Derived_gen.55):
|
procedure List.88 (#Derived_gen.55, #Derived_gen.56, #Derived_gen.57):
|
||||||
joinpoint List.622 List.138 List.139 List.140:
|
joinpoint List.622 List.138 List.139 List.140:
|
||||||
let List.630 : U64 = 0i64;
|
let List.630 : U64 = 0i64;
|
||||||
let List.624 : Int1 = CallByName Num.24 List.139 List.630;
|
let List.624 : Int1 = CallByName Num.24 List.139 List.630;
|
||||||
|
@ -993,9 +993,9 @@ procedure List.88 (#Derived_gen.53, #Derived_gen.54, #Derived_gen.55):
|
||||||
else
|
else
|
||||||
ret List.140;
|
ret List.140;
|
||||||
in
|
in
|
||||||
jump List.622 #Derived_gen.53 #Derived_gen.54 #Derived_gen.55;
|
jump List.622 #Derived_gen.55 #Derived_gen.56 #Derived_gen.57;
|
||||||
|
|
||||||
procedure List.90 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27):
|
procedure List.90 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24):
|
||||||
joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
|
joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
|
||||||
let List.576 : Int1 = CallByName Num.22 List.164 List.165;
|
let List.576 : Int1 = CallByName Num.22 List.164 List.165;
|
||||||
if List.576 then
|
if List.576 then
|
||||||
|
@ -1009,9 +1009,9 @@ procedure List.90 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_g
|
||||||
dec List.161;
|
dec List.161;
|
||||||
ret List.162;
|
ret List.162;
|
||||||
in
|
in
|
||||||
jump List.574 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27;
|
jump List.574 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24;
|
||||||
|
|
||||||
procedure List.90 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37):
|
procedure List.90 (#Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32):
|
||||||
joinpoint List.638 List.161 List.162 List.163 List.164 List.165:
|
joinpoint List.638 List.161 List.162 List.163 List.164 List.165:
|
||||||
let List.640 : Int1 = CallByName Num.22 List.164 List.165;
|
let List.640 : Int1 = CallByName Num.22 List.164 List.165;
|
||||||
if List.640 then
|
if List.640 then
|
||||||
|
@ -1025,9 +1025,9 @@ procedure List.90 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_g
|
||||||
dec List.161;
|
dec List.161;
|
||||||
ret List.162;
|
ret List.162;
|
||||||
in
|
in
|
||||||
jump List.638 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37;
|
jump List.638 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32;
|
||||||
|
|
||||||
procedure List.91 (#Derived_gen.44, #Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48):
|
procedure List.91 (#Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48, #Derived_gen.49):
|
||||||
joinpoint List.613 List.170 List.171 List.172 List.173 List.174:
|
joinpoint List.613 List.170 List.171 List.172 List.173 List.174:
|
||||||
let List.615 : Int1 = CallByName Num.22 List.173 List.174;
|
let List.615 : Int1 = CallByName Num.22 List.173 List.174;
|
||||||
if List.615 then
|
if List.615 then
|
||||||
|
@ -1041,7 +1041,7 @@ procedure List.91 (#Derived_gen.44, #Derived_gen.45, #Derived_gen.46, #Derived_g
|
||||||
dec List.170;
|
dec List.170;
|
||||||
ret List.171;
|
ret List.171;
|
||||||
in
|
in
|
||||||
jump List.613 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48;
|
jump List.613 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49;
|
||||||
|
|
||||||
procedure Num.131 (#Attr.2):
|
procedure Num.131 (#Attr.2):
|
||||||
let Num.265 : U32 = lowlevel NumIntCast #Attr.2;
|
let Num.265 : U32 = lowlevel NumIntCast #Attr.2;
|
||||||
|
@ -1075,16 +1075,12 @@ procedure Num.148 (Num.205, Num.206):
|
||||||
ret Num.206;
|
ret Num.206;
|
||||||
|
|
||||||
procedure Num.21 (#Attr.2, #Attr.3):
|
procedure Num.21 (#Attr.2, #Attr.3):
|
||||||
let Num.284 : Float32 = lowlevel NumMul #Attr.2 #Attr.3;
|
let Num.290 : Float32 = lowlevel NumMul #Attr.2 #Attr.3;
|
||||||
ret Num.284;
|
ret Num.290;
|
||||||
|
|
||||||
procedure Num.21 (#Attr.2, #Attr.3):
|
|
||||||
let Num.341 : U128 = lowlevel NumMul #Attr.2 #Attr.3;
|
|
||||||
ret Num.341;
|
|
||||||
|
|
||||||
procedure Num.22 (#Attr.2, #Attr.3):
|
procedure Num.22 (#Attr.2, #Attr.3):
|
||||||
let Num.288 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
|
let Num.287 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
|
||||||
ret Num.288;
|
ret Num.287;
|
||||||
|
|
||||||
procedure Num.22 (#Attr.2, #Attr.3):
|
procedure Num.22 (#Attr.2, #Attr.3):
|
||||||
let Num.416 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
|
let Num.416 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
|
||||||
|
@ -1107,8 +1103,8 @@ procedure Num.25 (#Attr.2, #Attr.3):
|
||||||
ret Num.413;
|
ret Num.413;
|
||||||
|
|
||||||
procedure Num.50 (#Attr.2):
|
procedure Num.50 (#Attr.2):
|
||||||
let Num.290 : U64 = lowlevel NumFloor #Attr.2;
|
let Num.289 : U64 = lowlevel NumFloor #Attr.2;
|
||||||
ret Num.290;
|
ret Num.289;
|
||||||
|
|
||||||
procedure Num.51 (#Attr.2, #Attr.3):
|
procedure Num.51 (#Attr.2, #Attr.3):
|
||||||
let Num.257 : U32 = lowlevel NumAddWrap #Attr.2 #Attr.3;
|
let Num.257 : U32 = lowlevel NumAddWrap #Attr.2 #Attr.3;
|
||||||
|
@ -1162,9 +1158,13 @@ procedure Num.75 (#Attr.2, #Attr.3):
|
||||||
let Num.406 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3;
|
let Num.406 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3;
|
||||||
ret Num.406;
|
ret Num.406;
|
||||||
|
|
||||||
|
procedure Num.78 (#Attr.2, #Attr.3):
|
||||||
|
let Num.341 : U128 = lowlevel NumMulWrap #Attr.2 #Attr.3;
|
||||||
|
ret Num.341;
|
||||||
|
|
||||||
procedure Num.96 (#Attr.2):
|
procedure Num.96 (#Attr.2):
|
||||||
let Num.287 : Str = lowlevel NumToStr #Attr.2;
|
let Num.286 : Str = lowlevel NumToStr #Attr.2;
|
||||||
ret Num.287;
|
ret Num.286;
|
||||||
|
|
||||||
procedure Num.96 (#Attr.2):
|
procedure Num.96 (#Attr.2):
|
||||||
let Num.414 : Str = lowlevel NumToStr #Attr.2;
|
let Num.414 : Str = lowlevel NumToStr #Attr.2;
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# ## not docs!
|
|
||||||
## docs, but with a problem
|
|
||||||
## (namely that this is a mix of docs and regular comments)
|
|
||||||
# not docs
|
|
||||||
x = 5
|
|
||||||
|
|
||||||
42
|
|
|
@ -1,7 +0,0 @@
|
||||||
# ######
|
|
||||||
# ## not docs!
|
|
||||||
# #still not docs
|
|
||||||
# #####
|
|
||||||
x = 5
|
|
||||||
|
|
||||||
42
|
|
|
@ -1611,7 +1611,7 @@ generateMultiElementSingleTagStruct = \buf, types, name, tagName, payloadFields,
|
||||||
}
|
}
|
||||||
|> \{ b, args, fields, fieldTypes, fieldAccesses } ->
|
|> \{ b, args, fields, fieldTypes, fieldAccesses } ->
|
||||||
argsStr = Str.joinWith args ", "
|
argsStr = Str.joinWith args ", "
|
||||||
fieldsStr = Str.joinWith fields "\n\(indent)\(indent)\(indent)"
|
fieldsStr = Str.joinWith fields ",\n\(indent)\(indent)\(indent)"
|
||||||
|
|
||||||
{
|
{
|
||||||
b: Str.concat
|
b: Str.concat
|
||||||
|
|
|
@ -4,6 +4,8 @@ app "zig-glue"
|
||||||
pf.Types.{ Types },
|
pf.Types.{ Types },
|
||||||
pf.File.{ File },
|
pf.File.{ File },
|
||||||
"../../compiler/builtins/bitcode/src/list.zig" as rocStdList : Str,
|
"../../compiler/builtins/bitcode/src/list.zig" as rocStdList : Str,
|
||||||
|
"../../compiler/builtins/bitcode/src/str.zig" as rocStdStr : Str,
|
||||||
|
"../../compiler/builtins/bitcode/src/utils.zig" as rocStdUtils : Str,
|
||||||
]
|
]
|
||||||
provides [makeGlue] to pf
|
provides [makeGlue] to pf
|
||||||
|
|
||||||
|
@ -18,10 +20,16 @@ makeGlue = \typesByArch ->
|
||||||
staticFiles : List File
|
staticFiles : List File
|
||||||
staticFiles = [
|
staticFiles = [
|
||||||
{ name: "list.zig", content: rocStdList },
|
{ name: "list.zig", content: rocStdList },
|
||||||
|
{ name: "str.zig", content: rocStdStr },
|
||||||
|
{ name: "utils.zig", content: rocStdUtils },
|
||||||
]
|
]
|
||||||
|
|
||||||
convertTypesToFile : Types -> File
|
convertTypesToFile : Types -> File
|
||||||
convertTypesToFile = \_ -> {
|
convertTypesToFile = \_ -> { name: "main.zig", content }
|
||||||
name: "glue.zig",
|
|
||||||
content: "// Nothing to see yet",
|
content =
|
||||||
}
|
"""
|
||||||
|
// ⚠️ GENERATED CODE ⚠️
|
||||||
|
//
|
||||||
|
// This package is generated by the `roc glue` CLI command
|
||||||
|
"""
|
||||||
|
|
|
@ -2971,20 +2971,7 @@ impl Clone for U4 {
|
||||||
target_arch = "x86_64"
|
target_arch = "x86_64"
|
||||||
))]
|
))]
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
let mut answer = unsafe {
|
*self
|
||||||
match self.discriminant() {
|
|
||||||
discriminant_U4::None => core::mem::transmute::<core::mem::MaybeUninit<U4>, U4>(
|
|
||||||
core::mem::MaybeUninit::uninit(),
|
|
||||||
),
|
|
||||||
discriminant_U4::Some => Self {
|
|
||||||
Some: self.Some.clone(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
answer.set_discriminant(self.discriminant());
|
|
||||||
|
|
||||||
answer
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3260,20 +3247,7 @@ impl Clone for U3 {
|
||||||
target_arch = "x86_64"
|
target_arch = "x86_64"
|
||||||
))]
|
))]
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
let mut answer = unsafe {
|
*self
|
||||||
match self.discriminant() {
|
|
||||||
discriminant_U3::None => core::mem::transmute::<core::mem::MaybeUninit<U3>, U3>(
|
|
||||||
core::mem::MaybeUninit::uninit(),
|
|
||||||
),
|
|
||||||
discriminant_U3::Some => Self {
|
|
||||||
Some: self.Some.clone(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
answer.set_discriminant(self.discriminant());
|
|
||||||
|
|
||||||
answer
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3549,20 +3523,7 @@ impl Clone for U1 {
|
||||||
target_arch = "x86_64"
|
target_arch = "x86_64"
|
||||||
))]
|
))]
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
let mut answer = unsafe {
|
*self
|
||||||
match self.discriminant() {
|
|
||||||
discriminant_U1::None => core::mem::transmute::<core::mem::MaybeUninit<U1>, U1>(
|
|
||||||
core::mem::MaybeUninit::uninit(),
|
|
||||||
),
|
|
||||||
discriminant_U1::Some => Self {
|
|
||||||
Some: self.Some.clone(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
answer.set_discriminant(self.discriminant());
|
|
||||||
|
|
||||||
answer
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,46 +131,19 @@ pub fn generate(
|
||||||
}
|
}
|
||||||
|
|
||||||
let lib = unsafe { Library::new(lib_path) }.unwrap();
|
let lib = unsafe { Library::new(lib_path) }.unwrap();
|
||||||
type MakeGlueReturnType =
|
|
||||||
roc_std::RocResult<roc_std::RocList<roc_type::File>, roc_std::RocStr>;
|
|
||||||
type MakeGlue = unsafe extern "C" fn(
|
|
||||||
*mut RocCallResult<MakeGlueReturnType>,
|
|
||||||
&roc_std::RocList<roc_type::Types>,
|
|
||||||
);
|
|
||||||
|
|
||||||
let make_glue: libloading::Symbol<MakeGlue> = unsafe {
|
|
||||||
lib.get("roc__makeGlueForHost_1_exposed_generic".as_bytes())
|
|
||||||
.unwrap_or_else(|_| panic!("Unable to load glue function"))
|
|
||||||
};
|
|
||||||
let roc_types: roc_std::RocList<roc_type::Types> =
|
let roc_types: roc_std::RocList<roc_type::Types> =
|
||||||
types.iter().map(|x| x.into()).collect();
|
types.iter().map(|x| x.into()).collect();
|
||||||
let mut files =
|
|
||||||
RocCallResult::new(roc_std::RocResult::err(roc_std::RocStr::empty()));
|
|
||||||
unsafe { make_glue(&mut files, &roc_types) };
|
|
||||||
|
|
||||||
// Roc will free data passed into it. So forget that data.
|
// NOTE: DO NOT DROP LIB! the return value will include static roc strings that
|
||||||
std::mem::forget(roc_types);
|
// are only kept alive when the dynamic library is not unloaded!
|
||||||
|
let files = call_roc_make_glue(&lib, backend, roc_types);
|
||||||
|
|
||||||
let files: Result<roc_std::RocList<roc_type::File>, roc_std::RocStr> =
|
|
||||||
match Result::from(files) {
|
|
||||||
Err((msg, tag)) => match tag {
|
|
||||||
CrashTag::Roc => panic!(r#"Roc failed with message: "{msg}""#),
|
|
||||||
CrashTag::User => panic!(r#"User crash with message: "{msg}""#),
|
|
||||||
},
|
|
||||||
Ok(x) => x.into(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let files = files.unwrap_or_else(|err| {
|
|
||||||
eprintln!("Glue generation failed: {err}");
|
|
||||||
|
|
||||||
process::exit(1);
|
|
||||||
});
|
|
||||||
for roc_type::File { name, content } in &files {
|
for roc_type::File { name, content } in &files {
|
||||||
let valid_name = PathBuf::from(name.as_str())
|
let valid_name = PathBuf::from(name.as_str())
|
||||||
.components()
|
.components()
|
||||||
.all(|comp| matches!(comp, Component::CurDir | Component::Normal(_)));
|
.all(|comp| matches!(comp, Component::CurDir | Component::Normal(_)));
|
||||||
if !valid_name {
|
if !valid_name || name.is_empty() {
|
||||||
eprintln!("File name was invalid: {}", &name);
|
eprintln!("File name was invalid: {:?}", &name);
|
||||||
|
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
@ -243,6 +216,69 @@ pub fn generate(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn call_roc_make_glue(
|
||||||
|
lib: &Library,
|
||||||
|
backend: CodeGenBackend,
|
||||||
|
roc_types: roc_std::RocList<roc_type::Types>,
|
||||||
|
) -> roc_std::RocList<roc_type::File> {
|
||||||
|
let roc_call_result = match backend {
|
||||||
|
CodeGenBackend::Assembly(_) => {
|
||||||
|
type MakeGlueReturnType = RocCallResult<
|
||||||
|
roc_std::RocResult<roc_std::RocList<roc_type::File>, roc_std::RocStr>,
|
||||||
|
>;
|
||||||
|
type MakeGlue =
|
||||||
|
unsafe extern "C" fn(roc_std::RocList<roc_type::Types>) -> MakeGlueReturnType;
|
||||||
|
|
||||||
|
let name_of_main = "test_main";
|
||||||
|
|
||||||
|
let make_glue: libloading::Symbol<MakeGlue> = unsafe {
|
||||||
|
lib.get(name_of_main.as_bytes())
|
||||||
|
.unwrap_or_else(|_| panic!("Unable to load glue function"))
|
||||||
|
};
|
||||||
|
|
||||||
|
unsafe { make_glue(roc_types) }
|
||||||
|
}
|
||||||
|
CodeGenBackend::Llvm(_) => {
|
||||||
|
type MakeGlueReturnType =
|
||||||
|
roc_std::RocResult<roc_std::RocList<roc_type::File>, roc_std::RocStr>;
|
||||||
|
type MakeGlue = unsafe extern "C" fn(
|
||||||
|
*mut RocCallResult<MakeGlueReturnType>,
|
||||||
|
&roc_std::RocList<roc_type::Types>,
|
||||||
|
);
|
||||||
|
|
||||||
|
let name_of_main = "roc__makeGlueForHost_1_exposed_generic";
|
||||||
|
|
||||||
|
let make_glue: libloading::Symbol<MakeGlue> = unsafe {
|
||||||
|
lib.get(name_of_main.as_bytes())
|
||||||
|
.unwrap_or_else(|_| panic!("Unable to load glue function"))
|
||||||
|
};
|
||||||
|
let mut files = RocCallResult::new(roc_std::RocResult::err(roc_std::RocStr::empty()));
|
||||||
|
unsafe { make_glue(&mut files, &roc_types) };
|
||||||
|
|
||||||
|
// Roc will free data passed into it. So forget that data.
|
||||||
|
std::mem::forget(roc_types);
|
||||||
|
|
||||||
|
files
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeGenBackend::Wasm => todo!(),
|
||||||
|
};
|
||||||
|
|
||||||
|
match Result::from(roc_call_result) {
|
||||||
|
Err((msg, tag)) => match tag {
|
||||||
|
CrashTag::Roc => panic!(r#"Roc failed with message: "{msg}""#),
|
||||||
|
CrashTag::User => panic!(r#"User crash with message: "{msg}""#),
|
||||||
|
},
|
||||||
|
Ok(files_or_error) => match Result::from(files_or_error) {
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Glue generation failed: {err}");
|
||||||
|
process::exit(1);
|
||||||
|
}
|
||||||
|
Ok(files) => files,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn number_lambda_sets(subs: &Subs, initial: Variable) -> Vec<Variable> {
|
fn number_lambda_sets(subs: &Subs, initial: Variable) -> Vec<Variable> {
|
||||||
let mut lambda_sets = vec![];
|
let mut lambda_sets = vec![];
|
||||||
let mut stack = vec![initial];
|
let mut stack = vec![initial];
|
||||||
|
|
|
@ -3553,20 +3553,7 @@ impl Clone for U1 {
|
||||||
target_arch = "x86_64"
|
target_arch = "x86_64"
|
||||||
))]
|
))]
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
let mut answer = unsafe {
|
*self
|
||||||
match self.discriminant() {
|
|
||||||
discriminant_U1::None => core::mem::transmute::<core::mem::MaybeUninit<U1>, U1>(
|
|
||||||
core::mem::MaybeUninit::uninit(),
|
|
||||||
),
|
|
||||||
discriminant_U1::Some => Self {
|
|
||||||
Some: self.Some.clone(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
answer.set_discriminant(self.discriminant());
|
|
||||||
|
|
||||||
answer
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,10 @@ mod glue_cli_run {
|
||||||
|
|
||||||
let test_name_str = stringify!($test_name);
|
let test_name_str = stringify!($test_name);
|
||||||
|
|
||||||
// TODO after #5924 is fixed; remove this if
|
// TODO after #5924 is fixed; remove this
|
||||||
if !(cfg!(target_os = "linux") && (test_name_str == "nullable_unwrapped" || test_name_str == "nullable_wrapped")) {
|
let skip_on_linux = ["closures", "option", "nullable_wrapped"];
|
||||||
|
|
||||||
|
if !(cfg!(target_os = "linux") && (skip_on_linux.contains(&test_name_str))) {
|
||||||
let out = run_app(&dir.join("app.roc"), std::iter::empty());
|
let out = run_app(&dir.join("app.roc"), std::iter::empty());
|
||||||
|
|
||||||
assert!(out.status.success());
|
assert!(out.status.success());
|
||||||
|
|
|
@ -117,14 +117,13 @@ impl<'a> ReplApp<'a> for CliApp {
|
||||||
main_fn_name: &str,
|
main_fn_name: &str,
|
||||||
ret_bytes: usize,
|
ret_bytes: usize,
|
||||||
mut transform: F,
|
mut transform: F,
|
||||||
) -> T
|
) -> Option<T>
|
||||||
where
|
where
|
||||||
F: FnMut(&'a Self::Memory, usize) -> T,
|
F: FnMut(&'a Self::Memory, usize) -> T,
|
||||||
Self::Memory: 'a,
|
Self::Memory: 'a,
|
||||||
{
|
{
|
||||||
run_jit_function_dynamic_type!(self.lib, main_fn_name, ret_bytes, |v| transform(
|
let mut t = |v| transform(&CliMemory, v);
|
||||||
&CliMemory, v
|
run_jit_function_dynamic_type!(self.lib, main_fn_name, ret_bytes, t)
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,8 +257,6 @@ fn get_tags_vars_and_variant<'a>(
|
||||||
(vars_of_tag, union_variant)
|
(vars_of_tag, union_variant)
|
||||||
}
|
}
|
||||||
|
|
||||||
const FAKE_EXPR: &Loc<Expr> = &Loc::at_zero(Expr::Crash);
|
|
||||||
|
|
||||||
fn expr_of_tag<'a, M: ReplAppMemory>(
|
fn expr_of_tag<'a, M: ReplAppMemory>(
|
||||||
env: &mut Env<'a, '_>,
|
env: &mut Env<'a, '_>,
|
||||||
mem: &'a M,
|
mem: &'a M,
|
||||||
|
@ -288,6 +286,7 @@ fn expr_of_tag<'a, M: ReplAppMemory>(
|
||||||
cmp_fields(&env.layout_cache.interner, i1, *lay1, i2, *lay2)
|
cmp_fields(&env.layout_cache.interner, i1, *lay1, i2, *lay2)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const FAKE_EXPR: &Loc<Expr> = &Loc::at_zero(Expr::Crash);
|
||||||
let mut output: Vec<&Loc<Expr>> =
|
let mut output: Vec<&Loc<Expr>> =
|
||||||
Vec::from_iter_in(std::iter::repeat(FAKE_EXPR).take(layouts.len()), env.arena);
|
Vec::from_iter_in(std::iter::repeat(FAKE_EXPR).take(layouts.len()), env.arena);
|
||||||
let mut field_addr = data_addr;
|
let mut field_addr = data_addr;
|
||||||
|
@ -351,11 +350,6 @@ fn tag_id_from_recursive_ptr<'a, M: ReplAppMemory>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const OPAQUE_FUNCTION: Expr = Expr::Var {
|
|
||||||
module_name: "",
|
|
||||||
ident: "<function>",
|
|
||||||
};
|
|
||||||
|
|
||||||
fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
env: &mut Env<'a, '_>,
|
env: &mut Env<'a, '_>,
|
||||||
app: &mut A,
|
app: &mut A,
|
||||||
|
@ -422,7 +416,10 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
Expr::Str(StrLiteral::PlainLine(arena_str))
|
Expr::Str(StrLiteral::PlainLine(arena_str))
|
||||||
};
|
};
|
||||||
|
|
||||||
app.call_function_returns_roc_str(env.target_info, main_fn_name, body)
|
match app.call_function_returns_roc_str(env.target_info, main_fn_name, body) {
|
||||||
|
Some(string) => string,
|
||||||
|
None => Expr::REPL_RUNTIME_CRASH,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LayoutRepr::Builtin(Builtin::List(elem_layout)) => app.call_function_returns_roc_list(
|
LayoutRepr::Builtin(Builtin::List(elem_layout)) => app.call_function_returns_roc_list(
|
||||||
main_fn_name,
|
main_fn_name,
|
||||||
|
@ -468,7 +465,7 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
}
|
}
|
||||||
Content::Structure(FlatType::Func(_, _, _)) => {
|
Content::Structure(FlatType::Func(_, _, _)) => {
|
||||||
// a function with a struct as the closure environment
|
// a function with a struct as the closure environment
|
||||||
OPAQUE_FUNCTION
|
Expr::REPL_OPAQUE_FUNCTION
|
||||||
}
|
}
|
||||||
other => {
|
other => {
|
||||||
unreachable!(
|
unreachable!(
|
||||||
|
@ -478,16 +475,21 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
app.call_function_dynamic_size(
|
let opt_struct = app.call_function_dynamic_size(
|
||||||
main_fn_name,
|
main_fn_name,
|
||||||
result_stack_size as usize,
|
result_stack_size as usize,
|
||||||
struct_addr_to_ast,
|
struct_addr_to_ast,
|
||||||
)
|
);
|
||||||
|
|
||||||
|
match opt_struct {
|
||||||
|
Some(struct_) => struct_,
|
||||||
|
None => Expr::REPL_RUNTIME_CRASH,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LayoutRepr::Union(UnionLayout::NonRecursive(_)) => {
|
LayoutRepr::Union(UnionLayout::NonRecursive(_)) => {
|
||||||
let size = env.layout_cache.interner.stack_size(layout);
|
let size = env.layout_cache.interner.stack_size(layout);
|
||||||
|
|
||||||
app.call_function_dynamic_size(
|
let opt_union = app.call_function_dynamic_size(
|
||||||
main_fn_name,
|
main_fn_name,
|
||||||
size as usize,
|
size as usize,
|
||||||
|mem: &'a A::Memory, addr: usize| {
|
|mem: &'a A::Memory, addr: usize| {
|
||||||
|
@ -500,7 +502,12 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
env.subs.get_root_key_without_compacting(raw_var),
|
env.subs.get_root_key_without_compacting(raw_var),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
);
|
||||||
|
|
||||||
|
match opt_union {
|
||||||
|
Some(union_) => union_,
|
||||||
|
None => Expr::REPL_RUNTIME_CRASH,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LayoutRepr::Union(UnionLayout::Recursive(_))
|
LayoutRepr::Union(UnionLayout::Recursive(_))
|
||||||
| LayoutRepr::Union(UnionLayout::NonNullableUnwrapped(_))
|
| LayoutRepr::Union(UnionLayout::NonNullableUnwrapped(_))
|
||||||
|
@ -508,7 +515,7 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
| LayoutRepr::Union(UnionLayout::NullableWrapped { .. }) => {
|
| LayoutRepr::Union(UnionLayout::NullableWrapped { .. }) => {
|
||||||
let size = env.layout_cache.interner.stack_size(layout);
|
let size = env.layout_cache.interner.stack_size(layout);
|
||||||
|
|
||||||
app.call_function_dynamic_size(
|
let opt_union = app.call_function_dynamic_size(
|
||||||
main_fn_name,
|
main_fn_name,
|
||||||
size as usize,
|
size as usize,
|
||||||
|mem: &'a A::Memory, addr: usize| {
|
|mem: &'a A::Memory, addr: usize| {
|
||||||
|
@ -521,7 +528,12 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
env.subs.get_root_key_without_compacting(raw_var),
|
env.subs.get_root_key_without_compacting(raw_var),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
);
|
||||||
|
|
||||||
|
match opt_union {
|
||||||
|
Some(union_) => union_,
|
||||||
|
None => Expr::REPL_RUNTIME_CRASH,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LayoutRepr::RecursivePointer(_) => {
|
LayoutRepr::RecursivePointer(_) => {
|
||||||
unreachable!("RecursivePointers can only be inside structures")
|
unreachable!("RecursivePointers can only be inside structures")
|
||||||
|
@ -530,7 +542,7 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>(
|
||||||
unreachable!("Ptr will never be visible to users")
|
unreachable!("Ptr will never be visible to users")
|
||||||
}
|
}
|
||||||
LayoutRepr::LambdaSet(_) | LayoutRepr::FunctionPointer(_) | LayoutRepr::Erased(_) => {
|
LayoutRepr::LambdaSet(_) | LayoutRepr::FunctionPointer(_) | LayoutRepr::Erased(_) => {
|
||||||
OPAQUE_FUNCTION
|
Expr::REPL_OPAQUE_FUNCTION
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -570,7 +582,7 @@ fn addr_to_ast<'a, M: ReplAppMemory>(
|
||||||
|
|
||||||
let expr = match (raw_content, layout) {
|
let expr = match (raw_content, layout) {
|
||||||
(Content::Structure(FlatType::Func(_, _, _)), _) | (_, LayoutRepr::LambdaSet(_) | LayoutRepr::FunctionPointer(_) | LayoutRepr::Erased(_)) => {
|
(Content::Structure(FlatType::Func(_, _, _)), _) | (_, LayoutRepr::LambdaSet(_) | LayoutRepr::FunctionPointer(_) | LayoutRepr::Erased(_)) => {
|
||||||
OPAQUE_FUNCTION
|
Expr::REPL_OPAQUE_FUNCTION
|
||||||
}
|
}
|
||||||
(_, LayoutRepr::Builtin(Builtin::Bool)) => {
|
(_, LayoutRepr::Builtin(Builtin::Bool)) => {
|
||||||
// TODO: bits are not as expected here.
|
// TODO: bits are not as expected here.
|
||||||
|
|
|
@ -25,12 +25,13 @@ pub trait ReplApp<'a> {
|
||||||
self.call_function(main_fn_name, transform)
|
self.call_function(main_fn_name, transform)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// When the executed code calls roc_panic, this function will return None
|
||||||
fn call_function_returns_roc_str<T, F>(
|
fn call_function_returns_roc_str<T, F>(
|
||||||
&mut self,
|
&mut self,
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
main_fn_name: &str,
|
main_fn_name: &str,
|
||||||
transform: F,
|
transform: F,
|
||||||
) -> T
|
) -> Option<T>
|
||||||
where
|
where
|
||||||
F: Fn(&'a Self::Memory, usize) -> T,
|
F: Fn(&'a Self::Memory, usize) -> T,
|
||||||
Self::Memory: 'a,
|
Self::Memory: 'a,
|
||||||
|
@ -45,12 +46,14 @@ pub trait ReplApp<'a> {
|
||||||
|
|
||||||
/// Run user code that returns a struct or union, whose size is provided as an argument
|
/// Run user code that returns a struct or union, whose size is provided as an argument
|
||||||
/// The `transform` callback takes the app's memory and the address of the returned value
|
/// The `transform` callback takes the app's memory and the address of the returned value
|
||||||
|
///
|
||||||
|
/// When the executed code calls roc_panic, this function will return None
|
||||||
fn call_function_dynamic_size<T, F>(
|
fn call_function_dynamic_size<T, F>(
|
||||||
&mut self,
|
&mut self,
|
||||||
main_fn_name: &str,
|
main_fn_name: &str,
|
||||||
ret_bytes: usize,
|
ret_bytes: usize,
|
||||||
transform: F,
|
transform: F,
|
||||||
) -> T
|
) -> Option<T>
|
||||||
where
|
where
|
||||||
F: FnMut(&'a Self::Memory, usize) -> T,
|
F: FnMut(&'a Self::Memory, usize) -> T,
|
||||||
Self::Memory: 'a;
|
Self::Memory: 'a;
|
||||||
|
|
|
@ -121,7 +121,7 @@ impl<'a> ReplApp<'a> for ExpectReplApp<'a> {
|
||||||
_target_info: TargetInfo,
|
_target_info: TargetInfo,
|
||||||
main_fn_name: &str,
|
main_fn_name: &str,
|
||||||
transform: F,
|
transform: F,
|
||||||
) -> T
|
) -> Option<T>
|
||||||
where
|
where
|
||||||
F: Fn(&'a Self::Memory, usize) -> T,
|
F: Fn(&'a Self::Memory, usize) -> T,
|
||||||
Self::Memory: 'a,
|
Self::Memory: 'a,
|
||||||
|
@ -138,11 +138,11 @@ impl<'a> ReplApp<'a> for ExpectReplApp<'a> {
|
||||||
_main_fn_name: &str,
|
_main_fn_name: &str,
|
||||||
_ret_bytes: usize,
|
_ret_bytes: usize,
|
||||||
mut transform: F,
|
mut transform: F,
|
||||||
) -> T
|
) -> Option<T>
|
||||||
where
|
where
|
||||||
F: FnMut(&'a Self::Memory, usize) -> T,
|
F: FnMut(&'a Self::Memory, usize) -> T,
|
||||||
Self::Memory: 'a,
|
Self::Memory: 'a,
|
||||||
{
|
{
|
||||||
transform(self.memory, self.offset)
|
Some(transform(self.memory, self.offset))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -755,6 +755,58 @@ fn type_problem_string_interpolation() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes!
|
||||||
|
#[test]
|
||||||
|
fn list_drop_at_negative_index() {
|
||||||
|
expect_failure(
|
||||||
|
"List.dropAt [1, 2, 3] -1",
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
── TYPE MISMATCH ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
This 2nd argument to dropAt has an unexpected type:
|
||||||
|
|
||||||
|
4│ List.dropAt [1, 2, 3] -1
|
||||||
|
^^
|
||||||
|
|
||||||
|
The argument is a number of type:
|
||||||
|
|
||||||
|
I8, I16, F32, I32, F64, I64, I128, or Dec
|
||||||
|
|
||||||
|
But dropAt needs its 2nd argument to be:
|
||||||
|
|
||||||
|
U64
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes!
|
||||||
|
#[test]
|
||||||
|
fn list_get_negative_index() {
|
||||||
|
expect_failure(
|
||||||
|
"List.get [1, 2, 3] -1",
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
── TYPE MISMATCH ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
This 2nd argument to get has an unexpected type:
|
||||||
|
|
||||||
|
4│ List.get [1, 2, 3] -1
|
||||||
|
^^
|
||||||
|
|
||||||
|
The argument is a number of type:
|
||||||
|
|
||||||
|
I8, I16, F32, I32, F64, I64, I128, or Dec
|
||||||
|
|
||||||
|
But get needs its 2nd argument to be:
|
||||||
|
|
||||||
|
U64
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn issue_2149_i8_ok() {
|
fn issue_2149_i8_ok() {
|
||||||
expect_success(r#"Str.toI8 "127""#, "Ok 127 : Result I8 [InvalidNumStr]");
|
expect_success(r#"Str.toI8 "127""#, "Ok 127 : Result I8 [InvalidNumStr]");
|
||||||
|
|
|
@ -160,7 +160,7 @@ impl<'a> ReplApp<'a> for WasmReplApp<'a> {
|
||||||
_main_fn_name: &str,
|
_main_fn_name: &str,
|
||||||
_ret_bytes: usize,
|
_ret_bytes: usize,
|
||||||
mut transform: F,
|
mut transform: F,
|
||||||
) -> T
|
) -> Option<T>
|
||||||
where
|
where
|
||||||
F: FnMut(&'a Self::Memory, usize) -> T,
|
F: FnMut(&'a Self::Memory, usize) -> T,
|
||||||
Self::Memory: 'a,
|
Self::Memory: 'a,
|
||||||
|
@ -172,7 +172,7 @@ impl<'a> ReplApp<'a> for WasmReplApp<'a> {
|
||||||
let app_result_addr = js_get_result_and_memory(copied_bytes.as_mut_ptr());
|
let app_result_addr = js_get_result_and_memory(copied_bytes.as_mut_ptr());
|
||||||
let mem = self.arena.alloc(WasmMemory { copied_bytes });
|
let mem = self.arena.alloc(WasmMemory { copied_bytes });
|
||||||
|
|
||||||
transform(mem, app_result_addr)
|
Some(transform(mem, app_result_addr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -361,7 +361,7 @@ impl RocStr {
|
||||||
let ptr = if len < big_string.capacity() {
|
let ptr = if len < big_string.capacity() {
|
||||||
// We happen to have excess capacity already, so we will be able
|
// We happen to have excess capacity already, so we will be able
|
||||||
// to write the terminator into the first byte of excess capacity.
|
// to write the terminator into the first byte of excess capacity.
|
||||||
big_string.ptr_to_first_elem() as *mut u8
|
big_string.ptr_to_first_elem()
|
||||||
} else {
|
} else {
|
||||||
// We always have an allocation that's even bigger than necessary,
|
// We always have an allocation that's even bigger than necessary,
|
||||||
// because the refcount bytes take up more than the 1B needed for
|
// because the refcount bytes take up more than the 1B needed for
|
||||||
|
@ -376,7 +376,7 @@ impl RocStr {
|
||||||
//
|
//
|
||||||
// IMPORTANT: Must use ptr::copy instead of ptr::copy_nonoverlapping
|
// IMPORTANT: Must use ptr::copy instead of ptr::copy_nonoverlapping
|
||||||
// because the regions definitely overlap!
|
// because the regions definitely overlap!
|
||||||
ptr::copy(big_string.ptr_to_first_elem() as *mut u8, alloc_ptr, len);
|
ptr::copy(big_string.ptr_to_first_elem(), alloc_ptr, len);
|
||||||
|
|
||||||
alloc_ptr
|
alloc_ptr
|
||||||
};
|
};
|
||||||
|
@ -388,7 +388,7 @@ impl RocStr {
|
||||||
// The backing list was not unique, so we can't mutate it in-place.
|
// The backing list was not unique, so we can't mutate it in-place.
|
||||||
// ask for `len + 1` to store the original string and the terminator
|
// ask for `len + 1` to store the original string and the terminator
|
||||||
with_stack_bytes(len + 1, |alloc_ptr: *mut u8| {
|
with_stack_bytes(len + 1, |alloc_ptr: *mut u8| {
|
||||||
let elem_ptr = big_string.ptr_to_first_elem() as *mut u8;
|
let elem_ptr = big_string.ptr_to_first_elem();
|
||||||
|
|
||||||
// memcpy the bytes into the stack allocation
|
// memcpy the bytes into the stack allocation
|
||||||
std::ptr::copy_nonoverlapping(elem_ptr, alloc_ptr, len);
|
std::ptr::copy_nonoverlapping(elem_ptr, alloc_ptr, len);
|
||||||
|
|
|
@ -255,9 +255,9 @@ mod tests {
|
||||||
decode_u32(&[0xff, 0xff, 0xff, 0xff, 0x0f]),
|
decode_u32(&[0xff, 0xff, 0xff, 0xff, 0x0f]),
|
||||||
Ok((u32::MAX, MAX_SIZE_ENCODED_U32))
|
Ok((u32::MAX, MAX_SIZE_ENCODED_U32))
|
||||||
);
|
);
|
||||||
assert!(matches!(decode_u32(&[0x80; 6]), Err(_)));
|
assert!(decode_u32(&[0x80; 6]).is_err());
|
||||||
assert!(matches!(decode_u32(&[0x80; 2]), Err(_)));
|
assert!(decode_u32(&[0x80; 2]).is_err());
|
||||||
assert!(matches!(decode_u32(&[]), Err(_)));
|
assert!(decode_u32(&[]).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.71.1"
|
channel = "1.72.1"
|
||||||
|
|
||||||
profile = "default"
|
profile = "default"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.71.1"
|
channel = "1.72.1"
|
||||||
|
|
||||||
profile = "default"
|
profile = "default"
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# How to update version:
|
# How to update version:
|
||||||
# - update `channel = "RUST_VERSION"`
|
# - update `channel = "RUST_VERSION"`
|
||||||
# - update `channel = "RUST_VERSION"` in examples/platform-switching/rust-platform/rust-toolchain.toml
|
# - update `channel = "RUST_VERSION"` in examples/platform-switching/rust-platform/rust-toolchain.toml
|
||||||
|
# - update `channel = "RUST_VERSION"` in examples/glue/rust-platform/rust-toolchain.toml
|
||||||
# - update FROM rust:RUST_VERSION-slim-buster in Earthfile
|
# - update FROM rust:RUST_VERSION-slim-buster in Earthfile
|
||||||
# - to update the nightly version:
|
# - to update the nightly version:
|
||||||
# - Find the latest nightly release that matches RUST_VERSION here: https://github.com/oxalica/rust-overlay/tree/master/manifests/nightly/2023
|
# - Find the latest nightly release that matches RUST_VERSION here: https://github.com/oxalica/rust-overlay/tree/master/manifests/nightly/2023
|
||||||
|
@ -10,9 +11,9 @@
|
||||||
# - update nightly-OLD_DATE in .github/workflows/windows_release_build.yml
|
# - update nightly-OLD_DATE in .github/workflows/windows_release_build.yml
|
||||||
# - update nightly-OLD_DATE in crates/compiler/build/src/link.rs
|
# - update nightly-OLD_DATE in crates/compiler/build/src/link.rs
|
||||||
|
|
||||||
channel = "1.71.1" # check ^^^ when changing this
|
channel = "1.72.1" # check ^^^ when changing this
|
||||||
#
|
#
|
||||||
# channel = "nightly-2023-05-28" # 1.71.0 nightly to be able to use unstable features
|
# channel = "nightly-2023-07-09" # 1.72.0 nightly to be able to use unstable features
|
||||||
profile = "default"
|
profile = "default"
|
||||||
components = [
|
components = [
|
||||||
# for usages of rust-analyzer or similar tools inside `nix develop`
|
# for usages of rust-analyzer or similar tools inside `nix develop`
|
||||||
|
|
|
@ -1221,23 +1221,7 @@ Here are the different fixed-size integer types that Roc supports:
|
||||||
| `-9_223_372_036_854_775_808` <br> `9_223_372_036_854_775_807` | `I64` |
|
| `-9_223_372_036_854_775_808` <br> `9_223_372_036_854_775_807` | `I64` |
|
||||||
| `0` <br> _(over 18 quintillion)_`18_446_744_073_709_551_615` | `U64` |
|
| `0` <br> _(over 18 quintillion)_`18_446_744_073_709_551_615` | `U64` |
|
||||||
| `-170_141_183_460_469_231_731_687_303_715_884_105_728` <br> `170_141_183_460_469_231_731_687_303_715_884_105_727` | `I128` |
|
| `-170_141_183_460_469_231_731_687_303_715_884_105_728` <br> `170_141_183_460_469_231_731_687_303_715_884_105_727` | `I128` |
|
||||||
|
| `0` <br> _(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` |
|
||||||
<<<<<<< HEAD
|
|
||||||
| `0` <br> _(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` |
|
|
||||||
|
|
||||||
Roc also has one variable-size integer type: `Nat` (short for "natural number"). The size of `Nat` is equal to the size of a memory address, which varies by system. For example, when compiling for a 64-bit system, `Nat` works the same way as `U64`. When compiling for a 32-bit system, it works the same way as `U32`. Most popular computing devices today are 64-bit, so `Nat` is usually the same as `U64`, but Web Assembly is typically 32-bit - so when running a Roc program built for Web Assembly, `Nat` will work like a `U32` in that program.
|
|
||||||
|
|
||||||
A common use for `Nat` is to store the length of a collection like a `List`; there's a function `List.len : List * -> Nat` which returns the length of the given list. 64-bit systems can represent longer lists in memory than 32-bit systems can, which is why the length of a list is represented as a `Nat`.
|
|
||||||
||||||| parent of cda0cfb47 (Remove Nat from documentation)
|
|
||||||
| `0` <br> _(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` |
|
|
||||||
|
|
||||||
Roc also has one variable-size integer type: `Nat` (short for "natural number"). The size of `Nat` is equal to the size of a memory address, which varies by system. For example, when compiling for a 64-bit system, `Nat` works the same way as `U64`. When compiling for a 32-bit system, it works the same way as `U32`. Most popular computing devices today are 64-bit, so `Nat` is usually the same as `U64`, but Web Assembly is typically 32-bit - so when running a Roc program built for Web Assembly, `Nat` will work like a `U32` in that program.
|
|
||||||
|
|
||||||
# A common use for `Nat` is to store the length of a collection like a `List`; there's a function `List.len : List * -> Nat` which returns the length of the given list. 64-bit systems can represent longer lists in memory than 32-bit systems can, which is why the length of a list is represented as a `Nat`.
|
|
||||||
|
|
||||||
| `0` <br> _(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` |
|
|
||||||
|
|
||||||
> > > > > > > cda0cfb47 (Remove Nat from documentation)
|
|
||||||
|
|
||||||
If any operation would result in an integer that is either too big or too small to fit in that range (e.g. calling `Int.maxI32 + 1`, which adds 1 to the highest possible 32-bit integer), then the operation will [overflow](https://en.wikipedia.org/wiki/Integer_overflow). When an overflow occurs, the program will crash.
|
If any operation would result in an integer that is either too big or too small to fit in that range (e.g. calling `Int.maxI32 + 1`, which adds 1 to the highest possible 32-bit integer), then the operation will [overflow](https://en.wikipedia.org/wiki/Integer_overflow). When an overflow occurs, the program will crash.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue