diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 21f45ccfd59df..a6f62e178482a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,20 @@ ## Description +## How Has This Been Tested? + + +## Key Areas to Review + + ## Type of Change - [ ] New feature - [ ] Bug fix @@ -18,22 +32,9 @@ - [ ] Aptos Framework - [ ] Aptos CLI/SDK - [ ] Developer Infrastructure +- [ ] Move Compiler - [ ] Other (specify) -## How Has This Been Tested? - - -## Key Areas to Review - - ## Checklist - [ ] I have read and followed the [CONTRIBUTING](https://github.com/aptos-labs/aptos-core/blob/main/CONTRIBUTING.md) doc - [ ] I have performed a self-review of my own code diff --git a/.github/actions/get-latest-docker-image-tag/action.yml b/.github/actions/get-latest-docker-image-tag/action.yml index f0c7940529f2d..f42a7062f509d 100644 --- a/.github/actions/get-latest-docker-image-tag/action.yml +++ b/.github/actions/get-latest-docker-image-tag/action.yml @@ -18,7 +18,7 @@ outputs: runs: using: composite steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} path: checkout_branch diff --git a/.github/actions/move-prover-setup/action.yaml b/.github/actions/move-prover-setup/action.yaml index 233347965a316..28171d6e783dd 100644 --- a/.github/actions/move-prover-setup/action.yaml +++ b/.github/actions/move-prover-setup/action.yaml @@ -14,7 +14,7 @@ runs: # rust-cache action will cache ~/.cargo and ./target # https://github.com/Swatinem/rust-cache#cache-details - name: Run cargo cache - uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # pin@v2.2.0 + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # pin@v2.7.3 - name: install related tools and prover dependencies shell: bash diff --git a/.github/actions/rust-setup/action.yaml b/.github/actions/rust-setup/action.yaml index 1749a6e32ff2a..ea5d5551f4cbc 100644 --- a/.github/actions/rust-setup/action.yaml +++ b/.github/actions/rust-setup/action.yaml @@ -20,7 +20,8 @@ runs: # rust-cache action will cache ~/.cargo and ./target # https://github.com/Swatinem/rust-cache#cache-details - name: Run cargo cache - uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # pin@v2.2.0 + if: !startsWith(github.ref, 'refs/pull/') + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # pin@v2.7.3 with: key: ${{ inputs.ADDITIONAL_KEY }} diff --git a/.github/workflows/aptos-node-release.yaml b/.github/workflows/aptos-node-release.yaml index b665ace3f1c68..e0aed3c5ed3df 100644 --- a/.github/workflows/aptos-node-release.yaml +++ b/.github/workflows/aptos-node-release.yaml @@ -19,7 +19,7 @@ jobs: release-aptos-node: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} diff --git a/.github/workflows/check-minimum-revision.yaml b/.github/workflows/check-minimum-revision.yaml index a8ff5b694a043..9460df2464522 100644 --- a/.github/workflows/check-minimum-revision.yaml +++ b/.github/workflows/check-minimum-revision.yaml @@ -20,7 +20,7 @@ jobs: check-minimum-revision: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ env.GIT_SHA }} fetch-depth: 1000 diff --git a/.github/workflows/check-protos.yaml b/.github/workflows/check-protos.yaml index adc7cae232c32..e3f9ac69c8154 100644 --- a/.github/workflows/check-protos.yaml +++ b/.github/workflows/check-protos.yaml @@ -34,7 +34,7 @@ jobs: github.event.pull_request.auto_merge != null ) steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Install buf, which we use to generate code from the protos for Rust and TS. - name: Install buf diff --git a/.github/workflows/check-sdk-examples.yaml b/.github/workflows/check-sdk-examples.yaml index b45b52f11267c..bc5e976e3df86 100644 --- a/.github/workflows/check-sdk-examples.yaml +++ b/.github/workflows/check-sdk-examples.yaml @@ -23,7 +23,7 @@ jobs: APTOS_FAUCET_URL: https://faucet.devnet.aptoslabs.com FAUCET_AUTH_TOKEN: ${{ secrets.DEVNET_TAP_AUTH_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version-file: .node-version diff --git a/.github/workflows/cli-e2e-tests.yaml b/.github/workflows/cli-e2e-tests.yaml index 70a1415ba9708..8799874e48cc7 100644 --- a/.github/workflows/cli-e2e-tests.yaml +++ b/.github/workflows/cli-e2e-tests.yaml @@ -30,7 +30,7 @@ jobs: contents: read id-token: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: ${{ !inputs.SKIP_JOB }} with: ref: ${{ inputs.GIT_SHA }} diff --git a/.github/workflows/cli-external-deps.yaml b/.github/workflows/cli-external-deps.yaml index edb70583557aa..50b44a423c87e 100644 --- a/.github/workflows/cli-external-deps.yaml +++ b/.github/workflows/cli-external-deps.yaml @@ -11,7 +11,7 @@ jobs: check-dynamic-deps: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: ${{ !inputs.SKIP_JOB }} with: ref: ${{ inputs.GIT_SHA }} diff --git a/.github/workflows/cli-release.yaml b/.github/workflows/cli-release.yaml index 478c606d77980..de2c8ae1b3b09 100644 --- a/.github/workflows/cli-release.yaml +++ b/.github/workflows/cli-release.yaml @@ -25,7 +25,7 @@ jobs: name: "Build Ubuntu 20.04 binary" runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.source_git_ref_override }} - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main @@ -41,7 +41,7 @@ jobs: name: "Build Ubuntu 22.04 binary" runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.source_git_ref_override }} - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main @@ -57,7 +57,7 @@ jobs: name: "Build Windows binary" runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.source_git_ref_override }} - name: Build CLI diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index 7591c4c3577d6..3dd336c0c0428 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/copy-images-to-dockerhub-nightly.yaml b/.github/workflows/copy-images-to-dockerhub-nightly.yaml index a38aad9e0d11b..c9596eda0e13f 100644 --- a/.github/workflows/copy-images-to-dockerhub-nightly.yaml +++ b/.github/workflows/copy-images-to-dockerhub-nightly.yaml @@ -13,7 +13,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/coverage-move-only.yaml b/.github/workflows/coverage-move-only.yaml index a195452d5e0d6..40e29bb0a5dd7 100644 --- a/.github/workflows/coverage-move-only.yaml +++ b/.github/workflows/coverage-move-only.yaml @@ -32,7 +32,7 @@ jobs: timeout-minutes: 60 runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main - name: prepare move lang prover tooling. shell: bash diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 2490c54b30209..d5251473d8ff7 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -29,7 +29,7 @@ jobs: timeout-minutes: 720 runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it. - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main @@ -60,7 +60,7 @@ jobs: timeout-minutes: 720 # incremented from 240 due to execution time limit hit in cron runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it. - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main @@ -95,7 +95,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: lcov_unit diff --git a/.github/workflows/cut-release-branch.yaml b/.github/workflows/cut-release-branch.yaml index 46021d7b780f9..5eb8c79352903 100644 --- a/.github/workflows/cut-release-branch.yaml +++ b/.github/workflows/cut-release-branch.yaml @@ -31,7 +31,7 @@ jobs: cut-release-branch: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.CUT_RELEASE_BRANCH_CREDENTIALS }} fetch-depth: 0 diff --git a/.github/workflows/docker-build-rosetta.yaml b/.github/workflows/docker-build-rosetta.yaml index 6139c8d8ed194..1aed7aa668014 100644 --- a/.github/workflows/docker-build-rosetta.yaml +++ b/.github/workflows/docker-build-rosetta.yaml @@ -19,7 +19,7 @@ jobs: build: runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/buildx-setup@main diff --git a/.github/workflows/docker-build-test.yaml b/.github/workflows/docker-build-test.yaml index 91a3400944c1c..d7bef88f17670 100644 --- a/.github/workflows/docker-build-test.yaml +++ b/.github/workflows/docker-build-test.yaml @@ -120,7 +120,7 @@ jobs: outputs: only_docs_changed: ${{ steps.determine_file_changes.outputs.only_docs_changed }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run the file change determinator id: determine_file_changes uses: ./.github/actions/file-change-determinator @@ -132,7 +132,7 @@ jobs: outputs: run_framework_upgrade_test: ${{ steps.determine_test_targets.outputs.run_framework_upgrade_test }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run the test target determinator id: determine_test_targets uses: ./.github/actions/test-target-determinator diff --git a/.github/workflows/docker-indexer-grpc-test.yaml b/.github/workflows/docker-indexer-grpc-test.yaml index dc78a9dc7697e..8cfb8cf1b1b09 100644 --- a/.github/workflows/docker-indexer-grpc-test.yaml +++ b/.github/workflows/docker-indexer-grpc-test.yaml @@ -23,7 +23,7 @@ jobs: IMAGE_TAG: ${{ inputs.GIT_SHA || 'devnet' }} # hardcode to a known good build when not running on workflow_call steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.GIT_SHA || github.event.pull_request.head.sha || github.sha }} diff --git a/.github/workflows/faucet-tests-main.yaml b/.github/workflows/faucet-tests-main.yaml index 0ca51a2f84708..dafa08ff5927b 100644 --- a/.github/workflows/faucet-tests-main.yaml +++ b/.github/workflows/faucet-tests-main.yaml @@ -51,7 +51,7 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'CICD:non-required-tests') runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: ${{ !inputs.SKIP_JOB }} with: ref: ${{ env.GIT_SHA }} diff --git a/.github/workflows/faucet-tests-prod.yaml b/.github/workflows/faucet-tests-prod.yaml index 940ef883a1e20..c731966c09015 100644 --- a/.github/workflows/faucet-tests-prod.yaml +++ b/.github/workflows/faucet-tests-prod.yaml @@ -39,7 +39,7 @@ jobs: needs: [permission-check] runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/docker-setup@main with: GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} @@ -62,7 +62,7 @@ jobs: contents: read id-token: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/docker-setup@main with: GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} diff --git a/.github/workflows/find-packages-with-undeclared-feature-dependencies.yaml b/.github/workflows/find-packages-with-undeclared-feature-dependencies.yaml index 45dfe907189b5..0087168d29054 100644 --- a/.github/workflows/find-packages-with-undeclared-feature-dependencies.yaml +++ b/.github/workflows/find-packages-with-undeclared-feature-dependencies.yaml @@ -6,6 +6,6 @@ jobs: find-packages-with-undeclared-feature-dependencies: runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main - run: scripts/find-packages-with-undeclared-feature-dependencies.sh diff --git a/.github/workflows/forge-pfn.yaml b/.github/workflows/forge-pfn.yaml index 7db14dd04ab1d..660ed535217b7 100644 --- a/.github/workflows/forge-pfn.yaml +++ b/.github/workflows/forge-pfn.yaml @@ -40,7 +40,7 @@ jobs: IMAGE_TAG: ${{ steps.get-docker-image-tag.outputs.IMAGE_TAG }} BRANCH: ${{ steps.determine-test-branch.outputs.BRANCH }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Determine branch based on cadence id: determine-test-branch diff --git a/.github/workflows/forge-stable.yaml b/.github/workflows/forge-stable.yaml index f7b3d9ee550e5..316979a9134e1 100644 --- a/.github/workflows/forge-stable.yaml +++ b/.github/workflows/forge-stable.yaml @@ -50,7 +50,7 @@ jobs: BRANCH: ${{ steps.determine-test-branch.outputs.BRANCH }} BRANCH_HASH: ${{ steps.hash-branch.outputs.BRANCH_HASH }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Determine branch based on cadence id: determine-test-branch diff --git a/.github/workflows/forge-unstable.yaml b/.github/workflows/forge-unstable.yaml index bfc926007220e..5ff54030cf475 100644 --- a/.github/workflows/forge-unstable.yaml +++ b/.github/workflows/forge-unstable.yaml @@ -40,7 +40,7 @@ jobs: IMAGE_TAG: ${{ steps.get-docker-image-tag.outputs.IMAGE_TAG }} BRANCH: ${{ steps.determine-test-branch.outputs.BRANCH }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Determine branch based on cadence id: determine-test-branch diff --git a/.github/workflows/fullnode-execute-devnet-main.yaml b/.github/workflows/fullnode-execute-devnet-main.yaml index b800d1f6f1074..4c9553695cb18 100644 --- a/.github/workflows/fullnode-execute-devnet-main.yaml +++ b/.github/workflows/fullnode-execute-devnet-main.yaml @@ -17,7 +17,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-execute-devnet-stable.yaml b/.github/workflows/fullnode-execute-devnet-stable.yaml index e0d013b119335..ea82a0d469b26 100644 --- a/.github/workflows/fullnode-execute-devnet-stable.yaml +++ b/.github/workflows/fullnode-execute-devnet-stable.yaml @@ -17,7 +17,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-fast-mainnet-main.yaml b/.github/workflows/fullnode-fast-mainnet-main.yaml index 2fe43beb8017a..e298c82ee3905 100644 --- a/.github/workflows/fullnode-fast-mainnet-main.yaml +++ b/.github/workflows/fullnode-fast-mainnet-main.yaml @@ -17,7 +17,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-fast-mainnet-stable.yaml b/.github/workflows/fullnode-fast-mainnet-stable.yaml index 53afaa9d55439..d1bc46d01c00b 100644 --- a/.github/workflows/fullnode-fast-mainnet-stable.yaml +++ b/.github/workflows/fullnode-fast-mainnet-stable.yaml @@ -17,7 +17,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-fast-testnet-main.yaml b/.github/workflows/fullnode-fast-testnet-main.yaml index 56dbeefa84afd..651669603d93f 100644 --- a/.github/workflows/fullnode-fast-testnet-main.yaml +++ b/.github/workflows/fullnode-fast-testnet-main.yaml @@ -17,7 +17,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-fast-testnet-stable.yaml b/.github/workflows/fullnode-fast-testnet-stable.yaml index 924ef153d5b10..5ef7ead938a45 100644 --- a/.github/workflows/fullnode-fast-testnet-stable.yaml +++ b/.github/workflows/fullnode-fast-testnet-stable.yaml @@ -17,7 +17,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-intelligent-devnet-main.yaml b/.github/workflows/fullnode-intelligent-devnet-main.yaml index 465ce361276d9..ed42c4ab600bf 100644 --- a/.github/workflows/fullnode-intelligent-devnet-main.yaml +++ b/.github/workflows/fullnode-intelligent-devnet-main.yaml @@ -18,7 +18,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-intelligent-mainnet-main.yaml b/.github/workflows/fullnode-intelligent-mainnet-main.yaml index 4475d6dc60a7d..b6df15fd54e66 100644 --- a/.github/workflows/fullnode-intelligent-mainnet-main.yaml +++ b/.github/workflows/fullnode-intelligent-mainnet-main.yaml @@ -18,7 +18,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-intelligent-mainnet-stable.yaml b/.github/workflows/fullnode-intelligent-mainnet-stable.yaml index 34a16ed2833d5..bb32af33046e3 100644 --- a/.github/workflows/fullnode-intelligent-mainnet-stable.yaml +++ b/.github/workflows/fullnode-intelligent-mainnet-stable.yaml @@ -18,7 +18,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/fullnode-intelligent-testnet-main.yaml b/.github/workflows/fullnode-intelligent-testnet-main.yaml index 407bec2f47a3f..7ddc46d3a45dd 100644 --- a/.github/workflows/fullnode-intelligent-testnet-main.yaml +++ b/.github/workflows/fullnode-intelligent-testnet-main.yaml @@ -18,7 +18,7 @@ jobs: check-repo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork diff --git a/.github/workflows/indexer-grpc-in-memory-cache-benchmark.yaml b/.github/workflows/indexer-grpc-in-memory-cache-benchmark.yaml index c3548c30b085c..5f8028973ef48 100644 --- a/.github/workflows/indexer-grpc-in-memory-cache-benchmark.yaml +++ b/.github/workflows/indexer-grpc-in-memory-cache-benchmark.yaml @@ -8,7 +8,7 @@ jobs: run-indexer-grpc-in-memory-cache-benchmark: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install grpcurl run: curl -sSL "https://github.com/fullstorydev/grpcurl/releases/download/v1.8.7/grpcurl_1.8.7_linux_x86_64.tar.gz" | sudo tar -xz -C /usr/local/bin - name: Rust setup diff --git a/.github/workflows/indexer-grpc-integration-tests.yaml b/.github/workflows/indexer-grpc-integration-tests.yaml index 4a1c2aa93b181..e9d733718312b 100644 --- a/.github/workflows/indexer-grpc-integration-tests.yaml +++ b/.github/workflows/indexer-grpc-integration-tests.yaml @@ -39,7 +39,7 @@ jobs: IMAGE_TAG: devnet steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install grpcurl run: curl -sSL "https://github.com/fullstorydev/grpcurl/releases/download/v1.8.7/grpcurl_1.8.7_linux_x86_64.tar.gz" | sudo tar -xz -C /usr/local/bin diff --git a/.github/workflows/keyless-circuit-daily-test.yaml b/.github/workflows/keyless-circuit-daily-test.yaml index 8fecb6df2c516..8ddc60e6dfe95 100644 --- a/.github/workflows/keyless-circuit-daily-test.yaml +++ b/.github/workflows/keyless-circuit-daily-test.yaml @@ -23,7 +23,7 @@ jobs: runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it. - uses: ./.github/actions/rust-setup diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index a556b8731c4cc..ccb77ca91de12 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -17,7 +17,7 @@ jobs: linkChecker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Link Checker id: lychee diff --git a/.github/workflows/move-test-compiler-v2.yaml b/.github/workflows/move-test-compiler-v2.yaml index 449892ab72f59..047acb6fa44ae 100644 --- a/.github/workflows/move-test-compiler-v2.yaml +++ b/.github/workflows/move-test-compiler-v2.yaml @@ -28,7 +28,7 @@ jobs: rust-move-tests: runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run Aptos Move tests with compiler V2 uses: ./.github/actions/move-tests-compiler-v2 with: diff --git a/.github/workflows/node-api-compatibility-tests.yaml b/.github/workflows/node-api-compatibility-tests.yaml index 0593a7ec533a9..cc22104c26139 100644 --- a/.github/workflows/node-api-compatibility-tests.yaml +++ b/.github/workflows/node-api-compatibility-tests.yaml @@ -48,7 +48,7 @@ jobs: contents: read id-token: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: ${{ !inputs.SKIP_JOB }} with: ref: ${{ env.GIT_SHA }} diff --git a/.github/workflows/prover-daily-test.yaml b/.github/workflows/prover-daily-test.yaml index 5ed59ec538937..fcaece5daf22b 100644 --- a/.github/workflows/prover-daily-test.yaml +++ b/.github/workflows/prover-daily-test.yaml @@ -25,7 +25,7 @@ jobs: runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} timeout-minutes: ${{ github.event_name == 'pull_request' && 10 || 480}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it. - uses: ./.github/actions/move-prover-setup diff --git a/.github/workflows/prune-old-workflow-runs.yaml b/.github/workflows/prune-old-workflow-runs.yaml index 8f715eb35b543..e7e736f195c72 100644 --- a/.github/workflows/prune-old-workflow-runs.yaml +++ b/.github/workflows/prune-old-workflow-runs.yaml @@ -16,7 +16,7 @@ jobs: if: github.repository == 'aptos-labs/aptos-core' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version-file: .node-version diff --git a/.github/workflows/replay-verify.yaml b/.github/workflows/replay-verify.yaml index 9ea1791265993..89ffff493f1b7 100644 --- a/.github/workflows/replay-verify.yaml +++ b/.github/workflows/replay-verify.yaml @@ -31,6 +31,7 @@ on: pull_request: paths: - ".github/workflows/replay-verify.yaml" + - ".github/workflows/workflow-run-replay-verify.yaml" - "testsuite/replay_verify.py" schedule: - cron: "0 22 * * 0,2,4" # The main branch cadence. This runs every Sun,Tues,Thurs @@ -46,7 +47,7 @@ jobs: runs-on: ubuntu-latest steps: # checkout the repo first, so check-aptos-core can use it and cancel the workflow if necessary - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/check-aptos-core with: cancel-workflow: ${{ github.event_name == 'schedule' }} # Cancel the workflow if it is scheduled on a fork @@ -64,12 +65,16 @@ jobs: # replay-verify config BUCKET: ${{ inputs.TESTNET_BUCKET || 'aptos-testnet-backup' }} SUB_DIR: e1 - HISTORY_START: 250000000 # TODO: We need an exhaustive list of txns_to_skip before we can set this to 0. - TXNS_TO_SKIP: 46874937 151020059 409163615 409163669 409163708 409163774 409163845 409163955 409164059 409164191 414625832 761241943 761247376 761483628 761492625 761494608 761500902 761500975 761504816 761508349 761508397 761508969 761509180 761515997 761531553 761531645 761553168 761553288 761659735 761660965 761661629 761662335 761662951 761664420 761666676 761666846 761667070 761667337 761669444 761670483 761671140 761671243 761671650 761672111 761672821 761674579 761674907 761675526 761709313 761709478 761709835 761846021 761846029 761846031 761846038 761846039 761846040 761846041 761846042 761846043 761846044 761846045 761846046 761846047 761846048 761846049 761846050 761846051 761846052 761846053 761846054 761846055 761846056 761846057 761846058 761846059 761846060 761846061 761846062 761846063 761846064 761846065 761846066 761846067 761846068 761846069 761846070 761846071 761846072 761846073 761846074 761846075 761846076 761846077 761846078 761846079 761846080 761846081 761846082 761846083 761846084 761846085 761846086 761846087 761846088 761846089 761846090 761846091 761846092 761846093 761846094 761846095 761846096 761846097 761846098 761846099 761846100 761846101 761846102 761846103 761846104 761846105 761846106 761846107 761846108 761846109 761846110 761846111 761846112 761846113 761846114 761846115 761846137 761846138 761846139 761846140 761846141 761846142 761846143 761846144 761846145 761846146 761846147 761846148 761846149 761846150 761846151 761846152 761846153 761846154 761846155 761846156 761846157 761846158 761846159 761846160 761846161 761846162 761846163 761846164 761846165 761846166 761846167 761846168 761846169 761846170 761846171 761846172 761846173 761846174 761846175 761846176 761846177 761846178 761846179 761846180 761846181 761846182 761846183 761846184 761846185 761846186 761846187 761846188 761846189 761846190 761846191 761846192 761846193 761846194 761846195 761846196 761846197 761846198 761846199 761846200 761846201 761846202 761846203 761846204 761846205 761846206 761846207 761846208 761846209 761846210 761846211 761846212 761846213 761846214 761846215 761846216 761846217 761846218 761846219 761846220 761846223 761846224 761846225 761846226 761846227 761846228 761846229 761846230 761846231 761846232 761846233 761846234 761846235 761846236 761846237 761846238 761846239 761846240 761846241 761846242 761846243 761846244 761846245 761846246 761846247 761846248 761846249 761846250 761846251 761846252 761846253 761846254 761846255 761846256 761846257 761846258 761846259 761846260 761846261 761846262 761846263 761846264 761846265 761846266 761846267 761846268 761846269 761846270 761846271 761846272 761846273 761846274 761846275 761846276 761846277 761846278 761846279 761846280 761846281 761846282 761846283 761846284 761846285 761846286 761846287 761846288 761846289 761846290 761846291 761846292 761846293 761846294 761846295 761846296 761846297 761846298 761846299 761846300 761846301 761846302 761846303 761846304 761846305 761846306 761846307 761846308 761846309 761846310 761846311 761846312 761846313 761846314 761846315 761846316 761846317 761846318 761846319 761846320 761846321 761846322 761846323 761846324 761846325 761846326 761846327 761846328 761846329 761846330 761846331 761846332 761846333 761846334 761846335 761846336 761846337 761846338 761846339 761846340 761846341 761846342 761846343 761846344 761846345 761846346 761846347 761846348 761846349 761846350 761846351 761846352 761846353 761846354 761846355 761846356 761846357 761846358 761846359 761846360 761846361 761846362 761846363 761846364 761846365 761846366 761846367 761846368 761846369 761846370 761846371 761846372 761846373 761846374 761846375 761846376 761846377 761846378 761846379 761846380 761846381 761846382 761846383 761846384 761846385 761846386 761846387 761846388 761846389 761846390 761846391 761846392 761846393 761846394 761846395 761846396 761846397 761846398 761846399 761846400 761846401 761846402 761846403 761846404 761846405 761846406 761846407 761846408 761846409 761846410 761846411 761846412 761846413 761846414 761846415 761846416 761846417 761846418 761846419 761846420 761846421 761846422 761846423 761846424 761846425 761846426 761846427 761846428 761846429 761846430 761846431 761846432 761846433 761846434 761846435 761846436 761846437 761846438 761846439 761846440 761846441 761846442 761846443 761846444 761846445 761846446 761846447 761846448 761846449 761846450 761846451 761846452 761846453 761846454 761846455 761846456 761846457 761846458 761846459 761846460 761846461 761846462 761846463 761846464 761846465 761846466 761846467 761846468 761846469 761846470 761846471 761846472 761846473 761846474 761846475 761846476 761846477 761846478 761846479 761846480 761846481 761846482 761846483 761846484 761846485 761846486 761846487 761846488 761846489 761846490 761846491 761846492 761846493 761846494 761846495 761846496 761846497 761846498 761846499 761846500 761846501 761846502 761846503 761846504 761846505 761846506 761846507 761846508 761846509 761846510 761846511 761846512 761846513 761846514 761846515 761846516 761846517 761846518 761846519 761846520 761846521 761846522 761846523 761846524 761846525 761846526 761846527 761846528 761846529 761846530 761846538 761846539 761846540 761846541 761846542 761846543 761846544 761846545 761846546 761846547 761846548 761846549 761846550 761846551 761846552 761846553 761846554 761846555 761846556 761846557 761846558 761846559 761846560 761846561 761846562 761846563 761846564 761846565 761846566 761846567 761846568 761846569 761846570 761846571 761846572 761846573 761846574 761846575 761846576 761846577 761846578 761846579 761846580 761846581 761846582 761846583 761846584 761846585 761846586 761846587 761846588 761846589 761846590 761846591 761846592 761846593 761846594 761846595 761846596 761846597 761846598 761846599 761846600 761846601 761846602 761846603 761846604 761846605 761846606 761846607 761846608 761846609 761846610 761846611 761846612 761846613 761846614 761846615 761846616 761846617 761846618 761846619 761846620 761846621 761846622 761846623 761846624 761846625 761846626 761846627 761846628 761846629 761846630 761846631 761846632 761846633 761846634 761846635 761846636 761846637 761846638 761846639 761846640 761846641 761846642 761846643 761846644 761846645 761846646 761846647 761846648 761846649 761846650 761846651 761846652 761846653 761846654 761846655 761846656 761846657 761888898 761888908 761888909 761888910 761888911 761888912 761888913 761888914 761888915 761888916 761888917 761888918 761888919 761888920 761888921 761888922 761888923 761888924 761888925 761888926 761888927 761888928 761888929 761888930 761888931 761888932 761888940 761888941 761888943 761888944 761888945 761888946 761888947 761888948 761888949 761888950 761888951 761888952 761888953 761888954 761888955 761888956 761888957 761888958 761888959 761888960 761888961 761888962 761888963 761888964 761888965 761888966 761888967 761888968 761888969 761888970 761888971 761888972 761888973 761888974 761888975 761888976 761888977 761888978 761888979 761888980 761888981 761888982 761888983 761888984 761888985 761888986 761888987 761888988 761888993 761888994 761888995 761888996 761888997 761888998 761888999 761889000 761889001 761889002 761889003 761889004 761889005 761889006 761889007 761889008 761889009 761889010 761889011 761889012 761889013 761889014 761889015 761889016 761889017 761889018 761889019 761889020 761889021 761889022 761889023 761889024 761889025 761889026 761889027 761889028 761889029 761889030 761889031 761889032 761889033 761889034 761889035 761889036 761889037 761889038 761889039 761889040 761889041 761889042 761889043 761889046 761889047 761889048 761889049 761889050 761889051 761889052 761889053 761889054 761889055 761889056 761889057 761889058 761889059 761889060 761889061 761889062 761889063 761889064 761889065 761889066 761889067 761889068 761889069 761889070 761889071 761889072 761889073 761889074 761889075 761889076 761889077 761889078 761889079 761889080 761889081 761889082 761889083 761889084 761889085 761889086 761889087 761889088 761889089 761889090 761889091 761889092 761889093 761889094 761889095 761889096 761889097 761889098 761889099 761889100 761889101 761889102 761889103 761889104 761889105 761889106 761889107 761889108 761889109 761889110 761889111 761889112 761889113 761889114 761889115 761889116 761889117 761889118 761889119 761889120 761889121 761889122 761889123 761889124 761889125 761889126 761889127 761889128 761889129 761889130 761889131 761889132 761889133 761889134 761889135 761889136 761889137 761889138 761889139 761889140 761889141 761889142 761889143 761889146 761889147 761889148 761889149 761889150 761889151 761889152 761889153 761889154 761889155 761889156 761889157 761889158 761889159 761889160 761889161 761889162 761889163 761889164 761889165 761889166 761889167 761889168 761889169 761889170 761889171 761889172 761889173 761889174 761889175 761889176 761889177 761889178 761889179 761889180 761889181 761889182 761889183 761889184 761889185 761889186 761889187 761889188 761889189 761889190 761889191 761889192 761889193 761889194 761889195 761889196 761889197 761889198 761889199 761889200 761889201 761889202 761889203 761889204 761889205 761889206 761889207 761889208 761889209 761889210 761889211 761889212 761889213 761889214 761889215 761889216 761889217 761889218 761889219 761889220 761889221 761889222 761889223 761889224 761889225 761889226 761889227 761889228 761889229 761889230 761889231 761889232 761889233 761889234 761889235 761889236 761889237 761889238 761889239 761889240 761889241 761889242 761889243 761889244 761889245 761889246 761889247 761889248 761889249 761889250 761889251 761889252 761889253 761889254 761889255 761889256 761889257 761889258 761889259 761889260 761889261 761889262 761889263 761889264 761889265 761889266 761889267 761889268 761889269 761889270 761889271 761889272 761889273 761889274 761889275 761889276 761889277 761889278 761889279 761889280 761889281 761889282 761889283 761889284 761889285 761889286 761889287 761889288 761889289 761889290 761889291 761889292 761889293 761889294 761889295 761889296 761889297 761889298 761889299 761889300 761889301 761889302 761889303 761889304 761889305 761889306 761889307 761889308 761889309 761889310 761889311 761889312 761889313 761889314 761889315 761889316 761889317 761889318 761889319 761889320 761889321 761889322 761889323 761889324 761889325 761889326 761889327 761889328 761889329 761889330 761889331 761889332 761889333 761889334 761889335 761889336 761889337 761889338 761889339 761889340 761889341 761889342 761889343 761889344 761889345 761889372 761889373 761889374 761889375 761889376 761889377 761889379 761889380 761889381 761889391 761889392 761889393 761889394 761889395 761889396 761889397 761889398 761889399 761889400 761889401 761889402 761889403 761889404 761889405 761889406 761889407 761889408 761889409 761889410 761889411 761889412 761889413 761889414 761889415 761889417 761889418 761889419 761889420 761889421 761889422 761889423 761889424 761889425 761889426 761889427 761889428 761889429 761889430 761889431 761889432 761889433 761889434 761889435 761889436 761889437 761889438 761889439 761889440 761889441 761889442 761889443 761889444 761889445 761889446 761889447 761889448 761889449 761889450 761889451 761889452 761889453 761889454 761889455 761889456 761889457 761889458 761889459 761889460 761889461 761889462 761889463 761889464 761889465 761889466 761889467 761889468 761889469 761889470 761889471 761889472 761889473 761889474 761889475 761889476 761889477 761889478 761889479 761889480 761889481 761889482 761889483 761889484 761889485 761889486 761889487 761889488 761889489 761889490 761889491 761889492 761889493 761889494 761889495 761889496 761889497 761889498 761889499 761889500 761889501 761889502 761889503 761889504 761889505 761889506 761889507 761889508 761889509 761889510 761889511 761889512 761889513 761889514 761889515 761889516 761889517 761889518 761889519 761889520 761889521 761889522 761889523 761889524 761889525 761889526 761889527 761889528 761889529 761889530 761889531 761889532 761889533 761889534 761889535 761889536 761889537 761889538 761889539 761889540 761889541 761889542 761889543 761889544 761889545 761889546 761889547 761889548 761889549 761889550 761889551 761889552 761889553 761889554 761889555 761889556 761889557 761889558 761889559 761889560 761889561 761889562 761889563 761889564 761889565 761889566 761889567 761889568 761889569 761889570 761889571 761889572 761889573 761889574 761889575 761889576 761889577 761889578 761889579 761889580 761889581 761889582 761889583 761889584 761889585 761889586 761889587 761889588 761889589 761889590 761889591 761889592 761889593 761889594 761889595 761889596 761889597 761889598 761889599 761889600 761889601 761889602 761889603 761889604 761889605 761889606 761889607 761889608 761889609 761889610 761889611 761889612 761889613 761889614 761889615 761889616 761889617 761889618 761889619 761889620 761889621 761889622 761889623 761889624 761889625 761889626 761889627 761889628 761889629 761889630 761889631 761889632 761889633 761889634 761889635 761889636 761889637 761889638 761889639 761889640 761889641 761889642 761889643 761889644 761889645 761889646 761889647 761889648 761889649 761889650 761889651 761889652 761889653 761889654 761889655 761889656 761889657 761889658 761889659 761889660 761889661 761889662 761889663 761889664 761889665 761889666 761889667 761889668 761889669 761889670 761889671 761889672 761889673 761889674 761889675 761889676 761889677 761889678 761889679 761889680 761889681 761889682 761889683 761889684 761889685 761889686 761889687 761889688 761889689 761889690 761889691 761889692 761889693 761889694 761889695 761889696 761889697 761889698 761889699 761889700 761889701 761889702 761889703 761889704 761889705 761889706 761889707 761889708 761889709 761889710 761889711 761889712 761889713 761889714 761889715 761889716 761889717 761889718 761889719 761889720 761889721 761889722 761889723 761889724 761889725 761889726 761889727 761889728 761889729 761889730 761889731 761889732 761889733 761889734 761889735 761889736 761889737 761889738 761889739 761889740 761889741 761889742 761889743 761889744 761889745 761889746 761889747 761889748 761889749 761889750 761889751 761889752 761889753 761889754 761889755 761889756 761889757 761889758 761889759 761889760 761889761 761889762 761889763 761889764 761889765 761889766 761889767 761889768 761889769 761889770 761889771 761889772 761889773 761889774 761889775 761889776 761889777 761889778 761889779 761889780 761889781 761889782 761889783 761889784 761889785 761889786 761889787 761889788 761889789 761889790 761889791 761889792 761889793 761889794 761889795 761889796 761889797 761889798 761889799 761889800 761889801 761889802 761889803 761889804 761889805 761889806 761889807 761889808 761889809 761889810 761889811 761889812 761889813 761889814 761889815 761889816 761889817 761889818 761889819 761889820 761889821 761889822 761889823 761889824 761889825 761889826 761889827 761889828 761889829 761889830 761889831 761889832 761889833 761889834 761889835 761889836 761889837 761889838 761889839 761889840 761889841 761889842 761889843 761889844 761889845 761889846 761889847 761889848 761889849 761889850 761889851 761889852 761889853 761889854 761889855 761889856 761889857 761889858 761889859 761889860 761889861 761889862 761889863 761889864 761889865 761889866 761889867 761889868 761889869 761889870 761889871 761889872 761889873 761889874 761889875 761889876 761889877 761889878 761889879 761889880 761889881 761889882 761889883 761889884 761889885 761889886 761889887 761889888 761889889 761889890 761889891 761889892 761889893 761889894 761889895 761889896 761889897 761889898 761889899 761889900 761889901 761889902 761889903 761889904 761889905 761889906 761889907 761889908 761889909 761889910 761889911 761889912 761889913 761889914 761889915 761889916 761889917 761889918 761889919 761889920 761889921 761889922 761889923 761889924 761889925 761889926 761889927 761889928 761889929 761889930 761889931 761889932 761889933 761889934 761889935 761889936 761889937 761889938 761889939 761889940 761889941 761889942 761889943 761889944 761889945 761889946 761889947 761889948 761889949 761889950 761889951 761889952 761889953 761889954 761889955 761889956 761889957 761889958 761889959 761889960 761889961 761889962 761889963 761889964 761889965 761889966 761889967 761889968 761889969 761889970 761889971 761889972 761889973 761889974 761889975 761889976 761889977 761889978 761889979 761889980 761889981 761889982 761889983 761889984 761889985 761889986 761889987 761889988 761889989 761889990 761889991 761889992 761889993 761889994 761889995 761889996 761889997 761889998 761889999 761890000 761890001 761890002 761890003 761890004 761890005 761890006 761890007 761890008 761890009 761890010 761890011 761890012 761890013 761890014 761890015 761890016 761890017 761890018 761890019 761890020 761890021 761890022 761890023 761890024 761890025 761890026 761890027 761890028 761890029 761890030 761890031 761890032 761890033 761890034 761890035 761890036 761890037 761890038 761890039 761890040 761890041 761890042 761890043 761890044 761890045 761890046 761890047 761890048 761890049 761890050 761890051 761890052 761890053 761890054 761890055 761890056 761890057 761890058 761890059 761890060 761890061 761890062 761890063 761890064 761890065 761890066 761890067 761890068 761890069 761890070 761890071 761890072 761890073 761890074 761890075 761890076 761890077 761890078 761890079 761890080 761890081 761890082 761890083 761890084 761890085 761890086 761890087 761890088 761890089 761890090 761890091 761890092 761890093 761890094 761890095 761890096 761890097 761890098 761890099 761890100 761890101 761890102 761890103 761890104 761890105 761890106 761890107 761890108 761890109 761890110 761890111 761890112 761890113 761890114 761890115 761890116 761890117 761890118 761890119 761890120 761890121 761890122 761890123 761890124 761890125 761890126 761890127 761890128 761890129 761890130 761890131 761890132 761890133 761890134 761890137 761890140 761890141 761890142 761890145 761890146 761890148 761890149 761890150 761890151 761890152 761890153 761890154 761890155 761890156 761890157 761890158 761890159 761890160 761890161 761890162 761890163 761890164 761890165 761890166 761890167 761890168 761890169 761890170 761890171 761890172 761890173 761890174 761890175 761890176 761890177 761890178 761890179 761890180 761890181 761890182 761890183 761890184 761890185 761890186 761890187 761890188 761890189 761890190 761890191 761890192 761890193 761890194 761890195 761890196 761890197 761890198 761890199 761890200 761890201 761890202 761890203 761890204 761890205 761890206 761890207 761890208 761890209 761890210 761890211 761890212 761890213 761890214 761890215 761890216 761890217 761890218 761890219 761890220 761890221 761890222 761890223 761890224 761890225 761890226 761890227 761890228 761890229 761890230 761890231 761890232 761890233 761890234 761890235 761890236 761890237 761890238 761890239 761890240 761890241 761890242 761890243 761890244 761890245 761890246 761890247 761890248 761890249 761890250 761890251 761890252 761890253 761890254 761890255 761890256 761890257 761890258 761890259 761890260 761890261 761890262 761890263 761890264 761890265 761890266 761890267 761890268 761890269 761890270 761890271 761890272 761890273 761890274 761890275 761890276 761890277 761890278 761890279 761890280 761890281 761890282 761890283 761890284 761890285 761890286 761890287 761890288 761890289 761890290 761890291 761890292 761890293 761890294 761890295 761890296 761890297 761890298 761890299 761890300 761890301 761890302 761890303 761890304 761890305 761890306 761890307 761890308 761890309 761890310 761890313 761890314 761890315 761890317 761890318 761890319 761890320 761890321 761890322 761890323 761890324 761890325 761890326 761890327 761890328 761890329 761890330 761890331 761890332 761890333 761890334 761890335 761890336 761890337 761890338 761890339 761890340 761890341 761890342 761890343 761890344 761890345 761890346 761890347 761890348 761890349 761890350 761890351 761890352 761890353 761890354 761890355 761890356 761890357 761890358 761890359 761890360 761890361 761890362 761890363 761890364 761890365 761890366 761890367 761890368 761890369 761890370 761890371 761890372 761890373 761890374 761890375 761890376 761890377 761890378 761890379 761890380 761890381 761890382 761890383 761890384 761890385 761890386 761890387 761890388 761890389 761890390 761890391 761890392 761890393 761890394 761890395 761890396 761890397 761890398 761890399 761890400 761890401 761890402 761890403 761890404 761890405 761890406 761890407 761890408 761890409 761890410 761890411 761890412 761890413 761890414 761890415 761890416 761890417 761890418 761890419 761890420 761890421 761890422 761890423 761890424 761890425 761890426 761890427 761890428 761890429 761890430 761890431 761890432 761890433 761890434 761890435 761890436 761890437 761890438 761890439 761890440 761890441 761890442 761890443 761890444 761890445 761890446 761890447 761890448 761890449 761890450 761890451 761890452 761890453 761890454 761890455 761890456 761890457 761890458 761890459 761890460 761890461 761890462 761890463 761890464 761890465 761890466 761890467 761890468 761890469 761890470 761890471 761890472 761890473 761890474 761890475 761890476 761890477 761890478 761890479 761890480 761890481 761890482 761890483 761890484 761890485 761890486 761890487 761890488 761890489 761890490 761890491 761890492 761890493 761890494 761890495 761890496 761890497 761890498 761890499 761890500 761890501 761890502 761890503 761890504 761890505 761890506 761890507 761890508 761890509 761890510 761890511 761890512 761890513 761890514 761890515 761890516 761890517 761890518 761890519 761890520 761890521 761890522 761890523 761890524 761890525 761890526 761890527 761890528 761890529 761890530 761890531 761890532 761890533 761890534 761890535 761890536 761890537 761890538 761890539 761890540 761890541 761890542 761890543 761890544 761890545 761890546 761890547 761890548 761890549 761890550 761890551 761890552 761890553 761890554 761890555 761890556 761890557 761890558 761890559 761890560 761890561 761890562 761890563 761890564 761890565 761890566 761890567 761890568 761890569 761943777 761959265 762339040 762340585 762368931 762417190 762417238 762417259 762417640 762417968 762417969 762418255 762419031 762419045 762419057 762419144 762419290 762419770 762419908 762419961 762419968 762419976 762419999 762420000 762420045 762420264 762420282 762420297 762420337 762420397 762420400 762420508 762420526 762420537 762420645 762420753 762420779 762420817 762420963 762421011 762421020 762421217 762421412 762755085 762755086 762755087 762755088 762755089 762755090 762755091 762755092 762755093 762755094 762755095 762755103 762755104 762755105 762755106 762755107 762755108 762755109 762755110 762755111 762755112 762755113 762755114 762755115 762755116 762755117 762755118 762755119 762755120 762755121 762755122 762755123 762755124 762755125 762755126 762755127 762755128 762755129 762755130 762755131 762755132 762755133 762755134 762755135 762755136 762755137 762755138 762755139 762755140 762755141 762755142 762755143 762755144 762755145 762755146 762755147 762755148 762755149 762755150 762755151 762755152 762755153 762755154 762755155 762755156 762755157 762755158 762755159 762755160 762755161 762755162 762755170 762755171 762755172 762755173 762755174 762755175 762755176 762755177 762755178 762755179 762755180 762755181 762755182 762755183 762755184 762755185 762755186 762755187 762755188 762755189 762755190 762755191 762755192 762755193 762755194 762755195 762755196 762755197 762755198 762755199 762755200 762755201 762755202 762755203 762755204 762755205 762755206 762755207 762755208 762755209 762755210 762755211 762755212 762755213 762755214 762755215 762755216 762755217 762755218 762755219 762755220 762755221 762755222 762755223 762755224 762755225 762755226 762755227 762755228 762755229 762755230 762755231 762755232 762755233 762755234 762755235 762755236 762755237 762755238 762755239 762755240 762755241 762755242 762755243 762755244 762755245 762755246 762755247 762755248 762755249 762755250 762755251 762755252 762755253 762755254 762755255 762755256 762755257 762755258 762755259 762755260 762755261 762755262 762755263 762755264 762755265 762755266 762755267 762755268 762755269 762755270 762755271 762755272 762755273 762755274 762755275 762755276 762755277 762755278 762755279 762755280 762755281 762755282 762755283 762755284 762755285 762755286 762755287 762755293 762755294 762755295 762755296 762755297 762755298 762755299 762755300 762755301 762755302 762755303 762755304 762755305 762755306 762755307 762755308 762755309 762755310 762755311 762755312 762755313 762755314 762755315 762755316 762755317 762755318 762755319 762755320 762755321 762755322 762755323 762755324 762755325 762755326 762755327 762755328 762755329 762755330 762755331 762755332 762755333 762755334 762755335 762755336 762755337 762755338 762755339 762755340 762755341 762755342 762755343 762755344 762755345 762755346 762755347 762755348 762755349 762755350 762755351 762755352 762755353 762755354 762755355 762755356 762755357 762755358 762755359 762755360 762755361 762755362 762755363 762755364 762755365 762755366 762755367 762755368 762755369 762755370 762755371 762755372 762755373 762755374 762755375 762755376 762755377 762755378 762755379 762755380 762755381 762755382 762755383 762755384 762755385 762755386 762755387 762755388 762755389 762755390 762755391 762755392 762755393 762755394 762755395 762755396 762755397 762755398 762755399 762755400 762755401 762755402 762755403 762755404 762755405 762755406 762755407 762755408 762755409 762755410 762755411 762755412 762755413 762755414 762755415 762755416 762755417 762755418 762755419 762755420 762755421 762755422 762755423 762755424 762755425 762755426 762755427 762755428 762755429 762755430 762755431 762755432 762755433 762755434 762755435 762755436 762755437 762755438 762755439 762755440 762755441 762755442 762755443 762755444 762755445 762755446 762755447 762755448 762755449 762755450 762755451 762755452 762755453 762755454 762755455 762755456 762755457 762755458 762755459 762755460 762755461 762755462 762755463 762755464 762755465 762755466 762755467 762755468 762755469 762755470 762755471 762755472 762755473 762755474 762755475 762755476 762755477 762755478 762755479 762755480 762755481 762755482 762755483 762755484 762755485 762755486 762755487 762755488 762755489 762755490 762755491 762755492 762755493 762755494 762755495 762755496 762755497 762755498 762755499 762755500 762755501 762755502 762755503 762755504 762755505 762755506 762755507 762755508 762755509 762755510 762755511 762755512 762755513 762755514 762755515 762755516 762755517 762755518 762755519 762755520 762755521 762755522 762755523 762755524 762755525 762755526 762755527 762755528 762755529 762755530 762755531 762755532 762755533 762755534 762755535 762755536 762755537 762755538 762755539 762755540 762755541 762755542 762755543 762755544 762755545 762755546 762755547 762755548 762755549 762755550 762755551 762755552 762755553 762755554 762755555 762755556 762755557 762755558 762755559 762755560 762755561 762755562 762755563 762755564 762755565 762755566 762755567 762755568 762755569 762755570 762755571 762755572 762755573 762755574 762755575 762755576 762755577 762755578 762755579 762755580 762755581 762755582 762755583 762755584 762755585 762755586 762755587 762755588 762755589 762755590 762755591 762755592 762755593 762755594 762755595 762755596 762755597 762755598 762755599 762755600 762755601 762755602 762755603 762758490 762758499 762758500 762758501 762758504 762758505 762758506 762758507 762758508 762758509 762758510 762758511 762758512 762758513 762758514 762758515 762758516 762758517 762758518 762758519 762758520 762758521 762758522 762758523 762758524 762758525 762758526 762758527 762758528 762758529 762758530 762758531 762758532 762758533 762758534 762758535 762758536 762758537 762758538 762758539 762758540 762758541 762758542 762758543 762758544 762758545 762758546 762758547 762758548 762758549 762758550 762758551 762758552 762758553 762758554 762758555 762758556 762758557 762758558 762758559 762758560 762758561 762758562 762758563 762758564 762758565 762758566 762758567 762758568 762758569 762758570 762758571 762758572 762758573 762758574 762758575 762758576 762758577 762758578 762758579 762758580 762758581 762758582 762758583 762758584 762758585 762758586 762758587 762758588 762758589 762758590 762758591 762758596 762758597 762758598 762758599 762758600 762758601 762758602 762758603 762758604 762758605 762758606 762758607 762758608 762758609 762758610 762758611 762758612 762758613 762758614 762758615 762758616 762758617 762758618 762758619 762758620 762758621 762758622 762758623 762758624 762758625 762758626 762758627 762758628 762758629 762758630 762758631 762758632 762758633 762758634 762758635 762758636 762758637 762758638 762758639 762758640 762758641 762758642 762758643 762758644 762758645 762758646 762758647 762758648 762758649 762758650 762758651 762758652 762758653 762758654 762758655 762758656 762758657 762758658 762758659 762758660 762758661 762758662 762758663 762758664 762758665 762758666 762758669 762758670 762758671 762758672 762758673 762758675 762758676 762758677 762758678 762758679 762758680 762758681 762758682 762758683 762758684 762758685 762758686 762758687 762758688 762758689 762758690 762758691 762758692 762758693 762758694 762758695 762758696 762758697 762758698 762758699 762758700 762758701 762758702 762758703 762758704 762758705 762758706 762758707 762758708 762758709 762758710 762758711 762758712 762758713 762758714 762758715 762758716 762758717 762758718 762758719 762758720 762758721 762758722 762758723 762758724 762758725 762758726 762758727 762758728 762758729 762758730 762758731 762758732 762758733 762758734 762758735 762758736 762758737 762758738 762758739 762758740 762758741 762758742 762758743 762758744 762758745 762758746 762758747 762758748 762758749 762758750 762758751 762758752 762758753 762758754 762758755 762758756 762758757 762758758 762758759 762758760 762758761 762758762 762758763 762758764 762758765 762758766 762758767 762758768 762758769 762758770 762758771 762758772 762758773 762758774 762758775 762758776 762758777 762758778 762758779 762758780 762758781 762758782 762758783 762758784 762758785 762758786 762758787 762758788 762758789 762758790 762758791 762758792 762758793 762758794 762758795 762758796 762758797 762758798 762758799 762758800 762758801 762758802 762758803 762758804 762758805 762758806 762758807 762758808 762758809 762758810 762758811 762758812 762758813 762758814 762758815 762758816 762758817 762758818 762758819 762758820 762758821 762758822 762758823 762758824 762758825 762758826 762758827 762758828 762758829 762758830 762758831 762758832 762758833 762758834 762758835 762758836 762758837 762758838 762758839 762758840 762758841 762758842 762758843 762758844 762758845 762758846 762758847 762758848 762758849 762758850 762758851 762758852 762758853 762758854 762758855 762758856 762758857 762758858 762758859 762758860 762758861 762758862 762758863 762758864 762758865 762758866 762758867 762758868 762758869 762758870 762758871 762758872 762758873 762758874 762758875 762758876 762758877 762758878 762758879 762758880 762758881 762758882 762758883 762758884 762758885 762758886 762758887 762758888 762758889 762758890 762758891 762758892 762758893 762758894 762758895 762758896 762758897 762758898 762758899 762758900 762758901 762758902 762758903 762758904 762758905 762758906 762758907 762758908 762758909 762758910 762758911 762758912 762758913 762758914 762758915 762758916 762758917 762758918 762758919 762758920 762758921 762758922 762758923 762758924 762758925 762758926 762758927 762758928 762758929 762758930 762758931 762758932 762758933 762758934 762758935 762758936 762758937 762758938 762758939 762758940 762758941 762758942 762758943 762758944 762758945 762758946 762758947 762758948 762758949 762758950 762758951 762758952 762758953 762758954 762758955 762758956 762758957 762758958 762758959 762758960 762758961 762758962 762758963 762758964 762758965 762758966 762758967 762758968 762758969 762758970 762758971 762758972 762758973 762758974 762758975 762758976 762758977 762758978 762758979 762758980 762758981 762758982 762758983 762758984 762758985 762758986 762758987 762758988 762758989 762758990 762758991 762758992 762758993 762758994 762758995 762758996 762758997 762758998 762758999 762759000 762759001 762759002 762759003 762759004 762759005 762759006 762814859 762814862 762814863 762814865 762814866 762814867 762814868 762814869 762814870 762814871 762814872 762814873 762814874 762814875 762814876 762814877 762814878 762814879 762814880 762814881 762814882 762814883 762814884 762814885 762814886 762814887 762814888 762814889 762814890 762814891 762814892 762814893 762814894 762814895 762814896 762814897 762814898 762814899 762814900 762814901 762814902 762814903 762814904 762814905 762814906 762814907 762814908 762814909 762814910 762814911 762814912 762814913 762814914 762814915 762814916 762814917 762814918 762814919 762814920 762814921 762814922 762814923 762814924 762814925 762814926 762814927 762814928 762814929 762814930 762814931 762814932 762814933 762814934 762814935 762814936 762814937 762814938 762814943 762814944 762814945 762814946 762814947 762814948 762814949 762814950 762814951 762814952 762814953 762814954 762814955 762814956 762814957 762814958 762814959 762814960 762814961 762814962 762814963 762814964 762814965 762814966 762814967 762814968 762814969 762814970 762814971 762814972 762814973 762814974 762814975 762814976 762814977 762814978 762814979 762814980 762814981 762814982 762814983 762814984 762814985 762814986 762814987 762814988 762814989 762814990 762814991 762814992 762814993 762814994 762814995 762814996 762814997 762814998 762814999 762815000 762815001 762815002 762815003 762815004 762815005 762815006 762815007 762815008 762815009 762815010 762815011 762815012 762815013 762815014 762815015 762815016 762815017 762815018 762815019 762815020 762815021 762815022 762815023 762815024 762815025 762815026 762815027 762815028 762815029 762815030 762815031 762815032 762815033 762815034 762815035 762815036 762815037 762815038 762815039 762815040 762815041 762815042 762815043 762815044 762815045 762815046 762815047 762815048 762815049 762815050 762815051 762815052 762815053 762815054 762815055 762815056 762815057 762815058 762815059 762815060 762815061 762815062 762815063 762815064 762815065 762815066 762815067 762815068 762815069 762815070 762815071 762815072 762815073 762815074 762815075 762815076 762815077 762815078 762815079 762815080 762815081 762815082 762815083 762815084 762815085 762815086 762815087 762815088 762815089 762815090 762815091 762815092 762815093 762815094 762815095 762815096 762815097 762815098 762815099 762815100 762815101 762815102 762815103 762815104 762815105 762815106 762815107 762815108 762815109 762815110 762815111 762815112 762815113 762815114 762815115 762815116 762815117 762815118 762815119 762815120 762815121 762815122 762815123 762815124 762815125 762815126 762815127 762815128 762815129 762815130 762815131 762815132 762815133 762815134 762815135 762815136 762815137 762815138 762815139 762815140 762815141 762815142 762815143 762815144 762815145 762815146 762815147 762815148 762815149 762815150 762815151 762815152 762815153 762815154 762815155 762815156 762815157 762815158 762815159 762815160 762815161 762815162 762815163 762815164 762815165 762815166 762815167 762815168 762815169 762815170 762815171 762815172 762815173 762815174 762815175 762815176 762815177 762815178 762815183 762815184 762815185 762815186 762815187 762815188 762815189 762815190 762815191 762815192 762815193 762815194 762815195 762815196 762815197 762815198 762815199 762815200 762815201 762815202 762815203 762815204 762815205 762815206 762815207 762815208 762815209 762815210 762815211 762815212 762815213 762815214 762815215 762815216 762815217 762815218 762815219 762815220 762815221 762815222 762815223 762815224 762815225 762815226 762815227 762815228 762815229 762815230 762815231 762815232 762815233 762815234 762815235 762815236 762815237 762815238 762815239 762815240 762815241 762815242 762815243 762815244 762815245 762815246 762815247 762815248 762815249 762815250 762815251 762815252 762815253 762815254 762815255 762815256 762815257 762815258 762815259 762815260 762815261 762815262 762815263 762815264 762815265 762815266 762815267 762815268 762815269 762815270 762815271 762815272 762815273 762815274 762815275 762815276 762815277 762815278 762815279 762815280 762815281 762815282 762815283 762815284 762815285 762815286 762815287 762815288 762815289 762815290 762815291 762815292 762815293 762815294 762815295 762815296 762815297 762815298 762815299 762815300 762815301 762815302 762815303 762815304 762815305 762815306 762815307 762815308 762815309 762815310 762815311 762815312 762815313 762815314 762815315 762815316 762815317 762815318 762815319 762815320 762815321 762815322 762815323 762815324 762815325 762815326 762815327 762815328 762815329 762815330 762815331 762815332 762815333 762815334 762815335 762815336 762815337 762815338 762815339 762815340 762815341 762815342 762815343 762815344 762815345 762815346 762815347 762815348 762815349 762815350 762815351 762815352 762815353 762815354 762815355 762815356 762815357 762815358 762815359 762815360 762815361 762815362 762815363 762815364 762815365 762815366 762815367 762815368 762815369 762817220 762817229 762817230 762817231 762817233 762817234 762817235 762817236 762817237 762817238 762817239 762817240 762817241 762817242 762817243 762817244 762817245 762817246 762817247 762817248 762817249 762817250 762817251 762817252 762817253 762817254 762817255 762817256 762817257 762817258 762817259 762817260 762817261 762817262 762817263 762817264 762817265 762817266 762817267 762817268 762817269 762817270 762817271 762817272 762817273 762817274 762817275 762817276 762817277 762817278 762817279 762817280 762817281 762817282 762817283 762817284 762817285 762817286 762817287 762817288 762817289 762817290 762817291 762817292 762817293 762817294 762817295 762817296 762817297 762817298 762817299 762817300 762817301 762817302 762817303 762817304 762817309 762817310 762817311 762817312 762817313 762817314 762817315 762817316 762817317 762817318 762817319 762817320 762817321 762817322 762817323 762817324 762817325 762817326 762817327 762817328 762817329 762817330 762817331 762817332 762817333 762817334 762817335 762817336 762817337 762817338 762817339 762817340 762817341 762817342 762817343 762817344 762817345 762817346 762817347 762817348 762817349 762817350 762817351 762817352 762817353 762817354 762817355 762817356 762817357 762817358 762817359 762817360 762817361 762817362 762817363 762817364 762817365 762817366 762817367 762817368 762817369 762817370 762817371 762817372 762817373 762817374 762817375 762817376 762817377 762817378 762817379 762817380 762817381 762817382 762817383 762817384 762817385 762817386 762817387 762817388 762817389 762817390 762817391 762817392 762817393 762817394 762817395 762817396 762817397 762817398 762817399 762817400 762817405 762817406 762817407 762817408 762817409 762817410 762817411 762817412 762817413 762817414 762817415 762817416 762817417 762817418 762817419 762817420 762817421 762817422 762817423 762817424 762817425 762817426 762817427 762817428 762817429 762817430 762817431 762817432 762817433 762817434 762817435 762817436 762817437 762817438 762817439 762817440 762817441 762817442 762817443 762817444 762817445 762817446 762817447 762817448 762817449 762817450 762817451 762817452 762817453 762817454 762817455 762817456 762817457 762817458 762817459 762817460 762817461 762817462 762817463 762817464 762817465 762817466 762817467 762817468 762817469 762817470 762817471 762817472 762817473 762817474 762817475 762817476 762817477 762817478 762817479 762817480 762817481 762817482 762817483 762817484 762817485 762817486 762817487 762817488 762817489 762817490 762817491 762817492 762817493 762817494 762817495 762817496 762817497 762817498 762817499 762817500 762817501 762817502 762817503 762817504 762817505 762817506 762817507 762817508 762817509 762817510 762817511 762817512 762817513 762817514 762817515 762817516 762817517 762817518 762817519 762817520 762817521 762817522 762817523 762817524 762817525 762817526 762817527 762817528 762817529 762817530 762817531 762817532 762817533 762817534 762817535 762817536 762817537 762817538 762817539 762817540 762817541 762817542 762817543 762817544 762817545 762817546 762817547 762817548 762817549 762817550 762817551 762817552 762817553 762817554 762817555 762817556 762817557 762817558 762817559 762817560 762817561 762817562 762817563 762817564 762817565 762817566 762817567 762817568 762817569 762817570 762817571 762817572 762817573 762817574 762817575 762817576 762817577 762817578 762817579 762817580 762817581 762817582 762817583 762817584 762817585 762817586 762817587 762817588 762817589 762817590 762817591 762817592 762817593 762817594 762817595 762817596 762817597 762817598 762817599 762817600 762817601 762817602 762817603 762817604 762817605 762817606 762817607 762817608 762817609 762817610 762817611 762817612 762817613 762817614 762817615 762817616 762817617 762817618 762817619 762817620 762817621 762817622 762817623 762817624 762817625 762817626 762817627 762817628 762817629 762817630 762817631 762817632 762817633 762817634 762817635 762817636 762817637 762817638 762817639 762817640 762817641 762817642 762817643 762817644 762817645 762817646 762817647 762817648 762817649 762817650 762817651 762817652 762817653 762817654 762817655 762817656 762817657 762817658 762817659 762817660 762817661 762817662 762817663 762817664 762817665 762817666 762817667 762817668 762817669 762817670 762817671 762817672 762817673 762817674 762817675 762817676 762817677 762817678 762817679 762817680 762817681 762817682 762817683 762817684 762817685 762817686 762817687 762817688 762817689 762817690 762817691 762817692 762817693 762817694 762817695 762817696 762817697 762817698 762817699 762817700 762817701 762817702 762817703 762817704 762817705 762817706 762817707 762817708 762817709 762817710 762817711 762817712 762817713 762817714 762817715 762817716 762817717 762817718 762817719 762817720 762817721 762817722 762817723 762817724 762817725 762817726 762817727 762817728 762817729 762817730 762817731 762817732 762817733 762817734 762817735 762817736 762828406 762828412 762828413 762828414 762828415 762828416 762828417 762828418 762828419 762828420 762828421 762828422 762828423 762828424 762828425 762828426 762828427 762828428 762828429 762828430 762828431 762828432 762828433 762828434 762828435 762828436 762828437 762828438 762828439 762828440 762828441 762828442 762828443 762828444 762828445 762828446 762828447 762828448 762828449 762828450 762828451 762828452 762828453 762828454 762828455 762828456 762828457 762828458 762828459 762828460 762828461 762828462 762828463 762828464 762828465 762828466 762828467 762828468 762828469 762828470 762828471 762828472 762828473 762828474 762828475 762828476 762828477 762828478 762828479 762828480 762828481 762828482 762828483 762828484 762828485 762828486 762828493 762828494 762828495 762828496 762828497 762828498 762828499 762828500 762828501 762828502 762828503 762828504 762828505 762828506 762828507 762828508 762828509 762828510 762828511 762828512 762828513 762828514 762828515 762828516 762828517 762828518 762828519 762828520 762828521 762828522 762828523 762828524 762828525 762828526 762828527 762828528 762828529 762828530 762828531 762828532 762828533 762828534 762828535 762828536 762828537 762828538 762828539 762828540 762828541 762828542 762828543 762828544 762828545 762828546 762828547 762828548 762828549 762828550 762828551 762828552 762828553 762828554 762828555 762828556 762828557 762828558 762828559 762828560 762828561 762828562 762828563 762828564 762828565 762828566 762828567 762828568 762828569 762828570 762828571 762828572 762828573 762828574 762828575 762828576 762828577 762828578 762828579 762828580 762828581 762828582 762828583 762828584 762828585 762828586 762828587 762828588 762828589 762828590 762828591 762828592 762828593 762828594 762828595 762828596 762828597 762828598 762828599 762828600 762828601 762828602 762828603 762828604 762828605 762828606 762828607 762828608 762828609 762828610 762828611 762828612 762828613 762828614 762828615 762828616 762828617 762828618 762828619 762828620 762828621 762828622 762828623 762828624 762828625 762828626 762828627 762828628 762828629 762828630 762828631 762828632 762828633 762828634 762828635 762828636 762828637 762828638 762828639 762828640 762828641 762828642 762828643 762828644 762828645 762828646 762828647 762828648 762828649 762828650 762828651 762828652 762828653 762828654 762828655 762828656 762828657 762828658 762828659 762828660 762828661 762828662 762828663 762828664 762828665 762828666 762828667 762828668 762828669 762828670 762828671 762828672 762828673 762828674 762828675 762828676 762828677 762828678 762828679 762828680 762828681 762828682 762828683 762828684 762828685 762828686 762828687 762828688 762828689 762828690 762828691 762828692 762828693 762828694 762828695 762828696 762828697 762828698 762828699 762828700 762828701 762828702 762828703 762828704 762828705 762828708 762828709 762828710 762828712 762828713 762828714 762828715 762828716 762828717 762828718 762828719 762828720 762828721 762828722 762828723 762828724 762828725 762828726 762828727 762828728 762828729 762828730 762828731 762828732 762828733 762828734 762828735 762828736 762828737 762828738 762828739 762828740 762828741 762828742 762828743 762828744 762828745 762828746 762828747 762828748 762828749 762828750 762828751 762828752 762828753 762828754 762828755 762828756 762828757 762828758 762828759 762828760 762828761 762828762 762828763 762828764 762828765 762828766 762828767 762828768 762828769 762828770 762828771 762828772 762828773 762828774 762828775 762828776 762828777 762828778 762828779 762828780 762828781 762828782 762828783 762828784 762828785 762828786 762828787 762828788 762828789 762828790 762828791 762828792 762828793 762828794 762828795 762828796 762828797 762828798 762828799 762828800 762828801 762828802 762828803 762828804 762828805 762828806 762828807 762828808 762828809 762828810 762828811 762828812 762828813 762828814 762828815 762828816 762828817 762828818 762828819 762828820 762828821 762828822 762828823 762828824 762828825 762828826 762828827 762828828 762828829 762828830 762828831 762828832 762828833 762828834 762828835 762828836 762828837 762828838 762828839 762828840 762828841 762828842 762828843 762828844 762828845 762828846 762828847 762828848 762828849 762828850 762828851 762828852 762828853 762828854 762828855 762828856 762828857 762828858 762828859 762828860 762828861 762828862 762828863 762828864 762828865 762828866 762828867 762828868 762828869 762828870 762828871 762828872 762828873 762828874 762828875 762828876 762828877 762828878 762828879 762828880 762828881 762828882 762828883 762828884 762828885 762828886 762828887 762828888 762828889 762828890 762828891 762828892 762828893 762828894 762828895 762828896 762828897 762828898 762828899 762828900 762828901 762828902 762828903 762828904 762828905 762828906 762828907 762828908 762828909 762828910 762828911 762828912 762828913 762828914 762828915 762828916 762828917 762828918 762828919 762829159 762829164 762829165 762829166 762829167 762829168 762829169 762829170 762829171 762829172 762829173 762829174 762829175 762829176 762829177 762829178 762829184 762829185 762829186 762829187 762829189 762829190 762829191 762829192 762829193 762829194 762829195 762829196 762829197 762829198 762829199 762829200 762829201 762829202 762829203 762829204 762829205 762829206 762829207 762829208 762829209 762829210 762829211 762829212 762829213 762829214 762829215 762829216 762829217 762829218 762829219 762829220 762829221 762829222 762829223 762829224 762829225 762829226 762829227 762829228 762829229 762829230 762829231 762829232 762829233 762829234 762829235 762829236 762829237 762829238 762829239 762829240 762829241 762829242 762829243 762829244 762829245 762829246 762829247 762829248 762829249 762829250 762829251 762829252 762829253 762829254 762829255 762829256 762829257 762829258 762829259 762829260 762829261 762829262 762829263 762829264 762829265 762829266 762829267 762829268 762829269 762829270 762829271 762829272 762829273 762829274 762829275 762829276 762829277 762829278 762829279 762829280 762829281 762829282 762829283 762829284 762829285 762829286 762829287 762829288 762829289 762829290 762829291 762829292 762829293 762829294 762829295 762829296 762829297 762829298 762829299 762829300 762829301 762829302 762829303 762829304 762829305 762829306 762829307 762829308 762829309 762829310 762829311 762829312 762829313 762829314 762829315 762829316 762829317 762829318 762829319 762829320 762829321 762829322 762829323 762829324 762829325 762829326 762829327 762829328 762829329 762829330 762829331 762829332 762829333 762829334 762829335 762829336 762829337 762829338 762829339 762829340 762829341 762829342 762829343 762829344 762829345 762829346 762829347 762829352 762829353 762829354 762829355 762829356 762829357 762829358 762829359 762829360 762829361 762829362 762829363 762829364 762829365 762829366 762829367 762829368 762829369 762829370 762829371 762829372 762829373 762829374 762829375 762829376 762829377 762829378 762829379 762829380 762829381 762829382 762829383 762829384 762829385 762829386 762829387 762829388 762829389 762829390 762829391 762829392 762829393 762829394 762829395 762829396 762829397 762829398 762829399 762829400 762829401 762829402 762829403 762829404 762829405 762829406 762829407 762829408 762829409 762829410 762829411 762829412 762829413 762829414 762829415 762829416 762829417 762829418 762829419 762829420 762829421 762829422 762829423 762829424 762829425 762829426 762829427 762829428 762829429 762829430 762829431 762829432 762829433 762829434 762829435 762829436 762829437 762829438 762829439 762829440 762829441 762829442 762829443 762829444 762829445 762829446 762829447 762829448 762829449 762829450 762829451 762829452 762829453 762829454 762829455 762829456 762829457 762829458 762829459 762829460 762829461 762829462 762829463 762829464 762829465 762829466 762829467 762829468 762829469 762829470 762829471 762829472 762829473 762829474 762829475 762829476 762829477 762829478 762829479 762829480 762829481 762829482 762829483 762829484 762829485 762829486 762829487 762829488 762829489 762829490 762829491 762829492 762829493 762829494 762829495 762829496 762829497 762829498 762829499 762829500 762829501 762829502 762829503 762829504 762829505 762829506 762829507 762829508 762829509 762829510 762829511 762829512 762829513 762829514 762829515 762829516 762829517 762829518 762829519 762829520 762829521 762829522 762829523 762829524 762829525 762829526 762829527 762829528 762829529 762829530 762829531 762829532 762829533 762829534 762829535 762829536 762829537 762829538 762829539 762829540 762829541 762829542 762829543 762829544 762829545 762829546 762829547 762829548 762829549 762829550 762829551 762829552 762829553 762829554 762829555 762829556 762829557 762829558 762829559 762829560 762829561 762829562 762829563 762829564 762829565 762829566 762829567 762829568 762829569 762829570 762829571 762829572 762829573 762829574 762829575 762829576 762829577 762829578 762829579 762829580 762829581 762829582 762829583 762829584 762829585 762829586 762829587 762829588 762829593 762829594 762829595 762829596 762829597 762829598 762829599 762829600 762829601 762829602 762829603 762829604 762829605 762829606 762829607 762829608 762829609 762829610 762829611 762829612 762829613 762829614 762829615 762829616 762829617 762829618 762829619 762829620 762829621 762829622 762829623 762829624 762829625 762829626 762829627 762829628 762829629 762829630 762829631 762829632 762829633 762829634 762829635 762829636 762829637 762829638 762829639 762829640 762829641 762829642 762829643 762829644 762829645 762829646 762829647 762829648 762829649 762829650 762829651 762829652 762829653 762829654 762829655 762829656 762829657 762829658 762829659 762829660 762829661 762829662 762829663 762829664 762829665 762829666 762829667 762829668 762829669 762829670 762829671 762829672 762829673 762829674 762829675 762829676 762831055 762831060 762831061 762831062 762831063 762831064 762831065 762831066 762831067 762831068 762831069 762831070 762831071 762831072 762831073 762831074 762831075 762831076 762831077 762831078 762831079 762831080 762831081 762831082 762831083 762831084 762831085 762831086 762831087 762831088 762831089 762831090 762831091 762831092 762831093 762831094 762831095 762831096 762831097 762831105 762831106 762831107 762831108 762831109 762831110 762831111 762831112 762831113 762831114 762831115 762831116 762831117 762831118 762831119 762831120 762831121 762831122 762831123 762831124 762831125 762831126 762831127 762831128 762831129 762831130 762831131 762831132 762831133 762831134 762831135 762831136 762831137 762831138 762831139 762831140 762831141 762831142 762831143 762831144 762831145 762831146 762831147 762831148 762831149 762831150 762831151 762831152 762831153 762831154 762831155 762831156 762831157 762831158 762831159 762831160 762831161 762831162 762831163 762831164 762831165 762831166 762831167 762831168 762831169 762831170 762831171 762831172 762831173 762831174 762831175 762831176 762831177 762831178 762831179 762831180 762831189 762831190 762831191 762831192 762831193 762831195 762831196 762831197 762831198 762831199 762831200 762831201 762831202 762831203 762831204 762831205 762831206 762831207 762831208 762831209 762831210 762831211 762831212 762831213 762831214 762831215 762831216 762831217 762831218 762831219 762831220 762831221 762831222 762831223 762831224 762831225 762831226 762831227 762831228 762831229 762831230 762831231 762831232 762831233 762831234 762831235 762831236 762831237 762831238 762831239 762831240 762831241 762831242 762831243 762831244 762831245 762831246 762831247 762831248 762831249 762831250 762831251 762831252 762831253 762831254 762831255 762831256 762831257 762831258 762831259 762831260 762831261 762831262 762831263 762831264 762831265 762831266 762831267 762831268 762831269 762831270 762831271 762831272 762831273 762831274 762831275 762831276 762831277 762831278 762831279 762831280 762831281 762831282 762831283 762831284 762831285 762831286 762831287 762831288 762831289 762831290 762831291 762831292 762831293 762831294 762831295 762831296 762831297 762831298 762831299 762831300 762831301 762831302 762831303 762831304 762831305 762831306 762831307 762831308 762831309 762831310 762831311 762831312 762831313 762831314 762831315 762831316 762831317 762831318 762831319 762831320 762831321 762831322 762831323 762831324 762831325 762831326 762831327 762831328 762831329 762831330 762831331 762831332 762831333 762831334 762831335 762831336 762831337 762831338 762831339 762831340 762831341 762831342 762831343 762831344 762831345 762831346 762831347 762831348 762831349 762831350 762831351 762831352 762831353 762831354 762831355 762831356 762831357 762831358 762831359 762831362 762831363 762831364 762831365 762831367 762831368 762831369 762831370 762831371 762831372 762831373 762831374 762831375 762831376 762831377 762831378 762831379 762831380 762831381 762831382 762831383 762831384 762831385 762831386 762831387 762831388 762831389 762831390 762831391 762831392 762831393 762831394 762831395 762831396 762831397 762831398 762831399 762831400 762831401 762831402 762831403 762831404 762831405 762831406 762831407 762831408 762831409 762831410 762831411 762831412 762831413 762831414 762831415 762831416 762831417 762831418 762831419 762831420 762831421 762831422 762831423 762831424 762831425 762831426 762831427 762831428 762831429 762831430 762831431 762831432 762831433 762831434 762831435 762831436 762831437 762831438 762831439 762831440 762831441 762831442 762831443 762831444 762831445 762831446 762831447 762831448 762831449 762831450 762831451 762831452 762831453 762831454 762831455 762831456 762831457 762831458 762831459 762831460 762831461 762831462 762831463 762831464 762831465 762831466 762831467 762831468 762831469 762831470 762831471 762831472 762831473 762831474 762831475 762831476 762831477 762831478 762831479 762831480 762831481 762831482 762831483 762831484 762831485 762831486 762831487 762831488 762831489 762831490 762831491 762831492 762831493 762831494 762831495 762831496 762831497 762831498 762831499 762831500 762831501 762831502 762831503 762831504 762831505 762831506 762831507 762831508 762831509 762831510 762831511 762831512 762831513 762831514 762831515 762831516 762831517 762831518 762831519 762831520 762831521 762831522 762831523 762831524 762831525 762831526 762831527 762831528 762831529 762831530 762831531 762831532 762831533 762831534 762831535 762831536 762831537 762831538 762831539 762831540 762831541 762831542 762831543 762831544 762831545 762831546 762831547 762831548 762831549 762831550 762831551 762831552 762831553 762831554 762831555 762831556 762831557 762831558 762831559 762831560 762831561 762831562 762831563 762831564 762831565 762831566 762831567 762831568 762831569 762831570 762831571 762831572 762831573 762831574 762831575 762831576 762831577 762831578 762831579 762831580 762831581 762831582 762831583 762831584 762831585 762831586 762831587 762831588 762831589 762831590 762831591 762831592 762831593 762831594 762831595 762831596 762831597 762831598 762831599 762831600 762831601 762831602 762831603 762831604 762831605 762831606 762831607 762831608 762831609 762831610 762831611 762831612 762831613 762831614 762831615 762831616 762831617 762831618 762831619 762831620 762831621 762831622 762831623 762831624 762831625 762831626 762831627 762831628 762831629 762831630 762831631 762831632 762831633 762831634 762831635 762831636 762831637 762831638 762831639 762831640 762831641 762831642 762831643 762831644 762831645 762831646 762831647 762831648 762831649 762831650 762831651 762831652 762831653 762831654 762831655 762831656 762831657 762831658 762831659 762831660 762831661 762831662 762831663 762831664 762831665 762831666 762831667 762831668 762831669 762831670 762831671 762831672 762831673 762831674 762831675 762831676 762831677 762831678 762831679 762831680 762831681 762831682 762831683 762831684 762831685 762831686 762831687 762831688 762831689 762831690 762831691 762831692 762831693 762831694 762831695 762831696 762831697 762831698 762831699 762831700 762831701 762831702 762831703 762831704 762831705 762831706 762831707 762831708 762831709 762831710 762831711 762831712 762831713 762831714 762831715 762831716 762831717 762831718 762831719 762831720 762831721 762831722 762831723 762831724 762831725 762831726 762831727 762831728 762831729 762831730 762831731 762831732 762831733 762831734 762831735 762831736 762831737 762831738 762831739 762831740 762831741 762831742 762831743 762831744 762831745 762831746 762831747 762831752 762831753 762831754 762831755 762831756 762831757 762831758 762831759 762831760 762831779 762831780 762831781 762831782 762831784 762831785 762831786 762831787 762831788 762831789 762831790 762831791 762831792 762831793 762831794 762831795 762831796 762831797 762831798 762831799 762831800 762831801 762831802 762831803 762831804 762831805 762831806 762831807 762831808 762831809 762831810 762831811 762831812 762831813 762831814 762831815 762831816 762831817 762831818 762831819 762831820 762831821 762831822 762831823 762831824 762831825 762831826 762831827 762831828 762831829 762831830 762831831 762831832 762831833 762831834 762831835 762831836 762831837 762831838 762831839 762831840 762831841 762831842 762831843 762831844 762831845 762831846 762831847 762831848 762831849 762831850 762831851 762831852 762831853 762831854 762831855 762831856 762831857 762831858 762831859 762831860 762831861 762831862 762831863 762831864 762831865 762831866 762831867 762831868 762831869 762831870 762831871 762831872 762831873 762831874 762831875 762831876 762831877 762831878 762831879 762831880 762831881 762831882 762831883 762831884 762831885 762831886 762831887 762831888 762831889 762831890 762831891 762831892 762831893 762831894 762831895 762831896 762831897 762831898 762831899 762831900 762831901 762831902 762831903 762831904 762831905 762831906 762831907 762831908 762831909 762831910 762831911 762831912 762831913 762831914 762831915 762831916 762831917 762831918 762831919 762831920 762831921 762831922 762831923 762831924 762831925 762831926 762831927 762831928 762831929 762831930 762831931 762831932 762831933 762831934 762831935 762831936 762831937 762831938 762831941 762831943 762831944 762831945 762831946 762831947 762831948 762831949 762831950 762831951 762831952 762831953 762831954 762831955 762831956 762831957 762831958 762831959 762831960 762831961 762831962 762831963 762831964 762831965 762831966 762831967 762831968 762831969 762831970 762831971 762831972 762831973 762831974 762831975 762831976 762831977 762831978 762831979 762831980 762831981 762831982 762831983 762831984 762831985 762831986 762831987 762831988 762831989 762831990 762831991 762831992 762831993 762831994 762831995 762831996 762831997 762831998 762831999 762832000 762832001 762832002 762832003 762832004 762832005 762832006 762832007 762832008 762832009 762832010 762832011 762832012 762832013 762832014 762832015 762832016 762832017 762832018 762832019 762832020 762832021 762832022 762832023 762832024 762832025 762832026 762832027 762832028 762832029 762832030 762832031 762832032 762832033 762832034 762832035 762832036 762832037 762832038 762832039 762832040 762832041 762832042 762832043 762832044 762832045 762832046 762832047 762832048 762832049 762832050 762832051 762832052 762832053 762832054 762832055 762832056 762832057 762832058 762832059 762832060 762832061 762832062 762832063 762832064 762832065 762832066 762832067 762832068 762832069 762832070 762832071 762832072 762832073 762832074 762832075 762832076 762832077 762832078 762832079 762832080 762832081 762832082 762832083 762832084 762832085 762832086 762832087 762832088 762832089 762832090 762832091 762832092 762832093 762832094 762832095 762832096 762832097 762832098 762832099 762832100 762832101 762832102 762832103 762844335 762844348 762844349 762844350 762844351 762844352 762844353 762844354 762844355 762844356 762844357 762844358 762844359 762844360 762844368 762844369 762844370 762844371 762844372 762844373 762844374 762844375 762844376 762844377 762844378 762844379 762844380 762844381 762844382 762844383 762844384 762844385 762844386 762844387 762844388 762844389 762844390 762844391 762844394 762844395 762844396 762844397 762844398 762844399 762844400 762844401 762844402 762844403 762844404 762844405 762844406 762844407 762844408 762844409 762844410 762844411 762844412 762844413 762844414 762844415 762844416 762844417 762844418 762844419 762844420 762844421 762844422 762844423 762844424 762844425 762844426 762844427 762844428 762844429 762844430 762844431 762844432 762844433 762844434 762844435 762844436 762844437 762844438 762844439 762844440 762844441 762844442 762844443 762844444 762844445 762844446 762844447 762844448 762844449 762844450 762844451 762844452 762844453 762844454 762844455 762844456 762844457 762844458 762844459 762844460 762844461 762844462 762844463 762844464 762844465 762844466 762844467 762844468 762844469 762844470 762844471 762844472 762844473 762844474 762844479 762844480 762844481 762844482 762844483 762844484 762844485 762844486 762844487 762844488 762844489 762844490 762844491 762844492 762844493 762844494 762844495 762844496 762844497 762844498 762844499 762844500 762844501 762844502 762844503 762844504 762844505 762844506 762844507 762844508 762844509 762844510 762844511 762844512 762844513 762844514 762844515 762844516 762844517 762844518 762844519 762844520 762844521 762844522 762844523 762844524 762844525 762844526 762844527 762844528 762844529 762844530 762844531 762844532 762844533 762844534 762844535 762844536 762844537 762844538 762844539 762844540 762844541 762844542 762844543 762844544 762844545 762844546 762844547 762844548 762844549 762844550 762844551 762844552 762844553 762844554 762844555 762844556 762844557 762844558 762844559 762844560 762844561 762844562 762844563 762844564 762844565 762844566 762844567 762844568 762844569 762844570 762844571 762844572 762844573 762844574 762844575 762844576 762844577 762844578 762844579 762844580 762844581 762844582 762844583 762844584 762844585 762844586 762844587 762844588 762844589 762844590 762844591 762844592 762844593 762844594 762844595 762844596 762844597 762844598 762844599 762844600 762844601 762844602 762844603 762844604 762844605 762844606 762844607 762844608 762844609 762844610 762844611 762844612 762844613 762844614 762844615 762844616 762844617 762844618 762844619 762844620 762844621 762844622 762844623 762844624 762844625 762844626 762844627 762844628 762844629 762844630 762844631 762844632 762844633 762844634 762844635 762844636 762844637 762844638 762844639 762844640 762844641 762844642 762844643 762844644 762844645 762844646 762844647 762844648 762844649 762844650 762844651 762844652 762844653 762844654 762844655 762844656 762844657 762844658 762844659 762844660 762844661 762844662 762844663 762844664 762844665 762844666 762844667 762844668 762844669 762844670 762844671 762844672 762844673 762844674 762844675 762844676 762844677 762844678 762844679 762844680 762844681 762844682 762844683 762844684 762844685 762844686 762844687 762844688 762844689 762844690 762844691 762844692 762844693 762844694 762844695 762844696 762844697 762844698 762844699 762844700 762844701 762844702 762844703 762844704 762844705 762844706 762844707 762844708 762844709 762844710 762844711 762844712 762844713 762844714 762844715 762844716 762844717 762844718 762844719 762844720 762844721 762844722 762844723 762844724 762844725 762844726 762844727 762844728 762844729 762844730 762844731 762844732 762844733 762844734 762844735 762844736 762844774 762844775 762844776 762844777 762844778 762844779 762844780 762844781 762844782 762844783 762844784 762844785 762844786 762844787 762844792 762844793 762844795 762844796 762844797 762844798 762844799 762844800 762844801 762844802 762844803 762844804 762844805 762844806 762844807 762844808 762844809 762844810 762844811 762844812 762844813 762844814 762844815 762844816 762844817 762844818 762844819 762844820 762844821 762844822 762844823 762844824 762844825 762844826 762844827 762844828 762844829 762844830 762844831 762844832 762844833 762844834 762844835 762844836 762844837 762844838 762844839 762844840 762844841 762844842 762844843 762844844 762844851 762844852 762844853 762844854 762844855 762844856 762844857 762844858 762844859 762844860 762844861 762844862 762844863 762844864 762844865 762844866 762844867 762844868 762844869 762844870 762844871 762844872 762844873 762844874 762844875 762844876 762844877 762844878 762844879 762844880 762844881 762844882 762844883 762844884 762844885 762844886 762844887 762844888 762844889 762844890 762844891 762844892 762844893 762844894 762844895 762844896 762844897 762844898 762844899 762844900 762844901 762844902 762844903 762844904 762844905 762844906 762844907 762844908 762844909 762844910 762844911 762844912 762844913 762844914 762844915 762844916 762844917 762844918 762844919 762844920 762844921 762844922 762844923 762844924 762844925 762844926 762844927 762844928 762844929 762844930 762844931 762844932 762844933 762844934 762844935 762844936 762844937 762844938 762844939 762844940 762844941 762844942 762844943 762844944 762844945 762844946 762844947 762844948 762844949 762844950 762844951 762844952 762844953 762844954 762844955 762844956 762844957 762844958 762844959 762844960 762844961 762844962 762844963 762844964 762844965 762844966 762844967 762844968 762844969 762844970 762844971 762844972 762844973 762844974 762844975 762844976 762844977 762844978 762844979 762844980 762844981 762844982 762844983 762844984 762844987 762844989 762844990 762844991 762844992 762844993 762844994 762844995 762844996 762844997 762844998 762844999 762845000 762845001 762845002 762845003 762845004 762845005 762845006 762845007 762845008 762845009 762845010 762845011 762845012 762845013 762845014 762845015 762845016 762845017 762845018 762845019 762845020 762845021 762845022 762845023 762845024 762845025 762845026 762845027 762845028 762845029 762845030 762845031 762845032 762845033 762845034 762845035 762845036 762845037 762845038 762845039 762845044 762845045 762845047 762845048 762845049 762845050 762845051 762845052 762845053 762845054 762845055 762845056 762845057 762845058 762845059 762845060 762845061 762845062 762845063 762845064 762845065 762845066 762845067 762845068 762845069 762845070 762845071 762845072 762845073 762845074 762845075 762845076 762845077 762845078 762845079 762845080 762845081 762845082 762845083 762845084 762845085 762845086 762845087 762845088 762845089 762845090 762845091 762845092 762845093 762845094 762845095 762845096 762845097 762845098 762845099 762845100 762845101 762845102 762845103 762845104 762845105 762845106 762845107 762845108 762845109 762845110 762845111 762845112 762845113 762845114 762845115 762845116 762845117 762845118 762845119 762845120 762845121 762845122 762845123 762845124 762845125 762845126 762845127 762845128 762845129 762845130 762845131 762845132 762845133 762845134 762845135 762845136 762845137 762845138 762845139 762845140 762845141 762845142 762845143 762845144 762845145 762845146 762845147 762845148 762845149 762845150 762845151 762845152 762845153 762845154 762845155 762845156 762845157 762845158 762845159 762845160 762845161 762845162 762845163 762845164 762845165 762845166 762845167 762845168 762845169 762845170 762845171 762845172 762845173 762845174 762845175 762845176 762845177 762845178 762845179 762845180 762845181 762845182 762845183 762845184 762845185 762845186 762845187 762845188 762845189 762845190 762845191 762845192 762845193 762845194 762845195 762845196 762845197 762845198 762845199 762845200 762845201 762845202 762845203 762845204 762845205 762845206 762845207 762845208 762845209 762845210 762845211 762845212 762845213 762845214 762845215 762845216 762845217 762845218 762845219 762845220 762845221 762845222 762845223 762845224 762845225 762845226 762845227 762845228 762845229 762845230 762845231 762845232 762845233 762845234 762845235 762845236 762845237 762845238 762845239 762845240 762845241 762845242 762845243 762845244 762845245 762845246 762845247 762845248 762845249 762845250 762845251 762845252 762845253 762845254 762845255 762845256 762845257 762845258 762845259 762845260 762845261 762845262 762845263 762845264 762845265 762845266 762845267 762845268 762845269 762845270 762845271 762845272 762845273 762845274 762845275 762845276 762845277 762845278 762845279 762845280 762845281 762845282 762845283 762845287 762845288 762845289 762845290 762845291 762845292 762845293 762845294 762845295 762845296 762845297 762845298 762845299 762845300 762845301 762845302 762845303 762845304 762845305 762845306 762845307 762845308 762845309 762845310 762845311 762845312 762845313 762845314 762845315 762845316 762845317 762845318 762845319 762845320 762845321 762845322 762845323 762845324 762845325 762845326 762845327 762845328 762845329 762845330 762845331 762845332 762845333 762845334 762845335 762845336 762845337 762845338 762845339 762845340 762845341 762845342 762845343 762845344 762845345 762845346 762845347 762845348 762845349 762845350 762845351 762845352 762845353 762845354 762845355 762845356 762845357 762845358 762845359 762845360 762845361 762845362 762845363 762845364 762845365 762845366 762845367 762845368 762845369 762845370 762845371 762845372 762845373 762845374 762845375 762845376 762845377 762845378 762845379 762845380 762845381 762845382 762845383 762845384 762845385 762845386 762845387 762845388 762845389 762845390 762845391 762845392 762845393 762845394 762845395 762845396 762845397 762845398 762845399 762845400 762845401 762845402 762845403 762845404 762845405 762845406 762845407 762845408 762845409 762845410 762845411 762845412 762845413 762845414 762845415 762845416 762845417 762845418 762848830 762848837 762848838 762848839 762848842 762848843 762848844 762848846 762848847 762848848 762848849 762848850 762848851 762848852 762848853 762848854 762848855 762848856 762848857 762848858 762848859 762848860 762848861 762848862 762848863 762848864 762848865 762848866 762848867 762848868 762848869 762848870 762848871 762848872 762848873 762848874 762848875 762848876 762848877 762848878 762848879 762848880 762848881 762848882 762848883 762848884 762848885 762848886 762848887 762848888 762848889 762848890 762848891 762848892 762848893 762848894 762848895 762848906 762848907 762848908 762848909 762848910 762848911 762848912 762848913 762848914 762848924 762848925 762848926 762848927 762848928 762848929 762848930 762848931 762848932 762848933 762848934 762848935 762848936 762848937 762848938 762848939 762848940 762848941 762848942 762848943 762848944 762848945 762848946 762848947 762848948 762848949 762848950 762848951 762848952 762848953 762848954 762848955 762848956 762848957 762848958 762848959 762848960 762848961 762848962 762848963 762848964 762848965 762848966 762848967 762848968 762848969 762848970 762848971 762848972 762848973 762848974 762848975 762848976 762848977 762848978 762848979 762848980 762848981 762848982 762848983 762848984 762848985 762848986 762848987 762848988 762848989 762848990 762848991 762848992 762848993 762848994 762848995 762848996 762848997 762848998 762848999 762849000 762849001 762849002 762849003 762849004 762849005 762849006 762849007 762849008 762849009 762849010 762849011 762849012 762849013 762849014 762849015 762849016 762849017 762849018 762849019 762849020 762849021 762849022 762849023 762849024 762849025 762849026 762849027 762849028 762849029 762849030 762849031 762849032 762849033 762849034 762849035 762849036 762849037 762849038 762849039 762849040 762849041 762849042 762849043 762849044 762849045 762849046 762849047 762849048 762849049 762849050 762849051 762849052 762849053 762849054 762849055 762849056 762849057 762849058 762849059 762849060 762849061 762849062 762849063 762849064 762849065 762849066 762849067 762849068 762849069 762849070 762849071 762849072 762849073 762849074 762849075 762849076 762849077 762849078 762849079 762849080 762849081 762849082 762849083 762849084 762849085 762849086 762849087 762849088 762849089 762849090 762849091 762849092 762849093 762849094 762849095 762849096 762849097 762849098 762849099 762849100 762849101 762849102 762849103 762849104 762849105 762849106 762849107 762849108 762849109 762849110 762849111 762849112 762849113 762849114 762849115 762849116 762849117 762849118 762849119 762849120 762849121 762849122 762849123 762849124 762849125 762849126 762849127 762849128 762849129 762849130 762849131 762849132 762849133 762849134 762849135 762849136 762849137 762849138 762849139 762849140 762849141 762849142 762849143 762849144 762849145 762849146 762849147 762849148 762849149 762849150 762849151 762849152 762849153 762849154 762849155 762849156 762849157 762849158 762849159 762849160 762849161 762849162 762849163 762849164 762849165 762849166 762849167 762849168 762849169 762849170 762849171 762849172 762849173 762849174 762849175 762849176 762849177 762849178 762849179 762849180 762849181 762849182 762849183 762849184 762849185 762849186 762849187 762849188 762849189 762849190 762849191 762849192 762849193 762849194 762849195 762849196 762849197 762849198 762849199 762849200 762849201 762849202 762849203 762849204 762849205 762849206 762849207 762849208 762849209 762849210 762849211 762849212 762849213 762849214 762849215 762849216 762849217 762849218 762849219 762849220 762849221 762849222 762849223 762849224 762849225 762849226 762849227 762849228 762849229 762849230 762849231 762849232 762849233 762849234 762849235 762849236 762849237 762849238 762849239 762849240 762849241 762849242 762849243 762849244 762849245 762849246 762849247 762849248 762849249 762849250 762849251 762849252 762849253 762849254 762849255 762849256 762849257 762849258 762849259 762849260 762849261 762849262 762849263 762849264 762849265 762849266 762849267 762849268 762849269 762849270 762849271 762849272 762849273 762849274 762849275 762849276 762849277 762849278 762849279 762849280 762849281 762849282 762849283 762849284 762849285 762849286 762849287 762849288 762849289 762849290 762849291 762849292 762849293 762849294 762849295 762849296 762849297 762849298 762849299 762849300 762849301 762849302 762849303 762849304 762849305 762849306 762849307 762849308 762849309 762849310 762849311 762849312 762849313 762849314 762849315 762849316 762849317 762849318 762849319 762849320 762849321 762849322 762849323 762849324 762849325 762849326 762849327 762849328 762849329 762849330 762849331 762849332 762849333 762849334 762849335 762849336 762849337 762849338 762849339 762849340 762849341 762849342 762849343 762849344 762849345 762849346 762849347 762849348 762849349 762849350 762849351 762849352 762849353 762849354 762849355 762849356 762849357 762849358 762849359 762849360 762849361 762849362 762849363 762849364 762849365 762849366 762849367 762849368 762849369 762849370 762849371 762849372 762849373 762849374 762849375 762849376 762849377 762849378 762849379 762849380 762849381 762849382 762849383 762849384 762849385 762849386 762849387 762849388 762849389 762849390 762849391 762849392 762849393 762849394 762849395 762849396 762849397 762849398 762849399 762849400 762849401 762849402 762849403 762849404 762849405 762849406 762849407 762849408 762849409 762849410 762849411 762849412 762849413 762849414 762849415 762849416 762849417 762849418 762849419 762849420 762849421 762849422 762849423 762849424 762849425 762849426 762849427 762849428 762849429 762849430 762849431 762849432 762849433 762849434 762849435 762849436 762849437 762849438 762849439 762849440 762849441 762849442 762849443 762849444 762849445 762849446 762849447 762849448 762849449 762849450 762849451 762849452 762849453 762849454 762849455 762849456 762849457 762849458 762849459 762849460 762849461 762849462 762849463 762849464 762849465 762849466 762849467 762849468 762849469 762849470 762849471 762849472 762849473 762849474 762849475 762849476 762849477 762849478 762849479 762849480 762849481 762849482 762849483 762849484 762849485 762849486 762849487 762849488 762849489 762849490 762849491 762849492 762849493 762849494 762849495 762849496 762849497 762849498 762849499 762849500 762849501 762849502 762849503 762849504 762849505 762849506 762849507 762849508 762849509 762849510 762849511 762849512 762849513 762849514 762849515 762849516 762849517 762849518 762849519 762849520 762849521 762849522 762849523 762849524 762849525 762849526 762849527 762849528 762849529 762849530 762849531 762849532 762849533 762849534 762849535 762849536 762849537 762849538 762849539 762849540 762849541 762849542 762849543 762849544 762849545 762849546 762849547 762849548 762849549 762849550 762849551 762849552 762849553 762849554 762849555 762849556 762849557 762849558 762849559 762849560 762849561 762849562 762849563 762849564 762849565 762849566 762849567 762849568 762849569 762849570 762849571 762849572 762849573 762849574 762849575 762849576 762849577 762849578 762849579 762849580 762849581 762849582 762849583 762849584 762849585 762849586 762849587 762849588 762849589 762849590 762849591 762849592 762849593 762849594 762849595 762849596 762849597 762849598 762849599 762849600 762849601 762849602 762849603 762849604 762849605 762849606 762849607 762849608 762849609 762849610 762849611 762849612 762849613 762849614 762849615 762849616 762849617 762849618 762849619 762849620 762849621 762849622 762849623 762849624 762849625 762849626 762849627 762849628 762849629 762849630 762849631 762849632 762849633 762849634 762849635 762849636 762849637 762849638 762849639 762849640 762849641 762849642 762849643 762849644 762849645 762849646 762849647 762849648 762849649 762849650 762849651 762849652 762849653 762849654 762849655 762849656 762849657 762849658 762849659 762849660 762849661 762849662 762849663 762849664 762849665 762849666 762849667 762849668 762849669 762849670 762849671 762849672 762849673 762849674 762849675 762849676 762849677 762849678 762849679 762849680 762849681 762849682 762849683 762849684 762849685 762849686 762849687 762849688 762849689 762849690 762849691 762849692 762849693 762849694 762849695 762849696 762849697 762849698 762849699 762849700 762849701 762849702 762849703 762849704 762849705 762849706 762849707 762849708 762849709 762849710 762849711 762849712 762849713 762849714 762849715 762849716 762849717 762849718 762849719 762849720 762849721 762849722 762849723 762849724 762849725 762849726 762849727 762849728 762849729 762849730 762849731 762849732 762849733 762849734 762849735 762849736 762849737 762849738 762849739 762849740 762849741 762849742 762849743 762849744 762849745 762849746 762849747 762849748 762849749 762849750 762849751 762849752 762849753 762849754 762849755 762849756 762849757 762849758 762849759 762849760 762849761 762849762 762849763 762849764 762849765 762849766 762849767 762849768 762849769 762849770 762849771 762849772 762849773 762849774 762849775 762849776 762849777 762849778 762849779 762849780 762849781 762849782 762849783 762849784 762849785 762849786 762849787 762849788 762849789 762849790 762849791 762849792 762849793 762849794 762849795 762849796 762849797 762849798 762849799 762849800 762849801 762849802 762849803 762849804 762849805 762849806 762849807 762849808 762849809 762849810 762849811 762849812 762849813 762849814 762849815 762849816 762849817 762849818 762849819 762849820 762849821 762849822 762849823 762849824 762849825 762849826 762849827 762849828 762849829 762849830 762849831 762849832 762849833 762849834 762849835 762849836 762849837 762849838 762849839 762849840 762849841 762849842 762849843 762849844 762849845 762849846 762849847 762849848 762849849 762849850 762849851 762849852 762849853 762849854 762849855 762849856 762849857 762850239 762850247 762850248 762850249 762850250 762850251 762850252 762850253 762850254 762850255 762850256 762850257 762850258 762850259 762850260 762850261 762850262 762850263 762850264 762850265 762850266 762850267 762850268 762850269 762850270 762850271 762850272 762850273 762850274 762850275 762850276 762850277 762850278 762850279 762850280 762850281 762850282 762850283 762850284 762850285 762850286 762850287 762850288 762850289 762850290 762850291 762850292 762850293 762850294 762850295 762850296 762850297 762850298 762850299 762850300 762850301 762850302 762850303 762850304 762850305 762850306 762850307 762850308 762850309 762850310 762850311 762850312 762850313 762850314 762850324 762850325 762850326 762850327 762850328 762850329 762850330 762850331 762850332 762850333 762850334 762850335 762850336 762850337 762850338 762850339 762850340 762850341 762850342 762850343 762850344 762850345 762850346 762850347 762850348 762850349 762850350 762850351 762850352 762850353 762850354 762850355 762850356 762850357 762850358 762850359 762850360 762850361 762850362 762850363 762850364 762850365 762850366 762850367 762850368 762850369 762850370 762850371 762850372 762850373 762850374 762850375 762850376 762850377 762850378 762850379 762850380 762850381 762850382 762850383 762850384 762850385 762850386 762850387 762850388 762850389 762850390 762850391 762850392 762850393 762850394 762850395 762850396 762850397 762850398 762850399 762850400 762850401 762850402 762850403 762850404 762850405 762850406 762850407 762850408 762850409 762850410 762850411 762850412 762850413 762850414 762850415 762850416 762850417 762850418 762850419 762850420 762850421 762850422 762850423 762850424 762850425 762850426 762850427 762850428 762850429 762850430 762850431 762850432 762850433 762850434 762850435 762850436 762850437 762850438 762850439 762850440 762850441 762850442 762850443 762850444 762850445 762850446 762850447 762850448 762850449 762850450 762850451 762850452 762850453 762850454 762850455 762850456 762850457 762850458 762850459 762850460 762850461 762850462 762850463 762850464 762850465 762850466 762850467 762850468 762850469 762850470 762850471 762850477 762850478 762850479 762850480 762850481 762850482 762850483 762850484 762850485 762850486 762850487 762850488 762850489 762850490 762850491 762850492 762850493 762850494 762850495 762850496 762850497 762850498 762850499 762850500 762850501 762850502 762850503 762850504 762850505 762850506 762850507 762850508 762850509 762850510 762850511 762850512 762850513 762850514 762850515 762850516 762850517 762850518 762850519 762850520 762850521 762850522 762850523 762850524 762850525 762850526 762850527 762850528 762850529 762850530 762850531 762850532 762850533 762850534 762850535 762850536 762850537 762850538 762850539 762850540 762850541 762850542 762850543 762850544 762850545 762850546 762850547 762850548 762850549 762850550 762850551 762850552 762850553 762850554 762850555 762850556 762850557 762850558 762850559 762850560 762850561 762850562 762850563 762850564 762850565 762850566 762850567 762850568 762850569 762850570 762850571 762850572 762850573 762850574 762850575 762850576 762850577 762850578 762850579 762850580 762850581 762850582 762850583 762850584 762850585 762850586 762850587 762850588 762850589 762850590 762850591 762850592 762850593 762850594 762850595 762850596 762850597 762850598 762850599 762850600 762850601 762850602 762850603 762850604 762850605 762850606 762850607 762850608 762850609 762850610 762850611 762850612 762850613 762850614 762850615 762850616 762850617 762850618 762850619 762850620 762850621 762850622 762850623 762850624 762850625 762850626 762850627 762850628 762850629 762850630 762850631 762850632 762850633 762850634 762850635 762850636 762850637 762850638 762850639 762850640 762850641 762850642 762850643 762850644 762850645 762850646 762850647 762850648 762850649 762850650 762850651 762850652 762850653 762850654 762850655 762850656 762850657 762850658 762850659 762850660 762850661 762850662 762850663 762850664 762850665 762850666 762850667 762850668 762850669 762850670 762850671 762850672 762850673 762850674 762850675 762850676 762850677 762850678 762850679 762850680 762850681 762850682 762850683 762850684 762850685 762850686 762850687 762850688 762850689 762850690 762850691 762850692 762850693 762850694 762850695 762850696 762850697 762850698 762850699 762850700 762850701 762850702 762850703 762850704 762850705 762850706 762850707 762850708 762850709 762850710 762850711 762850712 762850713 762850714 762850715 762850716 762850717 762850718 762850719 762850720 762850721 762850722 762850723 762850724 762850725 762850726 762850727 762850728 762850729 762850730 762850731 762850732 762850733 762850734 762850735 762850736 762850737 762850738 762850739 762850740 762850741 762850742 762850743 762850744 762850745 762850746 762850747 762850748 762850749 762850750 762850751 762850752 762850753 762850754 762850755 762850756 762850757 762850758 762850759 763270975 763294957 763295806 763304366 763304599 763305228 763305975 763309274 763314274 763315741 763315937 763316917 763317970 763318262 763318713 763319742 763319967 763321380 763336881 763339989 763351734 763351765 763351871 763360683 763410221 763413396 763416641 763536557 763536771 766222412 766339175 766339582 766339650 766339968 767275060 767418536 767420776 767441363 767444452 767466774 767466940 767551096 767563766 767567102 767567402 767568483 767573397 767573611 767574307 767584105 767648675 767648768 767652306 767745369 767746068 767746144 767746400 767746701 767746818 767746984 767747089 767748183 767770522 767772992 767773075 767833797 767834276 767843728 767843821 767843852 767844245 767844488 767857001 768418552 768419091 768425649 768457230 768457380 768457832 768789133 768794659 768958184 768963625 768965338 768973188 768976109 768982034 768985197 768986819 768990217 768994175 768995538 768997916 768998913 769002807 769027017 769048826 769050666 769051132 769058425 769082134 769127357 769144978 769153262 769169525 769171105 769177044 769191207 769197221 769216318 769929638 769950853 769981712 770063212 770069820 770201269 770510343 770753083 770756615 770756781 770756985 770769011 770769288 770769577 771035940 771721274 771747500 771749540 771755771 771768633 771777548 771788692 771791931 771872333 771903016 772028804 772039370 772040639 772043141 772043294 772082121 772357462 772358371 772362182 772362353 772365767 772366177 772366443 772367711 772368528 772369703 772370388 772373012 773312959 773348895 773397229 773402075 773464227 773499667 773872671 773873397 775135682 777785696 777812887 778002106 778094454 778134090 778151583 778151694 778151803 778151876 778151957 778152803 778201138 778728117 778728174 778732183 779474346 779497098 779516634 779656559 779779542 780314340 780338135 780338279 780338588 780339353 780339504 780339762 780398143 780398726 780398938 780399138 780399256 780399389 780399458 780400026 780400414 780400884 780401272 780414871 780415746 780446363 780535892 780537177 780557520 780561690 780595424 780595772 780596021 780596253 780596429 780596849 780609559 780619772 780619898 780627268 780627914 780628657 780629613 780630479 780720139 780720518 780721907 780784516 780974266 781007670 781021997 781022497 781111901 781112242 781113723 781114147 781127241 781127397 781141576 781142254 781142572 781147762 781149873 781151224 781151527 781151679 781151788 781152240 781152378 781152547 781152773 781264416 781264732 781265659 781266717 781267761 781268027 781268257 781268516 781332051 781335821 781335941 781377995 781378776 781398771 781415826 781416195 781591415 781682416 781684854 781777222 781780775 781781320 781781398 781785482 781788723 781790875 781796084 781796677 781813396 781828030 781831345 781831363 781831520 781834712 781834764 781834908 781835262 781835308 781836198 781836224 781836814 782007167 782015883 782235282 782318761 782517335 782540644 782607444 782608006 782691329 782691602 782692774 782697560 782698614 782698880 782699232 782699675 782700119 782712300 782719930 782729269 782742656 782749674 782778334 782778538 782808055 783375549 783403095 784059803 784164785 784197322 784254025 784266252 784267718 784268194 784268871 784272349 784275706 784278129 784283081 784283453 784334494 784348544 784488645 784536788 784545210 784552713 784558658 784571272 784599015 784600709 785960951 788595916 788633436 788635458 788664118 788693715 788699805 788707956 788749572 788838807 788849100 788679341 788868020 788693958 788876992 788888813 788890371 788890949 788984747 788989296 789037336 789082306 789082864 789085691 789086886 789163259 789171837 789188381 789201584 789266452 789274573 789585530 789586214 789587678 789699287 789699829 789700285 789702536 789741706 789742472 789744618 789746031 789809918 790129701 790202843 790219215 790226114 790302196 790346824 790347843 790448348 790449712 790450793 790454280 790454991 790456043 790456198 790456489 790458026 790461802 790462129 790467686 790475869 790478765 790483030 790594802 790595374 790603419 790613884 790627324 790629249 790630227 790631189 790632816 790684454 790727188 790742549 790764198 791569889 791801937 791834203 791834864 791893587 791895662 791896230 791897550 791907491 791912434 791993458 792002157 792005358 792150978 792159831 792172891 792178211 792179905 792188386 792195026 792195393 792217694 792256655 792415465 793233316 793233485 793233497 793233498 793273291 793287666 793329077 793331256 793342139 793359112 793369887 793413268 793436815 793522877 793524226 793533662 793537252 793539145 793553592 793554140 793556649 793557384 793557441 793564039 793582318 793662814 793846730 793853488 793860667 793870317 793888558 793892063 793892701 793936849 793956349 793974918 794307557 794804812 794810548 794813736 794813739 794813741 794813742 794813743 794827053 794889353 794922499 795033516 795035012 795036904 795037280 795048241 795050633 795050636 795053207 795059807 795062154 795068927 795074658 795076542 795078367 795094908 795096604 795097989 795100710 795101685 795149590 795149591 795152046 795152051 795152052 795152055 795152206 795152214 795152215 795152237 795152374 795152380 795164685 795164692 795164693 795164694 795164899 795164903 795164904 795164905 795165064 795165073 795165074 795165075 795170338 795170339 795170348 795170587 795170594 795170595 795170752 795170770 795170775 795200226 795238998 795239188 795239352 795239474 795239478 795239506 795239646 795239794 795243883 795243887 795243888 795244099 795244116 795244263 795244271 795244541 795244553 795244554 795244707 795244728 795244743 795244907 795245226 795245232 795245243 795245395 795245407 795247806 795247813 795248432 795248558 795248587 795249607 795249608 795249609 795249792 795249890 795250189 795257288 795257289 795257327 795257463 795257474 795257631 795257644 795257814 795257825 795257831 795258007 795258183 795259274 795259628 795259804 795259833 795259966 795259977 795259984 795260027 795260254 795260510 795260518 795260576 795263903 795265804 795265810 795265811 795265950 795265955 795265973 795265983 795266110 795266171 795266172 795266232 795266290 795266369 795266391 795266401 795266524 795266564 795266570 795266637 795266741 795267110 795267163 795267298 795267375 795267461 795267475 795267478 795267698 795267827 795269596 795269656 795269659 795269670 795269677 795269940 795270103 795283071 796142365 796142738 796267570 797185151 797185862 799007429 799009186 799009195 799009368 799009373 799009388 799009389 799009532 799009540 799009556 799009910 799009916 799009917 799010050 799010071 799010072 799010076 799017560 799017561 799017562 799017564 799017804 799017822 799017823 799017959 799017960 799018006 799019324 799019325 799019328 799019329 799019497 799019511 799019664 799019665 799019677 799019824 799019845 799020707 799020711 799020713 799020714 799020889 799020895 799020896 799020897 799020898 799021070 799021074 799021075 799021077 799021078 799021246 799021247 799021248 799021249 799021263 799021395 799021420 799115390 799240619 799324945 799324946 799324947 799324951 799324952 799325162 799325163 799325168 799325169 799325170 799325348 799325349 799325350 799325518 799325519 799325520 799325526 799325673 799325674 799325677 799325678 799325679 799328639 799334506 799351963 799359944 799361781 799368836 799387625 799434137 799436846 799469053 799493665 799526556 799595188 761164252 761169140 761202002 762417283 762417843 762417919 762418292 763351332 763861811 763863842 771749851 772372212 779410956 779433203 780314210 780462539 780595024 781787054 782273035 782315213 783390405 790536843 791697683 791775969 791919567 793233310 793233317 793233318 793233320 793376458 793523679 794893134 794918134 795259635 795265799 589866662 587489153 610736373 + HISTORY_START: 862000000 + # to see historical TXNS_TO_SKIP, check out ce6158ac2764ee9d4c8738a85f3bcdc6bd0cadc1 + TXNS_TO_SKIP: "0" + # 1195000000-122000000: https://github.com/aptos-labs/aptos-core/pull/13832 + RANGES_TO_SKIP: "1195000000-1220000000" BACKUP_CONFIG_TEMPLATE_PATH: terraform/helm/fullnode/files/backup/gcs.yaml # workflow config RUNS_ON: "high-perf-docker-with-local-ssd" - TIMEOUT_MINUTES: 480 + TIMEOUT_MINUTES: 180 + MAX_VERSIONS_PER_RANGE: 1800000 replay-mainnet: if: | @@ -84,12 +89,16 @@ jobs: # replay-verify config BUCKET: ${{ inputs.MAINNET_BUCKET || 'aptos-mainnet-backup' }} SUB_DIR: e1 - HISTORY_START: 0 - TXNS_TO_SKIP: 12253479 12277499 148358668 + HISTORY_START: 518000000 + #TXNS_TO_SKIP: 12253479 12277499 148358668 + TXNS_TO_SKIP: "0" + # 1197378568-1198492648: https://github.com/aptos-labs/aptos-core/pull/13832 + RANGES_TO_SKIP: "1197378568-1198492648" BACKUP_CONFIG_TEMPLATE_PATH: terraform/helm/fullnode/files/backup/gcs.yaml # workflow config RUNS_ON: "high-perf-docker-with-local-ssd" - TIMEOUT_MINUTES: 480 + TIMEOUT_MINUTES: 180 + MAX_VERSIONS_PER_RANGE: 1000000 test-replay: if: ${{ (github.event_name == 'pull_request') && contains(github.event.pull_request.labels.*.name, 'CICD:test-replay')}} @@ -101,9 +110,13 @@ jobs: # replay-verify config BUCKET: ${{ inputs.TESTNET_BUCKET || 'aptos-testnet-backup' }} SUB_DIR: e1 - HISTORY_START: 250000000 # TODO: We need an exhaustive list of txns_to_skip before we can set this to 0. - TXNS_TO_SKIP: 46874937 151020059 409163615 409163669 409163708 409163774 409163845 409163955 409164059 409164191 414625832 + HISTORY_START: 862000000 + # to see historical TXNS_TO_SKIP, check out ce6158ac2764ee9d4c8738a85f3bcdc6bd0cadc1 + TXNS_TO_SKIP: "0" + # 1195000000-1220000000: https://github.com/aptos-labs/aptos-core/pull/13832 + RANGES_TO_SKIP: "1195000000-1220000000" BACKUP_CONFIG_TEMPLATE_PATH: terraform/helm/fullnode/files/backup/gcs.yaml # workflow config RUNS_ON: "high-perf-docker-with-local-ssd" TIMEOUT_MINUTES: 120 # increase test replay timeout to capture more flaky errors + MAX_VERSIONS_PER_RANGE: 1800000 diff --git a/.github/workflows/run-fullnode-sync.yaml b/.github/workflows/run-fullnode-sync.yaml index 0b5d27b6f9722..82295e882bc77 100644 --- a/.github/workflows/run-fullnode-sync.yaml +++ b/.github/workflows/run-fullnode-sync.yaml @@ -60,7 +60,7 @@ jobs: runs-on: medium-perf-docker-with-local-ssd timeout-minutes: ${{ inputs.TIMEOUT_MINUTES || 300 }} # the default run is 300 minutes (5 hours). Specified here because workflow_dispatch uses string rather than number steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/fullnode-sync with: @@ -105,6 +105,6 @@ jobs: # Because we have to checkout the actions and then check out a different # git ref, it's possible the actions directory will be modified. So, we # need to check it out again for the Post Run actions/checkout to succeed. - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: actions diff --git a/.github/workflows/run-gas-calibration.yaml b/.github/workflows/run-gas-calibration.yaml index 1f91062a4f633..9d613140b8a13 100644 --- a/.github/workflows/run-gas-calibration.yaml +++ b/.github/workflows/run-gas-calibration.yaml @@ -27,7 +27,7 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'CICD:non-required-tests') runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it. - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main diff --git a/.github/workflows/rust-client-tests.yaml b/.github/workflows/rust-client-tests.yaml index 0b5ce8e5a9c9a..d612fc824c546 100644 --- a/.github/workflows/rust-client-tests.yaml +++ b/.github/workflows/rust-client-tests.yaml @@ -33,7 +33,7 @@ jobs: needs: [permission-check] runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/docker-setup@main with: GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} @@ -52,7 +52,7 @@ jobs: needs: [permission-check] runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/docker-setup@main with: GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} @@ -71,7 +71,7 @@ jobs: needs: [permission-check] runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: aptos-labs/aptos-core/.github/actions/docker-setup@main with: GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml index 19e8577fb383f..d05dbe2707391 100644 --- a/.github/workflows/semgrep.yaml +++ b/.github/workflows/semgrep.yaml @@ -20,7 +20,7 @@ jobs: if: (github.actor != 'dependabot[bot]') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: semgrep ci env: SEMGREP_RULES: >- diff --git a/.github/workflows/test-copy-images-to-dockerhub.yaml b/.github/workflows/test-copy-images-to-dockerhub.yaml index b488d771f04c4..25c9e8387fa23 100644 --- a/.github/workflows/test-copy-images-to-dockerhub.yaml +++ b/.github/workflows/test-copy-images-to-dockerhub.yaml @@ -18,7 +18,7 @@ jobs: test-copy-images: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version-file: .node-version diff --git a/.github/workflows/ts-sdk-e2e-tests.yaml b/.github/workflows/ts-sdk-e2e-tests.yaml index c906451abd78b..f31f0c9e2a875 100644 --- a/.github/workflows/ts-sdk-e2e-tests.yaml +++ b/.github/workflows/ts-sdk-e2e-tests.yaml @@ -44,7 +44,7 @@ jobs: outputs: only_docs_changed: ${{ steps.determine_file_changes.outputs.only_docs_changed }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run the file change determinator id: determine_file_changes uses: ./.github/actions/file-change-determinator @@ -55,7 +55,7 @@ jobs: needs: [permission-check, file_change_determinator] runs-on: runs-on,cpu=64,family=c7,hdd=500,image=aptos-ubuntu-x64,run-id=${{ github.run_id }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: needs.file_change_determinator.outputs.only_docs_changed != 'true' with: ref: ${{ env.GIT_SHA }} diff --git a/.github/workflows/windows-build.yaml b/.github/workflows/windows-build.yaml index 920d5d8f942f5..43cdc00fc8ed3 100644 --- a/.github/workflows/windows-build.yaml +++ b/.github/workflows/windows-build.yaml @@ -36,7 +36,7 @@ jobs: # this case). See more here: # https://github.com/Swatinem/rust-cache#cache-details - name: Run cargo cache - uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # pin@v2.2.0 + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # pin@v2.7.3 - name: Install the Developer Tools run: Set-Variable ProgressPreference SilentlyContinue ; PowerShell -ExecutionPolicy Bypass -File scripts/windows_dev_setup.ps1 -t diff --git a/.github/workflows/workflow-run-docker-rust-build.yaml b/.github/workflows/workflow-run-docker-rust-build.yaml index c21a5e10710bb..50e6e14ee1963 100644 --- a/.github/workflows/workflow-run-docker-rust-build.yaml +++ b/.github/workflows/workflow-run-docker-rust-build.yaml @@ -75,7 +75,7 @@ jobs: rust-all: runs-on: runs-on,cpu=64,family=c7,hdd=1024,image=aptos-ubuntu-x64,run-id=${{ github.run_id }},spot=co steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ env.GIT_SHA }} diff --git a/.github/workflows/workflow-run-execution-performance.yaml b/.github/workflows/workflow-run-execution-performance.yaml index 48c5c1ee6ff6b..086b59b700d3d 100644 --- a/.github/workflows/workflow-run-execution-performance.yaml +++ b/.github/workflows/workflow-run-execution-performance.yaml @@ -55,7 +55,7 @@ jobs: outputs: run_execution_performance_test: ${{ steps.determine_test_targets.outputs.run_execution_performance_test }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run the test target determinator id: determine_test_targets uses: ./.github/actions/test-target-determinator @@ -66,7 +66,7 @@ jobs: timeout-minutes: 60 runs-on: ${{ inputs.RUNNER_NAME }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.GIT_SHA }} if: ${{ inputs.IGNORE_TARGET_DETERMINATION || needs.test-target-determinator.outputs.run_execution_performance_test == 'true' }} diff --git a/.github/workflows/workflow-run-module-verify.yaml b/.github/workflows/workflow-run-module-verify.yaml index 2dd3a9ac7b0f4..de16bbade2ffe 100644 --- a/.github/workflows/workflow-run-module-verify.yaml +++ b/.github/workflows/workflow-run-module-verify.yaml @@ -38,7 +38,7 @@ jobs: timeout-minutes: ${{ inputs.TIMEOUT_MINUTES }} runs-on: ${{ inputs.RUNS_ON }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.GIT_SHA }} diff --git a/.github/workflows/workflow-run-replay-verify.yaml b/.github/workflows/workflow-run-replay-verify.yaml index 29dbdf1c88c13..cb7af2922a65d 100644 --- a/.github/workflows/workflow-run-replay-verify.yaml +++ b/.github/workflows/workflow-run-replay-verify.yaml @@ -25,6 +25,10 @@ on: required: false type: string description: The list of transaction versions to skip. If not specified, it will use the default list. + RANGES_TO_SKIP: + required: false + type: string + description: The optional list of transaction ranges to skip.. BACKUP_CONFIG_TEMPLATE_PATH: description: "The path to the backup config template to use." type: string @@ -39,7 +43,11 @@ on: description: "Github job timeout in minutes" type: number required: true - default: 720 + default: 180 + MAX_VERSIONS_PER_RANGE: + description: "The maximum number of versions to process in a single job." + type: number + required: true # This allows the workflow to be triggered manually from the Github UI or CLI # NOTE: because the "number" type is not supported, we default to 720 minute timeout workflow_dispatch: @@ -65,6 +73,10 @@ on: required: false type: string description: The list of transaction versions to skip. If not specified, it will use the default list. + RANGES_TO_SKIP: + required: false + type: string + description: The optional list of transaction ranges to skip.. BACKUP_CONFIG_TEMPLATE_PATH: description: "The path to the backup config template to use." type: string @@ -75,25 +87,128 @@ on: type: string required: true default: "high-perf-docker-with-local-ssd" - + MAX_VERSIONS_PER_RANGE: + description: "The maximum number of versions to process in a single job." + type: number + required: true jobs: + prepare: + runs-on: ${{ inputs.RUNS_ON }} + outputs: + job_ids: ${{ steps.gen-jobs.outputs.job_ids }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ inputs.GIT_SHA }} + + - name: Load cached aptos-debugger binary + id: cache-aptos-debugger-binary + uses: actions/cache@v4 + with: + # copy the binary to the root of the repo and cache it there, because rust-setup calls a cache-rust action + # which cleans up the target directory in its post action + path: | + aptos-debugger + testsuite/replay_verify.py + key: aptos-debugger-${{ inputs.GIT_SHA || github.sha }} + + - name: Prepare for build if not cached + if: steps.cache-aptos-debugger-binary.outputs.cache-hit != 'true' + uses: aptos-labs/aptos-core/.github/actions/rust-setup@main + with: + GIT_CREDENTIALS: ${{ inputs.GIT_CREDENTIALS }} + + - name: Build and strip aptos-debugger binary if not cached + if: steps.cache-aptos-debugger-binary.outputs.cache-hit != 'true' + shell: bash + run: | + cargo build --release -p aptos-debugger + strip -s target/release/aptos-debugger + cp target/release/aptos-debugger . + + - name: Install GCloud SDK + uses: "google-github-actions/setup-gcloud@v2" + with: + version: ">= 418.0.0" + install_components: "kubectl,gke-gcloud-auth-plugin" + + - name: get timestamp to use in cache key + id: get-timestamp + run: echo "ts=$(date +%s)" >> $GITHUB_OUTPUT + + - name: Load cached backup storage metadata cache dir (and save back afterwards) + uses: actions/cache@v4 + with: + path: metadata_cache + key: metadata-cache-${{ inputs.BUCKET }}/${{ inputs.SUB_DIR }}-${{ steps.get-timestamp.outputs.ts }} + restore-keys: metadata-cache-${{ inputs.BUCKET }}/${{ inputs.SUB_DIR }}- + + - name: Generate job ranges + id: gen-jobs + env: + BUCKET: ${{ inputs.BUCKET }} + SUB_DIR: ${{ inputs.SUB_DIR }} + run: | + ./aptos-debugger aptos-db gen-replay-verify-jobs \ + --metadata-cache-dir ./metadata_cache \ + --command-adapter-config ${{ inputs.BACKUP_CONFIG_TEMPLATE_PATH }} \ + --start-version ${{ inputs.HISTORY_START }} \ + --ranges-to-skip "${{ inputs.RANGES_TO_SKIP }}" \ + --max-versions-per-range ${{ inputs.MAX_VERSIONS_PER_RANGE }} \ + \ + --max-ranges-per-job 16 \ + --output-json-file jobs.json \ + + + jq -c 'length as $N | [range(0; $N)]' jobs.json > job_ids.json + + cat job_ids.json + jq . jobs.json + + echo "job_ids=$(cat job_ids.json)" >> $GITHUB_OUTPUT + + - name: Cache backup storage config and job definition + uses: actions/cache/save@v4 + with: + path: | + ${{ inputs.BACKUP_CONFIG_TEMPLATE_PATH }} + jobs.json + key: backup-config-${{ inputs.BUCKET }}/${{ inputs.SUB_DIR }}-${{ github.run_id }} + replay-verify: - timeout-minutes: ${{ inputs.TIMEOUT_MINUTES || 720 }} + needs: prepare + timeout-minutes: ${{ inputs.TIMEOUT_MINUTES || 180 }} runs-on: ${{ inputs.RUNS_ON }} strategy: fail-fast: false matrix: - number: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18] # runner number + job_id: ${{ fromJson(needs.prepare.outputs.job_ids) }} steps: - - name: Echo Runner Number - run: echo "Runner is ${{ matrix.number }}" - - uses: actions/checkout@v4 + - name: Load cached aptos-debugger binary and replay_verify.py script + uses: actions/cache/restore@v4 with: - ref: ${{ inputs.GIT_SHA }} + path: | + aptos-debugger + testsuite/replay_verify.py + key: aptos-debugger-${{ inputs.GIT_SHA || github.sha }} + fail-on-cache-miss: true + + - name: Load cached backup storage metadata cache dir + uses: actions/cache/restore@v4 + with: + path: metadata_cache + key: metadata-cache-${{ inputs.BUCKET }}/${{ inputs.SUB_DIR }}- + fail-on-cache-miss: true - - uses: aptos-labs/aptos-core/.github/actions/rust-setup@main + - name: Load cached backup storage config and job definitions + uses: actions/cache/restore@v4 with: - GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} + path: | + ${{ inputs.BACKUP_CONFIG_TEMPLATE_PATH }} + jobs.json + key: backup-config-${{ inputs.BUCKET }}/${{ inputs.SUB_DIR }}-${{ github.run_id }} + fail-on-cache-miss: true - name: Install GCloud SDK uses: "google-github-actions/setup-gcloud@v2" @@ -101,16 +216,79 @@ jobs: version: ">= 418.0.0" install_components: "kubectl,gke-gcloud-auth-plugin" - - name: Build CLI binaries in release mode - shell: bash - run: cargo build --release -p aptos-debugger - - name: Run replay-verify in parallel - shell: bash - run: testsuite/replay_verify.py ${{ matrix.number }} 19 # first argument is the runner number, second argument is the total number of runners env: BUCKET: ${{ inputs.BUCKET }} SUB_DIR: ${{ inputs.SUB_DIR }} - HISTORY_START: ${{ inputs.HISTORY_START }} - TXNS_TO_SKIP: ${{ inputs.TXNS_TO_SKIP }} - BACKUP_CONFIG_TEMPLATE_PATH: ${{ inputs.BACKUP_CONFIG_TEMPLATE_PATH }} + shell: bash + run: | + set -o nounset -o errexit -o pipefail + replay() { + idx=$1 + id=$2 + begin=$3 + end=$4 + desc=$5 + + echo --------- + echo Job start. $id: $desc + echo --------- + + MC=metadata_cache_$idx + cp -r metadata_cache $MC + DB=db_$idx + + for try in {0..6} + do + if [ $try -gt 0 ]; then + SLEEP=$((10 * $try)) + echo "sleeping for $SLEEP seconds before retry #$try" >&2 + sleep $SLEEP + fi + + res=0 + ./aptos-debugger aptos-db replay-verify \ + --metadata-cache-dir $MC \ + --command-adapter-config ${{ inputs.BACKUP_CONFIG_TEMPLATE_PATH }} \ + --start-version $begin \ + --end-version $end \ + \ + --lazy-quit \ + --enable-storage-sharding \ + --target-db-dir $DB \ + --concurrent-downloads 8 \ + --replay-concurrency-level 4 \ + || res=$? + + if [[ $res == 0 || $res == 2 ]] + then + return $res + fi + done + return 1 + } + + pids=() + idx=0 + while read id begin end desc; do + + replay $idx $id $begin $end "$desc" 2>&1 | sed "s/^/[partition $idx]: /" & + + pids[$idx]=$! + idx=$((idx+1)) + done < <(jq '.[${{ matrix.job_id }}][]' jobs.json) + + res=0 + for idx in `seq 0 $((idx-1))` + do + range_res=0 + wait ${pids[$idx]} || range_res=$? + echo partition $idx returned $range_res + if [[ $range_res != 0 ]] + then + res=$range_res + fi + done + + echo All partitions done, returning $res + exit $res diff --git a/Cargo.lock b/Cargo.lock index 413ce73564963..3837a3bcf00e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -244,9 +244,9 @@ checksum = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" dependencies = [ "backtrace", ] @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "aptos" -version = "4.2.0" +version = "4.2.2" dependencies = [ "anyhow", "aptos-api-types", @@ -919,7 +919,7 @@ dependencies = [ "maplit", "mini-moka", "mirai-annotations", - "mockall", + "mockall 0.11.4", "move-core-types", "num-derive", "num-traits", @@ -1099,7 +1099,7 @@ dependencies = [ "futures", "itertools 0.13.0", "maplit", - "mockall", + "mockall 0.11.4", "ordered-float 3.9.2", "rand 0.8.5", "serde", @@ -1245,6 +1245,7 @@ dependencies = [ "bcs 0.1.4", "clap 4.4.14", "itertools 0.13.0", + "serde_json", "tokio", ] @@ -2281,6 +2282,38 @@ dependencies = [ "url", ] +[[package]] +name = "aptos-indexer-processor-sdk" +version = "0.1.0" +source = "git+https://github.com/aptos-labs/aptos-indexer-processor-sdk.git?rev=9ecd252ccff53023664562001dd04c2886488c0d#9ecd252ccff53023664562001dd04c2886488c0d" +dependencies = [ + "anyhow", + "aptos-indexer-transaction-stream", + "aptos-protos 1.3.1 (git+https://github.com/aptos-labs/aptos-core.git?rev=5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb)", + "async-trait", + "bcs 0.1.4", + "bigdecimal", + "chrono", + "derive_builder", + "futures", + "hex", + "instrumented-channel", + "kanal", + "mockall 0.12.1", + "num_cpus", + "once_cell", + "petgraph 0.6.5", + "prometheus", + "prometheus-client", + "serde", + "serde_json", + "thiserror", + "tiny-keccak", + "tokio", + "tracing", + "url", +] + [[package]] name = "aptos-indexer-test-transactions" version = "1.0.0" @@ -2309,6 +2342,27 @@ dependencies = [ "url", ] +[[package]] +name = "aptos-indexer-transaction-stream" +version = "0.1.0" +source = "git+https://github.com/aptos-labs/aptos-indexer-processor-sdk.git?rev=9ecd252ccff53023664562001dd04c2886488c0d#9ecd252ccff53023664562001dd04c2886488c0d" +dependencies = [ + "anyhow", + "aptos-moving-average 0.1.0 (git+https://github.com/aptos-labs/aptos-indexer-processor-sdk.git?rev=9ecd252ccff53023664562001dd04c2886488c0d)", + "aptos-protos 1.3.1 (git+https://github.com/aptos-labs/aptos-core.git?rev=5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb)", + "chrono", + "futures-util", + "once_cell", + "prometheus", + "prost 0.12.3", + "sample", + "serde", + "tokio", + "tonic 0.11.0", + "tracing", + "url", +] + [[package]] name = "aptos-infallible" version = "0.1.0" @@ -2815,7 +2869,15 @@ dependencies = [ [[package]] name = "aptos-moving-average" version = "0.1.0" -source = "git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=fa1ce4947f4c2be57529f1c9732529e05a06cb7f#fa1ce4947f4c2be57529f1c9732529e05a06cb7f" +source = "git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=51a34901b40d7f75767ac907b4d2478104d6a515#51a34901b40d7f75767ac907b4d2478104d6a515" +dependencies = [ + "chrono", +] + +[[package]] +name = "aptos-moving-average" +version = "0.1.0" +source = "git+https://github.com/aptos-labs/aptos-indexer-processor-sdk.git?rev=9ecd252ccff53023664562001dd04c2886488c0d#9ecd252ccff53023664562001dd04c2886488c0d" dependencies = [ "chrono", ] @@ -3263,7 +3325,7 @@ dependencies = [ "claims", "futures", "maplit", - "mockall", + "mockall 0.11.4", "once_cell", "rand 0.7.3", "serde", @@ -3297,7 +3359,7 @@ dependencies = [ [[package]] name = "aptos-profiler" version = "0.1.0" -source = "git+https://github.com/aptos-labs/aptos-core.git?rev=4541add3fd29826ec57f22658ca286d2d6134b93#4541add3fd29826ec57f22658ca286d2d6134b93" +source = "git+https://github.com/aptos-labs/aptos-core.git?rev=202bdccff2b2d333a385ae86a4fcf23e89da9f62#202bdccff2b2d333a385ae86a4fcf23e89da9f62" dependencies = [ "anyhow", "backtrace", @@ -3762,7 +3824,7 @@ dependencies = [ "bcs 0.1.4", "claims", "futures", - "mockall", + "mockall 0.11.4", "move-core-types", "ntest", "once_cell", @@ -3851,7 +3913,7 @@ dependencies = [ "futures", "maplit", "mini-moka", - "mockall", + "mockall 0.11.4", "once_cell", "rand 0.7.3", "serde", @@ -3899,10 +3961,10 @@ dependencies = [ [[package]] name = "aptos-system-utils" version = "0.1.0" -source = "git+https://github.com/aptos-labs/aptos-core.git?rev=4541add3fd29826ec57f22658ca286d2d6134b93#4541add3fd29826ec57f22658ca286d2d6134b93" +source = "git+https://github.com/aptos-labs/aptos-core.git?rev=202bdccff2b2d333a385ae86a4fcf23e89da9f62#202bdccff2b2d333a385ae86a4fcf23e89da9f62" dependencies = [ "anyhow", - "aptos-profiler 0.1.0 (git+https://github.com/aptos-labs/aptos-core.git?rev=4541add3fd29826ec57f22658ca286d2d6134b93)", + "aptos-profiler 0.1.0 (git+https://github.com/aptos-labs/aptos-core.git?rev=202bdccff2b2d333a385ae86a4fcf23e89da9f62)", "async-mutex", "http 0.2.11", "hyper 0.14.28", @@ -5052,9 +5114,9 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", @@ -5723,7 +5785,7 @@ dependencies = [ "move-binary-format", "move-bytecode-verifier", "move-core-types", - "petgraph 0.5.1", + "petgraph 0.6.5", "proptest", ] @@ -6606,7 +6668,7 @@ dependencies = [ "bitflags 1.3.2", "crossterm_winapi", "libc", - "mio", + "mio 0.8.11", "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", @@ -6622,7 +6684,7 @@ dependencies = [ "bitflags 1.3.2", "crossterm_winapi", "libc", - "mio", + "mio 0.8.11", "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", @@ -6983,6 +7045,17 @@ dependencies = [ "uuid", ] +[[package]] +name = "delegate" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "der" version = "0.5.1" @@ -7098,7 +7171,7 @@ dependencies = [ "guppy", "guppy-workspace-hack", "once_cell", - "petgraph 0.6.4", + "petgraph 0.6.5", "rayon", "serde", "toml 0.5.11", @@ -7302,6 +7375,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + [[package]] name = "dunce" version = "1.0.4" @@ -8703,7 +8782,7 @@ dependencies = [ "nested", "once_cell", "pathdiff", - "petgraph 0.6.4", + "petgraph 0.6.5", "rayon", "semver", "serde", @@ -8939,9 +9018,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -9623,6 +9702,19 @@ dependencies = [ "web-sys", ] +[[package]] +name = "instrumented-channel" +version = "0.1.0" +source = "git+https://github.com/aptos-labs/aptos-indexer-processor-sdk.git?rev=9ecd252ccff53023664562001dd04c2886488c0d#9ecd252ccff53023664562001dd04c2886488c0d" +dependencies = [ + "delegate", + "derive_builder", + "kanal", + "once_cell", + "prometheus", + "prometheus-client", +] + [[package]] name = "integer-encoding" version = "3.0.4" @@ -9657,7 +9749,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] @@ -9683,7 +9775,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "rustix 0.38.28", "windows-sys 0.52.0", ] @@ -10022,7 +10114,7 @@ dependencies = [ "is-terminal", "itertools 0.10.5", "lalrpop-util", - "petgraph 0.6.4", + "petgraph 0.6.5", "regex", "regex-syntax 0.6.29", "string_cache", @@ -10568,6 +10660,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.52.0", +] + [[package]] name = "mirai-annotations" version = "1.12.0" @@ -10584,8 +10688,23 @@ dependencies = [ "downcast", "fragile", "lazy_static", - "mockall_derive", - "predicates", + "mockall_derive 0.11.4", + "predicates 2.1.5", + "predicates-tree", +] + +[[package]] +name = "mockall" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive 0.12.1", + "predicates 3.1.2", "predicates-tree", ] @@ -10601,6 +10720,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "mockall_derive" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "module-generation" version = "0.1.0" @@ -10727,7 +10858,7 @@ dependencies = [ "anyhow", "move-binary-format", "move-core-types", - "petgraph 0.5.1", + "petgraph 0.6.5", "serde-reflection", ] @@ -10741,7 +10872,7 @@ dependencies = [ "move-binary-format", "move-borrow-graph", "move-core-types", - "petgraph 0.5.1", + "petgraph 0.6.5", "serde", "typed-arena", ] @@ -10829,7 +10960,7 @@ dependencies = [ "move-symbol-pool", "once_cell", "pathdiff", - "petgraph 0.5.1", + "petgraph 0.6.5", "regex", "sha3 0.9.1", "tempfile", @@ -10874,7 +11005,7 @@ dependencies = [ "move-symbol-pool", "num 0.4.1", "once_cell", - "petgraph 0.5.1", + "petgraph 0.6.5", "strum 0.24.1", "strum_macros 0.24.3", "walkdir", @@ -10934,7 +11065,7 @@ dependencies = [ "move-command-line-common", "move-core-types", "move-ir-types", - "petgraph 0.5.1", + "petgraph 0.6.5", "serde", ] @@ -11134,7 +11265,7 @@ dependencies = [ "move-to-yul", "named-lock", "once_cell", - "petgraph 0.5.1", + "petgraph 0.6.5", "regex", "serde", "serde_yaml 0.8.26", @@ -11266,7 +11397,7 @@ dependencies = [ "move-stackless-bytecode-test-utils", "num 0.4.1", "paste", - "petgraph 0.5.1", + "petgraph 0.6.5", ] [[package]] @@ -11734,9 +11865,9 @@ dependencies = [ [[package]] name = "ntest" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da8ec6d2b73d45307e926f5af46809768581044384637af6b3f3fe7c3c88f512" +checksum = "fb183f0a1da7a937f672e5ee7b7edb727bf52b8a52d531374ba8ebb9345c0330" dependencies = [ "ntest_test_cases", "ntest_timeout", @@ -11744,9 +11875,9 @@ dependencies = [ [[package]] name = "ntest_test_cases" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be7d33be719c6f4d09e64e27c1ef4e73485dc4cc1f4d22201f89860a7fe22e22" +checksum = "16d0d3f2a488592e5368ebbe996e7f1d44aa13156efad201f5b4d84e150eaa93" dependencies = [ "proc-macro2", "quote", @@ -11755,11 +11886,11 @@ dependencies = [ [[package]] name = "ntest_timeout" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066b468120587a402f0b47d8f80035c921f6a46f8209efd0632a89a16f5188a4" +checksum = "fcc7c92f190c97f79b4a332f5e81dcf68c8420af2045c936c9be0bc9de6f63b5" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 1.0.109", @@ -11974,7 +12105,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.9", "libc", ] @@ -12329,7 +12460,7 @@ dependencies = [ "async-trait", "coset", "log", - "mockall", + "mockall 0.11.4", "p256", "passkey-types", "rand 0.8.5", @@ -12544,9 +12675,9 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset 0.4.2", "indexmap 2.2.5", @@ -13038,6 +13169,16 @@ dependencies = [ "regex", ] +[[package]] +name = "predicates" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" +dependencies = [ + "anstyle", + "predicates-core", +] + [[package]] name = "predicates-core" version = "1.0.6" @@ -13212,13 +13353,14 @@ dependencies = [ [[package]] name = "processor" version = "1.0.0" -source = "git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=fa1ce4947f4c2be57529f1c9732529e05a06cb7f#fa1ce4947f4c2be57529f1c9732529e05a06cb7f" +source = "git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=51a34901b40d7f75767ac907b4d2478104d6a515#51a34901b40d7f75767ac907b4d2478104d6a515" dependencies = [ "ahash 0.8.11", "allocative", "allocative_derive", "anyhow", - "aptos-moving-average 0.1.0 (git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=fa1ce4947f4c2be57529f1c9732529e05a06cb7f)", + "aptos-indexer-processor-sdk", + "aptos-moving-average 0.1.0 (git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=51a34901b40d7f75767ac907b4d2478104d6a515)", "aptos-protos 1.3.1 (git+https://github.com/aptos-labs/aptos-core.git?rev=5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb)", "async-trait", "bcs 0.1.4", @@ -13252,12 +13394,13 @@ dependencies = [ "postgres-native-tls", "prometheus", "prost 0.12.3", + "rayon", "regex", "serde", "serde_json", "server-framework", - "sha2 0.9.9", - "sha3 0.9.1", + "sha2 0.10.8", + "sha3 0.10.8", "strum 0.24.1", "tiny-keccak", "tokio", @@ -13300,9 +13443,33 @@ dependencies = [ "lazy_static", "memchr", "parking_lot 0.12.1", + "protobuf", "thiserror", ] +[[package]] +name = "prometheus-client" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504ee9ff529add891127c4827eb481bd69dc0ebc72e9a682e187db4caa60c3ca" +dependencies = [ + "dtoa", + "itoa", + "parking_lot 0.12.1", + "prometheus-client-derive-encode", +] + +[[package]] +name = "prometheus-client-derive-encode" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "prometheus-http-query" version = "0.5.2" @@ -14559,6 +14726,11 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "sample" +version = "0.1.0" +source = "git+https://github.com/aptos-labs/aptos-indexer-processor-sdk.git?rev=9ecd252ccff53023664562001dd04c2886488c0d#9ecd252ccff53023664562001dd04c2886488c0d" + [[package]] name = "scale-info" version = "1.0.0" @@ -14985,10 +15157,10 @@ dependencies = [ [[package]] name = "server-framework" version = "1.0.0" -source = "git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=fa1ce4947f4c2be57529f1c9732529e05a06cb7f#fa1ce4947f4c2be57529f1c9732529e05a06cb7f" +source = "git+https://github.com/aptos-labs/aptos-indexer-processors.git?rev=51a34901b40d7f75767ac907b4d2478104d6a515#51a34901b40d7f75767ac907b4d2478104d6a515" dependencies = [ "anyhow", - "aptos-system-utils 0.1.0 (git+https://github.com/aptos-labs/aptos-core.git?rev=4541add3fd29826ec57f22658ca286d2d6134b93)", + "aptos-system-utils 0.1.0 (git+https://github.com/aptos-labs/aptos-core.git?rev=202bdccff2b2d333a385ae86a4fcf23e89da9f62)", "async-trait", "backtrace", "clap 4.4.14", @@ -15143,7 +15315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" dependencies = [ "libc", - "mio", + "mio 0.8.11", "signal-hook", ] @@ -16125,22 +16297,21 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", - "mio", - "num_cpus", + "mio 1.0.2", "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2 0.5.5", "tokio-macros", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -16155,9 +16326,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", @@ -17022,9 +17193,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna 0.5.0", diff --git a/Cargo.toml b/Cargo.toml index 01669e6418f3f..f58a1e238a281 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -641,7 +641,7 @@ more-asserts = "0.3.0" named-lock = "0.2.0" native-tls = "0.2.10" neptune = { version = "13.0.0", default_features = false } -ntest = "0.9.0" +ntest = "0.9.3" num = "0.4.0" num-bigint = { version = "0.3.2", features = ["rand"] } num_cpus = "1.13.1" @@ -666,7 +666,7 @@ passkey-client = { version = "0.2.0" } passkey-types = { version = "0.2.0" } pbjson = "0.5.1" percent-encoding = "2.1.0" -petgraph = "0.5.1" +petgraph = "0.6.5" pin-project = "1.0.10" plotters = { version = "0.3.5", default-features = false } # We're using git deps until https://github.com/poem-web/poem/pull/829 gets formally released. diff --git a/api/src/context.rs b/api/src/context.rs index 73b3c31b11d91..939276891d81c 100644 --- a/api/src/context.rs +++ b/api/src/context.rs @@ -16,7 +16,7 @@ use aptos_api_types::{ AptosErrorCode, AsConverter, BcsBlock, GasEstimation, LedgerInfo, ResourceGroup, TransactionOnChainData, }; -use aptos_config::config::{NodeConfig, RoleType}; +use aptos_config::config::{GasEstimationConfig, NodeConfig, RoleType}; use aptos_crypto::HashValue; use aptos_gas_schedule::{AptosGasParameters, FromOnChainGasSchedule}; use aptos_logger::{error, info, Schema}; @@ -29,7 +29,6 @@ use aptos_types::{ access_path::{AccessPath, Path}, account_address::AccountAddress, account_config::{AccountResource, NewBlockEvent}, - block_executor::config::BlockExecutorConfigFromOnchain, chain_id::ChainId, contract_event::EventWithVersion, event::EventKey, @@ -42,7 +41,9 @@ use aptos_types::{ TStateView, }, transaction::{ - block_epilogue::BlockEndInfo, SignedTransaction, Transaction, TransactionWithProof, Version, + block_epilogue::BlockEndInfo, + use_case::{UseCaseAwareTransaction, UseCaseKey}, + SignedTransaction, Transaction, TransactionWithProof, Version, }, }; use futures::{channel::oneshot, SinkExt}; @@ -124,8 +125,7 @@ impl Context { })), gas_limit_cache: Arc::new(RwLock::new(GasLimitCache { last_updated_epoch: None, - block_executor_onchain_config: OnChainExecutionConfig::default_if_missing() - .block_executor_onchain_config(), + execution_onchain_config: OnChainExecutionConfig::default_if_missing(), })), view_function_stats, simulate_txn_stats, @@ -1000,9 +1000,10 @@ impl Context { start_version: Version, limit: u64, ledger_version: Version, - ) -> Result<(Vec<(u64, u64)>, Vec)> { + count_majority_use_case: bool, + ) -> Result<(Vec<(u64, u64)>, Vec, Option)> { if start_version > ledger_version || limit == 0 { - return Ok((vec![], vec![])); + return Ok((vec![], vec![], None)); } // This is just an estimation, so we can just skip over errors @@ -1014,11 +1015,16 @@ impl Context { let mut gas_prices = Vec::new(); let mut block_end_infos = Vec::new(); + let mut count_by_use_case = HashMap::new(); for (txn, info) in txns.zip(infos) { match txn.as_ref() { Ok(Transaction::UserTransaction(txn)) => { if let Ok(info) = info.as_ref() { gas_prices.push((txn.gas_unit_price(), info.gas_used())); + if count_majority_use_case { + let use_case_key = txn.parse_use_case(); + *count_by_use_case.entry(use_case_key).or_insert(0) += 1; + } } }, Ok(Transaction::BlockEpilogue(txn)) => { @@ -1030,7 +1036,80 @@ impl Context { } } - Ok((gas_prices, block_end_infos)) + let majority_use_case_fraction = if count_majority_use_case { + count_by_use_case.iter().max_by_key(|(_, v)| *v).and_then( + |(max_use_case, max_value)| { + if let UseCaseKey::ContractAddress(_) = max_use_case { + Some(*max_value as f32 / count_by_use_case.values().sum::() as f32) + } else { + None + } + }, + ) + } else { + None + }; + Ok((gas_prices, block_end_infos, majority_use_case_fraction)) + } + + fn block_min_inclusion_price( + &self, + ledger_info: &LedgerInfo, + first: Version, + last: Version, + gas_estimation_config: &GasEstimationConfig, + execution_config: &OnChainExecutionConfig, + ) -> Option { + let user_use_case_spread_factor = if gas_estimation_config.incorporate_reordering_effects { + execution_config + .transaction_shuffler_type() + .user_use_case_spread_factor() + } else { + None + }; + + match self.get_gas_prices_and_used( + first, + last - first, + ledger_info.ledger_version.0, + user_use_case_spread_factor.is_some(), + ) { + Ok((prices_and_used, block_end_infos, majority_use_case_fraction)) => { + let is_full_block = + if majority_use_case_fraction.map_or(false, |fraction| fraction > 0.5) { + // If majority use case is above half of transactions, UseCaseAware block reordering + // will allow other transactions to get in the block (AIP-68) + false + } else if prices_and_used.len() >= gas_estimation_config.full_block_txns { + true + } else if !block_end_infos.is_empty() { + assert_eq!(1, block_end_infos.len()); + block_end_infos.first().unwrap().limit_reached() + } else if let Some(block_gas_limit) = + execution_config.block_gas_limit_type().block_gas_limit() + { + let gas_used = prices_and_used.iter().map(|(_, used)| *used).sum::(); + gas_used >= block_gas_limit + } else { + false + }; + + if is_full_block { + Some( + self.next_bucket( + prices_and_used + .iter() + .map(|(price, _)| *price) + .min() + .unwrap(), + ), + ) + } else { + None + } + }, + Err(_) => None, + } } pub fn estimate_gas_price( @@ -1039,7 +1118,7 @@ impl Context { ) -> Result { let config = &self.node_config.api.gas_estimation; let min_gas_unit_price = self.min_gas_unit_price(ledger_info)?; - let block_config = self.block_executor_onchain_config(ledger_info)?; + let execution_config = self.execution_onchain_config(ledger_info)?; if !config.enabled { return Ok(self.default_gas_estimation(min_gas_unit_price)); } @@ -1120,40 +1199,9 @@ impl Context { let mut min_inclusion_prices = vec![]; // TODO: if multiple calls to db is a perf issue, combine into a single call and then split for (first, last) in blocks { - let min_inclusion_price = match self.get_gas_prices_and_used( - first, - last - first, - ledger_info.ledger_version.0, - ) { - Ok((prices_and_used, block_end_infos)) => { - let is_full_block = if prices_and_used.len() >= config.full_block_txns { - true - } else if !block_end_infos.is_empty() { - assert_eq!(1, block_end_infos.len()); - block_end_infos.first().unwrap().limit_reached() - } else if let Some(block_gas_limit) = - block_config.block_gas_limit_type.block_gas_limit() - { - let gas_used = prices_and_used.iter().map(|(_, used)| *used).sum::(); - gas_used >= block_gas_limit - } else { - false - }; - - if is_full_block { - self.next_bucket( - prices_and_used - .iter() - .map(|(price, _)| *price) - .min() - .unwrap(), - ) - } else { - min_gas_unit_price - } - }, - Err(_) => min_gas_unit_price, - }; + let min_inclusion_price = self + .block_min_inclusion_price(ledger_info, first, last, config, &execution_config) + .unwrap_or(min_gas_unit_price); min_inclusion_prices.push(min_inclusion_price); cache .min_inclusion_prices @@ -1321,16 +1369,16 @@ impl Context { } } - pub fn block_executor_onchain_config( + pub fn execution_onchain_config( &self, ledger_info: &LedgerInfo, - ) -> Result { + ) -> Result { // If it's the same epoch, use the cached results { let cache = self.gas_limit_cache.read().unwrap(); if let Some(ref last_updated_epoch) = cache.last_updated_epoch { if *last_updated_epoch == ledger_info.epoch.0 { - return Ok(cache.block_executor_onchain_config.clone()); + return Ok(cache.execution_onchain_config.clone()); } } } @@ -1341,7 +1389,7 @@ impl Context { // If a different thread updated the cache, we can exit early if let Some(ref last_updated_epoch) = cache.last_updated_epoch { if *last_updated_epoch == ledger_info.epoch.0 { - return Ok(cache.block_executor_onchain_config.clone()); + return Ok(cache.execution_onchain_config.clone()); } } @@ -1353,14 +1401,13 @@ impl Context { E::internal_with_code(e, AptosErrorCode::InternalError, ledger_info) })?; - let block_executor_onchain_config = OnChainExecutionConfig::fetch_config(&state_view) - .unwrap_or_else(OnChainExecutionConfig::default_if_missing) - .block_executor_onchain_config(); + let execution_onchain_config = OnChainExecutionConfig::fetch_config(&state_view) + .unwrap_or_else(OnChainExecutionConfig::default_if_missing); // Update the cache - cache.block_executor_onchain_config = block_executor_onchain_config.clone(); + cache.execution_onchain_config = execution_onchain_config.clone(); cache.last_updated_epoch = Some(ledger_info.epoch.0); - Ok(block_executor_onchain_config) + Ok(execution_onchain_config) } } @@ -1420,7 +1467,7 @@ pub struct GasEstimationCache { pub struct GasLimitCache { last_updated_epoch: Option, - block_executor_onchain_config: BlockExecutorConfigFromOnchain, + execution_onchain_config: OnChainExecutionConfig, } /// This function just calls tokio::task::spawn_blocking with the given closure and in diff --git a/api/types/src/convert.rs b/api/types/src/convert.rs index 6fdbbc7e3ac7c..85fecd9ec32ec 100644 --- a/api/types/src/convert.rs +++ b/api/types/src/convert.rs @@ -1011,14 +1011,9 @@ impl<'a, S: StateView> MoveConverter<'a, S> { fn get_table_info(&self, handle: TableHandle) -> Result> { if let Some(indexer_reader) = self.indexer_reader.as_ref() { - // Attempt to get table_info from the indexer_reader if it exists - Ok(indexer_reader.get_table_info(handle)?) - } else if self.db.indexer_enabled() { - // Attempt to get table_info from the db if indexer is enabled - Ok(Some(self.db.get_table_info(handle)?)) - } else { - Ok(None) + return Ok(indexer_reader.get_table_info(handle).unwrap_or(None)); } + Ok(None) } fn explain_vm_status( diff --git a/aptos-move/framework/aptos-framework/doc/account.md b/aptos-move/framework/aptos-framework/doc/account.md index 5ca951f1d3c3d..ce49d6226cc6f 100644 --- a/aptos-move/framework/aptos-framework/doc/account.md +++ b/aptos-move/framework/aptos-framework/doc/account.md @@ -1542,7 +1542,7 @@ Revoke the rotation capability offer given to to_be_revoked_recipient_addr
public entry fun revoke_rotation_capability(account: &signer, to_be_revoked_address: address) acquires Account {
     assert!(exists_at(to_be_revoked_address), error::not_found(EACCOUNT_DOES_NOT_EXIST));
     let addr = signer::address_of(account);
-    let account_resource = borrow_global_mut<Account>(addr);
+    let account_resource = borrow_global<Account>(addr);
     assert!(
         option::contains(&account_resource.rotation_capability_offer.for, &to_be_revoked_address),
         error::not_found(ENO_SUCH_ROTATION_CAPABILITY_OFFER)
@@ -1712,7 +1712,7 @@ has a signer capability offer from accoun
 
public entry fun revoke_signer_capability(account: &signer, to_be_revoked_address: address) acquires Account {
     assert!(exists_at(to_be_revoked_address), error::not_found(EACCOUNT_DOES_NOT_EXIST));
     let addr = signer::address_of(account);
-    let account_resource = borrow_global_mut<Account>(addr);
+    let account_resource = borrow_global<Account>(addr);
     assert!(
         option::contains(&account_resource.signer_capability_offer.for, &to_be_revoked_address),
         error::not_found(ENO_SUCH_SIGNER_CAPABILITY)
@@ -2194,7 +2194,7 @@ Capability based functions for efficient use.
     signed_message_bytes: vector<u8>,
     message: T,
 ) acquires Account {
-    let account_resource = borrow_global_mut<Account>(account);
+    let account_resource = borrow_global<Account>(account);
     // Verify that the `SignerCapabilityOfferProofChallengeV2` has the right information and is signed by the account owner's key
     if (account_scheme == ED25519_SCHEME) {
         let pubkey = ed25519::new_unvalidated_public_key_from_bytes(account_public_key);
diff --git a/aptos-move/framework/aptos-framework/doc/coin.md b/aptos-move/framework/aptos-framework/doc/coin.md
index 07e97171f99b1..f43569cd0787a 100644
--- a/aptos-move/framework/aptos-framework/doc/coin.md
+++ b/aptos-move/framework/aptos-framework/doc/coin.md
@@ -1963,7 +1963,7 @@ Return the BurnRef with the hot potato receipt.
     let metadata = assert_paired_metadata_exists<CoinType>();
     let metadata_addr = object_address(&metadata);
     assert!(exists<PairedFungibleAssetRefs>(metadata_addr), error::internal(EPAIRED_FUNGIBLE_ASSET_REFS_NOT_FOUND));
-    let burn_ref_opt = &mut borrow_global_mut<PairedFungibleAssetRefs>(metadata_addr).burn_ref_opt;
+    let burn_ref_opt = &borrow_global<PairedFungibleAssetRefs>(metadata_addr).burn_ref_opt;
     assert!(option::is_some(burn_ref_opt), error::not_found(EBURN_REF_NOT_FOUND));
     option::borrow(burn_ref_opt)
 }
@@ -3100,7 +3100,7 @@ available.
 
     // Can only succeed once on-chain governance agreed on the upgrade.
     assert!(
-        borrow_global_mut<SupplyConfig>(@aptos_framework).allow_upgrades,
+        borrow_global<SupplyConfig>(@aptos_framework).allow_upgrades,
         error::permission_denied(ECOIN_SUPPLY_UPGRADE_NOT_SUPPORTED)
     );
 
diff --git a/aptos-move/framework/aptos-framework/doc/jwks.md b/aptos-move/framework/aptos-framework/doc/jwks.md
index ca2f348427f3c..5a0b02e22ff63 100644
--- a/aptos-move/framework/aptos-framework/doc/jwks.md
+++ b/aptos-move/framework/aptos-framework/doc/jwks.md
@@ -1038,7 +1038,7 @@ aptos_framework::aptos_governance::reconfigure(&framework_signer);
     let provider_set = if (config_buffer::does_exist<SupportedOIDCProviders>()) {
         config_buffer::extract<SupportedOIDCProviders>()
     } else {
-        *borrow_global_mut<SupportedOIDCProviders>(@aptos_framework)
+        *borrow_global<SupportedOIDCProviders>(@aptos_framework)
     };
 
     let old_config_url = remove_oidc_provider_internal(&mut provider_set, name);
@@ -1113,7 +1113,7 @@ aptos_framework::aptos_governance::reconfigure(&framework_signer);
     let provider_set = if (config_buffer::does_exist<SupportedOIDCProviders>()) {
         config_buffer::extract<SupportedOIDCProviders>()
     } else {
-        *borrow_global_mut<SupportedOIDCProviders>(@aptos_framework)
+        *borrow_global<SupportedOIDCProviders>(@aptos_framework)
     };
     let ret = remove_oidc_provider_internal(&mut provider_set, name);
     config_buffer::upsert(provider_set);
diff --git a/aptos-move/framework/aptos-framework/doc/multisig_account.md b/aptos-move/framework/aptos-framework/doc/multisig_account.md
index a5fcc8ab9b835..8ce70dc316506 100644
--- a/aptos-move/framework/aptos-framework/doc/multisig_account.md
+++ b/aptos-move/framework/aptos-framework/doc/multisig_account.md
@@ -1831,7 +1831,7 @@ Return the id of the last transaction that was executed (successful or failed) o
 
 
 
public fun last_resolved_sequence_number(multisig_account: address): u64 acquires MultisigAccount {
-    let multisig_account_resource = borrow_global_mut<MultisigAccount>(multisig_account);
+    let multisig_account_resource = borrow_global<MultisigAccount>(multisig_account);
     multisig_account_resource.last_executed_sequence_number
 }
 
@@ -1858,7 +1858,7 @@ Return the id of the next transaction created.
public fun next_sequence_number(multisig_account: address): u64 acquires MultisigAccount {
-    let multisig_account_resource = borrow_global_mut<MultisigAccount>(multisig_account);
+    let multisig_account_resource = borrow_global<MultisigAccount>(multisig_account);
     multisig_account_resource.next_sequence_number
 }
 
@@ -1886,7 +1886,7 @@ Return a bool tuple indicating whether an owner has voted and if so, whether the
public fun vote(
     multisig_account: address, sequence_number: u64, owner: address): (bool, bool) acquires MultisigAccount {
-    let multisig_account_resource = borrow_global_mut<MultisigAccount>(multisig_account);
+    let multisig_account_resource = borrow_global<MultisigAccount>(multisig_account);
     assert!(
         sequence_number > 0 && sequence_number < multisig_account_resource.next_sequence_number,
         error::invalid_argument(EINVALID_SEQUENCE_NUMBER),
@@ -1920,7 +1920,7 @@ Return a bool tuple indicating whether an owner has voted and if so, whether the
 
 
 
public fun available_transaction_queue_capacity(multisig_account: address): u64 acquires MultisigAccount {
-    let multisig_account_resource = borrow_global_mut<MultisigAccount>(multisig_account);
+    let multisig_account_resource = borrow_global<MultisigAccount>(multisig_account);
     let num_pending_transactions = multisig_account_resource.next_sequence_number - multisig_account_resource.last_executed_sequence_number - 1;
     if (num_pending_transactions > MAX_PENDING_TRANSACTIONS) {
         0
diff --git a/aptos-move/framework/aptos-framework/doc/stake.md b/aptos-move/framework/aptos-framework/doc/stake.md
index 5a199ef91f69d..017d83723ad91 100644
--- a/aptos-move/framework/aptos-framework/doc/stake.md
+++ b/aptos-move/framework/aptos-framework/doc/stake.md
@@ -2501,7 +2501,7 @@ Initialize the validator account and give ownership to the signing account.
     fullnode_addresses: vector<u8>,
 ) acquires AllowedValidators {
     // Checks the public key has a valid proof-of-possession to prevent rogue-key attacks.
-    let pubkey_from_pop = &mut bls12381::public_key_from_bytes_with_pop(
+    let pubkey_from_pop = &bls12381::public_key_from_bytes_with_pop(
         consensus_pubkey,
         &proof_of_possession_from_bytes(proof_of_possession)
     );
@@ -2843,7 +2843,7 @@ Add coins into pool_address. this requires the corresp
     // Only track and validate voting power increase for active and pending_active validator.
     // Pending_inactive validator will be removed from the validator set in the next epoch.
     // Inactive validator's total stake will be tracked when they join the validator set.
-    let validator_set = borrow_global_mut<ValidatorSet>(@aptos_framework);
+    let validator_set = borrow_global<ValidatorSet>(@aptos_framework);
     // Search directly rather using get_validator_state to save on unnecessary loops.
     if (option::is_some(&find_validator(&validator_set.active_validators, pool_address)) ||
         option::is_some(&find_validator(&validator_set.pending_active, pool_address))) {
@@ -2999,7 +2999,7 @@ Rotate the consensus key of the validator, it'll take effect in next epoch.
     let validator_info = borrow_global_mut<ValidatorConfig>(pool_address);
     let old_consensus_pubkey = validator_info.consensus_pubkey;
     // Checks the public key has a valid proof-of-possession to prevent rogue-key attacks.
-    let pubkey_from_pop = &mut bls12381::public_key_from_bytes_with_pop(
+    let pubkey_from_pop = &bls12381::public_key_from_bytes_with_pop(
         new_consensus_pubkey,
         &proof_of_possession_from_bytes(proof_of_possession)
     );
@@ -3249,7 +3249,7 @@ This internal version can only be called by the Genesis module during Genesis.
     update_voting_power_increase(voting_power);
 
     // Add validator to pending_active, to be activated in the next epoch.
-    let validator_config = borrow_global_mut<ValidatorConfig>(pool_address);
+    let validator_config = borrow_global<ValidatorConfig>(pool_address);
     assert!(!vector::is_empty(&validator_config.consensus_pubkey), error::invalid_argument(EINVALID_PUBLIC_KEY));
 
     // Validate the current validator set size has not exceeded the limit.
@@ -3706,8 +3706,8 @@ power.
     }) {
         let old_validator_info = vector::borrow_mut(&mut validator_set.active_validators, i);
         let pool_address = old_validator_info.addr;
-        let validator_config = borrow_global_mut<ValidatorConfig>(pool_address);
-        let stake_pool = borrow_global_mut<StakePool>(pool_address);
+        let validator_config = borrow_global<ValidatorConfig>(pool_address);
+        let stake_pool = borrow_global<StakePool>(pool_address);
         let new_validator_info = generate_validator_info(pool_address, stake_pool, *validator_config);
 
         // A validator needs at least the min stake required to join the validator set.
diff --git a/aptos-move/framework/aptos-framework/doc/staking_contract.md b/aptos-move/framework/aptos-framework/doc/staking_contract.md
index 9e2b437696463..6376f194023f4 100644
--- a/aptos-move/framework/aptos-framework/doc/staking_contract.md
+++ b/aptos-move/framework/aptos-framework/doc/staking_contract.md
@@ -2361,7 +2361,7 @@ Distribute all unlocked (inactive) funds according to distribution shares.
     // Buy all recipients out of the distribution pool.
     while (pool_u64::shareholders_count(distribution_pool) > 0) {
         let recipients = pool_u64::shareholders(distribution_pool);
-        let recipient = *vector::borrow(&mut recipients, 0);
+        let recipient = *vector::borrow(&recipients, 0);
         let current_shares = pool_u64::shares(distribution_pool, recipient);
         let amount_to_distribute = pool_u64::redeem_shares(distribution_pool, recipient, current_shares);
         // If the recipient is the operator, send the commission to the beneficiary instead.
@@ -2411,7 +2411,7 @@ Assert that a staking_contract exists for the staker/operator pair.
 
 
fun assert_staking_contract_exists(staker: address, operator: address) acquires Store {
     assert!(exists<Store>(staker), error::not_found(ENO_STAKING_CONTRACT_FOUND_FOR_STAKER));
-    let staking_contracts = &mut borrow_global_mut<Store>(staker).staking_contracts;
+    let staking_contracts = &borrow_global<Store>(staker).staking_contracts;
     assert!(
         simple_map::contains_key(staking_contracts, &operator),
         error::not_found(ENO_STAKING_CONTRACT_FOUND_FOR_OPERATOR),
diff --git a/aptos-move/framework/aptos-framework/doc/vesting.md b/aptos-move/framework/aptos-framework/doc/vesting.md
index 0b3e7de7ad672..6f2d17e23f75f 100644
--- a/aptos-move/framework/aptos-framework/doc/vesting.md
+++ b/aptos-move/framework/aptos-framework/doc/vesting.md
@@ -3011,7 +3011,7 @@ account.
     role: String,
     role_holder: address,
 ) acquires VestingAccountManagement, VestingContract {
-    let vesting_contract = borrow_global_mut<VestingContract>(contract_address);
+    let vesting_contract = borrow_global<VestingContract>(contract_address);
     verify_admin(admin, vesting_contract);
 
     if (!exists<VestingAccountManagement>(contract_address)) {
@@ -3135,7 +3135,7 @@ staking_contract and stake modules.
 
 
 
public fun get_vesting_account_signer(admin: &signer, contract_address: address): signer acquires VestingContract {
-    let vesting_contract = borrow_global_mut<VestingContract>(contract_address);
+    let vesting_contract = borrow_global<VestingContract>(contract_address);
     verify_admin(admin, vesting_contract);
     get_vesting_account_signer_internal(vesting_contract)
 }
diff --git a/aptos-move/framework/aptos-framework/doc/voting.md b/aptos-move/framework/aptos-framework/doc/voting.md
index dfea6bb54d7ae..946e707b6e2b2 100644
--- a/aptos-move/framework/aptos-framework/doc/voting.md
+++ b/aptos-move/framework/aptos-framework/doc/voting.md
@@ -952,7 +952,7 @@ resolve this proposal.
         simple_map::add(&mut metadata, is_multi_step_in_execution_key, to_bytes(&false));
         // If the proposal is a single-step proposal, we check if the metadata passed by the client has the IS_MULTI_STEP_PROPOSAL_IN_EXECUTION_KEY key.
         // If they have the key, we will remove it, because a single-step proposal that doesn't need this key.
-    } else if (simple_map::contains_key(&mut metadata, &is_multi_step_in_execution_key)) {
+    } else if (simple_map::contains_key(&metadata, &is_multi_step_in_execution_key)) {
         simple_map::remove(&mut metadata, &is_multi_step_in_execution_key);
     };
 
diff --git a/aptos-move/framework/aptos-framework/sources/account.move b/aptos-move/framework/aptos-framework/sources/account.move
index a249fbb2d3d09..db1fed32ab6ce 100644
--- a/aptos-move/framework/aptos-framework/sources/account.move
+++ b/aptos-move/framework/aptos-framework/sources/account.move
@@ -517,7 +517,7 @@ module aptos_framework::account {
     public entry fun revoke_rotation_capability(account: &signer, to_be_revoked_address: address) acquires Account {
         assert!(exists_at(to_be_revoked_address), error::not_found(EACCOUNT_DOES_NOT_EXIST));
         let addr = signer::address_of(account);
-        let account_resource = borrow_global_mut(addr);
+        let account_resource = borrow_global(addr);
         assert!(
             option::contains(&account_resource.rotation_capability_offer.for, &to_be_revoked_address),
             error::not_found(ENO_SUCH_ROTATION_CAPABILITY_OFFER)
@@ -587,7 +587,7 @@ module aptos_framework::account {
     public entry fun revoke_signer_capability(account: &signer, to_be_revoked_address: address) acquires Account {
         assert!(exists_at(to_be_revoked_address), error::not_found(EACCOUNT_DOES_NOT_EXIST));
         let addr = signer::address_of(account);
-        let account_resource = borrow_global_mut(addr);
+        let account_resource = borrow_global(addr);
         assert!(
             option::contains(&account_resource.signer_capability_offer.for, &to_be_revoked_address),
             error::not_found(ENO_SUCH_SIGNER_CAPABILITY)
@@ -842,7 +842,7 @@ module aptos_framework::account {
         signed_message_bytes: vector,
         message: T,
     ) acquires Account {
-        let account_resource = borrow_global_mut(account);
+        let account_resource = borrow_global(account);
         // Verify that the `SignerCapabilityOfferProofChallengeV2` has the right information and is signed by the account owner's key
         if (account_scheme == ED25519_SCHEME) {
             let pubkey = ed25519::new_unvalidated_public_key_from_bytes(account_public_key);
diff --git a/aptos-move/framework/aptos-framework/sources/coin.move b/aptos-move/framework/aptos-framework/sources/coin.move
index 91a54edb7fddd..5f6598024d492 100644
--- a/aptos-move/framework/aptos-framework/sources/coin.move
+++ b/aptos-move/framework/aptos-framework/sources/coin.move
@@ -533,7 +533,7 @@ module aptos_framework::coin {
         let metadata = assert_paired_metadata_exists();
         let metadata_addr = object_address(&metadata);
         assert!(exists(metadata_addr), error::internal(EPAIRED_FUNGIBLE_ASSET_REFS_NOT_FOUND));
-        let burn_ref_opt = &mut borrow_global_mut(metadata_addr).burn_ref_opt;
+        let burn_ref_opt = &borrow_global(metadata_addr).burn_ref_opt;
         assert!(option::is_some(burn_ref_opt), error::not_found(EBURN_REF_NOT_FOUND));
         option::borrow(burn_ref_opt)
     }
@@ -1025,7 +1025,7 @@ module aptos_framework::coin {
 
         // Can only succeed once on-chain governance agreed on the upgrade.
         assert!(
-            borrow_global_mut(@aptos_framework).allow_upgrades,
+            borrow_global(@aptos_framework).allow_upgrades,
             error::permission_denied(ECOIN_SUPPLY_UPGRADE_NOT_SUPPORTED)
         );
 
diff --git a/aptos-move/framework/aptos-framework/sources/jwks.move b/aptos-move/framework/aptos-framework/sources/jwks.move
index bc2f5521edbf7..5c9b75147a9fe 100644
--- a/aptos-move/framework/aptos-framework/sources/jwks.move
+++ b/aptos-move/framework/aptos-framework/sources/jwks.move
@@ -317,7 +317,7 @@ module aptos_framework::jwks {
         let provider_set = if (config_buffer::does_exist()) {
             config_buffer::extract()
         } else {
-            *borrow_global_mut(@aptos_framework)
+            *borrow_global(@aptos_framework)
         };
 
         let old_config_url = remove_oidc_provider_internal(&mut provider_set, name);
@@ -352,7 +352,7 @@ module aptos_framework::jwks {
         let provider_set = if (config_buffer::does_exist()) {
             config_buffer::extract()
         } else {
-            *borrow_global_mut(@aptos_framework)
+            *borrow_global(@aptos_framework)
         };
         let ret = remove_oidc_provider_internal(&mut provider_set, name);
         config_buffer::upsert(provider_set);
diff --git a/aptos-move/framework/aptos-framework/sources/multisig_account.move b/aptos-move/framework/aptos-framework/sources/multisig_account.move
index 6ea72d7e0ed0d..1917e584d4a3b 100644
--- a/aptos-move/framework/aptos-framework/sources/multisig_account.move
+++ b/aptos-move/framework/aptos-framework/sources/multisig_account.move
@@ -457,14 +457,14 @@ module aptos_framework::multisig_account {
     #[view]
     /// Return the id of the last transaction that was executed (successful or failed) or removed.
     public fun last_resolved_sequence_number(multisig_account: address): u64 acquires MultisigAccount {
-        let multisig_account_resource = borrow_global_mut(multisig_account);
+        let multisig_account_resource = borrow_global(multisig_account);
         multisig_account_resource.last_executed_sequence_number
     }
 
     #[view]
     /// Return the id of the next transaction created.
     public fun next_sequence_number(multisig_account: address): u64 acquires MultisigAccount {
-        let multisig_account_resource = borrow_global_mut(multisig_account);
+        let multisig_account_resource = borrow_global(multisig_account);
         multisig_account_resource.next_sequence_number
     }
 
@@ -472,7 +472,7 @@ module aptos_framework::multisig_account {
     /// Return a bool tuple indicating whether an owner has voted and if so, whether they voted yes or no.
     public fun vote(
         multisig_account: address, sequence_number: u64, owner: address): (bool, bool) acquires MultisigAccount {
-        let multisig_account_resource = borrow_global_mut(multisig_account);
+        let multisig_account_resource = borrow_global(multisig_account);
         assert!(
             sequence_number > 0 && sequence_number < multisig_account_resource.next_sequence_number,
             error::invalid_argument(EINVALID_SEQUENCE_NUMBER),
@@ -486,7 +486,7 @@ module aptos_framework::multisig_account {
 
     #[view]
     public fun available_transaction_queue_capacity(multisig_account: address): u64 acquires MultisigAccount {
-        let multisig_account_resource = borrow_global_mut(multisig_account);
+        let multisig_account_resource = borrow_global(multisig_account);
         let num_pending_transactions = multisig_account_resource.next_sequence_number - multisig_account_resource.last_executed_sequence_number - 1;
         if (num_pending_transactions > MAX_PENDING_TRANSACTIONS) {
             0
diff --git a/aptos-move/framework/aptos-framework/sources/stake.move b/aptos-move/framework/aptos-framework/sources/stake.move
index 9639ffa8ff07d..0b65fa5f4eb7d 100644
--- a/aptos-move/framework/aptos-framework/sources/stake.move
+++ b/aptos-move/framework/aptos-framework/sources/stake.move
@@ -588,7 +588,7 @@ module aptos_framework::stake {
         fullnode_addresses: vector,
     ) acquires AllowedValidators {
         // Checks the public key has a valid proof-of-possession to prevent rogue-key attacks.
-        let pubkey_from_pop = &mut bls12381::public_key_from_bytes_with_pop(
+        let pubkey_from_pop = &bls12381::public_key_from_bytes_with_pop(
             consensus_pubkey,
             &proof_of_possession_from_bytes(proof_of_possession)
         );
@@ -730,7 +730,7 @@ module aptos_framework::stake {
         // Only track and validate voting power increase for active and pending_active validator.
         // Pending_inactive validator will be removed from the validator set in the next epoch.
         // Inactive validator's total stake will be tracked when they join the validator set.
-        let validator_set = borrow_global_mut(@aptos_framework);
+        let validator_set = borrow_global(@aptos_framework);
         // Search directly rather using get_validator_state to save on unnecessary loops.
         if (option::is_some(&find_validator(&validator_set.active_validators, pool_address)) ||
             option::is_some(&find_validator(&validator_set.pending_active, pool_address))) {
@@ -826,7 +826,7 @@ module aptos_framework::stake {
         let validator_info = borrow_global_mut(pool_address);
         let old_consensus_pubkey = validator_info.consensus_pubkey;
         // Checks the public key has a valid proof-of-possession to prevent rogue-key attacks.
-        let pubkey_from_pop = &mut bls12381::public_key_from_bytes_with_pop(
+        let pubkey_from_pop = &bls12381::public_key_from_bytes_with_pop(
             new_consensus_pubkey,
             &proof_of_possession_from_bytes(proof_of_possession)
         );
@@ -976,7 +976,7 @@ module aptos_framework::stake {
         update_voting_power_increase(voting_power);
 
         // Add validator to pending_active, to be activated in the next epoch.
-        let validator_config = borrow_global_mut(pool_address);
+        let validator_config = borrow_global(pool_address);
         assert!(!vector::is_empty(&validator_config.consensus_pubkey), error::invalid_argument(EINVALID_PUBLIC_KEY));
 
         // Validate the current validator set size has not exceeded the limit.
@@ -1273,8 +1273,8 @@ module aptos_framework::stake {
         }) {
             let old_validator_info = vector::borrow_mut(&mut validator_set.active_validators, i);
             let pool_address = old_validator_info.addr;
-            let validator_config = borrow_global_mut(pool_address);
-            let stake_pool = borrow_global_mut(pool_address);
+            let validator_config = borrow_global(pool_address);
+            let stake_pool = borrow_global(pool_address);
             let new_validator_info = generate_validator_info(pool_address, stake_pool, *validator_config);
 
             // A validator needs at least the min stake required to join the validator set.
diff --git a/aptos-move/framework/aptos-framework/sources/staking_contract.move b/aptos-move/framework/aptos-framework/sources/staking_contract.move
index 6120b770f23c8..be247f59bd259 100644
--- a/aptos-move/framework/aptos-framework/sources/staking_contract.move
+++ b/aptos-move/framework/aptos-framework/sources/staking_contract.move
@@ -785,7 +785,7 @@ module aptos_framework::staking_contract {
         // Buy all recipients out of the distribution pool.
         while (pool_u64::shareholders_count(distribution_pool) > 0) {
             let recipients = pool_u64::shareholders(distribution_pool);
-            let recipient = *vector::borrow(&mut recipients, 0);
+            let recipient = *vector::borrow(&recipients, 0);
             let current_shares = pool_u64::shares(distribution_pool, recipient);
             let amount_to_distribute = pool_u64::redeem_shares(distribution_pool, recipient, current_shares);
             // If the recipient is the operator, send the commission to the beneficiary instead.
@@ -815,7 +815,7 @@ module aptos_framework::staking_contract {
     /// Assert that a staking_contract exists for the staker/operator pair.
     fun assert_staking_contract_exists(staker: address, operator: address) acquires Store {
         assert!(exists(staker), error::not_found(ENO_STAKING_CONTRACT_FOUND_FOR_STAKER));
-        let staking_contracts = &mut borrow_global_mut(staker).staking_contracts;
+        let staking_contracts = &borrow_global(staker).staking_contracts;
         assert!(
             simple_map::contains_key(staking_contracts, &operator),
             error::not_found(ENO_STAKING_CONTRACT_FOUND_FOR_OPERATOR),
diff --git a/aptos-move/framework/aptos-framework/sources/vesting.move b/aptos-move/framework/aptos-framework/sources/vesting.move
index 527b4726ffb3b..9ede3acfa3d03 100644
--- a/aptos-move/framework/aptos-framework/sources/vesting.move
+++ b/aptos-move/framework/aptos-framework/sources/vesting.move
@@ -1064,7 +1064,7 @@ module aptos_framework::vesting {
         role: String,
         role_holder: address,
     ) acquires VestingAccountManagement, VestingContract {
-        let vesting_contract = borrow_global_mut(contract_address);
+        let vesting_contract = borrow_global(contract_address);
         verify_admin(admin, vesting_contract);
 
         if (!exists(contract_address)) {
@@ -1108,7 +1108,7 @@ module aptos_framework::vesting {
     /// This doesn't give the admin total power as the admin would still need to follow the rules set by
     /// staking_contract and stake modules.
     public fun get_vesting_account_signer(admin: &signer, contract_address: address): signer acquires VestingContract {
-        let vesting_contract = borrow_global_mut(contract_address);
+        let vesting_contract = borrow_global(contract_address);
         verify_admin(admin, vesting_contract);
         get_vesting_account_signer_internal(vesting_contract)
     }
diff --git a/aptos-move/framework/aptos-framework/sources/voting.move b/aptos-move/framework/aptos-framework/sources/voting.move
index 3bc26528ba736..a10e795b7369f 100644
--- a/aptos-move/framework/aptos-framework/sources/voting.move
+++ b/aptos-move/framework/aptos-framework/sources/voting.move
@@ -305,7 +305,7 @@ module aptos_framework::voting {
             simple_map::add(&mut metadata, is_multi_step_in_execution_key, to_bytes(&false));
             // If the proposal is a single-step proposal, we check if the metadata passed by the client has the IS_MULTI_STEP_PROPOSAL_IN_EXECUTION_KEY key.
             // If they have the key, we will remove it, because a single-step proposal that doesn't need this key.
-        } else if (simple_map::contains_key(&mut metadata, &is_multi_step_in_execution_key)) {
+        } else if (simple_map::contains_key(&metadata, &is_multi_step_in_execution_key)) {
             simple_map::remove(&mut metadata, &is_multi_step_in_execution_key);
         };
 
diff --git a/config/src/config/gas_estimation_config.rs b/config/src/config/gas_estimation_config.rs
index 763ac1b947486..00d943e9c1668 100644
--- a/config/src/config/gas_estimation_config.rs
+++ b/config/src/config/gas_estimation_config.rs
@@ -32,6 +32,8 @@ pub struct GasEstimationConfig {
     pub aggressive_block_history: usize,
     /// Time after write when previous value is returned without recomputing
     pub cache_expiration_ms: u64,
+    /// Whether to account which TransactionShufflerType is used onchain, and how it affects gas estimation
+    pub incorporate_reordering_effects: bool,
 }
 
 impl Default for GasEstimationConfig {
@@ -44,6 +46,7 @@ impl Default for GasEstimationConfig {
             market_block_history: 30,
             aggressive_block_history: 120,
             cache_expiration_ms: 500,
+            incorporate_reordering_effects: true,
         }
     }
 }
diff --git a/crates/aptos-metrics-core/src/const_metric.rs b/crates/aptos-metrics-core/src/const_metric.rs
index c354b0eed4921..744ff1b7c989c 100644
--- a/crates/aptos-metrics-core/src/const_metric.rs
+++ b/crates/aptos-metrics-core/src/const_metric.rs
@@ -37,7 +37,7 @@ impl ConstMetric {
 
         let mut metric = Metric::default();
         metric.set_counter(counter);
-        metric.set_label(labels);
+        metric.set_label(labels.into());
 
         Ok(ConstMetric {
             desc,
@@ -63,7 +63,7 @@ impl ConstMetric {
 
         let mut metric = Metric::default();
         metric.set_gauge(guage);
-        metric.set_label(labels);
+        metric.set_label(labels.into());
 
         Ok(ConstMetric {
             desc,
@@ -84,7 +84,7 @@ impl Collector for ConstMetric {
         met.set_name(self.desc.fq_name.clone());
         met.set_help(self.desc.help.clone());
         met.set_field_type(self.metric_type);
-        met.set_metric(vec![self.metric.clone()]);
+        met.set_metric(vec![self.metric.clone()].into());
 
         vec![met]
     }
diff --git a/crates/aptos/CHANGELOG.md b/crates/aptos/CHANGELOG.md
index 516bace3b2591..de17a8a00bbfd 100644
--- a/crates/aptos/CHANGELOG.md
+++ b/crates/aptos/CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to the Aptos CLI will be captured in this file. This project
 
 ## Unreleased
 
+## [4.2.2] - 2024/09/20
+- Fix localnet indexer processors that were emitting spamming logs in 4.2.1.
+
+## [4.2.1] - 2024/09/19
+- Fix localnet indexer processors that were failing to startup in 4.2.0
+
 ## [4.2.0] - 2024/09/16
 - Update latest VM and associated changes
 - Update to latest compiler
diff --git a/crates/aptos/Cargo.toml b/crates/aptos/Cargo.toml
index b1270bc827272..44a8a86281934 100644
--- a/crates/aptos/Cargo.toml
+++ b/crates/aptos/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "aptos"
 description = "Aptos tool for management of nodes and interacting with the blockchain"
-version = "4.2.0"
+version = "4.2.2"
 
 # Workspace inherited keys
 authors = { workspace = true }
@@ -85,7 +85,7 @@ pathsearch = { workspace = true }
 poem = { workspace = true }
 # We set default-features to false so we don't onboard the libpq dep. See more here:
 # https://github.com/aptos-labs/aptos-core/pull/12568
-processor = { git = "https://github.com/aptos-labs/aptos-indexer-processors.git", rev = "fa1ce4947f4c2be57529f1c9732529e05a06cb7f", default-features = false }
+processor = { git = "https://github.com/aptos-labs/aptos-indexer-processors.git", rev = "51a34901b40d7f75767ac907b4d2478104d6a515", default-features = false }
 rand = { workspace = true }
 regex = { workspace = true }
 reqwest = { workspace = true }
@@ -93,7 +93,7 @@ self_update = { git = "https://github.com/banool/self_update.git", rev = "830615
 serde = { workspace = true }
 serde_json = { workspace = true }
 serde_yaml = { workspace = true }
-server-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processors.git", rev = "fa1ce4947f4c2be57529f1c9732529e05a06cb7f" }
+server-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processors.git", rev = "51a34901b40d7f75767ac907b4d2478104d6a515" }
 tempfile = { workspace = true }
 thiserror = { workspace = true }
 tokio = { workspace = true }
diff --git a/crates/aptos/src/node/local_testnet/hasura_metadata.json b/crates/aptos/src/node/local_testnet/hasura_metadata.json
index 7a4906b33ecd4..d5f1a87a594c9 100644
--- a/crates/aptos/src/node/local_testnet/hasura_metadata.json
+++ b/crates/aptos/src/node/local_testnet/hasura_metadata.json
@@ -1,5 +1,5 @@
 {
-  "resource_version": 11,
+  "resource_version": 38,
   "metadata": {
     "version": 3,
     "sources": [
@@ -1225,6 +1225,7 @@
                   "columns": [
                     "collection_id",
                     "collection_name",
+                    "collection_properties",
                     "creator_address",
                     "current_supply",
                     "description",
@@ -1349,6 +1350,59 @@
               }
             ]
           },
+          {
+            "table": {
+              "name": "current_fungible_asset_balances",
+              "schema": "public"
+            },
+            "object_relationships": [
+              {
+                "name": "metadata",
+                "using": {
+                  "manual_configuration": {
+                    "column_mapping": {
+                      "asset_type": "asset_type"
+                    },
+                    "insertion_order": null,
+                    "remote_table": {
+                      "name": "fungible_asset_metadata",
+                      "schema": "public"
+                    }
+                  }
+                }
+              }
+            ],
+            "select_permissions": [
+              {
+                "role": "anonymous",
+                "permission": {
+                  "columns": [
+                    "amount",
+                    "amount_v1",
+                    "amount_v2",
+                    "asset_type",
+                    "asset_type_v1",
+                    "asset_type_v2",
+                    "is_frozen",
+                    "is_primary",
+                    "last_transaction_timestamp",
+                    "last_transaction_timestamp_v1",
+                    "last_transaction_timestamp_v2",
+                    "last_transaction_version",
+                    "last_transaction_version_v1",
+                    "last_transaction_version_v2",
+                    "owner_address",
+                    "storage_id",
+                    "token_standard"
+                  ],
+                  "filter": {},
+                  "limit": 100,
+                  "allow_aggregations": true
+                },
+                "comment": ""
+              }
+            ]
+          },
           {
             "table": {
               "name": "current_objects",
@@ -1485,6 +1539,21 @@
                     }
                   }
                 }
+              },
+              {
+                "name": "current_royalty_v1",
+                "using": {
+                  "manual_configuration": {
+                    "column_mapping": {
+                      "token_data_id": "token_data_id"
+                    },
+                    "insertion_order": null,
+                    "remote_table": {
+                      "name": "current_token_royalty_v1",
+                      "schema": "public"
+                    }
+                  }
+                }
               }
             ],
             "array_relationships": [
@@ -1708,50 +1777,23 @@
           },
           {
             "table": {
-              "name": "current_unified_fungible_asset_balances_to_be_renamed",
+              "name": "current_token_royalty_v1",
               "schema": "public"
             },
-            "configuration": {
-              "column_config": {},
-              "custom_column_names": {},
-              "custom_name": "current_fungible_asset_balances",
-              "custom_root_fields": {}
-            },
-            "object_relationships": [
-              {
-                "name": "metadata",
-                "using": {
-                  "manual_configuration": {
-                    "column_mapping": {
-                      "asset_type": "asset_type"
-                    },
-                    "insertion_order": null,
-                    "remote_table": {
-                      "name": "fungible_asset_metadata",
-                      "schema": "public"
-                    }
-                  }
-                }
-              }
-            ],
             "select_permissions": [
               {
                 "role": "anonymous",
                 "permission": {
                   "columns": [
-                    "amount",
-                    "asset_type",
-                    "is_frozen",
-                    "is_primary",
                     "last_transaction_timestamp",
                     "last_transaction_version",
-                    "owner_address",
-                    "storage_id",
-                    "token_standard"
+                    "payee_address",
+                    "royalty_points_denominator",
+                    "royalty_points_numerator",
+                    "token_data_id"
                   ],
                   "filter": {},
-                  "limit": 100,
-                  "allow_aggregations": true
+                  "limit": 100
                 },
                 "comment": ""
               }
@@ -2308,6 +2350,10 @@
               "from_env": "INDEXER_V2_POSTGRES_URL"
             },
             "isolation_level": "read-committed",
+            "pool_settings": {
+              "connection_lifetime": 600,
+              "max_connections": 100
+            },
             "use_prepared_statements": false
           }
         }
diff --git a/crates/aptos/src/node/local_testnet/processors.rs b/crates/aptos/src/node/local_testnet/processors.rs
index efd9baf8c8924..f9654f9c662b8 100644
--- a/crates/aptos/src/node/local_testnet/processors.rs
+++ b/crates/aptos/src/node/local_testnet/processors.rs
@@ -92,6 +92,18 @@ impl ProcessorManager {
             ProcessorName::ParquetFungibleAssetProcessor => {
                 bail!("ParquetFungibleAssetProcessor is not supported in the localnet")
             },
+            ProcessorName::ParquetTransactionMetadataProcessor => {
+                bail!("ParquetTransactionMetadataProcessor is not supported in the localnet")
+            },
+            ProcessorName::ParquetAnsProcessor => {
+                bail!("ParquetAnsProcessor is not supported in the localnet")
+            },
+            ProcessorName::ParquetEventsProcessor => {
+                bail!("ParquetEventsProcessor is not supported in the localnet")
+            },
+            ProcessorName::ParquetTokenV2Processor => {
+                bail!("ParquetTokenV2Processor is not supported in the localnet")
+            },
             ProcessorName::StakeProcessor => {
                 ProcessorConfig::StakeProcessor(StakeProcessorConfig {
                     query_retries: Default::default(),
diff --git a/execution/executor/src/chunk_executor.rs b/execution/executor/src/chunk_executor.rs
index 4b18dd00a53de..22289d087c4a5 100644
--- a/execution/executor/src/chunk_executor.rs
+++ b/execution/executor/src/chunk_executor.rs
@@ -57,6 +57,7 @@ use std::{
         atomic::{AtomicBool, Ordering},
         Arc,
     },
+    time::Instant,
 };
 
 pub static SIG_VERIFY_POOL: Lazy> = Lazy::new(|| {
@@ -598,9 +599,11 @@ impl TransactionReplayer for ChunkExecutorInner {
         mut event_vecs: Vec>,
         verify_execution_mode: &VerifyExecutionMode,
     ) -> Result<()> {
+        let started = Instant::now();
+        let num_txns = transactions.len();
         let mut latest_view = self.commit_queue.lock().expect_latest_view()?;
         let chunk_begin = latest_view.num_transactions() as Version;
-        let chunk_end = chunk_begin + transactions.len() as Version; // right-exclusive
+        let chunk_end = chunk_begin + num_txns as Version; // right-exclusive
 
         // Find epoch boundaries.
         let mut epochs = Vec::new();
@@ -636,11 +639,28 @@ impl TransactionReplayer for ChunkExecutorInner {
 
         self.commit_queue
             .lock()
-            .enqueue_chunk_to_commit_directly(executed_chunk.expect("Nothing to commit."))
+            .enqueue_chunk_to_commit_directly(executed_chunk.expect("Nothing to commit."))?;
+        info!(
+            num_txns = num_txns,
+            tps = (num_txns as f64 / started.elapsed().as_secs_f64()),
+            "TransactionReplayer::replay() OK"
+        );
+
+        Ok(())
     }
 
     fn commit(&self) -> Result {
-        self.commit_chunk_impl()
+        let started = Instant::now();
+
+        let chunk = self.commit_chunk_impl()?;
+
+        let num_committed = chunk.transactions_to_commit().len();
+        info!(
+            num_committed = num_committed,
+            tps = num_committed as f64 / started.elapsed().as_secs_f64(),
+            "TransactionReplayer::commit() OK"
+        );
+        Ok(chunk)
     }
 }
 
diff --git a/storage/backup/backup-cli/src/metadata/view.rs b/storage/backup/backup-cli/src/metadata/view.rs
index d42c3a39061a3..3b857651208de 100644
--- a/storage/backup/backup-cli/src/metadata/view.rs
+++ b/storage/backup/backup-cli/src/metadata/view.rs
@@ -105,6 +105,10 @@ impl MetadataView {
         self.compaction_timestamps.clone()
     }
 
+    pub fn all_state_snapshots(&self) -> &[StateSnapshotBackupMeta] {
+        &self.state_snapshot_backups
+    }
+
     pub fn select_state_snapshot(
         &self,
         target_version: Version,
diff --git a/storage/db-tool/Cargo.toml b/storage/db-tool/Cargo.toml
index a579e1ef63710..c4859b5f4ad76 100644
--- a/storage/db-tool/Cargo.toml
+++ b/storage/db-tool/Cargo.toml
@@ -26,6 +26,7 @@ aptos-vm = { workspace = true }
 bcs = { workspace = true }
 clap = { workspace = true }
 itertools = { workspace = true }
+serde_json = { workspace = true }
 tokio = { workspace = true }
 
 [dev-dependencies]
diff --git a/storage/db-tool/src/gen_replay_verify_jobs.rs b/storage/db-tool/src/gen_replay_verify_jobs.rs
new file mode 100644
index 0000000000000..09b800dd6e779
--- /dev/null
+++ b/storage/db-tool/src/gen_replay_verify_jobs.rs
@@ -0,0 +1,195 @@
+// Copyright (c) Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+use aptos_backup_cli::{
+    metadata::{
+        cache::{sync_and_load, MetadataCacheOpt},
+        StateSnapshotBackupMeta,
+    },
+    storage::DBToolStorageOpt,
+    utils::ConcurrentDownloadsOpt,
+};
+use aptos_types::transaction::Version;
+use clap::Parser;
+use itertools::Itertools;
+use std::{
+    io::Write,
+    iter::{once, zip},
+    path::PathBuf,
+};
+
+#[derive(Parser)]
+pub struct Opt {
+    #[clap(flatten)]
+    metadata_cache_opt: MetadataCacheOpt,
+    #[clap(flatten)]
+    storage: DBToolStorageOpt,
+    #[clap(flatten)]
+    concurrent_downloads: ConcurrentDownloadsOpt,
+    #[clap(
+        long,
+        help = "The first transaction version required to be replayed and verified. [Defaults to 0]"
+    )]
+    start_version: Option,
+    #[clap(
+        long,
+        help = "Determines the oldest epoch to replay, relative to the latest",
+        default_value = "4000"
+    )]
+    max_epochs: u64,
+    #[clap(
+        long,
+        help = "Version ranges to skip. e.g. 123-2456",
+        value_delimiter = ' '
+    )]
+    ranges_to_skip: Vec,
+    #[clap(long, help = "Target number of transactions for each job to replay")]
+    max_versions_per_range: u64,
+    #[clap(long, help = "Maximum ranges per job.")]
+    max_ranges_per_job: u64,
+    #[clap(long, help = "Output json file containing the jobs.")]
+    output_json_file: PathBuf,
+}
+
+impl Opt {
+    pub async fn run(self) -> anyhow::Result<()> {
+        let storage = self.storage.init_storage().await?;
+        let metadata_view = sync_and_load(
+            &self.metadata_cache_opt,
+            storage,
+            self.concurrent_downloads.get(),
+        )
+        .await?;
+
+        let storage_state = metadata_view.get_storage_state()?;
+        let global_end_version = storage_state
+            .latest_transaction_version
+            .expect("No transaction backups.")
+            + 1;
+        let latest_epoch = storage_state
+            .latest_state_snapshot_epoch
+            .expect("No state snapshots.");
+        let max_epochs = self.max_epochs.min(latest_epoch + 1);
+        let global_min_epoch = latest_epoch + 1 - max_epochs;
+
+        let fake_end = StateSnapshotBackupMeta {
+            epoch: latest_epoch,
+            version: global_end_version,
+            manifest: "".to_string(),
+        };
+        let job_ranges = metadata_view
+            .all_state_snapshots()
+            .iter()
+            .dedup_by(|a, b| a.epoch == b.epoch)
+            .filter(|s| s.epoch >= global_min_epoch && s.version <= global_end_version)
+            .chain(once(&fake_end))
+            .collect_vec()
+            .iter()
+            .rev()
+            .tuple_windows()
+            // to simplify things, if start_version appears in the middle of a range, give up the range
+            .take_while(|(_end, begin)| begin.version >= self.start_version.unwrap_or(0))
+            .peekable()
+            .batching(|it| {
+                match it.next() {
+                    Some((end, mut begin)) => {
+                        if end.version - begin.version >= self.max_versions_per_range {
+                            // cut big range short, this hopefully automatically skips load tests
+                            let msg = if end.epoch - begin.epoch > 15 {
+                                "!!! Need more snapshots !!!"
+                            } else {
+                                ""
+                            };
+                            Some((
+                                true,
+                                begin.version,
+                                begin.version + self.max_versions_per_range - 1,
+                                format!(
+                                    "Partial replay epoch {} - {}, {} txns starting from version {}, another {} versions omitted, until {}. {}",
+                                    begin.epoch,
+                                    end.epoch - 1,
+                                    self.max_versions_per_range,
+                                    begin.version,
+                                    end.version - begin.version - self.max_versions_per_range,
+                                    end.version,
+                                    msg
+                                )
+                            ))
+                        } else {
+                            while let Some((_prev_end, prev_begin)) = it.peek() {
+                                if end.version - prev_begin.version > self.max_versions_per_range {
+                                    break;
+                                }
+                                begin = prev_begin;
+                                let _ = it.next();
+                            }
+                            Some((
+                                false,
+                                begin.version,
+                                end.version - 1,
+                                format!(
+                                    "Replay epoch {} - {}, {} txns starting from version {}.",
+                                    begin.epoch,
+                                    end.epoch - 1,
+                                    end.version - begin.version,
+                                    begin.version,
+                                )
+                            ))
+                        }
+                    },
+                    None => None,
+                }
+            }).collect_vec();
+
+        // Deal with ranges_to_skip: to simplify things, we skip entire jobs instead of trimming them
+        let mut ranges_to_skip = self
+            .ranges_to_skip
+            .iter()
+            .flat_map(|range| {
+                if range.is_empty() {
+                    return None;
+                }
+                let (begin, end) = range
+                    .split('-')
+                    .map(|v| v.parse::().expect("Malformed range."))
+                    .collect_tuple()
+                    .expect("Malformed range.");
+                assert!(begin <= end, "Malformed Range.");
+                Some((begin, end))
+            })
+            .sorted()
+            .rev()
+            .peekable();
+
+        let job_ranges = job_ranges
+            .into_iter()
+            .filter(|(_, first, last, _)| {
+                while let Some((skip_first, skip_last)) = ranges_to_skip.peek() {
+                    if *skip_first > *last {
+                        let _ = ranges_to_skip.next();
+                    } else {
+                        return *skip_last < *first;
+                    }
+                }
+                true
+            })
+            .collect_vec();
+
+        let num_jobs = (job_ranges.len() as f32 / self.max_ranges_per_job as f32).ceil() as usize;
+        let mut jobs = vec![vec![]; num_jobs];
+
+        let mut job_idx = -1;
+        zip(job_ranges, (0..num_jobs).cycle()).for_each(
+            |((partial, first, last, desc), output_idx)| {
+                job_idx += 1;
+                let suffix = if partial { "-partial" } else { "" };
+                let job = format!("{output_idx}-{job_idx}{suffix} {first} {last} {desc}");
+                jobs[output_idx].push(job);
+            },
+        );
+
+        std::fs::File::create(self.output_json_file)?.write_all(&serde_json::to_vec(&jobs)?)?;
+
+        Ok(())
+    }
+}
diff --git a/storage/db-tool/src/lib.rs b/storage/db-tool/src/lib.rs
index aa5ce03cb0861..36c55e1493afe 100644
--- a/storage/db-tool/src/lib.rs
+++ b/storage/db-tool/src/lib.rs
@@ -6,6 +6,7 @@ extern crate core;
 mod backup;
 mod backup_maintenance;
 mod bootstrap;
+mod gen_replay_verify_jobs;
 mod replay_verify;
 pub mod restore;
 #[cfg(test)]
@@ -33,6 +34,8 @@ pub enum DBTool {
 
     ReplayVerify(replay_verify::Opt),
 
+    GenReplayVerifyJobs(gen_replay_verify_jobs::Opt),
+
     #[clap(subcommand)]
     Restore(restore::Command),
 }
@@ -49,6 +52,7 @@ impl DBTool {
                 info!("Replay verify result: {:?}", ret);
                 ret
             },
+            DBTool::GenReplayVerifyJobs(cmd) => cmd.run().await,
             DBTool::Restore(cmd) => cmd.run().await,
         }
     }
diff --git a/testsuite/smoke-test/src/indexer.rs b/testsuite/smoke-test/src/indexer.rs
index 45d2e6a2a4200..9cbbb782659e2 100644
--- a/testsuite/smoke-test/src/indexer.rs
+++ b/testsuite/smoke-test/src/indexer.rs
@@ -87,6 +87,8 @@ pub async fn execute_nft_txns<'t>(creator: LocalAccount, info: &mut AptosPublicI
     Ok(())
 }
 
+// TODO(grao): Old indexer is not used anymore, cleanup corresponding code and tests.
+#[ignore]
 #[tokio::test]
 async fn test_old_indexer() {
     if aptos_indexer::should_skip_pg_tests() {
diff --git a/third_party/move/move-compiler-v2/src/bytecode_generator.rs b/third_party/move/move-compiler-v2/src/bytecode_generator.rs
index e20f3b09bf19e..bda4618bc204e 100644
--- a/third_party/move/move-compiler-v2/src/bytecode_generator.rs
+++ b/third_party/move/move-compiler-v2/src/bytecode_generator.rs
@@ -406,9 +406,12 @@ impl<'env> Generator<'env> {
                         ),
                     );
                 }
-                self.emit_call(*id, targets, BytecodeOperation::WriteRef, vec![
-                    lhs_temp, rhs_temp,
-                ])
+                self.emit_call(
+                    *id,
+                    targets,
+                    BytecodeOperation::WriteRef,
+                    vec![lhs_temp, rhs_temp],
+                )
             },
             ExpData::Assign(id, lhs, rhs) => self.gen_assign(*id, lhs, rhs, None),
             ExpData::Return(id, exp) => {
@@ -476,9 +479,16 @@ impl<'env> Generator<'env> {
                     .rewrite_spec_descent(&SpecBlockTarget::Inline, spec);
                 self.emit_with(*id, |attr| Bytecode::SpecBlock(attr, spec));
             },
-            ExpData::Invoke(id, _, _) | ExpData::Lambda(id, _, _) => {
-                self.internal_error(*id, format!("not yet implemented: {:?}", exp))
-            },
+            // TODO(LAMBDA)
+            ExpData::Lambda(id, _, _) => self.error(
+                *id,
+                "Function-typed values not yet supported except as parameters to calls to inline functions",
+            ),
+            // TODO(LAMBDA)
+            ExpData::Invoke(_, exp, _) => self.error(
+                exp.as_ref().node_id(),
+                "Calls to function values other than inline function parameters not yet supported",
+            ),
             ExpData::Quant(id, _, _, _, _, _) => {
                 self.internal_error(*id, "unsupported specification construct")
             },
@@ -803,7 +813,11 @@ impl<'env> Generator<'env> {
 
             Operation::NoOp => {}, // do nothing
 
-            Operation::Closure(..) => self.internal_error(id, "closure not yet implemented"),
+            // TODO(LAMBDA)
+            Operation::Closure(..) => self.error(
+                id,
+                "Function-typed values not yet supported except as parameters to calls to inline functions",
+            ),
 
             // Non-supported specification related operations
             Operation::Exists(Some(_))
diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs b/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs
index 57a9976ed3635..05e86f37e82be 100644
--- a/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs
+++ b/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs
@@ -3,7 +3,7 @@
 
 //! Do a few checks of functions and function calls.
 
-use crate::Options;
+use crate::{experiments::Experiment, Options};
 use codespan_reporting::diagnostic::Severity;
 use move_binary_format::file_format::Visibility;
 use move_model::{
@@ -17,17 +17,44 @@ type QualifiedFunId = QualifiedId;
 
 /// check that non-inline function parameters do not have function type.
 pub fn check_for_function_typed_parameters(env: &mut GlobalEnv) {
+    let options = env
+        .get_extension::()
+        .expect("Options is available");
+    let lambda_params_ok = options.experiment_on(Experiment::LAMBDA_PARAMS);
+    let lambda_return_ok = options.experiment_on(Experiment::LAMBDA_RESULTS);
+    if lambda_params_ok && lambda_return_ok {
+        return;
+    }
+
     for caller_module in env.get_modules() {
         if caller_module.is_primary_target() {
             for caller_func in caller_module.get_functions() {
+                // Check that no functions have function return type
+                if !lambda_return_ok {
+                    let caller_name = caller_func.get_full_name_str();
+                    let return_type = caller_func.get_result_type();
+                    let has_function_value =
+                        return_type.clone().flatten().iter().any(Type::is_function);
+                    if has_function_value {
+                        let type_display_ctx = caller_func.get_type_display_ctx();
+                        env.diag(
+                            Severity::Error,
+                            &caller_func.get_id_loc(),
+                            &format!("Functions may not return function-typed values, but function `{}` return type is `{}`:",
+                                     caller_name,
+                                     return_type.display(&type_display_ctx)),
+                        );
+                    }
+                }
                 // Check that non-inline function parameters don't have function type
-                if !caller_func.is_inline() {
+                if !caller_func.is_inline() && !lambda_params_ok {
                     let parameters = caller_func.get_parameters();
                     let bad_params: Vec<_> = parameters
                         .iter()
                         .filter(|param| matches!(param.1, Type::Fun(_, _)))
                         .collect();
                     if !bad_params.is_empty() {
+                        let type_display_ctx = caller_func.get_type_display_ctx();
                         let caller_name = caller_func.get_full_name_str();
                         let reasons: Vec<(Loc, String)> = bad_params
                             .iter()
@@ -35,8 +62,9 @@ pub fn check_for_function_typed_parameters(env: &mut GlobalEnv) {
                                 (
                                     param.2.clone(),
                                     format!(
-                                        "Parameter `{}` has a function type.",
+                                        "Parameter `{}` has function-valued type `{}`.",
                                         param.0.display(env.symbol_pool()),
+                                        param.1.display(&type_display_ctx)
                                     ),
                                 )
                             })
diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs b/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs
index cb11736440a66..8326c3e8af618 100644
--- a/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs
+++ b/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs
@@ -309,7 +309,7 @@ impl<'a> ExpRewriterFunctions for LambdaLifter<'a> {
                 env.error(
                     &loc,
                     &format!(
-                        "captured variable `{}` cannot be modified inside of a lambda",
+                        "captured variable `{}` cannot be modified inside of a lambda", // TODO(LAMBDA)
                         name.display(env.symbol_pool())
                     ),
                 );
@@ -327,7 +327,7 @@ impl<'a> ExpRewriterFunctions for LambdaLifter<'a> {
                 env.error(
                     &loc,
                     &format!(
-                        "captured variable `{}` cannot be modified inside of a lambda",
+                        "captured variable `{}` cannot be modified inside of a lambda", // TODO(LAMBDA)
                         name.display(env.symbol_pool())
                     ),
                 );
diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs b/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs
index 29c5a6b299bca..1246ac0ea5ba0 100644
--- a/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs
+++ b/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs
@@ -101,7 +101,7 @@ impl<'a> RecursiveStructChecker<'a> {
                         self.report_invalid_field(&struct_env, &field_env);
                     }
                 },
-                Type::Primitive(_) | Type::TypeParameter(_) => {},
+                Type::Primitive(_) | Type::TypeParameter(_) | Type::Fun(..) => {},
                 _ => unreachable!("invalid field type"),
             }
             path.pop();
diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs b/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs
index 276b8dc3d675c..e9da0d5cbb053 100644
--- a/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs
+++ b/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs
@@ -55,12 +55,16 @@ fn used_type_parameters_in_fields(struct_env: &StructEnv) -> BTreeSet {
 fn used_type_parameters_in_ty(ty: &Type) -> BTreeSet {
     match ty {
         Type::Primitive(_) => BTreeSet::new(),
-        Type::Struct(_, _, tys) => tys.iter().flat_map(used_type_parameters_in_ty).collect(),
+        Type::Tuple(tys) | Type::Struct(_, _, tys) => {
+            tys.iter().flat_map(used_type_parameters_in_ty).collect()
+        },
         Type::TypeParameter(i) => BTreeSet::from([*i]),
         Type::Vector(ty) => used_type_parameters_in_ty(ty),
+        Type::Fun(t1, t2) => [t1, t2]
+            .iter()
+            .flat_map(|t| used_type_parameters_in_ty(t))
+            .collect(),
         Type::Reference(..)
-        | Type::Fun(..)
-        | Type::Tuple(..)
         | Type::TypeDomain(..)
         | Type::ResourceDomain(..)
         | Type::Error
diff --git a/third_party/move/move-compiler-v2/src/experiments.rs b/third_party/move/move-compiler-v2/src/experiments.rs
index d7bdf7820c00e..c067d2f243ee1 100644
--- a/third_party/move/move-compiler-v2/src/experiments.rs
+++ b/third_party/move/move-compiler-v2/src/experiments.rs
@@ -111,11 +111,32 @@ pub static EXPERIMENTS: Lazy> = Lazy::new(|| {
             description: "Turns on or off specification rewriting".to_string(),
             default: Given(false),
         },
+        Experiment {
+            name: Experiment::LAMBDA_FIELDS.to_string(),
+            description: "Turns on or off function values in struct fields".to_string(),
+            default: Given(false),
+        },
         Experiment {
             name: Experiment::LAMBDA_LIFTING.to_string(),
             description: "Turns on or off lambda lifting".to_string(),
             default: Given(false),
         },
+        Experiment {
+            name: Experiment::LAMBDA_PARAMS.to_string(),
+            description: "Turns on or off function values as parameters to non-inline functions"
+                .to_string(),
+            default: Given(false),
+        },
+        Experiment {
+            name: Experiment::LAMBDA_RESULTS.to_string(),
+            description: "Turns on or off function values in function results".to_string(),
+            default: Given(false),
+        },
+        Experiment {
+            name: Experiment::LAMBDA_VALUES.to_string(),
+            description: "Turns on or off first-class function values".to_string(),
+            default: Given(false),
+        },
         Experiment {
             name: Experiment::RECURSIVE_TYPE_CHECK.to_string(),
             description: "Turns on or off checking of recursive structs and type instantiations"
@@ -275,7 +296,11 @@ impl Experiment {
     pub const INLINING: &'static str = "inlining";
     pub const KEEP_INLINE_FUNS: &'static str = "keep-inline-funs";
     pub const KEEP_UNINIT_ANNOTATIONS: &'static str = "keep-uninit-annotations";
+    pub const LAMBDA_FIELDS: &'static str = "lambda-fields";
     pub const LAMBDA_LIFTING: &'static str = "lambda-lifting";
+    pub const LAMBDA_PARAMS: &'static str = "lambda-params";
+    pub const LAMBDA_RESULTS: &'static str = "lambda-results";
+    pub const LAMBDA_VALUES: &'static str = "lambda-values";
     pub const LINT_CHECKS: &'static str = "lint-checks";
     pub const OPTIMIZE: &'static str = "optimize";
     pub const OPTIMIZE_EXTRA: &'static str = "optimize-extra";
diff --git a/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs b/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs
index 4fd794aca6c6b..b371d7f17cf2e 100644
--- a/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs
+++ b/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs
@@ -365,7 +365,20 @@ impl ModuleGenerator {
                     ReferenceKind::Mutable => FF::SignatureToken::MutableReference(target_ty),
                 }
             },
-            Fun(_, _) | TypeDomain(_) | ResourceDomain(_, _, _) | Error | Var(_) => {
+            Fun(_param_ty, _result_ty) => {
+                // let _param_ty = Box::new(self.signature_token(ctx, loc, param_ty));
+                // let _result_ty = Box::new(self.signature_token(ctx, loc, result_ty));
+                // TODO(LAMBDA)
+                ctx.error(
+                    loc,
+                    format!(
+                        "Unexpected type: {}",
+                        ty.display(&ctx.env.get_type_display_ctx())
+                    ),
+                );
+                FF::SignatureToken::Bool
+            },
+            TypeDomain(_) | ResourceDomain(_, _, _) | Error | Var(_) => {
                 ctx.internal_error(
                     loc,
                     format!(
diff --git a/third_party/move/move-compiler-v2/src/lint_common.rs b/third_party/move/move-compiler-v2/src/lint_common.rs
index f8e92596f7257..63858546906a9 100644
--- a/third_party/move/move-compiler-v2/src/lint_common.rs
+++ b/third_party/move/move-compiler-v2/src/lint_common.rs
@@ -21,6 +21,7 @@ pub enum LintChecker {
     BlocksInConditions,
     NeedlessBool,
     NeedlessDerefRef,
+    NeedlessMutableReference,
     NeedlessRefDeref,
     NeedlessRefInFieldAccess,
     SimplerNumericExpression,
diff --git a/third_party/move/move-compiler-v2/src/pipeline/lint_processor.rs b/third_party/move/move-compiler-v2/src/pipeline/lint_processor.rs
index a82e0d9b8b2eb..4d8ba5dd82125 100644
--- a/third_party/move/move-compiler-v2/src/pipeline/lint_processor.rs
+++ b/third_party/move/move-compiler-v2/src/pipeline/lint_processor.rs
@@ -6,10 +6,14 @@
 //! The lint checks also assume that all the correctness checks have already been performed.
 
 mod avoid_copy_on_identity_comparison;
+mod needless_mutable_reference;
 
 use crate::{
     lint_common::{lint_skips_from_attributes, LintChecker},
-    pipeline::lint_processor::avoid_copy_on_identity_comparison::AvoidCopyOnIdentityComparison,
+    pipeline::lint_processor::{
+        avoid_copy_on_identity_comparison::AvoidCopyOnIdentityComparison,
+        needless_mutable_reference::NeedlessMutableReference,
+    },
 };
 use move_compiler::shared::known_attributes::LintAttribute;
 use move_model::model::{FunctionEnv, GlobalEnv, Loc};
@@ -72,7 +76,10 @@ impl FunctionTargetProcessor for LintProcessor {
 impl LintProcessor {
     /// Returns the default pipeline of stackless bytecode linters to run.
     fn get_default_linter_pipeline() -> Vec> {
-        vec![Box::new(AvoidCopyOnIdentityComparison {})]
+        vec![
+            Box::new(AvoidCopyOnIdentityComparison {}),
+            Box::new(NeedlessMutableReference {}),
+        ]
     }
 
     /// Returns a filtered pipeline of stackless bytecode linters to run.
diff --git a/third_party/move/move-compiler-v2/src/pipeline/lint_processor/needless_mutable_reference.rs b/third_party/move/move-compiler-v2/src/pipeline/lint_processor/needless_mutable_reference.rs
new file mode 100644
index 0000000000000..c3758742d36a9
--- /dev/null
+++ b/third_party/move/move-compiler-v2/src/pipeline/lint_processor/needless_mutable_reference.rs
@@ -0,0 +1,241 @@
+// Copyright (c) Aptos Foundation
+// SPDX-License-Identifier: Apache-2.0
+
+//! This module implements a stackless-bytecode linter that checks for mutable references
+//! that are never used mutably, and suggests to use immutable references instead.
+//! For example, if a mutable reference is never written to or passed as a mutable reference
+//! parameter to a function call, it can be replaced with an immutable reference.
+//!
+//! Currently, we only track mutable references that are:
+//! - function parameters,
+//! - obtained via `&mut` or `borrow_global_mut`.
+
+use crate::{lint_common::LintChecker, pipeline::lint_processor::StacklessBytecodeLinter};
+use move_model::{
+    ast::TempIndex,
+    model::{GlobalEnv, Loc, Parameter},
+};
+use move_stackless_bytecode::{
+    function_target::FunctionTarget,
+    stackless_bytecode::{Bytecode, Operation},
+};
+use std::collections::{BTreeMap, BTreeSet};
+
+/// Track "mutable" usages of certain mutable references in a function.
+/// Currently, the tracking is performed conservatively, in a flow-insensitive
+/// manner, to minimize perceived false positives.
+#[derive(Default)]
+struct MutableReferenceUsageTracker {
+    /// Keys are temps which are origins of certain mutable references.
+    /// Each key is mapped to a location where it acquires the mutable reference.
+    /// The origins tracked currently are:
+    /// - function parameters that are mutable references.
+    /// - mutable references acquired through `&mut` or `borrow_global_mut`.
+    /// The list above can be extended in the future.
+    origins: BTreeMap,
+    /// Derived edges from mutable references.
+    /// A derived edge y -> x is created in the following cases:
+    /// - `x = y;`,  where y: &mut
+    /// - `x = &mut y.f;`
+    /// Each origin also has an entry in `derived_edges` (usually mapping to an
+    /// empty set, unless an origin is also derived).
+    derived_edges: BTreeMap>,
+    /// The set of mutable references that are known to be used mutably, either directly
+    /// or through a derived edge. To be used mutably, the mutable reference is:
+    /// - written to via `WriteRef`, or
+    /// - passed as an argument to a function call's mutable reference parameter.
+    mutably_used: BTreeSet,
+}
+
+impl MutableReferenceUsageTracker {
+    /// For the `target` function, get locations we can warn about needless mutable references.
+    pub fn get_needless_mutable_refs(target: &FunctionTarget) -> Vec {
+        let mut tracker = Self::get_tracker_from_params(target);
+        for instr in target.get_bytecode() {
+            tracker.update(target, instr);
+        }
+        tracker.get_mutably_unused_locations()
+    }
+
+    /// Get an initial tracker from function parameters.
+    fn get_tracker_from_params(target: &FunctionTarget) -> Self {
+        let mut tracker = Self::default();
+        for (origin, loc) in Self::get_mut_reference_params(target) {
+            tracker.add_origin(origin, loc);
+        }
+        tracker
+    }
+
+    /// Get locations where origins are not used mutably.
+    fn get_mutably_unused_locations(self) -> Vec {
+        self.origins
+            .into_iter()
+            .filter_map(|(t, loc)| {
+                if !self.mutably_used.contains(&t) {
+                    Some(loc)
+                } else {
+                    None
+                }
+            })
+            .collect()
+    }
+
+    /// Get mutable reference function parameters, along with their location info.
+    fn get_mut_reference_params(target: &FunctionTarget) -> BTreeMap {
+        target
+            .func_env
+            .get_parameters_ref()
+            .iter()
+            .enumerate()
+            .filter_map(|(i, Parameter(_, ty, loc))| {
+                if ty.is_mutable_reference() {
+                    // Note: we assume that parameters are laid out as the initial temps.
+                    Some((i, loc.clone()))
+                } else {
+                    None
+                }
+            })
+            .collect()
+    }
+
+    /// Update the tracker given `instr`.
+    fn update(&mut self, target: &FunctionTarget, instr: &Bytecode) {
+        self.update_origins(target, instr);
+        self.update_derived_edges(target, instr);
+        self.update_mutably_used(target.global_env(), instr);
+    }
+
+    /// Update origins given `instr`.
+    fn update_origins(&mut self, target: &FunctionTarget, instr: &Bytecode) {
+        use Bytecode::*;
+        use Operation::*;
+        // We currently track `&mut` and `borrow_global_mut` as origins.
+        if let Call(id, dsts, BorrowLoc | BorrowGlobal(..), _, _) = instr {
+            debug_assert!(dsts.len() == 1);
+            if target.get_local_type(dsts[0]).is_mutable_reference() {
+                // The location of whichever instruction appears first for the origin
+                // is used for reporting.
+                self.add_origin(dsts[0], target.get_bytecode_loc(*id));
+            }
+        }
+    }
+
+    /// Update derived edges given `instr`.
+    fn update_derived_edges(&mut self, target: &FunctionTarget, instr: &Bytecode) {
+        use Bytecode::*;
+        use Operation::*;
+        match instr {
+            Assign(_, dst, src, _) => {
+                if self.node_exists(*src) {
+                    self.add_derived_edge(*dst, *src);
+                }
+            },
+            Call(_, dsts, BorrowField(..) | BorrowVariantField(..), srcs, ..) => {
+                debug_assert!(srcs.len() == 1 && dsts.len() == 1);
+                if self.node_exists(srcs[0])
+                    && target.get_local_type(dsts[0]).is_mutable_reference()
+                {
+                    self.add_derived_edge(dsts[0], srcs[0]);
+                }
+            },
+            _ => {},
+        }
+    }
+
+    /// Update mutable usages given `instr`.
+    fn update_mutably_used(&mut self, env: &GlobalEnv, instr: &Bytecode) {
+        use Bytecode::*;
+        use Operation::*;
+        match instr {
+            Call(_, _, WriteRef, srcs, _) => {
+                self.set_and_propagate_mutably_used(srcs[0]);
+            },
+            Call(_, _, Function(mid, fid, _), srcs, _) => {
+                let callee_env = env.get_function_qid(mid.qualified(*fid));
+                callee_env
+                    .get_parameter_types()
+                    .iter()
+                    .enumerate()
+                    .filter(|(_, ty)| ty.is_mutable_reference())
+                    .map(|(i, _)| srcs[i])
+                    .for_each(|src| self.set_and_propagate_mutably_used(src));
+            },
+            _ => {},
+        }
+    }
+
+    /// Add an origin to the tracker.
+    fn add_origin(&mut self, origin: TempIndex, loc: Loc) {
+        self.origins.entry(origin).or_insert(loc);
+        self.derived_edges.entry(origin).or_default();
+    }
+
+    /// Check if a node exists in the tracker.
+    fn node_exists(&self, node: TempIndex) -> bool {
+        self.derived_edges.contains_key(&node)
+    }
+
+    /// Add a derived edge to the tracker.
+    fn add_derived_edge(&mut self, from: TempIndex, to: TempIndex) {
+        self.derived_edges.entry(from).or_default().insert(to);
+        self.propagate_mutably_used(from, to);
+    }
+
+    /// Propagate mutably used information from `from` to `to`.
+    fn propagate_mutably_used(&mut self, from: TempIndex, to: TempIndex) {
+        if self.mutably_used.contains(&from) {
+            self.set_and_propagate_mutably_used(to);
+        }
+    }
+
+    /// Set a mutable reference as mutably used.
+    /// Propagate this information transitively through derived edges.
+    /// Propagation is stopped early if a node is already marked as mutably used.
+    fn set_and_propagate_mutably_used(&mut self, node: TempIndex) {
+        let mut mutably_used = std::mem::take(&mut self.mutably_used);
+        self.set_and_propagate_mutably_used_helper(node, &mut mutably_used);
+        self.mutably_used = mutably_used;
+    }
+
+    /// Helper function for `set_and_propagate_mutably_used`.
+    /// Note that `self` is lacking the `mutably_used` field for the duration of
+    /// this method (and it is instead passed separately and explicitly).
+    fn set_and_propagate_mutably_used_helper(
+        &self,
+        node: TempIndex,
+        mutably_used: &mut BTreeSet,
+    ) {
+        if !mutably_used.insert(node) {
+            // Stop early if a node is already marked as mutably used.
+            return;
+        }
+        if let Some(parents) = self.derived_edges.get(&node) {
+            for parent in parents {
+                self.set_and_propagate_mutably_used_helper(*parent, mutably_used);
+            }
+        }
+    }
+}
+
+/// Linter for detecting needless mutable references.
+pub struct NeedlessMutableReference {}
+
+impl StacklessBytecodeLinter for NeedlessMutableReference {
+    fn get_lint_checker(&self) -> LintChecker {
+        LintChecker::NeedlessMutableReference
+    }
+
+    fn check(&self, target: &FunctionTarget) {
+        let needless_mutable_refs = MutableReferenceUsageTracker::get_needless_mutable_refs(target);
+        for loc in needless_mutable_refs {
+            if loc.is_inlined() {
+                continue;
+            }
+            self.warning(
+                target.global_env(),
+                &loc,
+                "Needless mutable reference or borrow: consider using immutable reference or borrow instead",
+            );
+        }
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp
new file mode 100644
index 0000000000000..bbc6a9d36aef0
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: value of type `M::R` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/assign_unpack_references.move:17:33
+   │
+17 │         R { s1: S { f }, s2 } = &R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
+   │                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used
+
+error: value of type `M::R` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/assign_unpack_references.move:27:33
+   │
+27 │         R { s1: S { f }, s2 } = &mut R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
+   │                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/assign_unpack_references.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp
new file mode 100644
index 0000000000000..ac2b384d7f6a7
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: value of type `M::R` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/bind_unpack_references.move:13:41
+   │
+13 │         let R { s1: S { f }, s2 }: &R = &R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
+   │                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used
+
+error: value of type `M::R` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/bind_unpack_references.move:20:45
+   │
+20 │         let R { s1: S { f }, s2 }: &mut R = &mut R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
+   │                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/bind_unpack_references.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp
new file mode 100644
index 0000000000000..470ba80ca3109
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: value of type `M::R` does not have the `drop` ability
+  ┌─ tests/ability-check/typing/borrow_local_temp_resource.move:6:9
+  │
+6 │         &R{};
+  │         ^^^^ implicitly dropped here since it is no longer used
+
+error: value of type `M::R` does not have the `drop` ability
+  ┌─ tests/ability-check/typing/borrow_local_temp_resource.move:7:9
+  │
+7 │         &mut R{};
+  │         ^^^^^^^^ implicitly dropped here since it is no longer used
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp_resource.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp_resource.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp
new file mode 100644
index 0000000000000..75db7a1e361f1
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp
@@ -0,0 +1,43 @@
+
+Diagnostics:
+error: local `r` of type `M::R` does not have the `copy` ability
+  ┌─ tests/ability-check/typing/derefrence_reference.move:6:16
+  │
+6 │         R {} = *r;
+  │                ^^ reference content copied here
+
+error: local `b` of type `M::B` does not have the `copy` ability
+  ┌─ tests/ability-check/typing/derefrence_reference.move:7:24
+  │
+7 │         B { r: R{} } = *b;
+  │                        ^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+  ┌─ tests/ability-check/typing/derefrence_reference.move:8:17
+  │
+8 │         R{} = *&b.r;
+  │                 ^^^ reference content copied here
+
+error: local `r` of type `M::R` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/derefrence_reference.move:12:16
+   │
+12 │         R {} = *r;
+   │                ^^ reference content copied here
+
+error: local `b` of type `M::B` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/derefrence_reference.move:13:24
+   │
+13 │         B { r: R{} } = *b;
+   │                        ^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/derefrence_reference.move:14:17
+   │
+14 │         R{} = *&b.r;
+   │                 ^^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/derefrence_reference.move:15:21
+   │
+15 │         R{} = *&mut b.r;
+   │                     ^^^ reference content copied here
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_reference.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/derefrence_reference.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.no-opt.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.no-opt.exp
new file mode 100644
index 0000000000000..2534788508830
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.no-opt.exp
@@ -0,0 +1,43 @@
+
+Diagnostics:
+error: local `r` of type `M::R` does not have the `copy` ability
+  ┌─ tests/reference-safety/derefrence_reference.move:6:16
+  │
+6 │         R {} = *r;
+  │                ^^ reference content copied here
+
+error: local `b` of type `M::B` does not have the `copy` ability
+  ┌─ tests/reference-safety/derefrence_reference.move:7:24
+  │
+7 │         B { r: R{} } = *b;
+  │                        ^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+  ┌─ tests/reference-safety/derefrence_reference.move:8:17
+  │
+8 │         R{} = *&b.r;
+  │                 ^^^ reference content copied here
+
+error: local `r` of type `M::R` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:12:16
+   │
+12 │         R {} = *r;
+   │                ^^ reference content copied here
+
+error: local `b` of type `M::B` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:13:24
+   │
+13 │         B { r: R{} } = *b;
+   │                        ^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:14:17
+   │
+14 │         R{} = *&b.r;
+   │                 ^^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:15:21
+   │
+15 │         R{} = *&mut b.r;
+   │                     ^^^ reference content copied here
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.old.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.old.exp
new file mode 100644
index 0000000000000..2534788508830
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/derefrence_reference.old.exp
@@ -0,0 +1,43 @@
+
+Diagnostics:
+error: local `r` of type `M::R` does not have the `copy` ability
+  ┌─ tests/reference-safety/derefrence_reference.move:6:16
+  │
+6 │         R {} = *r;
+  │                ^^ reference content copied here
+
+error: local `b` of type `M::B` does not have the `copy` ability
+  ┌─ tests/reference-safety/derefrence_reference.move:7:24
+  │
+7 │         B { r: R{} } = *b;
+  │                        ^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+  ┌─ tests/reference-safety/derefrence_reference.move:8:17
+  │
+8 │         R{} = *&b.r;
+  │                 ^^^ reference content copied here
+
+error: local `r` of type `M::R` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:12:16
+   │
+12 │         R {} = *r;
+   │                ^^ reference content copied here
+
+error: local `b` of type `M::B` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:13:24
+   │
+13 │         B { r: R{} } = *b;
+   │                        ^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:14:17
+   │
+14 │         R{} = *&b.r;
+   │                 ^^^ reference content copied here
+
+error: value of type `M::R` does not have the `copy` ability
+   ┌─ tests/reference-safety/derefrence_reference.move:15:21
+   │
+15 │         R{} = *&mut b.r;
+   │                     ^^^ reference content copied here
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid.exp
similarity index 76%
rename from third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.exp
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid.exp
index bddddda5a5cec..a16945445b85c 100644
--- a/third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.exp
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid.exp
@@ -1,19 +1,19 @@
 
 Diagnostics:
 error: cannot use `u128` with an operator which expects a value of type `u8`
-   ┌─ tests/checking/typing/eq_invalid.move:13:21
+   ┌─ tests/ability-check/typing/eq_invalid.move:13:21
    │
 13 │         (0: u8) == (1: u128);
    │                     ^
 
 error: cannot use `bool` with an operator which expects a value of type `integer`
-   ┌─ tests/checking/typing/eq_invalid.move:14:14
+   ┌─ tests/ability-check/typing/eq_invalid.move:14:14
    │
 14 │         0 == false;
    │              ^^^^^
 
 error: reference type `&integer` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/eq_invalid.move:15:12
+   ┌─ tests/ability-check/typing/eq_invalid.move:15:12
    │
 15 │         &0 == 1;
    │            ^^
@@ -21,19 +21,19 @@ error: reference type `&integer` is not allowed as a type argument (type was inf
    = required by instantiating type parameter `T` of function `==`
 
 error: cannot use `&integer` with an operator which expects a value of type `integer`
-   ┌─ tests/checking/typing/eq_invalid.move:16:14
+   ┌─ tests/ability-check/typing/eq_invalid.move:16:14
    │
 16 │         1 == &0;
    │              ^^
 
 error: cannot use `&S` with an operator which expects a value of type `S`
-   ┌─ tests/checking/typing/eq_invalid.move:17:14
+   ┌─ tests/ability-check/typing/eq_invalid.move:17:14
    │
 17 │         s == s_ref;
    │              ^^^^^
 
 error: reference type `&mut S` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/eq_invalid.move:18:15
+   ┌─ tests/ability-check/typing/eq_invalid.move:18:15
    │
 18 │         s_mut == s;
    │               ^^
@@ -41,13 +41,13 @@ error: reference type `&mut S` is not allowed as a type argument (type was infer
    = required by instantiating type parameter `T` of function `==`
 
 error: unable to infer instantiation of type `G2<_>` (consider providing type arguments or annotating the type)
-   ┌─ tests/checking/typing/eq_invalid.move:28:9
+   ┌─ tests/ability-check/typing/eq_invalid.move:28:9
    │
 28 │         G2{} == G2{};
    │         ^^^^
 
 error: tuple type `()` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/eq_invalid.move:33:12
+   ┌─ tests/ability-check/typing/eq_invalid.move:33:12
    │
 33 │         () == ();
    │            ^^
@@ -55,7 +55,7 @@ error: tuple type `()` is not allowed as a type argument (type was inferred)
    = required by instantiating type parameter `T` of function `==`
 
 error: tuple type `(integer, integer)` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/eq_invalid.move:34:16
+   ┌─ tests/ability-check/typing/eq_invalid.move:34:16
    │
 34 │         (0, 1) == (0, 1);
    │                ^^
@@ -63,7 +63,7 @@ error: tuple type `(integer, integer)` is not allowed as a type argument (type w
    = required by instantiating type parameter `T` of function `==`
 
 error: tuple type `(integer, integer, integer)` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/eq_invalid.move:35:19
+   ┌─ tests/ability-check/typing/eq_invalid.move:35:19
    │
 35 │         (1, 2, 3) == (0, 1);
    │                   ^^
@@ -71,7 +71,7 @@ error: tuple type `(integer, integer, integer)` is not allowed as a type argumen
    = required by instantiating type parameter `T` of function `==`
 
 error: tuple type `(integer, integer)` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/eq_invalid.move:36:16
+   ┌─ tests/ability-check/typing/eq_invalid.move:36:16
    │
 36 │         (0, 1) == (1, 2, 3);
    │                ^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp
new file mode 100644
index 0000000000000..7fea4b627a31d
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp
@@ -0,0 +1,19 @@
+
+Diagnostics:
+error: local `r` of type `M::R` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/eq_invalid2.move:11:9
+   │
+11 │         r == r;
+   │         ^^^^^^ copy needed here because value is still in use
+
+error: local `r` of type `M::R` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/eq_invalid2.move:11:9
+   │
+11 │         r == r;
+   │         ^^^^^^ operator drops value here (consider borrowing the argument)
+
+error: value of type `M::G1` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/eq_invalid2.move:15:9
+   │
+15 │         G1{ f: t } == G1{ f: t };
+   │         ^^^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument)
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.move
new file mode 100644
index 0000000000000..6e35450a894d1
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/eq_invalid2.move
@@ -0,0 +1,17 @@
+module 0x8675309::M {
+    struct S { u: u64 }
+    struct R has key {
+        f: u64
+    }
+    struct G0 has drop { f: T }
+    struct G1 { f: T }
+    struct G2 has drop {}
+
+    fun t1(r: R) {
+        r == r;
+    }
+
+    fun t3(t: T) {
+        G1{ f: t } == G1{ f: t };
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/exp_list_resource_drop.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/exp_list_resource_drop.exp
new file mode 100644
index 0000000000000..90b32906711cc
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/exp_list_resource_drop.exp
@@ -0,0 +1,2 @@
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list_resource_drop.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/exp_list_resource_drop.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/exp_list_resource_drop.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/exp_list_resource_drop.move
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/ignore_inferred_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource.exp
similarity index 70%
rename from third_party/move/move-compiler-v2/tests/checking/typing/ignore_inferred_resource.exp
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource.exp
index eea49f1b8d5ec..3449a615dcc9e 100644
--- a/third_party/move/move-compiler-v2/tests/checking/typing/ignore_inferred_resource.exp
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource.exp
@@ -1,7 +1,7 @@
 
 Diagnostics:
 error: unable to infer instantiation of type `S<_>` (consider providing type arguments or annotating the type)
-  ┌─ tests/checking/typing/ignore_inferred_resource.move:4:9
+  ┌─ tests/ability-check/typing/ignore_inferred_resource.move:4:9
   │
 4 │         S{};
   │         ^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/ignore_inferred_resource.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/ignore_inferred_resource.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource2.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource2.exp
new file mode 100644
index 0000000000000..441423aabd8b0
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource2.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: unable to infer instantiation of type `S<_>` (consider providing type arguments or annotating the type)
+  ┌─ tests/ability-check/typing/ignore_inferred_resource2.move:4:9
+  │
+4 │         S{};
+  │         ^^^
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource2.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource2.move
new file mode 100644
index 0000000000000..7c271d25b02b1
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource2.move
@@ -0,0 +1,6 @@
+module 0x8675309::M {
+    struct S has drop {}
+    fun no() {
+        S{};
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource3.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource3.exp
new file mode 100644
index 0000000000000..90b32906711cc
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource3.exp
@@ -0,0 +1,2 @@
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource3.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource3.move
new file mode 100644
index 0000000000000..4cede30b50822
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource3.move
@@ -0,0 +1,6 @@
+module 0x8675309::M {
+    struct S has drop {}
+    fun no() {
+        S{};
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource4.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource4.exp
new file mode 100644
index 0000000000000..90b32906711cc
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource4.exp
@@ -0,0 +1,2 @@
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource4.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource4.move
new file mode 100644
index 0000000000000..fa29aa768979d
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource4.move
@@ -0,0 +1,6 @@
+module 0x8675309::M {
+    struct S has drop {}
+    fun no() {
+        S{};
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/module_call_explicit_type_arguments.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/module_call_explicit_type_arguments.exp
new file mode 100644
index 0000000000000..33ca7a8206653
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/module_call_explicit_type_arguments.exp
@@ -0,0 +1,17 @@
+
+Diagnostics:
+error: local `_x` of type `T` does not have the `drop` ability
+  ┌─ tests/ability-check/typing/module_call_explicit_type_arguments.move:2:33
+  │
+2 │       fun foo(_x: T, _y: U) {
+  │ ╭─────────────────────────────────^
+3 │ │     }
+  │ ╰─────^ implicitly dropped here since it is no longer used
+
+error: local `_y` of type `U` does not have the `drop` ability
+  ┌─ tests/ability-check/typing/module_call_explicit_type_arguments.move:2:33
+  │
+2 │       fun foo(_x: T, _y: U) {
+  │ ╭─────────────────────────────────^
+3 │ │     }
+  │ ╰─────^ implicitly dropped here since it is no longer used
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/module_call_explicit_type_arguments.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/module_call_explicit_type_arguments.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.exp
new file mode 100644
index 0000000000000..6be249a01f461
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.exp
@@ -0,0 +1,19 @@
+
+Diagnostics:
+error: local `r` of type `M::R` does not have the `drop` ability
+  ┌─ tests/ability-check/typing/mutate_resource.move:5:9
+  │
+5 │         *r = R {};
+  │         ^^^^^^^^^ reference content dropped here
+
+error: local `r` of type `T` does not have the `drop` ability
+  ┌─ tests/ability-check/typing/mutate_resource.move:9:9
+  │
+9 │         *r = x;
+  │         ^^^^^^ reference content dropped here
+
+error: local `r` of type `T` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/mutate_resource.move:13:9
+   │
+13 │         *r = x;
+   │         ^^^^^^ reference content dropped here
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/mutate_resource.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/mutate_resource.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/mutate_resource.move
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid.exp
similarity index 75%
rename from third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.exp
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid.exp
index 91a3ffa5997c1..260b2b9c2cf70 100644
--- a/third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.exp
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid.exp
@@ -1,19 +1,19 @@
 
 Diagnostics:
 error: cannot use `u128` with an operator which expects a value of type `u8`
-   ┌─ tests/checking/typing/neq_invalid.move:13:21
+   ┌─ tests/ability-check/typing/neq_invalid.move:13:21
    │
 13 │         (0: u8) != (1: u128);
    │                     ^
 
 error: cannot use `bool` with an operator which expects a value of type `integer`
-   ┌─ tests/checking/typing/neq_invalid.move:14:14
+   ┌─ tests/ability-check/typing/neq_invalid.move:14:14
    │
 14 │         0 != false;
    │              ^^^^^
 
 error: reference type `&integer` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/neq_invalid.move:15:12
+   ┌─ tests/ability-check/typing/neq_invalid.move:15:12
    │
 15 │         &0 != 1;
    │            ^^
@@ -21,19 +21,19 @@ error: reference type `&integer` is not allowed as a type argument (type was inf
    = required by instantiating type parameter `T` of function `!=`
 
 error: cannot use `&integer` with an operator which expects a value of type `integer`
-   ┌─ tests/checking/typing/neq_invalid.move:16:14
+   ┌─ tests/ability-check/typing/neq_invalid.move:16:14
    │
 16 │         1 != &0;
    │              ^^
 
 error: cannot use `&S` with an operator which expects a value of type `S`
-   ┌─ tests/checking/typing/neq_invalid.move:17:14
+   ┌─ tests/ability-check/typing/neq_invalid.move:17:14
    │
 17 │         s != s_ref;
    │              ^^^^^
 
 error: reference type `&mut S` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/neq_invalid.move:18:15
+   ┌─ tests/ability-check/typing/neq_invalid.move:18:15
    │
 18 │         s_mut != s;
    │               ^^
@@ -41,25 +41,25 @@ error: reference type `&mut S` is not allowed as a type argument (type was infer
    = required by instantiating type parameter `T` of function `!=`
 
 error: unable to infer instantiation of type `G0<_>` (consider providing type arguments or annotating the type)
-   ┌─ tests/checking/typing/neq_invalid.move:26:9
+   ┌─ tests/ability-check/typing/neq_invalid.move:26:9
    │
 26 │         G0{} != G0{};
    │         ^^^^
 
 error: unable to infer instantiation of type `G1` (consider providing type arguments or annotating the type)
-   ┌─ tests/checking/typing/neq_invalid.move:27:9
+   ┌─ tests/ability-check/typing/neq_invalid.move:27:9
    │
 27 │         G1{} != G1{};
    │         ^^^^
 
 error: unable to infer instantiation of type `G2<_>` (consider providing type arguments or annotating the type)
-   ┌─ tests/checking/typing/neq_invalid.move:28:9
+   ┌─ tests/ability-check/typing/neq_invalid.move:28:9
    │
 28 │         G2{} != G2{};
    │         ^^^^
 
 error: tuple type `()` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/neq_invalid.move:32:12
+   ┌─ tests/ability-check/typing/neq_invalid.move:32:12
    │
 32 │         () != ();
    │            ^^
@@ -67,7 +67,7 @@ error: tuple type `()` is not allowed as a type argument (type was inferred)
    = required by instantiating type parameter `T` of function `!=`
 
 error: tuple type `(integer, integer)` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/neq_invalid.move:33:16
+   ┌─ tests/ability-check/typing/neq_invalid.move:33:16
    │
 33 │         (0, 1) != (0, 1);
    │                ^^
@@ -75,7 +75,7 @@ error: tuple type `(integer, integer)` is not allowed as a type argument (type w
    = required by instantiating type parameter `T` of function `!=`
 
 error: tuple type `(integer, integer, integer)` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/neq_invalid.move:34:19
+   ┌─ tests/ability-check/typing/neq_invalid.move:34:19
    │
 34 │         (1, 2, 3) != (0, 1);
    │                   ^^
@@ -83,7 +83,7 @@ error: tuple type `(integer, integer, integer)` is not allowed as a type argumen
    = required by instantiating type parameter `T` of function `!=`
 
 error: tuple type `(integer, integer)` is not allowed as a type argument (type was inferred)
-   ┌─ tests/checking/typing/neq_invalid.move:35:16
+   ┌─ tests/ability-check/typing/neq_invalid.move:35:16
    │
 35 │         (0, 1) != (1, 2, 3);
    │                ^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp
new file mode 100644
index 0000000000000..c21ca3e6e5640
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp
@@ -0,0 +1,37 @@
+
+Diagnostics:
+error: local `s2` of type `M::S` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/neq_invalid2.move:17:9
+   │
+17 │         s != s2;
+   │         ^^^^^^^ operator drops value here (consider borrowing the argument)
+
+error: local `s` of type `M::S` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/neq_invalid2.move:17:9
+   │
+17 │         s != s2;
+   │         ^^^^^^^ operator drops value here (consider borrowing the argument)
+
+error: local `r1` of type `M::R` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/neq_invalid2.move:22:9
+   │
+22 │         r1 != r2;
+   │         ^^^^^^^^ operator drops value here (consider borrowing the argument)
+
+error: local `r2` of type `M::R` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/neq_invalid2.move:22:9
+   │
+22 │         r1 != r2;
+   │         ^^^^^^^^ operator drops value here (consider borrowing the argument)
+
+error: value of type `M::G1` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/neq_invalid2.move:27:9
+   │
+27 │         G1{} != G1{};
+   │         ^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument)
+
+error: value of type `M::G2` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/neq_invalid2.move:28:9
+   │
+28 │         G2{} != G2{};
+   │         ^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument)
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.move
new file mode 100644
index 0000000000000..e8bfbd6af0a36
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/neq_invalid2.move
@@ -0,0 +1,30 @@
+module 0x8675309::M {
+    struct S { u: u64 }
+    struct R {
+        f: u64
+    }
+    struct G0 has drop {}
+    struct G1 {}
+    struct G2 {}
+    struct Key has key {}
+
+    // Leave out test cases and edit code to avoid shadowing drop errors here.
+    fun t0(s: S, s2: S) {
+        // (0: u8) != (1: u128);
+        // 0 != false;
+        // &0 != 1;
+        // 1 != &0;
+        s != s2;
+        // s_mut != s;
+    }
+
+    fun t1(r1: R, r2: R) {
+        r1 != r2;
+    }
+
+    fun t3() {
+        G0{} != G0{};
+        G1{} != G1{};
+        G2{} != G2{};
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.exp
new file mode 100644
index 0000000000000..b35c01849ea5f
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.exp
@@ -0,0 +1,9 @@
+
+Diagnostics:
+error: local `s` of type `M::S` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/pack.move:14:29
+   │
+14 │         let n2 = Nat { f: *&s };
+   │                             ^ copy needed here because value is still in use
+15 │         R { s: _, f: _, n1: _, n2: _ } = (R { s, n2, f, n1 }: R);
+   │                                               - used here
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/pack.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/pack.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/pack.move
diff --git a/third_party/move/move-prover/bytecode-pipeline/tests/data_invariant_instrumentation/pack.v2_exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/pack.v2_exp
similarity index 100%
rename from third_party/move/move-prover/bytecode-pipeline/tests/data_invariant_instrumentation/pack.v2_exp
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/pack.v2_exp
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities_invalid.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid.exp
similarity index 83%
rename from third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities_invalid.exp
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid.exp
index 13aa65f64eb3a..8218cd50a0ebe 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities_invalid.exp
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid.exp
@@ -1,7 +1,7 @@
 
 Diagnostics:
 error: type `NoAbilities` is missing required ability `store`
-   ┌─ tests/checking/abilities/v1/phantom_param_op_abilities_invalid.move:30:17
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid.move:30:17
    │
 30 │         move_to>(s, x);
    │                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -10,7 +10,7 @@ error: type `NoAbilities` is missing required ability `store`
    = required by instantiating type parameter `T:key` of function `move_to`
 
 error: type `NoAbilities` is missing required ability `store`
-   ┌─ tests/checking/abilities/v1/phantom_param_op_abilities_invalid.move:35:19
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid.move:35:19
    │
 35 │         move_from>(@0x0)
    │                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -19,7 +19,7 @@ error: type `NoAbilities` is missing required ability `store`
    = required by instantiating type parameter `T:key` of function `move_from`
 
 error: type `NoAbilities` is missing required ability `store`
-   ┌─ tests/checking/abilities/v1/phantom_param_op_abilities_invalid.move:40:16
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid.move:40:16
    │
 40 │         exists>(@0x0)
    │                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -28,7 +28,7 @@ error: type `NoAbilities` is missing required ability `store`
    = required by instantiating type parameter `T:key` of function `exists`
 
 error: type `NoAbilities` is missing required ability `store`
-   ┌─ tests/checking/abilities/v1/phantom_param_op_abilities_invalid.move:44:28
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid.move:44:28
    │
  7 │     struct RequireStore { a: T }
    │                         - declaration of type parameter `T`
@@ -40,7 +40,7 @@ error: type `NoAbilities` is missing required ability `store`
    = required by instantiating type parameter `T:store` of struct `RequireStore`
 
 error: type `NoAbilities` is missing required ability `store`
-   ┌─ tests/checking/abilities/v1/phantom_param_op_abilities_invalid.move:45:22
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid.move:45:22
    │
  7 │     struct RequireStore { a: T }
    │                         - declaration of type parameter `T`
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities_invalid.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities_invalid.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp
new file mode 100644
index 0000000000000..9ff4f8060bc86
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp
@@ -0,0 +1,27 @@
+
+Diagnostics:
+error: local `ref` of type `M::HasDrop` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:11:9
+   │
+11 │         *ref = HasDrop { a: NoAbilities { } };
+   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference content dropped here
+
+error: value of type `M::HasDrop` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:16:9
+   │
+16 │         _ = HasDrop { a: NoAbilities { } };
+   │         ^ implicitly dropped here since it is no longer used
+
+error: local `_x` of type `M::HasDrop` does not have the `drop` ability
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:20:51
+   │
+20 │       fun f3(_x: HasDrop) {
+   │ ╭───────────────────────────────────────────────────^
+21 │ │     }
+   │ ╰─────^ implicitly dropped here since it is no longer used
+
+error: local `x` of type `M::HasCopy` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/phantom_param_op_abilities_invalid2.move:25:10
+   │
+25 │         (copy x, x)
+   │          ^^^^^^ explicitly copied here
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.move
new file mode 100644
index 0000000000000..e903ea8103fd6
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.move
@@ -0,0 +1,27 @@
+module 0x42::M {
+    struct NoAbilities { }
+    struct HasDrop has drop { a: T2 }
+    struct HasCopy has copy { a: T2 }
+    struct HasStore has store { a: T2}
+    struct HasKey has key { a : T2 }
+    struct RequireStore { a: T }
+
+    // Writing to a references requires drop
+    fun f1(ref: &mut HasDrop) {
+        *ref = HasDrop { a: NoAbilities { } };
+    }
+
+    // Ignoring values requires drop
+    fun f2() {
+        _ = HasDrop { a: NoAbilities { } };
+    }
+
+    // Leaving value in local requires drop
+    fun f3(_x: HasDrop) {
+    }
+
+    // `copy` requires copy
+    fun f4(x: HasCopy): (HasCopy,  HasCopy) {
+        (copy x, x)
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp
new file mode 100644
index 0000000000000..a00ded68efbf9
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp
@@ -0,0 +1,9 @@
+
+Diagnostics:
+error: local `f1` of type `M::Box>` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/type_variable_join_threaded_unpack.move:40:44
+   │
+40 │         Container::put(&mut v, Box { f1: *&f1, f2 });
+   │                                            ^^ copy needed here because value is still in use
+41 │         f1
+   │         -- used here
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp
new file mode 100644
index 0000000000000..01898c35db8c6
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp
@@ -0,0 +1,9 @@
+
+Diagnostics:
+error: local `f1` of type `M::Box>` does not have the `copy` ability
+   ┌─ tests/ability-check/typing/type_variable_join_threaded_unpack_assign.move:44:44
+   │
+44 │         Container::put(&mut v, Box { f1: *&f1, f2 });
+   │                                            ^^ copy needed here because value is still in use
+45 │         f1
+   │         -- used here
diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign.move b/third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign.move
rename to third_party/move/move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.move
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive2.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive2.exp
new file mode 100644
index 0000000000000..90b32906711cc
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive2.exp
@@ -0,0 +1,2 @@
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive2.move b/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive2.move
new file mode 100644
index 0000000000000..50598545bb58e
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive2.move
@@ -0,0 +1,8 @@
+module 0x8675309::M {
+    struct S has copy, drop { s: T }
+    fun t(s: signer): S {
+        let x = S { s };
+        *&x
+    }
+}
+// check: READREF_RESOURCE_ERROR
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.exp
index 3137b238c7efd..79f203af97ef5 100644
--- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.exp
+++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.exp
@@ -75,56 +75,89 @@ error: tuple type `(u64, u64)` is not allowed as a type argument
    = required by instantiating type parameter `T:drop` of struct `S`
 
 error: type `R` is missing required ability `drop`
-   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:32:19
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:28:11
    │
  3 │     struct S has drop { f: T }
    │              - declaration of type parameter `T`
    ·
-32 │         let f1: S = abort 0;
+28 │         S,
+   │           ^
+   │
+   = required by instantiating type parameter `T:drop` of struct `S`
+
+error: reference type `&u64` is not allowed as a type argument
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:29:11
+   │
+ 3 │     struct S has drop { f: T }
+   │              - declaration of type parameter `T`
+   ·
+29 │         S<&u64>,
+   │           ^^^^
+   │
+   = required by instantiating type parameter `T:drop` of struct `S`
+
+error: tuple type `(u64, u64)` is not allowed as a type argument
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:31:11
+   │
+ 3 │     struct S has drop { f: T }
+   │              - declaration of type parameter `T`
+   ·
+31 │         S<(u64, u64)>,
+   │           ^^^^^^^^^^
+   │
+   = required by instantiating type parameter `T:drop` of struct `S`
+
+error: type `R` is missing required ability `drop`
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:37:19
+   │
+ 3 │     struct S has drop { f: T }
+   │              - declaration of type parameter `T`
+   ·
+37 │         let f1: S = abort 0;
    │                   ^
    │
    = required by instantiating type parameter `T:drop` of struct `S`
 
 error: reference type `&u64` is not allowed as a type argument
-   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:33:19
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:38:19
    │
  3 │     struct S has drop { f: T }
    │              - declaration of type parameter `T`
    ·
-33 │         let f2: S<&u64> = abort 0;
+38 │         let f2: S<&u64> = abort 0;
    │                   ^^^^
    │
    = required by instantiating type parameter `T:drop` of struct `S`
 
 error: tuple type `(u64, u64)` is not allowed as a type argument
-   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:35:19
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:40:19
    │
  3 │     struct S has drop { f: T }
    │              - declaration of type parameter `T`
    ·
-35 │         let f4: S<(u64, u64)> = abort 0;
+40 │         let f4: S<(u64, u64)> = abort 0;
    │                   ^^^^^^^^^^
    │
    = required by instantiating type parameter `T:drop` of struct `S`
 
 error: reference type `&&u64` is not allowed as a type argument
-   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:39:12
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:44:12
    │
  5 │     fun id(x: T): T { x }
    │            - declaration of type parameter `T`
    ·
-39 │         id<&(&u64)>(abort 0);
+44 │         id<&(&u64)>(abort 0);
    │            ^^^^^^^
    │
    = required by instantiating type parameter `T` of function `id`
 
 error: type `R` is missing required ability `drop`
-   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:42:11
+   ┌─ tests/ability-check/v1-typing/instantiate_signatures.move:47:11
    │
  3 │     struct S has drop { f: T }
    │              - declaration of type parameter `T`
    ·
-42 │         S> { f: abort 0 };
+47 │         S> { f: abort 0 };
    │           ^^^^
    │
    = required by instantiating type parameter `T:drop` of struct `S`
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.move b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.move
index 33f84f31b4ae2..60b7cf1aa0beb 100644
--- a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.move
+++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.move
@@ -14,11 +14,16 @@ module M {
         f4: S<(u64, u64)>,
     }
 
-    fun f1(
+    fun f1a(
         _f1: S,
         _f2: S<&u64>,
         _f3: &(&u64),
         _f4: S<(u64, u64)>,
+    ) {
+        abort 0
+    }
+
+    fun f1b(
     ): (
         S,
         S<&u64>,
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.exp b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.exp
new file mode 100644
index 0000000000000..159105ab0cca0
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+bug: unexpected type: _
+  ┌─ tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move:6:9
+  │
+6 │     fun t0() {
+  │         ^^
diff --git a/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move
new file mode 100644
index 0000000000000..c508612afb679
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move
@@ -0,0 +1,10 @@
+module 0x8675309::M {
+    struct Coin {}
+    struct R  { r: T }
+    struct S has drop { c: T }
+
+    fun t0() {
+        R {r:_ } = R { r: 0 };
+        // S { c: Coin {} };
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/acquires-checker/acquires_error_msg.exp b/third_party/move/move-compiler-v2/tests/acquires-checker/typing/acquires_error_msg.exp
similarity index 80%
rename from third_party/move/move-compiler-v2/tests/acquires-checker/acquires_error_msg.exp
rename to third_party/move/move-compiler-v2/tests/acquires-checker/typing/acquires_error_msg.exp
index 227dc546ff5df..88be37c4461b0 100644
--- a/third_party/move/move-compiler-v2/tests/acquires-checker/acquires_error_msg.exp
+++ b/third_party/move/move-compiler-v2/tests/acquires-checker/typing/acquires_error_msg.exp
@@ -1,7 +1,7 @@
 
 Diagnostics:
 error: missing acquires annotation for `Test`
-  ┌─ tests/acquires-checker/acquires_error_msg.move:6:16
+  ┌─ tests/acquires-checker/typing/acquires_error_msg.move:6:16
   │
 6 │     public fun call_modify_without_acquire() {
   │                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/acquires-checker/acquires_error_msg.move b/third_party/move/move-compiler-v2/tests/acquires-checker/typing/acquires_error_msg.move
similarity index 100%
rename from third_party/move/move-compiler-v2/tests/acquires-checker/acquires_error_msg.move
rename to third_party/move/move-compiler-v2/tests/acquires-checker/typing/acquires_error_msg.move
diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp
index c8a13847d8cae..9a7714eaeae4c 100644
--- a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp
+++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp
@@ -4,8 +4,8 @@ module 0x815::m {
         table: m::Table,
     }
     struct Table {
-        x: #0,
-        y: #1,
+        x: T1,
+        y: T2,
     }
     struct ValueWrap {
         val: u64,
diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp
index 9a0e87baab823..54c0d2bf6f939 100644
--- a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp
+++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp
@@ -4,7 +4,7 @@ module 0x42::fields {
         h: u64,
     }
     struct G {
-        f: #0,
+        f: X,
     }
     struct S {
         f: u64,
diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp
index 27c69ad451e84..016fcc4ac5bee 100644
--- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp
+++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp
@@ -42,7 +42,7 @@ module 0xc0ffee::m {
     enum Option {
         None,
         Some {
-            value: #0,
+            value: A,
         }
     }
     enum Outer {
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/anonymous_field_fail.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/anonymous_field_fail.exp
new file mode 100644
index 0000000000000..c35ca46a4d926
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/anonymous_field_fail.exp
@@ -0,0 +1,34 @@
+
+Diagnostics:
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/anonymous_field_fail.move:2:13
+  │
+2 │     struct S(u8);
+  │             ^ Move 2 language construct is not enabled: positional fields
+
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/anonymous_field_fail.move:4:5
+  │
+4 │     enum E {
+  │     ^^^^ Move 2 language construct is not enabled: enum types
+
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/anonymous_field_fail.move:5:10
+  │
+5 │         V(S)
+  │          ^ Move 2 language construct is not enabled: positional fields
+
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/anonymous_field_fail.move:9:11
+  │
+9 │         x.1;
+  │           ^ Move 2 language construct is not enabled: positional field
+
+error: unexpected token
+   ┌─ tests/checking-lang-v1/anonymous_field_fail.move:10:14
+   │
+10 │         let S(_x) = x;
+   │              ^
+   │              │
+   │              Unexpected '('
+   │              Expected '{'
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/anonymous_field_fail.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/anonymous_field_fail.move
new file mode 100644
index 0000000000000..bdaf4ed087c2c
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/anonymous_field_fail.move
@@ -0,0 +1,15 @@
+module 0x42::test {
+    struct S(u8);
+
+    enum E {
+        V(S)
+    }
+
+    fun foo(x: S, y: E) {
+        x.1;
+        let S(_x) = x;
+        match (y) {
+            E::V(_y) => {}
+        }
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/dotdot_not_supported.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/dotdot_not_supported.exp
new file mode 100644
index 0000000000000..3441edb3639e9
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/dotdot_not_supported.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/dotdot_not_supported.move:8:11
+  │
+8 │         let S { .. } = x;
+  │                 ^^ Move 2 language construct is not enabled: `..` patterns
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/dotdot_not_supported.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/dotdot_not_supported.move
new file mode 100644
index 0000000000000..e28747e65d6e6
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/dotdot_not_supported.move
@@ -0,0 +1,10 @@
+module 0x42::test {
+	struct S {
+		x: bool,
+		y: u8
+	}
+
+	fun test_0(x: S) {
+		let S { .. } = x;
+	}
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.exp
new file mode 100644
index 0000000000000..7eecb2c8d0891
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.exp
@@ -0,0 +1,18 @@
+
+Diagnostics:
+warning: Unused parameter `f`. Consider removing or prefixing with an underscore: `_f`
+  ┌─ tests/checking-lang-v1/eq_inline_typed.move:3:20
+  │
+3 │     inline fun foo(f: |&u64|) {
+  │                    ^
+
+// -- Model dump before bytecode pipeline
+module 0x42::m {
+    private inline fun foo(f: |&u64|) {
+        Tuple()
+    }
+    private fun g() {
+        Tuple();
+        Tuple()
+    }
+} // end 0x42::m
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.move
new file mode 100644
index 0000000000000..fd6c39261d521
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/eq_inline_typed.move
@@ -0,0 +1,13 @@
+module 0x42::m {
+
+    inline fun foo(f: |&u64|) {
+    }
+
+    fun g() {
+        foo(|v: &u64| {
+            v == &1;
+        });
+    }
+
+
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/expansion/access_specifier_not_supported.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/expansion/access_specifier_not_supported.exp
new file mode 100644
index 0000000000000..666c992ab1484
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/expansion/access_specifier_not_supported.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/expansion/access_specifier_not_supported.move:8:14
+  │
+8 │     fun f2() reads S {
+  │              ^^^^^ Move 2 language construct is not enabled: access specifiers
+
+error: unsupported language construct
+   ┌─ tests/checking-lang-v1/expansion/access_specifier_not_supported.move:11:14
+   │
+11 │     fun f3() writes S {
+   │              ^^^^^^ Move 2 language construct is not enabled: access specifiers
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/expansion/access_specifier_not_supported.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/expansion/access_specifier_not_supported.move
new file mode 100644
index 0000000000000..0b76ed198e0de
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/expansion/access_specifier_not_supported.move
@@ -0,0 +1,31 @@
+module 0x42::m {
+
+    struct S has key {}
+    struct R has key {}
+    struct T has key {}
+    struct G has key {}
+
+    fun f2() reads S {
+    }
+
+    fun f3() writes S {
+    }
+
+    fun f4() acquires S(*) {
+    }
+
+    fun f5() acquires 0x42::*::* {
+    }
+
+    fun f6() acquires 0x42::m::R {
+    }
+
+    fun f7() acquires *(*) {
+    }
+
+    fun f8() acquires *(0x42) {
+    }
+
+    fun f9(_a: address) acquires *(_a) {
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/no_receiver_calls.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/no_receiver_calls.exp
new file mode 100644
index 0000000000000..0b47e7929ac27
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/no_receiver_calls.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: not supported before language version `2.0`: receiver style function calls
+  ┌─ tests/checking-lang-v1/no_receiver_calls.move:7:9
+  │
+7 │         t.receiver(1);
+  │         ^^^^^^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/no_receiver_calls.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/no_receiver_calls.move
new file mode 100644
index 0000000000000..f442a7c6e5ddf
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/no_receiver_calls.move
@@ -0,0 +1,10 @@
+module 0x42::m {
+    struct T has drop {}
+
+    fun receiver(self: &T, _x: u64) { abort 1 }
+
+    fun call_receiver(t: T) {
+        t.receiver(1);
+        receiver(&t, 1)
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/public_packge_visibility.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/public_packge_visibility.exp
new file mode 100644
index 0000000000000..82360a7634b56
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/public_packge_visibility.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/public_packge_visibility.move:2:5
+  │
+2 │     public(package) fun foo() {}
+  │     ^^^^^^^^^^^^^^^ Move 2 language construct is not enabled: public(package) visibility
+
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/public_packge_visibility.move:6:5
+  │
+6 │     public(package) fun main() {}
+  │     ^^^^^^^^^^^^^^^ Move 2 language construct is not enabled: public(package) visibility
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/public_packge_visibility.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/public_packge_visibility.move
new file mode 100644
index 0000000000000..234bf5c71c6c9
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/public_packge_visibility.move
@@ -0,0 +1,7 @@
+module 0x42::M {
+    public(package) fun foo() {}
+}
+
+script {
+    public(package) fun main() {}
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_public.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_public.exp
new file mode 100644
index 0000000000000..353aff45280e0
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_public.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: invalid modifier
+  ┌─ tests/checking-lang-v1/struct_public.move:3:5
+  │
+3 │     public struct Foo {}
+  │     ^^^^^^ Invalid struct declaration. Structs cannot have visibility modifiers as they are always 'public'
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_public.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_public.move
new file mode 100644
index 0000000000000..656037e8ce2dd
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_public.move
@@ -0,0 +1,4 @@
+module 0x42::M {
+    // visibility modifiers on structs fail during parsing
+    public struct Foo {}
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_without_fields.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_without_fields.exp
new file mode 100644
index 0000000000000..7754c9f2e4a8c
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_without_fields.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: unsupported language construct
+  ┌─ tests/checking-lang-v1/struct_without_fields.move:3:13
+  │
+3 │     struct S;
+  │             ^ Move 2 language construct is not enabled: struct declaration without field list
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_without_fields.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_without_fields.move
new file mode 100644
index 0000000000000..626d7c0e9a698
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/struct_without_fields.move
@@ -0,0 +1,4 @@
+module M {
+    // Non-native structs must specify the list of fields.
+    struct S;
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_nested_self_as_invalid.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_nested_self_as_invalid.exp
new file mode 100644
index 0000000000000..88abc349a9137
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_nested_self_as_invalid.exp
@@ -0,0 +1,19 @@
+
+Diagnostics:
+warning: unused alias
+  ┌─ tests/checking-lang-v1/use_nested_self_as_invalid.move:8:26
+  │
+8 │     use 0x2::X::{Self as B, foo, S};
+  │                          ^ Unused 'use' of alias 'B'. Consider removing it
+
+error: unbound module
+   ┌─ tests/checking-lang-v1/use_nested_self_as_invalid.move:10:19
+   │
+10 │     struct X { f: X::S, f2: S }
+   │                   ^ Unbound module or type alias 'X'
+
+error: unbound module
+   ┌─ tests/checking-lang-v1/use_nested_self_as_invalid.move:12:9
+   │
+12 │         X::foo();
+   │         ^ Unbound module or type alias 'X'
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_nested_self_as_invalid.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_nested_self_as_invalid.move
new file mode 100644
index 0000000000000..aee8cbf91bd5d
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_nested_self_as_invalid.move
@@ -0,0 +1,16 @@
+address 0x2 {
+module X {
+    struct S {}
+    public fun foo() {}
+}
+
+module M {
+    use 0x2::X::{Self as B, foo, S};
+
+    struct X { f: X::S, f2: S }
+    fun bar() {
+        X::foo();
+        foo()
+    }
+}
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.exp b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.exp
new file mode 100644
index 0000000000000..8b717c666f02b
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.exp
@@ -0,0 +1,13 @@
+// -- Model dump before bytecode pipeline
+module 0x2::X {
+    struct S {
+        dummy_field: bool,
+    }
+} // end 0x2::X
+module 0x2::M {
+    use 0x2::X::{Self, S as X}; // resolved as: 0x2::X
+    struct A {
+        f1: X::S,
+        f2: X::S,
+    }
+} // end 0x2::M
diff --git a/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.move b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.move
new file mode 100644
index 0000000000000..b5bf9a383661b
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking-lang-v1/use_struct_overlap_with_module.move
@@ -0,0 +1,10 @@
+address 0x2 {
+module X {
+    struct S {}
+}
+
+module M {
+    use 0x2::X::{Self, S as X};
+    struct A { f1: X, f2: X::S }
+}
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.exp
index e1c7dbe1ee3a9..c82fdb11b6990 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.exp
@@ -115,114 +115,114 @@ error: type `Cup` is missing required abilities `copy + drop + store`
    = required by instantiating type parameter `T:copy + drop + store` of function `cds`
 
 error: type `signer` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:45:24
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:35:24
    │
 13 │     struct Sc {}
    │                       - declaration of type parameter `T`
    ·
-45 │         let Sc {} = Sc {};
+35 │         let Sc {} = Sc {};
    │                        ^^^^^^
    │
    = required by instantiating type parameter `phantom T:copy` of struct `Sc`
 
 error: type `signer` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:46:24
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:36:24
    │
 13 │     struct Sc {}
    │                       - declaration of type parameter `T`
    ·
-46 │         let Sc {} = Sc> {};
+36 │         let Sc {} = Sc> {};
    │                        ^^^^^^^^^^^^^^
    │
    = required by instantiating vector type parameter
    = required by instantiating type parameter `phantom T:copy` of struct `Sc`
 
 error: type `NoC` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:47:24
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:37:24
    │
 13 │     struct Sc {}
    │                       - declaration of type parameter `T`
    ·
-47 │         let Sc {} = Sc> {};
+37 │         let Sc {} = Sc> {};
    │                        ^^^^^^^^^^^
    │
    = required by instantiating vector type parameter
    = required by instantiating type parameter `phantom T:copy` of struct `Sc`
 
 error: type `u64` is missing required ability `key`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:48:24
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:38:24
    │
 14 │     struct Sk {}
    │                       - declaration of type parameter `T`
    ·
-48 │         let Sk {} = Sk {};
+38 │         let Sk {} = Sk {};
    │                        ^^^
    │
    = required by instantiating type parameter `phantom T:key` of struct `Sk`
 
 error: type `signer` is missing required ability `key`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:49:24
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:39:24
    │
 14 │     struct Sk {}
    │                       - declaration of type parameter `T`
    ·
-49 │         let Sk {} = Sk {};
+39 │         let Sk {} = Sk {};
    │                        ^^^^^^
    │
    = required by instantiating type parameter `phantom T:key` of struct `Sk`
 
 error: type `vector` is missing required ability `key`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:50:24
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:40:24
    │
 14 │     struct Sk {}
    │                       - declaration of type parameter `T`
    ·
-50 │         let Sk {} = Sk> {};
+40 │         let Sk {} = Sk> {};
    │                        ^^^^^^^^^^^
    │
    = required by instantiating type parameter `phantom T:key` of struct `Sk`
 
 error: type `vector` is missing required ability `key`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:51:24
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:41:24
    │
 14 │     struct Sk {}
    │                       - declaration of type parameter `T`
    ·
-51 │         let Sk {} = Sk> {};
+41 │         let Sk {} = Sk> {};
    │                        ^^^^^^^^^^^
    │
    = required by instantiating type parameter `phantom T:key` of struct `Sk`
 
 error: type `signer` is missing required abilities `copy + store`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:52:28
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:42:28
    │
 15 │     struct Scds {}
    │                         - declaration of type parameter `T`
    ·
-52 │         let Scds {} = Scds {};
+42 │         let Scds {} = Scds {};
    │                            ^^^^^^
    │
    = required by instantiating type parameter `phantom T:copy + drop + store` of struct `Scds`
 
 error: type `NoC` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:53:28
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:43:28
    │
 15 │     struct Scds {}
    │                         - declaration of type parameter `T`
    ·
-53 │         let Scds {} = Scds> {};
+43 │         let Scds {} = Scds> {};
    │                            ^^^^^^^^^^^
    │
    = required by instantiating vector type parameter
    = required by instantiating type parameter `phantom T:copy + drop + store` of struct `Scds`
 
 error: type `Cup` is missing required abilities `copy + drop + store`
-   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:54:28
+   ┌─ tests/checking/abilities/v1/ability_constraint_prims_invalid.move:44:28
    │
 15 │     struct Scds {}
    │                         - declaration of type parameter `T`
    ·
-54 │         let Scds {} = Scds>> {};
+44 │         let Scds {} = Scds>> {};
    │                            ^^^^^^^^^^^^^^^
    │
    = required by instantiating vector type parameter
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.move b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.move
index daf57a1dc300d..edca6d17a365d 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.move
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.move
@@ -27,20 +27,10 @@ module M {
         cds();
         cds>();
         cds>>();
-        let Sc {} = Sc {};
-        let Sc {} = Sc> {};
-        let Sc {} = Sc> {};
-        let Sk {} = Sk {};
-        let Sk {} = Sk {};
-        let Sk {} = Sk> {};
-        let Sk {} = Sk> {};
-        let Scds {} = Scds {};
-        let Scds {} = Scds> {};
-        let Scds {} = Scds>> {};
     }
 
     /// Not all above errors are shown because of duplicate removal,
-    /// so do them again here.
+    /// so some moved here.
     fun t2() {
         let Sc {} = Sc {};
         let Sc {} = Sc> {};
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.exp
index b4def71946cde..873f05529cffd 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.exp
@@ -112,3 +112,116 @@ error: type `NoC` is missing required ability `copy`
    │
    = required by instantiating type parameter `T2` of struct `Pair`
    = required by instantiating type parameter `T:copy + drop + store` of function `cds`
+
+error: type `NoC` is missing required ability `copy`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:34:24
+   │
+13 │     struct Sc {}
+   │                       - declaration of type parameter `T`
+   ·
+34 │         let Sc {} = Sc {};
+   │                        ^^^
+   │
+   = required by instantiating type parameter `phantom T:copy` of struct `Sc`
+
+error: type `Cup` is missing required ability `copy`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:35:24
+   │
+13 │     struct Sc {}
+   │                       - declaration of type parameter `T`
+   ·
+35 │         let Sc {} = Sc> {};
+   │                        ^^^^^^^^
+   │
+   = required by instantiating type parameter `phantom T:copy` of struct `Sc`
+
+error: type `NoC` is missing required ability `copy`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:36:24
+   │
+13 │     struct Sc {}
+   │                       - declaration of type parameter `T`
+   ·
+36 │         let Sc {} = Sc> {};
+   │                        ^^^^^^^^
+   │
+   = required by instantiating type parameter `T` of struct `Box`
+   = required by instantiating type parameter `phantom T:copy` of struct `Sc`
+
+error: type `NoK` is missing required ability `key`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:37:24
+   │
+14 │     struct Sk {}
+   │                       - declaration of type parameter `T`
+   ·
+37 │         let Sk {} = Sk {};
+   │                        ^^^
+   │
+   = required by instantiating type parameter `phantom T:key` of struct `Sk`
+
+error: type `Cup` is missing required ability `key`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:38:24
+   │
+14 │     struct Sk {}
+   │                       - declaration of type parameter `T`
+   ·
+38 │         let Sk {} = Sk> {};
+   │                        ^^^^^^^^
+   │
+   = required by instantiating type parameter `phantom T:key` of struct `Sk`
+
+error: type `Cup` is missing required ability `store`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:39:24
+   │
+14 │     struct Sk {}
+   │                       - declaration of type parameter `T`
+   ·
+39 │         let Sk {} = Sk>> {};
+   │                        ^^^^^^^^^^^^^
+   │
+   = required by instantiating type parameter `T` of struct `Box`
+   = required by instantiating type parameter `phantom T:key` of struct `Sk`
+
+error: type `NoC` is missing required ability `copy`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:40:28
+   │
+15 │     struct Scds {}
+   │                         - declaration of type parameter `T`
+   ·
+40 │         let Scds {} = Scds {};
+   │                            ^^^
+   │
+   = required by instantiating type parameter `phantom T:copy + drop + store` of struct `Scds`
+
+error: type `Cup` is missing required abilities `copy + drop + store`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:41:28
+   │
+15 │     struct Scds {}
+   │                         - declaration of type parameter `T`
+   ·
+41 │         let Scds {} = Scds> {};
+   │                            ^^^^^^^^
+   │
+   = required by instantiating type parameter `phantom T:copy + drop + store` of struct `Scds`
+
+error: type `Cup` is missing required abilities `copy + drop + store`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:42:28
+   │
+15 │     struct Scds {}
+   │                         - declaration of type parameter `T`
+   ·
+42 │         let Scds {} = Scds> {};
+   │                            ^^^^^^^^
+   │
+   = required by instantiating type parameter `phantom T:copy + drop + store` of struct `Scds`
+
+error: type `NoC` is missing required ability `copy`
+   ┌─ tests/checking/abilities/v1/ability_constraint_structs_invalid.move:43:28
+   │
+15 │     struct Scds {}
+   │                         - declaration of type parameter `T`
+   ·
+43 │         let Scds {} = Scds> {};
+   │                            ^^^^^^^^^^^^^^
+   │
+   = required by instantiating type parameter `T2` of struct `Pair`
+   = required by instantiating type parameter `phantom T:copy + drop + store` of struct `Scds`
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.move b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.move
index f51edb3803c13..8359049cb4724 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.move
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.move
@@ -26,6 +26,11 @@ module M {
         cds>();
         cds>();
         cds>();
+    }
+
+    /// Not all above errors are shown because of duplicate removal,
+    /// so some moved here.
+    fun t2() {
         let Sc {} = Sc {};
         let Sc {} = Sc> {};
         let Sc {} = Sc> {};
@@ -37,7 +42,5 @@ module M {
         let Scds {} = Scds> {};
         let Scds {} = Scds> {};
     }
-
-
 }
 }
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.exp
index c87dabdc1f719..2f6ac4baa985e 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.exp
@@ -1,114 +1,10 @@
 
 Diagnostics:
-error: type `TnoC` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:21:11
+error: duplicate declaration, item, or annotation
+   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:35:9
    │
- 7 │     fun c() {}
-   │           - declaration of type parameter `T`
+16 │     fun t<
+   │         - Alias previously defined here
    ·
-21 │         c();
-   │           ^^^^
-   │
-   = required by instantiating type parameter `T:copy` of function `c`
-
-error: type `Cup` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:22:11
-   │
- 7 │     fun c() {}
-   │           - declaration of type parameter `T`
-   ·
-22 │         c>();
-   │           ^^^^^^^^^
-   │
-   = required by instantiating type parameter `T:copy` of function `c`
-
-error: type `TnoC` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:23:11
-   │
- 7 │     fun c() {}
-   │           - declaration of type parameter `T`
-   ·
-23 │         c>();
-   │           ^^^^^^^^^
-   │
-   = required by instantiating type parameter `T` of struct `Box`
-   = required by instantiating type parameter `T:copy` of function `c`
-
-error: type `TnoK` is missing required ability `key`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:24:11
-   │
- 8 │     fun k() {}
-   │           - declaration of type parameter `T`
-   ·
-24 │         k();
-   │           ^^^^
-   │
-   = required by instantiating type parameter `T:key` of function `k`
-
-error: type `Cup` is missing required ability `key`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:25:11
-   │
- 8 │     fun k() {}
-   │           - declaration of type parameter `T`
-   ·
-25 │         k>();
-   │           ^^^^^^^^^
-   │
-   = required by instantiating type parameter `T:key` of function `k`
-
-error: type `Cup` is missing required ability `store`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:26:11
-   │
- 8 │     fun k() {}
-   │           - declaration of type parameter `T`
-   ·
-26 │         k>>();
-   │           ^^^^^^^^^^^^^^
-   │
-   = required by instantiating type parameter `T` of struct `Box`
-   = required by instantiating type parameter `T:key` of function `k`
-
-error: type `TnoC` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:27:13
-   │
- 9 │     fun cds() {}
-   │             - declaration of type parameter `T`
-   ·
-27 │         cds();
-   │             ^^^^
-   │
-   = required by instantiating type parameter `T:copy + drop + store` of function `cds`
-
-error: type `Cup` is missing required abilities `copy + drop + store`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:28:13
-   │
- 9 │     fun cds() {}
-   │             - declaration of type parameter `T`
-   ·
-28 │         cds>();
-   │             ^^^^^^^^^
-   │
-   = required by instantiating type parameter `T:copy + drop + store` of function `cds`
-
-error: type `Cup` is missing required abilities `copy + drop + store`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:29:13
-   │
- 9 │     fun cds() {}
-   │             - declaration of type parameter `T`
-   ·
-29 │         cds>();
-   │             ^^^^^^^^^
-   │
-   = required by instantiating type parameter `T:copy + drop + store` of function `cds`
-
-error: type `TnoC` is missing required ability `copy`
-   ┌─ tests/checking/abilities/v1/ability_constraint_tparams_invalid.move:30:13
-   │
- 9 │     fun cds() {}
-   │             - declaration of type parameter `T`
-   ·
-30 │         cds>();
-   │             ^^^^^^^^^^^^^^^
-   │
-   = required by instantiating type parameter `T2` of struct `Pair`
-   = required by instantiating type parameter `T:copy + drop + store` of function `cds`
+35 │     fun t<
+   │         ^ Duplicate module member or alias 't'. Top level names in a namespace must be unique
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.move b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.move
index 366e1cddadbf9..0aa8814a6fc66 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.move
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.move
@@ -28,6 +28,15 @@ module M {
         cds>();
         cds>();
         cds>();
+    }
+
+    /// Not all above errors are shown because of duplicate removal,
+    /// so some moved here.
+    fun t<
+        TnoC: drop + store + key,
+        TnoK: copy + drop + store,
+        T,
+    >() {
         let Sc {} = Sc {};
         let Sc {} = Sc> {};
         let Sc {} = Sc> {};
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp
index 93bcfd12e634f..d6fff4b1fb6bf 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp
@@ -1,11 +1,11 @@
 // -- Model dump before bytecode pipeline
 module 0x42::M {
     struct Box {
-        f: #0,
+        f: T,
     }
     struct Pair {
-        f1: #0,
-        f2: #1,
+        f1: T1,
+        f2: T2,
     }
     struct R {
         dummy_field: bool,
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp
index 438f27a7322ab..d5ccb52b48d21 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp
@@ -1,22 +1,22 @@
 // -- Model dump before bytecode pipeline
 module 0x42::M {
     struct HasCopy {
-        a: #1,
+        a: T2,
     }
     struct HasDrop {
-        a: #1,
+        a: T2,
     }
     struct HasKey {
-        a: #1,
+        a: T2,
     }
     struct HasStore {
-        a: #1,
+        a: T2,
     }
     struct NoAbilities {
         dummy_field: bool,
     }
     struct RequireStore {
-        a: #0,
+        a: T,
     }
     private fun f1(ref: &mut M::HasDrop) {
         ref = pack M::HasDrop(1);
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp
index cbc230acd5142..4b1929b32c2ae 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp
@@ -1,34 +1,34 @@
 // -- Model dump before bytecode pipeline
 module 0x42::M {
     struct HasAbilities {
-        a: #1,
+        a: T2,
     }
     struct HasCopy {
-        a: #1,
+        a: T2,
     }
     struct HasDrop {
-        a: #1,
+        a: T2,
     }
     struct HasKey {
-        a: #1,
+        a: T2,
     }
     struct HasStore {
-        a: #1,
+        a: T2,
     }
     struct NoAbilities {
         a: bool,
     }
     struct S1 {
-        a: #0,
+        a: T,
     }
     struct S2 {
         a: M::S1>,
     }
     struct S3 {
-        a: #0,
-        b: #1,
-        c: #2,
-        d: #3,
+        a: T1,
+        b: T2,
+        c: T3,
+        d: T4,
     }
     struct S4 {
         a: M::S3, M::HasCopy, M::HasStore, M::HasKey>,
diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp
index bfa5c712d716a..c989623b114ba 100644
--- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp
@@ -1,16 +1,16 @@
 // -- Model dump before bytecode pipeline
 module 0x42::M {
     struct HasCopy {
-        a: #1,
+        a: T2,
     }
     struct HasDrop {
-        a: #1,
+        a: T2,
     }
     struct HasKey {
-        a: #1,
+        a: T2,
     }
     struct HasStore {
-        a: #1,
+        a: T2,
     }
     struct NoAbilities {
         dummy_field: bool,
diff --git a/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp b/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp
index 90bd63bc24c3a..87b52a3c44aec 100644
--- a/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp
@@ -28,16 +28,16 @@ module 0x42::test {
         y: u8,
     }
     struct S4 {
-        x: #0,
+        x: T,
         y: test::S3,
     }
     struct S5 {
-        0: #0,
-        1: #1,
+        0: T,
+        1: U,
     }
     struct S6 {
-        x: #0,
-        y: #1,
+        x: T,
+        y: U,
     }
     struct S7 {
         0: u8,
@@ -299,3 +299,21 @@ module 0x42::test {
         }
     }
 } // end 0x42::test
+
+
+Diagnostics:
+error: match not exhaustive
+    ┌─ tests/checking/dotdot/dotdot_valid.move:142:16
+    │
+142 │         match (x) {
+    │                ^
+    │
+    = missing `E1::C{..}`
+
+error: match not exhaustive
+    ┌─ tests/checking/dotdot/dotdot_valid.move:153:16
+    │
+153 │         match (x) {
+    │                ^
+    │
+    = missing `E1::C{..}`
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg.exp
deleted file mode 100644
index ea9ede1967b84..0000000000000
--- a/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg.exp
+++ /dev/null
@@ -1,21 +0,0 @@
-// -- Model dump before bytecode pipeline
-module 0x42::test {
-    struct Test {
-        value: u64,
-    }
-    public fun call_modify_without_acquire()
-        acquires test::Test(*)
-     {
-        test::modify();
-        Tuple()
-    }
-    public fun modify()
-        acquires test::Test(*)
-     {
-        select test::Test.value<&mut test::Test>(BorrowGlobal(Mutable)(0xcafe)) = 2;
-        Tuple()
-    }
-} // end 0x42::test
-
-
-============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg_inline.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg_inline.exp
new file mode 100644
index 0000000000000..1125fc22314ff
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg_inline.exp
@@ -0,0 +1,12 @@
+
+Diagnostics:
+error: missing acquires annotation for `Test`
+   ┌─ tests/checking/inlining/acquires_error_msg_inline.move:6:16
+   │
+ 6 │     public fun call_modify_without_acquire() {
+   │                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ 7 │         modify(); // expect error message here
+   │         -------- from a call inlined at this callsite
+   ·
+11 │         borrow_global_mut(@0xcafe).value = 2;
+   │         -------------------------------- acquired here
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg.move b/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg_inline.move
similarity index 64%
rename from third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg.move
rename to third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg_inline.move
index 0a587b097ca14..0db2a23937458 100644
--- a/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg.move
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/acquires_error_msg_inline.move
@@ -3,11 +3,11 @@ module 0x42::test {
         value: u64
     }
 
-    public fun call_modify_without_acquire() acquires Test {
+    public fun call_modify_without_acquire() {
         modify(); // expect error message here
     }
 
-    public fun modify() acquires Test {
+    public inline fun modify() acquires Test {
         borrow_global_mut(@0xcafe).value = 2;
     }
 }
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/break_continue_in_lambda_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/break_continue_in_lambda_typed.exp
new file mode 100644
index 0000000000000..85d0ec7301714
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/break_continue_in_lambda_typed.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: Break outside of a loop not currently supported in inline functions
+  ┌─ tests/checking/inlining/break_continue_in_lambda_typed.move:3:9
+  │
+3 │         break;
+  │         ^^^^^
+
+error: Break outside of a loop not supported in function-typed arguments (lambda expressions)
+   ┌─ tests/checking/inlining/break_continue_in_lambda_typed.move:40:32
+   │
+40 │                 brk2(|_x: u64| break);
+   │                                ^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/break_continue_in_lambda_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/break_continue_in_lambda_typed.move
new file mode 100644
index 0000000000000..52d85e2156339
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/break_continue_in_lambda_typed.move
@@ -0,0 +1,55 @@
+module 0xc0ffee::m {
+    inline fun brk() {
+        break;
+    }
+
+    inline fun brk2(f: |u64|) {
+        f(2);
+    }
+
+    inline fun brk3() {
+	while (true) {
+            break;
+	}
+    }
+
+    inline fun brk4() {
+	while (true) {
+            continue;
+	}
+    }
+
+    public fun foo(): u64 {
+        let i = 0;
+        while (i < 10) {
+            i = i + 1;
+            if (i == 5) {
+                brk();
+		brk3();
+		brk4();
+            }
+        };
+        i
+    }
+
+    public fun bar(): u64 {
+        let i = 0;
+        while (i < 10) {
+            i = i + 1;
+            if (i == 5) {
+                brk2(|_x: u64| break);
+		brk2(|_x: u64| while (true) { break });
+		brk2(|_x: u64| while (true) { continue });
+            }
+        };
+        i
+    }
+
+    fun broken() {
+	break;
+    }
+
+    fun continued() {
+	continue;
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.exp
new file mode 100644
index 0000000000000..858b6714484a5
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.exp
@@ -0,0 +1,15 @@
+// -- Model dump before bytecode pipeline
+module 0xc0ffee::m {
+    private fun continued() {
+        continue;
+        Tuple()
+    }
+} // end 0xc0ffee::m
+
+
+Diagnostics:
+error: missing enclosing loop statement
+  ┌─ tests/checking/inlining/continue_without_loop.move:3:2
+  │
+3 │     continue;
+  │     ^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.move b/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.move
new file mode 100644
index 0000000000000..0bae965b3d173
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/continue_without_loop.move
@@ -0,0 +1,5 @@
+module 0xc0ffee::m {
+    fun continued() {
+	continue;
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/cool_inlining_test_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/cool_inlining_test_typed.exp
new file mode 100644
index 0000000000000..9b193b7c044a2
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/cool_inlining_test_typed.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: no function named `beans` found
+   ┌─ tests/checking/inlining/cool_inlining_test_typed.move:15:22
+   │
+15 │         foo(|_x: u8| beans())
+   │                      ^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/cool_inlining_test_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/cool_inlining_test_typed.move
new file mode 100644
index 0000000000000..530805b4f198a
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/cool_inlining_test_typed.move
@@ -0,0 +1,17 @@
+module 0xc0ffee::cool {
+    public fun beans(): u64 {
+        42
+    }
+}
+
+module 0xc0ffee::m {
+    inline fun foo(f: |u8| u64): u64 {
+        use 0xc0ffee::cool::beans;
+        beans();  // discharge unused use warning
+        f(3)
+    }
+
+    public fun bar(): u64 {
+        foo(|_x: u8| beans())
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda3.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda3.exp
new file mode 100644
index 0000000000000..e9bb6db171607
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda3.exp
@@ -0,0 +1,17 @@
+// -- Model dump before bytecode pipeline
+module 0x8675309::M {
+    public fun lambda_not_allowed() {
+        {
+          let _x: |u64|u64 = |i: u64| Add(i, 1);
+          Tuple()
+        }
+    }
+} // end 0x8675309::M
+
+
+Diagnostics:
+error: Function-typed values not yet supported except as parameters to calls to inline functions
+   ┌─ tests/checking/inlining/lambda3.move:77:18
+   │
+77 │         let _x = |i| i + 1; // expected lambda not allowed
+   │                  ^^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda3.move b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda3.move
new file mode 100644
index 0000000000000..5450bac87c1cb
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda3.move
@@ -0,0 +1,99 @@
+module 0x8675309::M {
+    // use 0x1::XVector;
+
+    // public inline fun foreach(v: &vector, action: |&T|) { // expected to be not implemented
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(XVector::borrow(v, i));
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun reduce(v: vector, accu: R, reducer: |T, R|R): R {
+    //     while (!XVector::is_empty(&v)) {
+    //         accu = reducer(XVector::pop_back(&mut v), accu);
+    //     };
+    //     accu
+    // }
+
+
+    // public fun correct_foreach() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + *e) // expected to be not implemented
+    // }
+
+    // public fun correct_reduce(): u64 {
+    //     let v = vector[1, 2, 3];
+    //     reduce(v, 0, |t, r| t + r)
+    // }
+
+    // public fun corrected_nested() {
+    //     let v = vector[vector[1,2], vector[3]];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + reduce!(*e, 0, |t, r| t + r));
+    // }
+
+    // public inline fun wrong_local_call_arg_count(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(XVector::borrow(v, i), i); // expected to have wrong argument count
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun wrong_local_call_arg_type(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(i); // expected to have wrong argument type
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun wrong_local_call_result_type(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         i = i + action(XVector::borrow(v, i)); // expected to have wrong result type
+    //     }
+    // }
+
+    // public fun wrong_local_call_no_fun(x: u64) {
+    //     x(1) // expected to be not a function
+    // }
+
+    // public fun wrong_lambda_inferred_type() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + e) // expected to cannot infer type
+    // }
+
+    // public fun wrong_lambda_result_type() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| { sum = sum + *e; *e }) // expected to have wrong result type of lambda
+    // }
+
+    public fun lambda_not_allowed() {
+        let _x = |i| i + 1; // expected lambda not allowed
+    }
+
+    // struct FieldFunNotAllowed {
+    //     f: |u64|u64, // expected lambda not allowed
+    // }
+
+    // public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed
+
+    // public inline fun macro_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+    //     abort (1)
+    // }
+    // public fun fun_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+    //     abort (1)
+    // }
+}
+
+// module 0x1::XVector {
+//     public fun length(v: &vector): u64 { abort(1) }
+//     public fun is_empty(v: &vector): bool { abort(1) }
+//     public fun borrow(v: &vector, i: u64): &T { abort(1) }
+//     public fun pop_back(v: &mut vector): T { abort(1) }
+// }
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda4.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda4.exp
new file mode 100644
index 0000000000000..7a6fd81d69593
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda4.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: Functions may not return function-typed values, but function `M::macro_result_lambda_not_allowed` return type is `|u64|`:
+   ┌─ tests/checking/inlining/lambda4.move:86:23
+   │
+86 │     public inline fun macro_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+   │                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Functions may not return function-typed values, but function `M::fun_result_lambda_not_allowed` return type is `|u64|`:
+   ┌─ tests/checking/inlining/lambda4.move:89:16
+   │
+89 │     public fun fun_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+   │                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda4.move b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda4.move
new file mode 100644
index 0000000000000..4a378b7e14b10
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda4.move
@@ -0,0 +1,99 @@
+module 0x8675309::M {
+    // use 0x1::XVector;
+
+    // public inline fun foreach(v: &vector, action: |&T|) { // expected to be not implemented
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(XVector::borrow(v, i));
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun reduce(v: vector, accu: R, reducer: |T, R|R): R {
+    //     while (!XVector::is_empty(&v)) {
+    //         accu = reducer(XVector::pop_back(&mut v), accu);
+    //     };
+    //     accu
+    // }
+
+
+    // public fun correct_foreach() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + *e) // expected to be not implemented
+    // }
+
+    // public fun correct_reduce(): u64 {
+    //     let v = vector[1, 2, 3];
+    //     reduce(v, 0, |t, r| t + r)
+    // }
+
+    // public fun corrected_nested() {
+    //     let v = vector[vector[1,2], vector[3]];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + reduce!(*e, 0, |t, r| t + r));
+    // }
+
+    // public inline fun wrong_local_call_arg_count(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(XVector::borrow(v, i), i); // expected to have wrong argument count
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun wrong_local_call_arg_type(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(i); // expected to have wrong argument type
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun wrong_local_call_result_type(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         i = i + action(XVector::borrow(v, i)); // expected to have wrong result type
+    //     }
+    // }
+
+    // public fun wrong_local_call_no_fun(x: u64) {
+    //     x(1) // expected to be not a function
+    // }
+
+    // public fun wrong_lambda_inferred_type() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + e) // expected to cannot infer type
+    // }
+
+    // public fun wrong_lambda_result_type() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| { sum = sum + *e; *e }) // expected to have wrong result type of lambda
+    // }
+
+    // public fun lambda_not_allowed() {
+    //     let _x = |i| i + 1; // expected lambda not allowed
+    // }
+
+    // struct FieldFunNotAllowed {
+    //     f: |u64|u64, // expected lambda not allowed
+    // }
+
+    // public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed
+
+    public inline fun macro_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+        abort (1)
+    }
+    public fun fun_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+        abort (1)
+    }
+}
+
+// module 0x1::XVector {
+//     public fun length(v: &vector): u64 { abort(1) }
+//     public fun is_empty(v: &vector): bool { abort(1) }
+//     public fun borrow(v: &vector, i: u64): &T { abort(1) }
+//     public fun pop_back(v: &mut vector): T { abort(1) }
+// }
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda5.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda5.exp
new file mode 100644
index 0000000000000..8dc25cb601fb4
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda5.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: Functions may not return function-typed values, but function `M::macro_result_lambda_not_allowed` return type is `|u64|`:
+   ┌─ tests/checking/inlining/lambda5.move:86:23
+   │
+86 │     public inline fun macro_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+   │                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda5.move b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda5.move
new file mode 100644
index 0000000000000..291c8e5cab61f
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda5.move
@@ -0,0 +1,99 @@
+module 0x8675309::M {
+    // use 0x1::XVector;
+
+    // public inline fun foreach(v: &vector, action: |&T|) { // expected to be not implemented
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(XVector::borrow(v, i));
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun reduce(v: vector, accu: R, reducer: |T, R|R): R {
+    //     while (!XVector::is_empty(&v)) {
+    //         accu = reducer(XVector::pop_back(&mut v), accu);
+    //     };
+    //     accu
+    // }
+
+
+    // public fun correct_foreach() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + *e) // expected to be not implemented
+    // }
+
+    // public fun correct_reduce(): u64 {
+    //     let v = vector[1, 2, 3];
+    //     reduce(v, 0, |t, r| t + r)
+    // }
+
+    // public fun corrected_nested() {
+    //     let v = vector[vector[1,2], vector[3]];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + reduce!(*e, 0, |t, r| t + r));
+    // }
+
+    // public inline fun wrong_local_call_arg_count(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(XVector::borrow(v, i), i); // expected to have wrong argument count
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun wrong_local_call_arg_type(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         action(i); // expected to have wrong argument type
+    //         i = i + 1;
+    //     }
+    // }
+
+    // public inline fun wrong_local_call_result_type(v: &vector, action: |&T|) {
+    //     let i = 0;
+    //     while (i < XVector::length(v)) {
+    //         i = i + action(XVector::borrow(v, i)); // expected to have wrong result type
+    //     }
+    // }
+
+    // public fun wrong_local_call_no_fun(x: u64) {
+    //     x(1) // expected to be not a function
+    // }
+
+    // public fun wrong_lambda_inferred_type() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| sum = sum + e) // expected to cannot infer type
+    // }
+
+    // public fun wrong_lambda_result_type() {
+    //     let v = vector[1, 2, 3];
+    //     let sum = 0;
+    //     foreach(&v, |e| { sum = sum + *e; *e }) // expected to have wrong result type of lambda
+    // }
+
+    // public fun lambda_not_allowed() {
+    //     let _x = |i| i + 1; // expected lambda not allowed
+    // }
+
+    // struct FieldFunNotAllowed {
+    //     f: |u64|u64, // expected lambda not allowed
+    // }
+
+    // public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed
+
+    public inline fun macro_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+        abort (1)
+    }
+    // public fun fun_result_lambda_not_allowed(): |u64| {  // expected lambda not allowed
+    //     abort (1)
+    // }
+}
+
+// module 0x1::XVector {
+//     public fun length(v: &vector): u64 { abort(1) }
+//     public fun is_empty(v: &vector): bool { abort(1) }
+//     public fun borrow(v: &vector, i: u64): &T { abort(1) }
+//     public fun pop_back(v: &mut vector): T { abort(1) }
+// }
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_param_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_param_typed.exp
new file mode 100644
index 0000000000000..6e66b076fa40b
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_param_typed.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+error: Currently, a function-typed parameter to an inline function must be a literal lambda expression
+  ┌─ tests/checking/inlining/lambda_param_typed.move:7:15
+  │
+7 │     inline_apply(f, b)
+  │                  ^
+
+error: Currently, a function-typed parameter to an inline function must be a literal lambda expression
+   ┌─ tests/checking/inlining/lambda_param_typed.move:11:16
+   │
+11 │     inline_apply4(f, b)
+   │                   ^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_param_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_param_typed.move
new file mode 100644
index 0000000000000..98e5b59e65ddb
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_param_typed.move
@@ -0,0 +1,31 @@
+module 0x42::LambdaParam {
+    public inline fun inline_apply(f: |u64|u64, b: u64) : u64 {
+	f(b)
+    }
+
+    public inline fun inline_apply2(f: |u64|u64, b: u64) : u64 {
+	inline_apply(f, b)
+    }
+
+    public inline fun inline_apply3(f: |u64|u64, b: u64) : u64 {
+	inline_apply4(f, b)
+    }
+
+    public inline fun inline_apply4(_f: |u64|u64, b: u64) : u64 {
+	b
+    }
+
+    fun test_lambda_symbol_param1() {
+	let a = inline_apply2(|x: u64| x, 3);
+	assert!(a == 3, 0);
+    }
+
+    fun test_lambda_symbol_param2() {
+	let a = inline_apply2(|x: u64| x, 3);
+	assert!(a == 3, 0);
+	let b = inline_apply(|x: u64| x, 3);
+	assert!(b == 3, 0);
+	let b = inline_apply3(|x: u64| x, 3);
+	assert!(b == 3, 0);
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_return_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_return_typed.exp
new file mode 100644
index 0000000000000..f52bf7c3477ba
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_return_typed.exp
@@ -0,0 +1,7 @@
+
+Diagnostics:
+error: Return not currently supported in inline functions
+  ┌─ tests/checking/inlining/lambda_return_typed.move:3:2
+  │
+3 │     return f(b)
+  │     ^^^^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_return_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_return_typed.move
new file mode 100644
index 0000000000000..1ea4d58270306
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_return_typed.move
@@ -0,0 +1,10 @@
+module 0x42::LambdaReturn {
+    public inline fun inline_apply2(f: |u64|u64, b: u64) : u64 {
+	return f(b)
+    }
+
+    fun test_lambda_symbol_param() {
+	let a = inline_apply2(|x: u64| { x }, 3);
+	assert!(a == 3, 0);
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.exp
new file mode 100644
index 0000000000000..11a8de528f5cb
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.exp
@@ -0,0 +1,98 @@
+// -- Model dump before bytecode pipeline
+module 0x42::LambdaTest1 {
+    public inline fun inline_apply(f: |u64|u64,b: u64): u64 {
+        (f)(b)
+    }
+    public inline fun inline_apply1(f: |u64|u64,b: u64): u64 {
+        {
+          let (a: u64, b: u64): (u64, u64) = Tuple(Add((f)(b), 1), 12);
+          Mul(a, 12)
+        }
+    }
+    public inline fun inline_mul(a: u64,b: u64): u64 {
+        Mul(a, b)
+    }
+} // end 0x42::LambdaTest1
+module 0x42::LambdaTest2 {
+    use 0x42::LambdaTest1; // resolved as: 0x42::LambdaTest1
+    use std::vector;
+    public inline fun foreach(v: &vector<#0>,action: |�|) {
+        {
+          let i: u64 = 0;
+          loop {
+            if Lt(i, vector::length(v)) {
+              (action)(vector::borrow(v, i));
+              i: u64 = Add(i, 1);
+              Tuple()
+            } else {
+              break
+            }
+          }
+        }
+    }
+    public inline fun inline_apply2(g: |u64|u64,c: u64): u64 {
+        Add({
+          let (b: u64): (u64) = Tuple((g)({
+            let (a: u64, b: u64): (u64, u64) = Tuple(c, 3);
+            Mul(a, 3)
+          }));
+          {
+            let (a: u64, b: u64): (u64, u64) = Tuple(Add({
+              let (z: u64): (u64) = Tuple(b);
+              z
+            }, 1), 12);
+            Mul(a, 12)
+          }
+        }, 2)
+    }
+    public inline fun inline_apply3(g: |u64|u64,c: u64): u64 {
+        Add(LambdaTest1::inline_apply1(g, LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x: u64| LambdaTest1::inline_apply(|y: u64| y, x), 3))), 4)
+    }
+    public fun test_inline_lambda() {
+        {
+          let product: u64 = 1;
+          {
+            let (v: &vector): (&vector) = Tuple(Borrow(Immutable)([Number(1), Number(2), Number(3)]));
+            {
+              let i: u64 = 0;
+              loop {
+                if Lt(i, vector::length(v)) {
+                  {
+                    let (e: &u64): (&u64) = Tuple(vector::borrow(v, i));
+                    product: u64 = {
+                      let (a: u64, b: u64): (u64, u64) = Tuple(product, Deref(e));
+                      Mul(a, b)
+                    }
+                  };
+                  i: u64 = Add(i, 1);
+                  Tuple()
+                } else {
+                  break
+                }
+              }
+            }
+          };
+          Tuple()
+        }
+    }
+} // end 0x42::LambdaTest2
+module 0x42::LambdaTest {
+    use 0x42::LambdaTest2; // resolved as: 0x42::LambdaTest2
+    public inline fun inline_apply(f: |u64|u64,b: u64): u64 {
+        (f)(b)
+    }
+    public inline fun inline_apply_test(): u64 {
+        1120
+    }
+    private fun test_lambda() {
+        if false {
+          Tuple()
+        } else {
+          Abort(0)
+        };
+        Tuple()
+    }
+} // end 0x42::LambdaTest
+
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.move
new file mode 100644
index 0000000000000..e690fc4ffec92
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/lambda_typed.move
@@ -0,0 +1,62 @@
+module 0x42::LambdaTest1 {
+    public inline fun inline_mul(a: u64, b: u64): u64 {
+	a * b
+    }
+
+    public inline fun inline_apply1(f: |u64|u64, b: u64) : u64 {
+	inline_mul(f(b) + 1, inline_mul(3, 4))
+    }
+
+    public inline fun inline_apply(f: |u64|u64, b: u64) : u64 {
+	f(b)
+    }
+}
+
+module 0x42::LambdaTest2 {
+    use 0x42::LambdaTest1;
+    use std::vector;
+
+    public inline fun foreach(v: &vector, action: |&T|) { // expected to be not implemented
+        let i = 0;
+        while (i < vector::length(v)) {
+            action(vector::borrow(v, i));
+            i = i + 1;
+        }
+    }
+
+    public fun test_inline_lambda() {
+	let v = vector[1, 2, 3];
+	let product = 1;
+	foreach(&v, |e: &u64| product = LambdaTest1::inline_mul(product, *e));
+    }
+
+    public inline fun inline_apply2(g: |u64|u64, c: u64) : u64 {
+	LambdaTest1::inline_apply1(|z: u64|z, g(LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x: u64|x, 3)))) + 2
+    }
+
+    public inline fun inline_apply3(g: |u64|u64, c: u64) : u64 {
+	LambdaTest1::inline_apply1(g,
+	    LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x:u64| {
+		LambdaTest1::inline_apply(|y: u64|y, x)
+	    },
+		3))) + 4
+    }
+}
+
+module 0x42::LambdaTest {
+    use 0x42::LambdaTest2;
+
+    public inline fun inline_apply(f: |u64|u64, b: u64) : u64 {
+	f(b)
+    }
+
+    public inline fun inline_apply_test() : u64 {
+	LambdaTest2::inline_apply2(|x: u64| x + 1, 3) +
+	LambdaTest2::inline_apply2(|x: u64| x * x, inline_apply(|y: u64|y, 3))
+    }
+
+    fun test_lambda() {
+	let a = inline_apply_test();
+	assert!(a == 1, 0);
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/non_lambda_arg.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/non_lambda_arg.exp
index aa83fbc21a0bd..88cfe01e12e08 100644
--- a/third_party/move/move-compiler-v2/tests/checking/inlining/non_lambda_arg.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/non_lambda_arg.exp
@@ -4,10 +4,10 @@ error: Only inline functions may have function-typed parameters, but non-inline
   ┌─ tests/checking/inlining/non_lambda_arg.move:4:16
   │
 4 │     public fun incorrect_sort(arr: &mut vector, a_less_b: |T, T| bool) {
-  │                ^^^^^^^^^^^^^^                               -------- Parameter `a_less_b` has a function type.
+  │                ^^^^^^^^^^^^^^                               -------- Parameter `a_less_b` has function-valued type `|(T, T)|bool`.
 
 error: Only inline functions may have function-typed parameters, but non-inline function `sort::incorrect_sort_recursive` has a function parameter:
   ┌─ tests/checking/inlining/non_lambda_arg.move:9:16
   │
 9 │     public fun incorrect_sort_recursive(arr: &mut vector, low: u64, high: u64, a_less_b: |T, T| bool) {
-  │                ^^^^^^^^^^^^^^^^^^^^^^^^                                                    -------- Parameter `a_less_b` has a function type.
+  │                ^^^^^^^^^^^^^^^^^^^^^^^^                                                    -------- Parameter `a_less_b` has function-valued type `|(T, T)|bool`.
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp
new file mode 100644
index 0000000000000..cf71f9d1297c0
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp
@@ -0,0 +1,29 @@
+// -- Model dump before bytecode pipeline
+module 0x42::objects {
+    struct ReaderRef {
+        addr: address,
+    }
+    public fun get_addr(ref: &objects::ReaderRef<#0>): address {
+        select objects::ReaderRef.addr<&objects::ReaderRef>(ref)
+    }
+    public inline fun reader(ref: &objects::ReaderRef<#0>): � {
+        BorrowGlobal(Immutable)(objects::get_addr(ref))
+    }
+} // end 0x42::objects
+module 0x42::token {
+    use 0x42::objects as obj; // resolved as: 0x42::objects
+    struct Token {
+        val: u64,
+    }
+    public fun get_value(ref: &objects::ReaderRef): u64
+        acquires token::Token(*)
+     {
+        select token::Token.val<&token::Token>({
+          let (ref: &objects::ReaderRef): (&objects::ReaderRef) = Tuple(ref);
+          BorrowGlobal(Immutable)(objects::get_addr(ref))
+        })
+    }
+} // end 0x42::token
+
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.move b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.move
new file mode 100644
index 0000000000000..37f2720a95b55
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.move
@@ -0,0 +1,24 @@
+module 0x42::objects {
+
+    struct ReaderRef has store {
+        addr: address
+    }
+
+    public fun get_addr(ref: &ReaderRef): address {
+        ref.addr
+    }
+
+    public inline fun reader(ref: &ReaderRef): &T {
+        borrow_global(get_addr(ref))
+    }
+}
+
+module 0x42::token {
+    use 0x42::objects as obj;
+
+    struct Token has key { val: u64 }
+
+    public fun get_value(ref: &obj::ReaderRef): u64 acquires Token {
+        obj::reader(ref).val
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid_noacquires.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid_noacquires.exp
new file mode 100644
index 0000000000000..040117f39fb1f
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid_noacquires.exp
@@ -0,0 +1,12 @@
+
+Diagnostics:
+error: missing acquires annotation for `Token`
+   ┌─ tests/checking/inlining/resources_valid_noacquires.move:21:16
+   │
+12 │         borrow_global(get_addr(ref))
+   │         ------------------------------- acquired here
+   ·
+21 │     public fun get_value(ref: &obj::ReaderRef): u64 {
+   │                ^^^^^^^^^
+22 │         obj::reader(ref).val
+   │         ---------------- from a call inlined at this callsite
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid_noacquires.move b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid_noacquires.move
new file mode 100644
index 0000000000000..895bc3ec90889
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid_noacquires.move
@@ -0,0 +1,24 @@
+module 0x42::objects {
+
+    struct ReaderRef has store {
+        addr: address
+    }
+
+    public fun get_addr(ref: &ReaderRef): address {
+        ref.addr
+    }
+
+    public inline fun reader(ref: &ReaderRef): &T {
+        borrow_global(get_addr(ref))
+    }
+}
+
+module 0x42::token {
+    use 0x42::objects as obj;
+
+    struct Token has key { val: u64 }
+
+    public fun get_value(ref: &obj::ReaderRef): u64 {
+        obj::reader(ref).val
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/return_in_lambda_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/return_in_lambda_typed.exp
new file mode 100644
index 0000000000000..565b1d881cec9
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/return_in_lambda_typed.exp
@@ -0,0 +1,19 @@
+
+Diagnostics:
+error: Return not currently supported in function-typed arguments (lambda expressions)
+   ┌─ tests/checking/inlining/return_in_lambda_typed.move:13:13
+   │
+13 │             return adder(x, y)
+   │             ^^^^^^^^^^^^^^^^^^
+
+error: Return not currently supported in function-typed arguments (lambda expressions)
+   ┌─ tests/checking/inlining/return_in_lambda_typed.move:16:13
+   │
+16 │             return adder(x, y)
+   │             ^^^^^^^^^^^^^^^^^^
+
+error: Return not currently supported in function-typed arguments (lambda expressions)
+   ┌─ tests/checking/inlining/return_in_lambda_typed.move:19:13
+   │
+19 │             return adder(x, y)
+   │             ^^^^^^^^^^^^^^^^^^
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/return_in_lambda_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/return_in_lambda_typed.move
new file mode 100644
index 0000000000000..c59650aec4734
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/return_in_lambda_typed.move
@@ -0,0 +1,22 @@
+module 0x42::Test {
+
+    inline fun apply(f:|u64, u64| u64, x: u64, y: u64): u64 {
+        f(x, y)
+    }
+
+    inline fun adder(x: u64, y: u64): u64 {
+        x + y
+    }
+
+    public fun main(): u64 {
+        apply(|x: u64, y: u64| {
+            return adder(x, y)
+        }, 10, 100);
+        apply(|x: u64, y| {
+            return adder(x, y)
+        }, 10, 100);
+        apply(|x, y: u64| {
+            return adder(x, y)
+        }, 10, 100)
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.exp
new file mode 100644
index 0000000000000..4f7f74661aa59
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.exp
@@ -0,0 +1,51 @@
+
+Diagnostics:
+warning: Unused parameter `z`. Consider removing or prefixing with an underscore: `_z`
+  ┌─ tests/checking/inlining/shadowing_unused_nodecl_typed.move:6:42
+  │
+6 │     public inline fun quux(f:|u64, u64|, z: u64) {
+  │                                          ^
+
+// -- Model dump before bytecode pipeline
+module 0x42::Test {
+    public inline fun foo(f: |(u64, u64)|,z: u64) {
+        {
+          let (z: u64): (u64) = Tuple(z);
+          (f)(3, 5);
+          Tuple()
+        };
+        Tuple()
+    }
+    public inline fun quux(f: |(u64, u64)|,z: u64) {
+        (f)(3, 5);
+        Tuple()
+    }
+    public fun test_shadowing() {
+        {
+          let _x: u64 = 1;
+          _x: u64 = 3;
+          Tuple();
+          Tuple();
+          if Eq(_x, 3) {
+            Tuple()
+          } else {
+            Abort(0)
+          }
+        }
+    }
+    public fun test_shadowing2() {
+        {
+          let _x: u64 = 1;
+          _x: u64 = 3;
+          Tuple();
+          if Eq(_x, 3) {
+            Tuple()
+          } else {
+            Abort(0)
+          }
+        }
+    }
+} // end 0x42::Test
+
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.move
new file mode 100644
index 0000000000000..3191a28a0d3ca
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_nodecl_typed.move
@@ -0,0 +1,37 @@
+//# publish
+module 0x42::Test {
+
+    // Ideally, we would have a warning about unused var "z" here, but
+    // we don't check inlined functions until they are inlined.
+    public inline fun quux(f:|u64, u64|, z: u64) {
+        let x = 3;
+	let q = 5;
+        f(x, q);
+    }
+
+    public inline fun foo(f:|u64, u64|, z: u64) {
+        quux(|a: u64, b: u64| f(a, b), z);
+    }
+
+    public fun test_shadowing() {
+        let _x = 1;
+	let z = 4;
+        foo(|y: u64, _q: u64| {
+            _x = y  // We expect this to assign 3 via foo if renaming works correctly. If not it would
+                    // have the value 1.
+        }, z);
+        assert!(_x == 3, 0)
+    }
+
+    public fun test_shadowing2() {
+        let _x = 1;
+	let z = 4;
+        quux(|y: u64, _q: u64| {
+            _x = y  // We expect this to assign 3 via foo if renaming works correctly. If not it would
+                    // have the value 1.
+        }, z);
+        assert!(_x == 3, 0)
+    }
+}
+
+//# run 0x42::Test::test_shadowing
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.exp
new file mode 100644
index 0000000000000..2c3a1c4b158bd
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.exp
@@ -0,0 +1,43 @@
+// -- Model dump before bytecode pipeline
+module 0x42::Test {
+    public inline fun foo(f: |(u64, u64)|,z: u64) {
+        {
+          let (_z: u64): (u64) = Tuple(z);
+          (f)(3, 5);
+          Tuple()
+        };
+        Tuple()
+    }
+    public inline fun quux(f: |(u64, u64)|,_z: u64) {
+        (f)(3, 5);
+        Tuple()
+    }
+    public fun test_shadowing() {
+        {
+          let _x: u64 = 1;
+          _x: u64 = 3;
+          Tuple();
+          Tuple();
+          if Eq(_x, 3) {
+            Tuple()
+          } else {
+            Abort(0)
+          }
+        }
+    }
+    public fun test_shadowing2() {
+        {
+          let _x: u64 = 1;
+          _x: u64 = 3;
+          Tuple();
+          if Eq(_x, 3) {
+            Tuple()
+          } else {
+            Abort(0)
+          }
+        }
+    }
+} // end 0x42::Test
+
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.move
new file mode 100644
index 0000000000000..2366415033c67
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/shadowing_unused_typed.move
@@ -0,0 +1,35 @@
+//# publish
+module 0x42::Test {
+
+    public inline fun quux(f:|u64, u64|, _z: u64) {
+        let x = 3;
+	let q = 5;
+        f(x, q);
+    }
+
+    public inline fun foo(f:|u64, u64|, z: u64) {
+        quux(|a: u64, b: u64| f(a, b), z);
+    }
+
+    public fun test_shadowing() {
+        let _x = 1;
+	let z = 4;
+        foo(|y: u64, _q: u64| {
+            _x = y  // We expect this to assign 3 via foo if renaming works correctly. If not it would
+                    // have the value 1.
+        }, z);
+        assert!(_x == 3, 0)
+    }
+
+    public fun test_shadowing2() {
+        let _x = 1;
+	let z = 4;
+        quux(|y: u64, _q: u64| {
+            _x = y  // We expect this to assign 3 via foo if renaming works correctly. If not it would
+                    // have the value 1.
+        }, z);
+        assert!(_x == 3, 0)
+    }
+}
+
+//# run 0x42::Test::test_shadowing
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.exp
new file mode 100644
index 0000000000000..f5a5f2de0f028
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.exp
@@ -0,0 +1,60 @@
+// -- Model dump before bytecode pipeline
+module 0x42::Test {
+    private inline fun apply(v: u64,predicate: |u64|bool): bool {
+        spec {
+          assert Ge($t0, 0);
+        }
+        ;
+        (predicate)(v)
+    }
+    public fun test_apply(x: u64) {
+        {
+          let r1: bool = {
+            let (v: u64): (u64) = Tuple(x);
+            spec {
+              assert Ge(v, 0);
+            }
+            ;
+            {
+              let (v: u64): (u64) = Tuple(v);
+              Ge(v, 0)
+            }
+          };
+          spec {
+            assert r1;
+          }
+          ;
+          if r1 {
+            Tuple()
+          } else {
+            Abort(1)
+          };
+          {
+            let r2: bool = {
+              let (v: u64): (u64) = Tuple(x);
+              spec {
+                assert Ge(v, 0);
+              }
+              ;
+              {
+                let (v: u64): (u64) = Tuple(v);
+                Neq(v, 0)
+              }
+            };
+            spec {
+              assert r2;
+            }
+            ;
+            if r2 {
+              Tuple()
+            } else {
+              Abort(2)
+            };
+            Tuple()
+          }
+        }
+    }
+} // end 0x42::Test
+
+
+============ bytecode verification succeeded ========
diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.move b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.move
new file mode 100644
index 0000000000000..060e459a17ef0
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/inlining/spec_inlining_typed.move
@@ -0,0 +1,22 @@
+module 0x42::Test {
+    inline fun apply(v: u64, predicate: |u64| bool): bool {
+        spec {
+            assert v >= 0;
+        };
+        predicate(v)
+    }
+
+    public fun test_apply(x: u64) {
+        let r1 = apply(x, |v: u64| v >= 0);
+        spec {
+            assert r1;
+        };
+        assert!(r1, 1);
+
+        let r2 = apply(x, |v: u64| v != 0);
+        spec {
+            assert r2;
+        };
+        assert!(r2, 2);
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/standalone_module_ident2.exp b/third_party/move/move-compiler-v2/tests/checking/naming/standalone_module_ident2.exp
new file mode 100644
index 0000000000000..568536f81a8d1
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/naming/standalone_module_ident2.exp
@@ -0,0 +1,13 @@
+
+Diagnostics:
+warning: unused alias
+  ┌─ tests/checking/naming/standalone_module_ident2.move:6:14
+  │
+6 │     use 0x2::X;
+  │              ^ Unused 'use' of alias 'X'. Consider removing it
+
+error: undeclared `X`
+  ┌─ tests/checking/naming/standalone_module_ident2.move:8:17
+  │
+8 │         let x = X;
+  │                 ^
diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/standalone_module_ident2.move b/third_party/move/move-compiler-v2/tests/checking/naming/standalone_module_ident2.move
new file mode 100644
index 0000000000000..53e2ed7bb774f
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/naming/standalone_module_ident2.move
@@ -0,0 +1,12 @@
+address 0x2 {
+
+module X {}
+
+module M {
+    use 0x2::X;
+    fun foo() {
+        let x = X;
+    }
+}
+
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp b/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp
index bc74029181400..24c92c36b428b 100644
--- a/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp
@@ -49,16 +49,16 @@ module 0x42::test {
         dummy_field: bool,
     }
     struct S2 {
-        f: test::S3<#1>,
+        f: test::S3,
     }
     struct S3 {
         dummy_field: bool,
     }
     struct S4 {
-        f: vector<#0>,
+        f: vector,
     }
     struct S5 {
-        f: vector<#0>,
-        g: vector<#1>,
+        f: vector,
+        g: vector,
     }
 } // end 0x42::test
diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp b/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp
index d18cbc88a3820..0bed925598e10 100644
--- a/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp
@@ -18,16 +18,16 @@ module 0x42::test {
         dummy_field: bool,
     }
     struct S2 {
-        f: test::S3<#1>,
+        f: test::S3,
     }
     struct S3 {
         dummy_field: bool,
     }
     struct S4 {
-        f: vector<#0>,
+        f: vector,
     }
     struct S5 {
-        f: vector<#0>,
-        g: vector<#1>,
+        f: vector,
+        g: vector,
     }
 } // end 0x42::test
diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp
index 5280e3ddd0a51..456ba4a877dcc 100644
--- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp
@@ -16,9 +16,9 @@ module 0x42::test {
         1: bool,
     }
     struct S3 {
-        0: #1,
+        0: T2,
         1: u8,
-        2: #0,
+        2: T1,
     }
     private fun bar(x: test::S2) {
         select test::S2.0(x);
diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp
index 3271dea2b7566..19444714c6765 100644
--- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp
@@ -7,20 +7,20 @@ module 0x42::test {
         0: u8,
     }
     struct S2 {
-        0: #0,
+        0: T,
         1: u8,
     }
     struct S3 {
-        0: #0,
+        0: T,
         1: u8,
     }
     struct S4 {
         x: u8,
-        y: #0,
+        y: T,
     }
     struct S5 {
-        0: #0,
-        1: test::S3<#0>,
+        0: T,
+        1: test::S3,
     }
     struct S6 {
         dummy_field: bool,
diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp
index c56d7f9c7a5c1..286130d5412c0 100644
--- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp
@@ -19,14 +19,14 @@ module 0x42::test {
         1: bool,
     }
     struct S3 {
-        0: #0,
+        0: T,
         1: u8,
     }
     struct S4 {
         dummy_field: bool,
     }
     struct S5 {
-        x: #0,
+        x: T,
         y: u8,
     }
     private fun S0_inhabited(): test::S0 {
diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp
index 2b5cb1622dfa7..82b91830ecb21 100644
--- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp
@@ -2,7 +2,7 @@
 module 0x42::test {
     enum Bar {
         A {
-            0: #0,
+            0: T,
         }
         B {
             0: u8,
@@ -11,7 +11,7 @@ module 0x42::test {
     }
     enum Foo {
         A {
-            0: #0,
+            0: T,
         }
         B {
             0: u8,
diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp
index 8df2af098de89..701b2269dd3ee 100644
--- a/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp
@@ -39,8 +39,8 @@ module 0x42::n {
 module 0x42::m {
     use 0x42::n::{T}; // resolved as: 0x42::n
     struct G {
-        x: #0,
-        y: #1,
+        x: T,
+        y: R,
     }
     struct S {
         x: u64,
diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp
index b396815647805..045df0a157638 100644
--- a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp
@@ -1,7 +1,7 @@
 // -- Model dump before bytecode pipeline
 module 0x42::m {
     struct S {
-        x: #0,
+        x: T,
     }
     private fun id(self: m::S<#0>): m::S<#0> {
         self
diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp
new file mode 100644
index 0000000000000..045df0a157638
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp
@@ -0,0 +1,47 @@
+// -- Model dump before bytecode pipeline
+module 0x42::m {
+    struct S {
+        x: T,
+    }
+    private fun id(self: m::S<#0>): m::S<#0> {
+        self
+    }
+    private inline fun inlined(f: |m::S<#0>|m::S<#0>,s: m::S<#0>) {
+        (f)(s);
+        Tuple()
+    }
+    private fun receiver(self: m::S<#0>,y: #0) {
+        select m::S.x>(self) = y;
+        Tuple()
+    }
+    private fun receiver_more_generics(self: m::S<#0>,_y: #1) {
+        Tuple()
+    }
+    private fun receiver_needs_type_args(self: m::S<#0>,_y: #0) {
+        Abort(1)
+    }
+    private fun receiver_ref(self: &m::S<#0>,_y: #0) {
+        Tuple()
+    }
+    private fun receiver_ref_mut(self: &mut m::S<#0>,y: #0) {
+        select m::S.x<&mut m::S>(self) = y
+    }
+    private fun test_call_styles(s: m::S,x: u64) {
+        m::receiver(s, x);
+        m::receiver_ref(Borrow(Immutable)(s), x);
+        m::receiver_ref_mut(Borrow(Mutable)(s), x);
+        m::receiver_more_generics(s, 22);
+        m::receiver_needs_type_args(s, x);
+        Tuple()
+    }
+    private fun test_receiver_inference(s: m::S) {
+        {
+          let (s: m::S): (m::S) = Tuple(s);
+          {
+            let (s: m::S): (m::S) = Tuple(s);
+            m::id(s)
+          };
+          Tuple()
+        }
+    }
+} // end 0x42::m
diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.move b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.move
new file mode 100644
index 0000000000000..6b5a48ebc7d2a
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.move
@@ -0,0 +1,49 @@
+module 0x42::m {
+
+    struct S { x: T }
+
+    // Call styles
+
+    fun receiver(self: S, y: T) {
+        self.x = y;
+    }
+
+    fun receiver_ref(self: &S, _y: T) {
+    }
+
+    fun receiver_ref_mut(self: &mut S, y: T) {
+        self.x = y
+    }
+
+    fun receiver_more_generics(self: S, _y: R) {
+    }
+
+    fun receiver_needs_type_args(self: S, _y: T) {
+        abort 1
+    }
+
+    fun test_call_styles(s: S, x: u64) {
+        s.receiver(x);
+        s.receiver_ref(x);
+        s.receiver_ref_mut(x);
+        s.receiver_more_generics(22);
+        s.receiver_needs_type_args::(x);
+    }
+
+    // Inference of receiver function
+
+    inline fun inlined(f: |S|S, s: S) {
+        f(s);
+    }
+
+    fun id(self: S): S {
+        self
+    }
+
+    fun test_receiver_inference(s: S) {
+        // In the lambda the type of `s` is not known when the expression is checked,
+        // and the receiver function `id` is resolved later when the parameter type is unified
+        // with the lambda expression
+        inlined(|s: S| s.id(), s)
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.exp
new file mode 100644
index 0000000000000..b45494f8c2cf6
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.exp
@@ -0,0 +1,37 @@
+// -- Model dump before bytecode pipeline
+module 0x42::b {
+    struct MyOtherList {
+        len: u64,
+    }
+    public fun len(self: &b::MyOtherList): u64 {
+        select b::MyOtherList.len<&b::MyOtherList>(self)
+    }
+} // end 0x42::b
+module 0x42::a {
+    struct MyList {
+        len: u64,
+    }
+    public fun len(self: &a::MyList): u64 {
+        select a::MyList.len<&a::MyList>(self)
+    }
+} // end 0x42::a
+module 0x42::c {
+    use 0x42::a; // resolved as: 0x42::a
+    use 0x42::b; // resolved as: 0x42::b
+    private inline fun foo(f: |(a::MyList, b::MyOtherList)|,x: a::MyList,y: b::MyOtherList) {
+        (f)(x, y)
+    }
+    private fun test(x: a::MyList,y: b::MyOtherList) {
+        {
+          let (x: a::MyList, y: b::MyOtherList): (a::MyList, b::MyOtherList) = Tuple(x, y);
+          {
+            let (x: a::MyList, y: b::MyOtherList): (a::MyList, b::MyOtherList) = Tuple(x, y);
+            if Eq(Add(a::len(Borrow(Immutable)(x)), b::len(Borrow(Immutable)(y))), 1) {
+              Tuple()
+            } else {
+              Abort(1)
+            }
+          }
+        }
+    }
+} // end 0x42::c
diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.move b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.move
new file mode 100644
index 0000000000000..dc5b73e4e55ca
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/receiver/same_names_typed.move
@@ -0,0 +1,32 @@
+module 0x42::a {
+
+    struct MyList { len: u64 }
+
+    public fun len(self: &MyList): u64 {
+        self.len
+    }
+}
+
+module 0x42::b {
+
+    struct MyOtherList { len: u64 }
+
+    public fun len(self: &MyOtherList): u64 {
+        self.len
+    }
+}
+
+module 0x42::c {
+    use 0x42::a;
+    use 0x42::b;
+
+    inline fun foo(f: |a::MyList, b::MyOtherList|, x: a::MyList, y: b::MyOtherList) {
+        f(x, y)
+    }
+
+    fun test(x: a::MyList, y: b::MyOtherList) {
+        // In the lambda below, the type of x and y is not known when the
+        // expression is checked.
+        foo(|x: a::MyList, y: b::MyOtherList| { assert!(x.len() + y.len() == 1, 1) }, x, y)
+    }
+}
diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp
new file mode 100644
index 0000000000000..e3c750934cc8c
--- /dev/null
+++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp
@@ -0,0 +1,80 @@
+// -- Model dump before bytecode pipeline
+module 0x42::m {
+    spec {
+      invariant forall a: address: TypeDomain
(): Implies(exists(a), { + let (x: address): (address) = Tuple(a); + { + let r: bool = { + let (a: address): (address) = Tuple(x); + Lt(select m::S.f({ + let (a: address): (address) = Tuple(a); + global(a) + }), 10) + }; + r + } + }); + } + + struct S { + f: u64, + } + spec { + invariant { + let (x: u64): (u64) = Tuple(select m::S.f()); + { + let r: bool = { + let (x: u64): (u64) = Tuple(x); + Gt(x, 0) + }; + r + } + }; + } + + private inline fun exec(f: |#0|#1,x: #0): #1 { + { + let r: R = (f)(x); + spec { + assert Eq<#1>(r, (f)($t1)); + } + ; + r + } + } + private fun function_code_spec_block(x: u64): u64 { + spec { + assert { + let (x: u64): (u64) = Tuple($t0); + { + let r: bool = { + let (y: u64): (u64) = Tuple(x); + Gt(y, 0) + }; + r + } + }; + } + ; + Add(x, 1) + } + private fun function_spec_block(x: u64): u64 { + Add(x, 1) + } + spec { + ensures Eq(result0(), { + let (x: u64): (u64) = Tuple($t0); + { + let r: num = { + let (x: u64): (u64) = Tuple(x); + Add(x, 1) + }; + r + } + }); + } + + private inline fun get(a: address): � { + BorrowGlobal(Immutable)(a) + } +} // end 0x42::m diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.move b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.move new file mode 100644 index 0000000000000..fcbfc1d52ec19 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.move @@ -0,0 +1,33 @@ +module 0x42::m { + + inline fun exec(f: |T|R, x: T): R { + let r = f(x); + spec { assert r == f(x); }; + r + } + + // Function spec block + fun function_spec_block(x: u64): u64 { + x + 1 + } + spec function_spec_block { + ensures result == exec(|x: u64| x + 1, x); + } + + // Function code spec block + fun function_code_spec_block(x: u64): u64 { + spec { assert exec(|y: u64| y > 0, x); }; + x + 1 + } + + // Struct spec block + struct S has key { f: u64 } + spec S { invariant exec(|x: u64| x > 0, f); } + + // Global invariant + spec module { + invariant forall a: address: + exists(a) ==> exec(|a: address| get(a).f < 10, a); + } + inline fun get(a: address): &R { borrow_global(a) } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp index 3ef30afac08f9..18adeb54b8b68 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp @@ -53,7 +53,7 @@ note: unused schema M::SchemaExp // -- Model dump before bytecode pipeline module 0x42::M { struct S { - x: #0, + x: X, } private fun add(x: u64): u64 { Add(x, 1) diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp index 591fc4fd388df..9212527bc1ea8 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp @@ -4,7 +4,7 @@ module 0x42::M { x: u64, } struct G { - x: #0, + x: T, y: bool, } struct R { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.exp index 86b792a8b5680..d503528ee9b0f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.exp @@ -1,7 +1,7 @@ Diagnostics: -error: the left-hand side has 3 items but the right-hand side provided 4 - ┌─ tests/checking/typing/assign_nested.move:14:9 +error: invalid assignment + ┌─ tests/checking/typing/assign_nested.move:14:19 │ -14 │ (_, x, _) = four(); - │ ^^^^^^^^^ +14 │ (_, x, _, s.f) = four(); + │ ^^^ Invalid assignment syntax. Expected: a local, a field write, or a deconstructing assignment diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.move b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.move index f492d8242081c..29c3340c4b0fe 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.move +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested.move @@ -11,7 +11,7 @@ module 0x8675309::A { let r = 0; let r_ref = &mut r; let s = S { f: 0 }; - (_, x, _) = four(); + (_, x, _, s.f) = four(); } } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.exp new file mode 100644 index 0000000000000..909472ecef030 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.exp @@ -0,0 +1,39 @@ + +Diagnostics: +warning: Unused local variable `r_ref`. Consider removing or prefixing with an underscore: `_r_ref` + ┌─ tests/checking/typing/assign_nested2.move:12:13 + │ +12 │ let r_ref = &mut r; + │ ^^^^^ + +warning: Unused local variable `s`. Consider removing or prefixing with an underscore: `_s` + ┌─ tests/checking/typing/assign_nested2.move:13:13 + │ +13 │ let s = S { f: 0 }; + │ ^ + +// -- Model dump before bytecode pipeline +module 0x8675309::A { + struct S { + f: u64, + } + private fun four(): (u64, u64, u64, u64) { + Tuple(0, 1, 2, 3) + } + public fun mixed() { + { + let x: u64; + { + let r: u64 = 0; + { + let r_ref: &mut u64 = Borrow(Mutable)(r); + { + let s: A::S = pack A::S(0); + (_: u64, x: u64, _: u64, _: u64): (u64, u64, u64, u64) = A::four(); + Tuple() + } + } + } + } + } +} // end 0x8675309::A diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.move b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.move new file mode 100644 index 0000000000000..17445eec24783 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_nested2.move @@ -0,0 +1,17 @@ +module 0x8675309::A { + + struct S has drop { f: u64 } + + fun four(): (u64, u64, u64, u64) { + (0, 1, 2, 3) + } + + public fun mixed() { + let x: u64; + let r = 0; + let r_ref = &mut r; + let s = S { f: 0 }; + (_, x, _, _) = four(); + } + +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references.exp deleted file mode 100644 index 0013af0023a25..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references.exp +++ /dev/null @@ -1,58 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - struct R { - s1: M::S, - s2: M::S, - } - struct S { - f: u64, - } - private fun t0() { - { - let f: u64; - { - let s2: M::S; - M::R{ s1: M::S{ f }, s2 } = pack M::R(pack M::S(0), pack M::S(1)); - f; - s2; - f: u64 = 0; - s2: M::S = pack M::S(0); - f; - s2; - Tuple() - } - } - } - private fun t1() { - { - let f: &u64; - { - let s2: &M::S; - M::R{ s1: M::S{ f }, s2 } = Borrow(Immutable)(pack M::R(pack M::S(0), pack M::S(1))); - f; - s2; - f: &u64 = Borrow(Immutable)(0); - s2: &M::S = Borrow(Immutable)(pack M::S(0)); - f; - s2; - Tuple() - } - } - } - private fun t2() { - { - let f: &mut u64; - { - let s2: &mut M::S; - M::R{ s1: M::S{ f }, s2 } = Borrow(Mutable)(pack M::R(pack M::S(0), pack M::S(1))); - f; - s2; - f: &mut u64 = Borrow(Mutable)(0); - s2: &mut M::S = Borrow(Mutable)(pack M::S(0)); - f; - s2; - Tuple() - } - } - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references.exp b/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references.exp deleted file mode 100644 index 8a20a43e515fb..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references.exp +++ /dev/null @@ -1,46 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - struct R { - s1: M::S, - s2: M::S, - } - struct S { - f: u64, - } - private fun t0() { - { - let M::R{ s1: M::S{ f }, s2 } = pack M::R(pack M::S(0), pack M::S(1)); - f; - s2; - f: u64 = 0; - s2: M::S = pack M::S(0); - f; - s2; - Tuple() - } - } - private fun t1() { - { - let M::R{ s1: M::S{ f }, s2 } = Borrow(Immutable)(pack M::R(pack M::S(0), pack M::S(1))); - f; - s2; - f: &u64 = Borrow(Immutable)(0); - s2: &M::S = Borrow(Immutable)(pack M::S(0)); - f; - s2; - Tuple() - } - } - private fun t2() { - { - let M::R{ s1: M::S{ f }, s2 } = Borrow(Mutable)(pack M::R(pack M::S(0), pack M::S(1))); - f; - s2; - f: &mut u64 = Borrow(Mutable)(0); - s2: &mut M::S = Borrow(Mutable)(pack M::S(0)); - f; - s2; - Tuple() - } - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid2.exp b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid2.exp new file mode 100644 index 0000000000000..7591f6c9994c5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid2.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: cannot adapt `integer` to annotated type `bool` + ┌─ tests/checking/typing/block_with_statements_invalid2.move:4:23 + │ +4 │ ({ let x = 0; x } : bool); + │ ^ + +error: cannot adapt `&_` to annotated type `u64` + ┌─ tests/checking/typing/block_with_statements_invalid2.move:5:23 + │ +5 │ ({ let x = 0; &x } : u64); + │ ^^ + +error: cannot adapt `&mut _` to annotated type `()` + ┌─ tests/checking/typing/block_with_statements_invalid2.move:6:23 + │ +6 │ ({ let y = 0; &mut (y + 1) } : ()); + │ ^^^^^^^^^^^^ + +error: expected 2 items but found 3 + ┌─ tests/checking/typing/block_with_statements_invalid2.move:8:23 + │ +8 │ ({ let x = 0; (x, false, false) } : (u64, bool)); + │ ^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid2.move b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid2.move new file mode 100644 index 0000000000000..eb5ab484dcbb7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid2.move @@ -0,0 +1,10 @@ +module 0x8675309::M { + struct R has drop {} + fun t0() { + ({ let x = 0; x } : bool); + ({ let x = 0; &x } : u64); + ({ let y = 0; &mut (y + 1) } : ()); + ({ let r = { let r = R {}; r }; r } : R); + ({ let x = 0; (x, false, false) } : (u64, bool)); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp_resource.exp b/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp_resource.exp deleted file mode 100644 index 0f0cb380f57f7..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/borrow_local_temp_resource.exp +++ /dev/null @@ -1,14 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - struct R { - dummy_field: bool, - } - struct S { - dummy_field: bool, - } - private fun t0() { - Borrow(Immutable)(pack M::R(false)); - Borrow(Mutable)(pack M::R(false)); - Tuple() - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp index 7352449fc0bf1..a670f268e2b0c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp @@ -23,3 +23,23 @@ module 0x8675309::M { break } } // end 0x8675309::M + + +Diagnostics: +error: missing enclosing loop statement + ┌─ tests/checking/typing/break_outside_loop.move:6:9 + │ +6 │ break + │ ^^^^^ + +error: missing enclosing loop statement + ┌─ tests/checking/typing/break_outside_loop.move:10:9 + │ +10 │ break; + │ ^^^^^ + +error: missing enclosing loop statement + ┌─ tests/checking/typing/break_outside_loop.move:14:21 + │ +14 │ if (x >= 5) break; + │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp index d181cba0ed945..e77ad864b8a12 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/continue_outside_loop.exp @@ -11,3 +11,11 @@ module 0x8675309::M { continue } } // end 0x8675309::M + + +Diagnostics: +error: missing enclosing loop statement + ┌─ tests/checking/typing/continue_outside_loop.move:6:9 + │ +6 │ continue + │ ^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_reference.exp b/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_reference.exp deleted file mode 100644 index 23c269a5f9e30..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_reference.exp +++ /dev/null @@ -1,22 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - struct B { - r: M::R, - } - struct R { - dummy_field: bool, - } - private fun t0(r: &M::R,b: &M::B) { - M::R{ dummy_field: _ } = Deref(r); - M::B{ r: M::R{ dummy_field: _ } } = Deref(b); - M::R{ dummy_field: _ } = Deref(Borrow(Immutable)(select M::B.r<&M::B>(b))); - Tuple() - } - private fun t1(r: &mut M::R,b: &mut M::B) { - M::R{ dummy_field: _ } = Deref(r); - M::B{ r: M::R{ dummy_field: _ } } = Deref(b); - M::R{ dummy_field: _ } = Deref(Borrow(Immutable)(select M::B.r<&mut M::B>(b))); - M::R{ dummy_field: _ } = Deref(Borrow(Mutable)(select M::B.r<&mut M::B>(b))); - Tuple() - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp index e36049a6df034..0d20bff8595b6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct G { - f: #0, + f: T, } struct R { f: u64, diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.exp new file mode 100644 index 0000000000000..c7449303ddf2c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.exp @@ -0,0 +1,18 @@ + +Diagnostics: +warning: Unused parameter `f`. Consider removing or prefixing with an underscore: `_f` + ┌─ tests/checking/typing/eq_inline_typed.move:3:20 + │ +3 │ inline fun foo(f: |&u64|) { + │ ^ + +// -- Model dump before bytecode pipeline +module 0x42::m { + private inline fun foo(f: |&u64|) { + Tuple() + } + private fun g() { + Tuple(); + Tuple() + } +} // end 0x42::m diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.move b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.move new file mode 100644 index 0000000000000..fd6c39261d521 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq_inline_typed.move @@ -0,0 +1,13 @@ +module 0x42::m { + + inline fun foo(f: |&u64|) { + } + + fun g() { + foo(|v: &u64| { + v == &1; + }); + } + + +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp b/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp index 2545066f07559..5bf0a3e5f29ee 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct R { - f: #0, + f: T, } struct S { dummy_field: bool, diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list_resource_drop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/exp_list_resource_drop.exp deleted file mode 100644 index a4df2dd650411..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list_resource_drop.exp +++ /dev/null @@ -1,18 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - struct Box { - f: #0, - } - struct R { - f: #0, - } - struct S { - dummy_field: bool, - } - private fun t0() { - Tuple(0, pack M::S(false), pack M::R(1)); - Tuple(0, pack M::S(false), pack M::Box>(pack M::R(1))); - Tuple(0, pack M::S(false), pack M::Box(Abort(0))); - Tuple() - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp index c3d568872e95c..ebcdc1fcfcfdb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp @@ -48,3 +48,11 @@ error: tuple type `()` is not allowed as a type argument (type was inferred) │ ^ │ = required by instantiating type parameter `T` of function `foreach` + +error: function type `|u64|u64` is not allowed as a field type + ┌─ tests/checking/typing/lambda.move:81:12 + │ +81 │ f: |u64|u64, // expected lambda not allowed + │ ^^^^^^^^ + │ + = required by declaration of field `f` diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda2.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda2.exp new file mode 100644 index 0000000000000..3488e91208849 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda2.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: Only inline functions may have function-typed parameters, but non-inline function `M::fun_arg_lambda_not_allowed` has a function parameter: + ┌─ tests/checking/typing/lambda2.move:84:16 + │ +84 │ public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ - Parameter `x` has function-valued type `|u64|`. + +warning: Unused parameter `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/checking/typing/lambda2.move:84:43 + │ +84 │ public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed + │ ^ + +error: Functions may not return function-typed values, but function `M::macro_result_lambda_not_allowed` return type is `|u64|`: + ┌─ tests/checking/typing/lambda2.move:86:23 + │ +86 │ public inline fun macro_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: Functions may not return function-typed values, but function `M::fun_result_lambda_not_allowed` return type is `|u64|`: + ┌─ tests/checking/typing/lambda2.move:89:16 + │ +89 │ public fun fun_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda2.move b/third_party/move/move-compiler-v2/tests/checking/typing/lambda2.move new file mode 100644 index 0000000000000..5d7cc52daf2ae --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda2.move @@ -0,0 +1,100 @@ +module 0x8675309::M { + // use 0x1::XVector; + + // public inline fun foreach(v: &vector, action: |&T|) { // expected to be not implemented + // let i = 0; + // while (i < XVector::length(v)) { + // action(XVector::borrow(v, i)); + // i = i + 1; + // } + // } + + // public inline fun reduce(v: vector, accu: R, reducer: |T, R|R): R { + // while (!XVector::is_empty(&v)) { + // accu = reducer(XVector::pop_back(&mut v), accu); + // }; + // accu + // } + + + // public fun correct_foreach() { + // let v = vector[1, 2, 3]; + // let sum = 0; + // foreach(&v, |e| sum = sum + *e) // expected to be not implemented + // } + + // public fun correct_reduce(): u64 { + // let v = vector[1, 2, 3]; + // reduce(v, 0, |t, r| t + r) + // } + + // public fun corrected_nested() { + // let v = vector[vector[1,2], vector[3]]; + // let sum = 0; + // foreach(&v, |e| sum = sum + reduce!(*e, 0, |t, r| t + r)); + // } + + // public inline fun wrong_local_call_arg_count(v: &vector, action: |&T|) { + // let i = 0; + // while (i < XVector::length(v)) { + // action(XVector::borrow(v, i), i); // expected to have wrong argument count + // i = i + 1; + // } + // } + + // public inline fun wrong_local_call_arg_type(v: &vector, action: |&T|) { + // let i = 0; + // while (i < XVector::length(v)) { + // action(i); // expected to have wrong argument type + // i = i + 1; + // } + // } + + // public inline fun wrong_local_call_result_type(v: &vector, action: |&T|) { + // let i = 0; + // while (i < XVector::length(v)) { + // i = i + action(XVector::borrow(v, i)); // expected to have wrong result type + // } + // } + + // public fun wrong_local_call_no_fun(x: u64) { + // x(1) // expected to be not a function + // } + + // public fun wrong_lambda_inferred_type() { + // let v = vector[1, 2, 3]; + // let sum = 0; + // foreach(&v, |e| sum = sum + e) // expected to cannot infer type + // } + + // public fun wrong_lambda_result_type() { + // let v = vector[1, 2, 3]; + // let sum = 0; + // foreach(&v, |e| { sum = sum + *e; *e }) // expected to have wrong result type of lambda + // } + + public fun lambda_not_allowed() { + let _x = |i| i + 1; // expected lambda not allowed + } + + // struct FieldFunNotAllowed { + // f: |u64|u64, // expected lambda not allowed + // } + + public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed + + public inline fun macro_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + abort (1) + } + public fun fun_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + abort (1) + } + +} + +// module 0x1::XVector { +// public fun length(v: &vector): u64 { abort(1) } +// public fun is_empty(v: &vector): bool { abort(1) } +// public fun borrow(v: &vector, i: u64): &T { abort(1) } +// public fun pop_back(v: &mut vector): T { abort(1) } +// } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed.exp new file mode 100644 index 0000000000000..7817686444d8f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed.exp @@ -0,0 +1,45 @@ + +Diagnostics: +error: expected `|(&T, u64)|_` but found a value of type `|&T|` + ┌─ tests/checking/typing/lambda_typed.move:40:13 + │ +40 │ action(XVector::borrow(v, i), i); // expected to have wrong argument count + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `|u64|_` but found a value of type `|&T|` + ┌─ tests/checking/typing/lambda_typed.move:48:13 + │ +48 │ action(i); // expected to have wrong argument type + │ ^^^^^^^^^ + +error: cannot use `()` with an operator which expects a value of type `u64` + ┌─ tests/checking/typing/lambda_typed.move:56:21 + │ +56 │ i = i + action(XVector::borrow(v, i)); // expected to have wrong result type + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot return `u64` from a function with result type `|integer|` + ┌─ tests/checking/typing/lambda_typed.move:61:9 + │ +61 │ x(1) // expected to be not a function + │ ^^^^ + +error: cannot use `&u64` with an operator which expects a value of type `integer` + ┌─ tests/checking/typing/lambda_typed.move:67:43 + │ +67 │ foreach(&v, |e: &u64| sum = sum + e) // expected to cannot infer type + │ ^ + +error: cannot pass `|&u64|u64` to a function which expects argument of type `|&u64|` + ┌─ tests/checking/typing/lambda_typed.move:73:21 + │ +73 │ foreach(&v, |e: &u64| { sum = sum + *e; *e }) // expected to have wrong result type of lambda + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: function type `|u64|u64` is not allowed as a field type + ┌─ tests/checking/typing/lambda_typed.move:81:12 + │ +81 │ f: |u64|u64, // expected lambda not allowed + │ ^^^^^^^^ + │ + = required by declaration of field `f` diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed.move b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed.move new file mode 100644 index 0000000000000..391db99ddd587 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed.move @@ -0,0 +1,110 @@ +module 0x8675309::M { + use 0x1::XVector; + + public inline fun foreach(v: &vector, action: |&T|) { // expected to be not implemented + let i = 0; + while (i < XVector::length(v)) { + action(XVector::borrow(v, i)); + i = i + 1; + } + } + + public inline fun reduce(v: vector, accu: R, reducer: |T, R|R): R { + while (!XVector::is_empty(&v)) { + accu = reducer(XVector::pop_back(&mut v), accu); + }; + accu + } + + + public fun correct_foreach() { + let v = vector[1, 2, 3]; + let sum = 0; + foreach(&v, |e: &u64| sum = sum + *e) // expected to be not implemented + } + + public fun correct_reduce(): u64 { + let v = vector[1, 2, 3]; + reduce(v, 0, |t: u64, r: u64| t + r) + } + + public fun corrected_nested() { + let v = vector[vector[1,2], vector[3]]; + let sum = 0; + foreach(&v, |e: &vector| sum = sum + reduce(*e, 0, |t: u64, r: u64| t + r)); + } + + public inline fun wrong_local_call_arg_count(v: &vector, action: |&T|) { + let i = 0; + while (i < XVector::length(v)) { + action(XVector::borrow(v, i), i); // expected to have wrong argument count + i = i + 1; + } + } + + public inline fun wrong_local_call_arg_type(v: &vector, action: |&T|) { + let i = 0; + while (i < XVector::length(v)) { + action(i); // expected to have wrong argument type + i = i + 1; + } + } + + public inline fun wrong_local_call_result_type(v: &vector, action: |&T|) { + let i = 0; + while (i < XVector::length(v)) { + i = i + action(XVector::borrow(v, i)); // expected to have wrong result type + } + } + + public fun wrong_local_call_no_fun(x: u64) { + x(1) // expected to be not a function + } + + public fun wrong_lambda_inferred_type() { + let v = vector[1, 2, 3]; + let sum = 0; + foreach(&v, |e: &u64| sum = sum + e) // expected to cannot infer type + } + + public fun wrong_lambda_result_type() { + let v = vector[1, 2, 3]; + let sum = 0; + foreach(&v, |e: &u64| { sum = sum + *e; *e }) // expected to have wrong result type of lambda + } + + public fun lambda_not_allowed() { + let _x = |i: u64| i + 1; // expected lambda not allowed + } + + struct FieldFunNotAllowed { + f: |u64|u64, // expected lambda not allowed + } + + public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed + + public inline fun macro_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + abort (1) + } + public fun fun_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + abort (1) + } + + public fun correct_reduce2(): u64 { + let v = vector[1, 2, 3]; + reduce(v, 0, |t: u64, r| t + r) + } + + public fun corrected_nested2() { + let v = vector[vector[1,2], vector[3]]; + let sum = 0; + foreach(&v, |e: &vector| sum = sum + reduce(*e, 0, |t, r: u64| t + r)); + } +} + +module 0x1::XVector { + public fun length(v: &vector): u64 { abort(1) } + public fun is_empty(v: &vector): bool { abort(1) } + public fun borrow(v: &vector, i: u64): &T { abort(1) } + public fun pop_back(v: &mut vector): T { abort(1) } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen.exp new file mode 100644 index 0000000000000..28c542fa4b1d4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen.move:38:38 + │ +38 │ let r = use_mut2_ref(&mut v, |x: &mut u64| *x); + │ ^^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen.move:53:38 + │ +53 │ let r = use_mut2_ref(&mut v, |x: &mut u64| *(freeze(x))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen.move:58:37 + │ +58 │ let r = use_imm_ref(&mut v, |x: &mut u64| *x); + │ ^^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen.move:73:37 + │ +73 │ let r = use_imm_ref(&mut v, |x: &mut u64| *(freeze(x))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen.move b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen.move new file mode 100644 index 0000000000000..df50f25e6d39b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen.move @@ -0,0 +1,75 @@ +module 0x8675309::M { + use std::vector; + + public inline fun use_mut_ref(v: &mut vector, action: |&mut T|T): T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun use_mut2_ref(v: &mut vector, action: |&T|T): T { + return action(vector::borrow_mut(v, 0)) + } + + public inline fun use_imm_ref(v: &mut vector, action: |&T|T): T { + return action(vector::borrow(v, 0)) + } + + public fun consume_mut_mut() { + let v = vector[1, 2, 3]; + let r = use_mut_ref(&mut v, |x: &mut u64| *x); + } + + public fun consume_mut_imm() { + let v = vector[1, 2, 3]; + let r = use_mut_ref(&mut v, |x: &u64| *x); + } + + public fun consume_mut_untyped() { + let v = vector[1, 2, 3]; + let r = use_mut_ref(&mut v, |x| *x); + } + + public fun consume_mut_freeze() { + let v = vector[1, 2, 3]; + let r = use_mut_ref(&mut v, |x: &mut u64| *(freeze(x))); + } + + public fun consume_mut2_mut() { + let v = vector[1, 2, 3]; + let r = use_mut2_ref(&mut v, |x: &mut u64| *x); + } + + public fun consume_mut2_imm() { + let v = vector[1, 2, 3]; + let r = use_mut2_ref(&mut v, |x: &u64| *x); + } + + public fun consume_mut2_untyped() { + let v = vector[1, 2, 3]; + let r = use_mut2_ref(&mut v, |x| *x); + } + + public fun consume_mut2_freeze() { + let v = vector[1, 2, 3]; + let r = use_mut2_ref(&mut v, |x: &mut u64| *(freeze(x))); + } + + public fun consume_imm_mut() { + let v = vector[1, 2, 3]; + let r = use_imm_ref(&mut v, |x: &mut u64| *x); + } + + public fun consume_imm_imm() { + let v = vector[1, 2, 3]; + let r = use_imm_ref(&mut v, |x: &u64| *x); + } + + public fun consume_imm_untyped() { + let v = vector[1, 2, 3]; + let r = use_imm_ref(&mut v, |x| *x); + } + + public fun consume_imm_freeze() { + let v = vector[1, 2, 3]; + let r = use_imm_ref(&mut v, |x: &mut u64| *(freeze(x))); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen_result.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen_result.exp new file mode 100644 index 0000000000000..7c5cd89701bbe --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen_result.exp @@ -0,0 +1,49 @@ + +Diagnostics: +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:33:38 + │ +33 │ let r = pass_mut_ref(&mut v, |x: &u64| x); + │ ^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:43:38 + │ +43 │ let r = pass_mut_ref(&mut v, |x: &mut u64| (freeze(x))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:55:39 + │ +55 │ let r = pass_mut2_ref(&mut v, |x: &u64| x); + │ ^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:65:39 + │ +65 │ let r = pass_mut2_ref(&mut v, |x: &mut u64| (freeze(x))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:94:39 + │ +94 │ let r = pass_mut4_ref(&mut v, |x: &mut u64| x); + │ ^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:109:39 + │ +109 │ let r = pass_mut4_ref(&mut v, |x: &mut u64| (freeze(x))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:116:38 + │ +116 │ let r = pass_imm_ref(&mut v, |x: &mut u64| x); + │ ^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_typed_widen_result.move:131:38 + │ +131 │ let r = pass_imm_ref(&mut v, |x: &mut u64| (freeze(x))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen_result.move b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen_result.move new file mode 100644 index 0000000000000..601cab6492a29 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_typed_widen_result.move @@ -0,0 +1,133 @@ +module 0x8675309::M { + use std::vector; + + public inline fun pass_mut_ref(v: &mut vector, action: |&mut T|&mut T): &mut T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_mut2_ref(v: &mut vector, action: |&mut T|&mut T): &T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_mut3_ref(v: &mut vector, action: |&mut T|&T): &T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_mut4_ref(v: &mut vector, action: |&T|&T): &T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_imm_ref(v: &mut vector, action: |&T|&T): &T { + return action(vector::borrow(v, 0)) + } + + // 1 + + public fun consume_mut_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x: &mut u64| x); + } + + public fun consume_mut_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x: &u64| x); + } + + public fun consume_mut_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x| x); + } + + public fun consume_mut_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x: &mut u64| (freeze(x))); + } + + // 2 + + public fun consume_mut2_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x: &mut u64| x); + } + + public fun consume_mut2_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x: &u64| x); + } + + public fun consume_mut2_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x| x); + } + + public fun consume_mut2_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x: &mut u64| (freeze(x))); + } + + // 3 + + public fun consume_mut3_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x: &mut u64| x); + } + + public fun consume_mut3_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x: &u64| x); + } + + public fun consume_mut3_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x| x); + } + + public fun consume_mut3_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x: &mut u64| (freeze(x))); + } + + // 4 + + public fun consume_mut4_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x: &mut u64| x); + } + + public fun consume_mut4_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x: &u64| x); + } + + public fun consume_mut4_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x| x); + } + + public fun consume_mut4_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x: &mut u64| (freeze(x))); + } + + // imm + + public fun consume_imm_mut() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x: &mut u64| x); + } + + public fun consume_imm_imm() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x: &u64| x); + } + + public fun consume_imm_untyped() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x| x); + } + + public fun consume_imm_freeze() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x: &mut u64| (freeze(x))); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen.exp new file mode 100644 index 0000000000000..641f4f0165093 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_widen.move:33:38 + │ +33 │ let r = use_mut2_ref(&mut v, |x| *(freeze(x))); + │ ^^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_widen.move:43:37 + │ +43 │ let r = use_imm_ref(&mut v, |x| *(freeze(x))); + │ ^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen.move b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen.move new file mode 100644 index 0000000000000..748d60f38498c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen.move @@ -0,0 +1,45 @@ +module 0x8675309::M { + use std::vector; + + public inline fun use_mut_ref(v: &mut vector, action: |&mut T|T): T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun use_mut2_ref(v: &mut vector, action: |&T|T): T { + return action(vector::borrow_mut(v, 0)) + } + + public inline fun use_imm_ref(v: &mut vector, action: |&T|T): T { + return action(vector::borrow(v, 0)) + } + + public fun consume_mut_mut() { + let v = vector[1, 2, 3]; + let r = use_mut_ref(&mut v, |x| *x); + } + + public fun consume_mut_freeze() { + let v = vector[1, 2, 3]; + let r = use_mut_ref(&mut v, |x| *(freeze(x))); + } + + public fun consume_mut2_mut() { + let v = vector[1, 2, 3]; + let r = use_mut2_ref(&mut v, |x| *x); + } + + public fun consume_mut2_freeze() { + let v = vector[1, 2, 3]; + let r = use_mut2_ref(&mut v, |x| *(freeze(x))); + } + + public fun consume_imm_mut() { + let v = vector[1, 2, 3]; + let r = use_imm_ref(&mut v, |x| *x); + } + + public fun consume_imm_freeze() { + let v = vector[1, 2, 3]; + let r = use_imm_ref(&mut v, |x| *(freeze(x))); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen_result.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen_result.exp new file mode 100644 index 0000000000000..065dfb4facfde --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen_result.exp @@ -0,0 +1,31 @@ + +Diagnostics: +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_widen_result.move:43:38 + │ +43 │ let r = pass_mut_ref(&mut v, |x| (freeze(x))); + │ ^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_widen_result.move:65:39 + │ +65 │ let r = pass_mut2_ref(&mut v, |x| (freeze(x))); + │ ^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_widen_result.move:109:39 + │ +109 │ let r = pass_mut4_ref(&mut v, |x| (freeze(x))); + │ ^^^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_widen_result.move:126:38 + │ +126 │ let r = pass_imm_ref(&mut v, |x| freeze(x)); + │ ^^^^^^^^^^^^^ + +error: the function takes `&mut` but `&` was provided + ┌─ tests/checking/typing/lambda_widen_result.move:136:38 + │ +136 │ let r = pass_imm_ref(&mut v, |x| (freeze(x))); + │ ^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen_result.move b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen_result.move new file mode 100644 index 0000000000000..f49a5c4a2728e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda_widen_result.move @@ -0,0 +1,138 @@ +module 0x8675309::M { + use std::vector; + + public inline fun pass_mut_ref(v: &mut vector, action: |&mut T|&mut T): &mut T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_mut2_ref(v: &mut vector, action: |&mut T|&mut T): &T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_mut3_ref(v: &mut vector, action: |&mut T|&T): &T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_mut4_ref(v: &mut vector, action: |&T|&T): &T { + action(vector::borrow_mut(v, 0)) + } + + public inline fun pass_imm_ref(v: &mut vector, action: |&T|&T): &T { + return action(vector::borrow(v, 0)) + } + + // 1 + + public fun consume_mut_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x| x); + } + + public fun consume_mut_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x| x); + } + + public fun consume_mut_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x| x); + } + + public fun consume_mut_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut_ref(&mut v, |x| (freeze(x))); + } + + // 2 + + public fun consume_mut2_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x| x); + } + + public fun consume_mut2_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x| x); + } + + public fun consume_mut2_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x| x); + } + + public fun consume_mut2_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut2_ref(&mut v, |x| (freeze(x))); + } + + // 3 + + public fun consume_mut3_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x| x); + } + + public fun consume_mut3_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x| x); + } + + public fun consume_mut3_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x| x); + } + + public fun consume_mut3_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut3_ref(&mut v, |x| (freeze(x))); + } + + // 4 + + public fun consume_mut4_mut() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x| x); + } + + public fun consume_mut4_imm() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x| x); + } + + public fun consume_mut4_untyped() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x| x); + } + + public fun consume_mut4_freeze() { + let v = vector[1, 2, 3]; + let r = pass_mut4_ref(&mut v, |x| (freeze(x))); + } + + // imm + + public fun consume_imm_mut() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x| x); + } + + public fun consume_imm_imm() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x| x); + } + + public fun consume_imm_imm_freeze() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x| freeze(x)); + } + + public fun consume_imm_untyped() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x| x); + } + + public fun consume_imm_freeze() { + let v = vector[1, 2, 3]; + let r = pass_imm_ref(&mut v, |x| (freeze(x))); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp index a729ac9e9d988..3b0b0935d3d28 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x42::M { struct Cup { - f1: #0, + f1: T, } struct R { dummy_field: bool, diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments.exp b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments.exp deleted file mode 100644 index 5b26dfa27bfad..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments.exp +++ /dev/null @@ -1,18 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - private fun foo(_x: #0,_y: #1) { - Tuple() - } - private fun t1() { - M::foo(false, false); - M::foo(0, false); - M::foo(false, 0); - M::foo(0, 0); - Tuple() - } - private fun t2(t: #0,u: #1,v: #2) { - M::foo(t, 0); - M::foo(u, v); - Tuple() - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/mutate_resource.exp b/third_party/move/move-compiler-v2/tests/checking/typing/mutate_resource.exp deleted file mode 100644 index f307869a7753b..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/mutate_resource.exp +++ /dev/null @@ -1,18 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - struct R { - dummy_field: bool, - } - private fun t0(r: &mut M::R) { - r = pack M::R(false); - Tuple() - } - private fun t1(r: &mut #0,x: #0) { - r = x; - Tuple() - } - private fun t2(r: &mut #0,x: #0) { - r = x; - Tuple() - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp index c4c982bba8e20..b2e5e4ab46938 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct G { - f: #0, + f: T, } struct R { f: u64, diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp b/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp index d82dc536aca59..8710d11f47b25 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp @@ -4,11 +4,11 @@ module 0x42::simple_map { use std::option; use std::vector; struct Element { - key: #0, - value: #1, + key: Key, + value: Value, } struct SimpleMap { - data: vector>, + data: vector>, } public fun borrow(map: &simple_map::SimpleMap<#0, #1>,key: �):  { { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/number_literal_too_large_256.exp b/third_party/move/move-compiler-v2/tests/checking/typing/number_literal_too_large_256.exp new file mode 100644 index 0000000000000..31e9d0f17ae75 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/number_literal_too_large_256.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid number literal + ┌─ tests/checking/typing/number_literal_too_large_256.move:3:9 + │ +3 │ 115792089237316195423570985008687907853269984665640564039457584007913129639936; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid number literal. The given literal is too large to fit into the largest possible integer type, 'u256' diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/number_literal_too_large_256.move b/third_party/move/move-compiler-v2/tests/checking/typing/number_literal_too_large_256.move new file mode 100644 index 0000000000000..b47442a99f52d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/number_literal_too_large_256.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + fun foo() { + 115792089237316195423570985008687907853269984665640564039457584007913129639936; + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/pack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/pack.exp deleted file mode 100644 index ce3eca24ab5c2..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/pack.exp +++ /dev/null @@ -1,49 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x8675309::M { - struct Nat { - f: #0, - } - struct R { - s: M::S, - f: u64, - n1: M::Nat, - n2: M::Nat, - } - struct S { - f: u64, - } - private fun t0() { - pack M::S(0); - { - let s: M::S = pack M::S(0); - M::R{ s: _, f: _, n1: _, n2: _ } = { - let $s: M::S = pack M::S(0); - { - let $n2: M::Nat = pack M::Nat(s); - { - let $n1: M::Nat = pack M::Nat(0); - pack M::R($s, 0, $n1, $n2) - } - } - }; - { - let s: M::S = pack M::S(0); - { - let n1: M::Nat = pack M::Nat(0); - { - let n2: M::Nat = pack M::Nat(Deref(Borrow(Immutable)(s))); - M::R{ s: _, f: _, n1: _, n2: _ } = { - let $s: M::S = s; - { - let $n2: M::Nat = n2; - pack M::R($s, 0, n1, $n2) - } - }; - pack M::Nat>>(pack M::Nat>(pack M::Nat(pack M::S(0)))); - Tuple() - } - } - } - } - } -} // end 0x8675309::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp b/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp index 4e1a345132678..7002b18f808e9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp @@ -4,17 +4,17 @@ module 0x42::M1 { a: u64, } struct S2 { - a: M1::S1<#0>, - b: vector>, + a: M1::S1, + b: vector>, } struct S3 { - a: #1, - b: #3, + a: T2, + b: T4, } struct S4 { a: u64, } struct S5 { - a: M1::S4<#0>, + a: M1::S4, } } // end 0x42::M1 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.exp b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.exp new file mode 100644 index 0000000000000..15c7a926284f4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.exp @@ -0,0 +1,9 @@ +// -- Model dump before bytecode pipeline +module 0x42::M { + public fun get_x(): u64 { + false + } + public fun get_y(): u64 { + false + } +} // end 0x42::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.move b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.move new file mode 100644 index 0000000000000..bf342fcfa6282 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.move @@ -0,0 +1,15 @@ +address 0x42 { +module M { + const X: u64 = Y; + const Y: u64 = X; + const Z: u64 = 0; + + public fun get_x(): u64 { + X + } + + public fun get_y(): u64 { + Y + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp index 0d0ae4c52ac2e..c006b28884c9f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp @@ -1,8 +1,8 @@ // -- Model dump before bytecode pipeline module 0x42::M { struct Box { - f1: #0, - f2: #0, + f1: T, + f2: T, } private fun t0() { { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp index 63252d1509136..0c41fd90aff73 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp @@ -1,8 +1,8 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct Box { - f1: #0, - f2: #0, + f1: T, + f2: T, } private fun new(): M::Box<#0> { Abort(0) diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp index 141500cd03452..d638034ca2547 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp @@ -1,8 +1,8 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct Box { - f1: #0, - f2: #0, + f1: T, + f2: T, } private fun new(): M::Box<#0> { Abort(0) diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp index 00bbfae97d9e5..0369a3da12beb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x2::Container { struct T { - f: #0, + f: V, } public fun get(_self: &Container::T<#0>): #0 { Abort(0) @@ -16,8 +16,8 @@ module 0x2::Container { module 0x2::M { use 0x2::Container; // resolved as: 0x2::Container struct Box { - f1: #0, - f2: #0, + f1: T, + f2: T, } private fun t0(): M::Box { { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack.exp deleted file mode 100644 index 867745d67f570..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack.exp +++ /dev/null @@ -1,46 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x2::Container { - struct T { - f: #0, - } - public fun get(_self: &Container::T<#0>): #0 { - Abort(0) - } - public fun new(): Container::T<#0> { - Abort(0) - } - public fun put(_self: &mut Container::T<#0>,_item: #0) { - Abort(0) - } -} // end 0x2::Container -module 0x2::M { - use 0x2::Container; // resolved as: 0x2::Container - struct Box { - f1: #0, - f2: #0, - } - private fun new(): M::Box<#0> { - Abort(0) - } - private fun t0(): u64 { - { - let v: Container::T> = Container::new>(); - { - let M::Box{ f1, f2 } = Container::get>(Borrow(Immutable)(v)); - f2; - Container::put>(Borrow(Mutable)(v), pack M::Box(0, 0)); - f1 - } - } - } - private fun t1(): M::Box> { - { - let v: Container::T>>> = Container::new>>>(); - { - let M::Box>>{ f1, f2 } = Container::get>>>(Borrow(Immutable)(v)); - Container::put>>>(Borrow(Mutable)(v), pack M::Box>>(Deref(Borrow(Immutable)(f1)), f2)); - f1 - } - } - } -} // end 0x2::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign.exp deleted file mode 100644 index 0638a9144b677..0000000000000 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign.exp +++ /dev/null @@ -1,54 +0,0 @@ -// -- Model dump before bytecode pipeline -module 0x2::Container { - struct T { - f: #0, - } - public fun get(_self: &Container::T<#0>): #0 { - Abort(0) - } - public fun new(): Container::T<#0> { - Abort(0) - } - public fun put(_self: &mut Container::T<#0>,_item: #0) { - Abort(0) - } -} // end 0x2::Container -module 0x2::M { - use 0x2::Container; // resolved as: 0x2::Container - struct Box { - f1: #0, - f2: #0, - } - private fun new(): M::Box<#0> { - Abort(0) - } - private fun t0(): u64 { - { - let v: Container::T> = Container::new>(); - { - let f1: u64; - { - let f2: u64; - M::Box{ f1, f2 } = Container::get>(Borrow(Immutable)(v)); - f2; - Container::put>(Borrow(Mutable)(v), pack M::Box(0, 0)); - f1 - } - } - } - } - private fun t1(): M::Box> { - { - let v: Container::T>>> = Container::new>>>(); - { - let f1: M::Box>; - { - let f2: M::Box>; - M::Box>>{ f1, f2 } = Container::get>>>(Borrow(Immutable)(v)); - Container::put>>>(Borrow(Mutable)(v), pack M::Box>>(Deref(Borrow(Immutable)(f1)), f2)); - f1 - } - } - } - } -} // end 0x2::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.exp b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.exp new file mode 100644 index 0000000000000..ca98b47e485f2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.exp @@ -0,0 +1,26 @@ + +Diagnostics: +warning: Unused anonymous function parameter `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/checking/typing/unused_lambda_param_typed.move:7:18 + │ +7 │ test(0, |x: u64| 1); + │ ^ + +// -- Model dump before bytecode pipeline +module 0xc0ffee::m { + private inline fun test(p: u64,f: |u64|u64): u64 { + (f)(p) + } + private fun unused_lambda() { + 1; + Tuple() + } + private fun unused_lambda_suppressed1() { + 1; + Tuple() + } + private fun unused_lambda_suppressed2() { + 1; + Tuple() + } +} // end 0xc0ffee::m diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.move b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.move new file mode 100644 index 0000000000000..eb82be0c92b67 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unused_lambda_param_typed.move @@ -0,0 +1,17 @@ +module 0xc0ffee::m { + inline fun test(p: u64, f: |u64| u64): u64 { + f(p) + } + + fun unused_lambda() { + test(0, |x: u64| 1); + } + + fun unused_lambda_suppressed1() { + test(0, |_x: u64| 1); + } + + fun unused_lambda_suppressed2() { + test(0, |_: u64| 1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp index afd5f2f73d767..f02b528d31840 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp @@ -19,7 +19,7 @@ warning: unused type parameter // -- Model dump before bytecode pipeline module 0x2::Token { struct Coin { - type: #0, + type: AssetType, value: u64, } public fun create(type: #0,value: u64): Token::Coin<#0> { @@ -91,7 +91,7 @@ module 0x3::OneToOneMarket { record: Map::T, } struct Pool { - coin: Token::Coin<#0>, + coin: Token::Coin, } struct Price { price: u64, diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp index b2f8b5a64657b..454ba0a69976f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x2::Token { struct Coin { - type: #0, + type: AssetType, value: u64, } public fun create(type: #0,value: u64): Token::Coin<#0> { @@ -93,7 +93,7 @@ module 0xb055::OneToOneMarket { record: u64, } struct Pool { - coin: Token::Coin<#0>, + coin: Token::Coin, } struct Price { price: u64, diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp index 1365da99cef53..3dd980bb022e7 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_constants.exp @@ -45,3 +45,13 @@ module 0x815::m { } } // end 0x815::m + + +Diagnostics: +error: match not exhaustive + ┌─ tests/checking/variants/variants_constants.move:29:16 + │ +29 │ match (c) { Red => abort 1, Blue => abort 2 } // no error + │ ^ + │ + = missing `Color::RGB{..}` diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp index 2662bcbd649a7..75510f9e49735 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp @@ -11,7 +11,7 @@ module 0x815::m { } enum Generic { Foo { - 0: #0, + 0: T, } Bar { 0: u64, diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp index 2662bcbd649a7..75510f9e49735 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp @@ -11,7 +11,7 @@ module 0x815::m { } enum Generic { Foo { - 0: #0, + 0: T, } Bar { 0: u64, diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp index 079ed8439d493..cade5cdd10043 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { struct S { - f: #0, + f: T, } private fun f() { M::g>() diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp index 01e7a4ee24a6a..f0995c038ecd2 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp @@ -1,7 +1,7 @@ // -- Model dump before bytecode pipeline module 0x42::M { struct Box { - f: #0, + f: T, } public fun t0() { M::t1(); diff --git a/third_party/move/move-compiler-v2/tests/deprecated/assert_function.exp b/third_party/move/move-compiler-v2/tests/deprecated/assert_function.exp new file mode 100644 index 0000000000000..d7fa408decb50 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/deprecated/assert_function.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: no function named `assert` found + ┌─ tests/deprecated/assert_function.move:3:9 + │ +3 │ assert(true, 42); + │ ^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/deprecated/assert_function.move b/third_party/move/move-compiler-v2/tests/deprecated/assert_function.move new file mode 100644 index 0000000000000..e961bc01e62cd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/deprecated/assert_function.move @@ -0,0 +1,5 @@ +script { + fun main() { + assert(true, 42); + } +} diff --git a/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_basecase.exp b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_basecase.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_basecase.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_basecase.move b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_basecase.move new file mode 100644 index 0000000000000..3c3081c7870ce --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_basecase.move @@ -0,0 +1,33 @@ +address 0x42 { +module M { + use 0x41::N; + + struct S {} + + const C: u64 = 0; + + public fun foo(): N::S { let _foo = C + 3; N::bar() } + + spec foo {} +} +} + +module 0x41::N { + struct S has drop { } + + public fun bar(): S { S { } } + + public fun consume(_x: S) { } +} + +script { + use 0x42::M; + use 0x41::N::S; + + fun main() { + let foo: S = M::foo(); + 0x41::N::consume(foo); + } + + spec main { } +} diff --git a/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.exp b/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.exp new file mode 100644 index 0000000000000..efb4cdee84f64 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.exp @@ -0,0 +1,64 @@ + +============ disassembled file-format ================== +// Move bytecode v7 +module 42.m { +use 0000000000000000000000000000000000000000000000000000000000000001::vector; + + +struct E has copy, drop, store { + key: Ty0 +} +struct Option has copy, drop, store { + vec: vector +} + +public destroy_none(Arg0: Option) /* def_idx: 0 */ { +B0: + 0: ImmBorrowLoc[0](Arg0: Option) + 1: Call is_none(&Option): bool + 2: BrFalse(4) +B1: + 3: Branch(6) +B2: + 4: LdU64(262144) + 5: Abort +B3: + 6: MoveLoc[0](Arg0: Option) + 7: UnpackGeneric[0](Option) + 8: VecUnpack(2, 0) + 9: Ret +} +public foo(Arg0: E, Arg1: &mut Ty0) /* def_idx: 1 */ { +L2: loc0: E +L3: loc1: Ty0 +L4: loc2: E +L5: loc3: E +L6: loc4: u64 +B0: + 0: MoveLoc[0](Arg0: E) + 1: StLoc[2](loc0: E) + 2: MoveLoc[2](loc0: E) + 3: UnpackGeneric[1](E) + 4: StLoc[3](loc1: Ty0) + 5: MoveLoc[3](loc1: Ty0) + 6: PackGeneric[1](E) + 7: StLoc[4](loc2: E) + 8: MoveLoc[4](loc2: E) + 9: StLoc[5](loc3: E) + 10: MoveLoc[5](loc3: E) + 11: UnpackGeneric[1](E) + 12: LdU64(3) + 13: StLoc[6](loc4: u64) + 14: MoveLoc[1](Arg1: &mut Ty0) + 15: WriteRef + 16: Ret +} +public is_none(Arg0: &Option): bool /* def_idx: 2 */ { +B0: + 0: MoveLoc[0](Arg0: &Option) + 1: ImmBorrowFieldGeneric[0](Option.vec: vector) + 2: Call vector::is_empty(&vector): bool + 3: Ret +} +} +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.move b/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.move new file mode 100644 index 0000000000000..a38d3de9db2a4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.move @@ -0,0 +1,42 @@ +module 0x42::m { + use std::vector; + + struct Option has copy, drop, store { + vec: vector + } + + public fun is_none(t: &Option): bool { + vector::is_empty(&t.vec) + } + + public fun destroy_none(t: Option) { + assert!(is_none(&t), 0x40000); + let Option { vec } = t; + vector::destroy_empty(vec) + } + + struct E has copy, drop, store { + key: Key, + } + + public inline fun h(x: E, v: |Key| E): E { + let E { key } = x; + v(key) + } + + public inline fun g(x: E, v: |E|) { + v(x) + } + + public fun foo( + data: E, v: &mut Key) { + let f = h(data, |e: Key| { + E {key: e} + }); + g(f, |e: E| { + let (E { key }, _x) = (e, 3); + *v = key; + }); + } + +} diff --git a/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.opt.exp b/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.opt.exp new file mode 100644 index 0000000000000..046a3069a091c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/file-format-generator/unpack_generic_struct_typed.opt.exp @@ -0,0 +1,47 @@ + +============ disassembled file-format ================== +// Move bytecode v7 +module 42.m { +use 0000000000000000000000000000000000000000000000000000000000000001::vector; + + +struct E has copy, drop, store { + key: Ty0 +} +struct Option has copy, drop, store { + vec: vector +} + +public destroy_none(Arg0: Option) /* def_idx: 0 */ { +B0: + 0: ImmBorrowLoc[0](Arg0: Option) + 1: Call is_none(&Option): bool + 2: BrFalse(7) +B1: + 3: MoveLoc[0](Arg0: Option) + 4: UnpackGeneric[0](Option) + 5: VecUnpack(2, 0) + 6: Ret +B2: + 7: LdU64(262144) + 8: Abort +} +public foo(Arg0: E, Arg1: &mut Ty0) /* def_idx: 1 */ { +B0: + 0: MoveLoc[0](Arg0: E) + 1: UnpackGeneric[1](E) + 2: PackGeneric[1](E) + 3: UnpackGeneric[1](E) + 4: MoveLoc[1](Arg1: &mut Ty0) + 5: WriteRef + 6: Ret +} +public is_none(Arg0: &Option): bool /* def_idx: 2 */ { +B0: + 0: MoveLoc[0](Arg0: &Option) + 1: ImmBorrowFieldGeneric[0](Option.vec: vector) + 2: Call vector::is_empty(&vector): bool + 3: Ret +} +} +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_hexstring.exp b/third_party/move/move-compiler-v2/tests/folding/constants_hexstring.exp new file mode 100644 index 0000000000000..3cd2419cbd2dc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_hexstring.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid hex string + ┌─ tests/folding/constants_hexstring.move:6:29 + │ +6 │ const C12: vector = x"hello"; + │ ^^^^^^^^ Odd number of characters in hex string. Expected 2 hexadecimal digits for each byte + +error: invalid hex string + ┌─ tests/folding/constants_hexstring.move:7:31 + │ +7 │ const C13: vector = x"hello!"; + │ ^ Invalid hexadecimal character: 'h' diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_hexstring.move b/third_party/move/move-compiler-v2/tests/folding/constants_hexstring.move new file mode 100644 index 0000000000000..db5e628e6bac1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_hexstring.move @@ -0,0 +1,9 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C11: vector = x"deadbeef"; + const C12: vector = x"hello"; + const C13: vector = x"hello!"; +} +} diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_quoted_string.exp b/third_party/move/move-compiler-v2/tests/folding/constants_quoted_string.exp new file mode 100644 index 0000000000000..6cffcc2f11976 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_quoted_string.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid byte string + ┌─ tests/folding/constants_quoted_string.move:5:29 + │ +5 │ const C12: vector = ""; + │ ^ String literal must begin with b" (for a byte string) or x" (for a hex string) diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_quoted_string.move b/third_party/move/move-compiler-v2/tests/folding/constants_quoted_string.move new file mode 100644 index 0000000000000..a51de933b4e29 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_quoted_string.move @@ -0,0 +1,8 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C12: vector = ""; + const C13: vector = "foo; +} +} diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_simple.move b/third_party/move/move-compiler-v2/tests/folding/constants_simple.move index dc5e980cf6a65..36ea3929b3d70 100644 --- a/third_party/move/move-compiler-v2/tests/folding/constants_simple.move +++ b/third_party/move/move-compiler-v2/tests/folding/constants_simple.move @@ -11,6 +11,9 @@ module M { const C7: u256 = 4 / 3 + 4 - 1 << 143; const C8: u16 = 123; const C9: u32 = (453 as u32); - + const C10: vector = b""; + const C11: vector = x"deadbeef"; + const C12: vector = b"\"foo\""; + const C13: vector = b"\"\x48"; } } diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_single_quote.exp b/third_party/move/move-compiler-v2/tests/folding/constants_single_quote.exp new file mode 100644 index 0000000000000..7719a8e9f4933 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_single_quote.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid character + ┌─ tests/folding/constants_single_quote.move:4:29 + │ +4 │ const C13: vector = "foo + │ ^ Invalid character: '"'; string literal must begin with `b"` and closing quote `"` must appear on same line diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_single_quote.move b/third_party/move/move-compiler-v2/tests/folding/constants_single_quote.move new file mode 100644 index 0000000000000..5ac99045bd143 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_single_quote.move @@ -0,0 +1,10 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + const C13: vector = "foo + "; + const C14: vector = "bar"; + const C15: vector = b"baz"; + const C16: vector = x"quux"; +} +} diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_string_non_utf8.exp b/third_party/move/move-compiler-v2/tests/folding/constants_string_non_utf8.exp new file mode 100644 index 0000000000000..1f4aa39687e2a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_string_non_utf8.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid character + ┌─ tests/folding/constants_string_non_utf8.move:5:31 + │ +5 │ const C12: vector = b"ÿ"; + │ ^ Invalid character 'ÿ' found when reading file. Only ASCII printable characters, tabs (\t), lf (\n) and crlf (\r\n) are permitted. diff --git a/third_party/move/move-compiler-v2/tests/folding/constants_string_non_utf8.move b/third_party/move/move-compiler-v2/tests/folding/constants_string_non_utf8.move new file mode 100644 index 0000000000000..b1ff20f608048 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/folding/constants_string_non_utf8.move @@ -0,0 +1,7 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C12: vector = b"ÿ"; +} +} diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.exp index 560bf63d49ec9..cd8a217423ba1 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.exp @@ -18,6 +18,206 @@ module 0xcafe::m { } // end 0xcafe::m +// -- Model dump after env processor unused checks: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor type parameter check: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor check recursive struct definition: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor check cyclic type instantiation: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor unused struct params check: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check before inlining: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor inlining: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check after inlining: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor acquires check: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + +// -- Model dump after env processor simplifier: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, |y: u64| Add(y, c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add(x, c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, |x: u64| Add({ + let x: u64 = Add(c, 1); + x + }, x)) + } +} // end 0xcafe::m + + // -- Model dump after env processor lambda-lifting: module 0xcafe::m { private fun map(x: u64,f: |u64|u64): u64 { @@ -45,3 +245,61 @@ module 0xcafe::m { }, x) } } // end 0xcafe::m + + +// -- Model dump after env processor specification checker: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, closure m::no_name_clash$lambda$1(c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, closure m::with_name_clash1$lambda$1(c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, closure m::with_name_clash2$lambda$1(c)) + } + private fun no_name_clash$lambda$1(c: u64,y: u64): u64 { + Add(y, c) + } + private fun with_name_clash1$lambda$1(c: u64,x: u64): u64 { + Add(x, c) + } + private fun with_name_clash2$lambda$1(c: u64,x: u64): u64 { + Add({ + let x: u64 = Add(c, 1); + x + }, x) + } +} // end 0xcafe::m + + +// -- Model dump after env processor specification rewriter: +module 0xcafe::m { + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun no_name_clash(x: u64,c: u64): u64 { + m::map(x, closure m::no_name_clash$lambda$1(c)) + } + private fun with_name_clash1(x: u64,c: u64): u64 { + m::map(x, closure m::with_name_clash1$lambda$1(c)) + } + private fun with_name_clash2(x: u64,c: u64): u64 { + m::map(x, closure m::with_name_clash2$lambda$1(c)) + } + private fun no_name_clash$lambda$1(c: u64,y: u64): u64 { + Add(y, c) + } + private fun with_name_clash1$lambda$1(c: u64,x: u64): u64 { + Add(x, c) + } + private fun with_name_clash2$lambda$1(c: u64,x: u64): u64 { + Add({ + let x: u64 = Add(c, 1); + x + }, x) + } +} // end 0xcafe::m diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.exp index 9b00da4dfeba8..3664bd2e163bb 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.exp @@ -44,6 +44,463 @@ module 0xcafe::m { } // end 0xcafe::m +// -- Model dump after env processor unused checks: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor type parameter check: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor check recursive struct definition: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor check cyclic type instantiation: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor unused struct params check: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check before inlining: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor inlining: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check after inlining: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor acquires check: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(z); + Add(y, Deref(r)) + }) + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor simplifier: +module 0xcafe::m { + struct S { + x: u64, + } + private fun map(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun assigns_local(x: u64,c: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| z: u64 = 2; + Add(y, c)) + } + } + private fun assigns_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| x: u64 = 2; + Add(y, c)) + } + private fun borrows_local(x: u64): u64 { + { + let z: u64 = 1; + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(z); + Add(y, Deref(r)) + }) + } + } + private fun borrows_param(x: u64,c: u64): u64 { + m::map(x, |y: u64| { + let r: &mut u64 = Borrow(Mutable)(c); + Add(y, Deref(r)) + }) + } + private fun immutable_borrow_ok(x: u64): u64 { + m::map(x, |y: u64| { + let r: &u64 = Borrow(Immutable)(1); + Add(y, Deref(r)) + }) + } +} // end 0xcafe::m + + Diagnostics: error: captured variable `x` cannot be modified inside of a lambda diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.exp index 9ddfd3b736119..6da5f81560227 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.exp @@ -12,6 +12,146 @@ module 0xcafe::m { } // end 0xcafe::m +// -- Model dump after env processor unused checks: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor type parameter check: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor check recursive struct definition: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor check cyclic type instantiation: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor unused struct params check: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check before inlining: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor inlining: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check after inlining: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor acquires check: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor simplifier: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, |y: u64| Cast(m::map2(Cast(Sub(y, c)), |y: u8| Add(y, Cast(c))))) + } +} // end 0xcafe::m + + // -- Model dump after env processor lambda-lifting: module 0xcafe::m { private fun map1(x: u64,f: |u64|u64): u64 { @@ -30,3 +170,43 @@ module 0xcafe::m { Cast(m::map2(Cast(Sub(y, c)), closure m::nested$lambda$1(c))) } } // end 0xcafe::m + + +// -- Model dump after env processor specification checker: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, closure m::nested$lambda$2(c)) + } + private fun nested$lambda$1(c: u64,y: u8): u8 { + Add(y, Cast(c)) + } + private fun nested$lambda$2(c: u64,y: u64): u64 { + Cast(m::map2(Cast(Sub(y, c)), closure m::nested$lambda$1(c))) + } +} // end 0xcafe::m + + +// -- Model dump after env processor specification rewriter: +module 0xcafe::m { + private fun map1(x: u64,f: |u64|u64): u64 { + (f)(x) + } + private fun map2(x: u8,f: |u8|u8): u8 { + (f)(x) + } + private fun nested(x: u64,c: u64): u64 { + m::map1(x, closure m::nested$lambda$2(c)) + } + private fun nested$lambda$1(c: u64,y: u8): u8 { + Add(y, Cast(c)) + } + private fun nested$lambda$2(c: u64,y: u64): u64 { + Cast(m::map2(Cast(Sub(y, c)), closure m::nested$lambda$1(c))) + } +} // end 0xcafe::m diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp index c61dde92a484d..e62a7f7bcb71e 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp @@ -1,7 +1,177 @@ // -- Model dump before env processor pipeline: module 0xcafe::m { struct S { - x: #0, + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor unused checks: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor type parameter check: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor check recursive struct definition: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor check cyclic type instantiation: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor unused struct params check: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check before inlining: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor inlining: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor access and use check after inlining: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor acquires check: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, |(m::S{ x }, _y: u64): (m::S, u64)| { + let y: u64 = x; + Add(x, y) + }) + } +} // end 0xcafe::m + + +// -- Model dump after env processor simplifier: +module 0xcafe::m { + struct S { + x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { (f)(s, x) @@ -18,7 +188,53 @@ module 0xcafe::m { // -- Model dump after env processor lambda-lifting: module 0xcafe::m { struct S { - x: #0, + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, closure m::pattern$lambda$1()) + } + private fun pattern$lambda$1(param$0: m::S,_y: u64): u64 { + { + let m::S{ x } = param$0; + { + let y: u64 = x; + Add(x, y) + } + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor specification checker: +module 0xcafe::m { + struct S { + x: T, + } + private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { + (f)(s, x) + } + private fun pattern(s: m::S,x: u64): u64 { + m::consume(s, x, closure m::pattern$lambda$1()) + } + private fun pattern$lambda$1(param$0: m::S,_y: u64): u64 { + { + let m::S{ x } = param$0; + { + let y: u64 = x; + Add(x, y) + } + } + } +} // end 0xcafe::m + + +// -- Model dump after env processor specification rewriter: +module 0xcafe::m { + struct S { + x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { (f)(s, x) diff --git a/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_deref_ref_warn.exp b/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_deref_ref_warn.exp index 4c0e855df81b0..218d94dfe989c 100644 --- a/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_deref_ref_warn.exp +++ b/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_deref_ref_warn.exp @@ -129,4 +129,14 @@ warning: [lint] Needless pair of `*` and `&` operators: consider removing them = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_deref_ref)]`. +Diagnostics: +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/model_ast_lints/needless_deref_ref_warn.move:35:15 + │ +35 │ *&mut borrow_global_mut(addr).y + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_ref_in_field_access_warn.exp b/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_ref_in_field_access_warn.exp index b637f3baae6a3..a0d938626a2eb 100644 --- a/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_ref_in_field_access_warn.exp +++ b/third_party/move/move-compiler-v2/tests/lints/model_ast_lints/needless_ref_in_field_access_warn.exp @@ -177,4 +177,38 @@ warning: [lint] Needless `&mut` taken for field access: consider removing `&mut` = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_ref_in_field_access)]`. +Diagnostics: +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/model_ast_lints/needless_ref_in_field_access_warn.move:51:9 + │ +51 │ (&mut make_S()).y.a + (&mut (&mut s).y).a + │ ^^^^^^^^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/model_ast_lints/needless_ref_in_field_access_warn.move:51:37 + │ +51 │ (&mut make_S()).y.a + (&mut (&mut s).y).a + │ ^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/model_ast_lints/needless_ref_in_field_access_warn.move:90:18 + │ +90 │ (&e).0 + (&mut e).0 + │ ^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/model_ast_lints/needless_ref_in_field_access_warn.move:125:18 + │ +125 │ (&s).x + (&mut s).x + │ ^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + + ============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.exp b/third_party/move/move-compiler-v2/tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.exp new file mode 100644 index 0000000000000..6c2805c244b0c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.exp @@ -0,0 +1,150 @@ + +Diagnostics: +warning: [lint] Needless pair of `*` and `&mut` operators: consider removing them + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:200:9 + │ +200 │ *&mut s.x + │ ^^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_deref_ref)]`. + +warning: [lint] Needless pair of `*` and `&mut` operators: consider removing them + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:204:9 + │ +204 │ *&mut s + │ ^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_deref_ref)]`. + +warning: [lint] Needless pair of `*` and `&mut` operators: consider removing them + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:212:9 + │ +212 │ *&mut u + │ ^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_deref_ref)]`. + + +Diagnostics: +warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:175:9 + │ +175 │ x = y; // Produces a cycle in the `derived_edges`. + │ ^^^^^ + + +Diagnostics: +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:14:17 + │ +14 │ let y = &mut x; + │ ^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:24:17 + │ +24 │ let y = &mut x; + │ ^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:41:20 + │ +41 │ fun test3_warn(s: &mut S): u64 { + │ ^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:109:17 + │ +109 │ let r = borrow_global_mut(addr); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:114:17 + │ +114 │ let r = borrow_global_mut(addr); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:119:21 + │ +119 │ fun test_warn_3(s: &mut S, p: bool, addr: address): u64 acquires S { + │ ^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:120:19 + │ +120 │ let ref = borrow_global_mut(addr); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:153:22 + │ +153 │ a = &mut e1.0; + │ ^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:155:22 + │ +155 │ a = &mut e2.0; + │ ^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:160:21 + │ +160 │ fun test_warn_2(a: &mut E, b: &mut E) { + │ ^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:160:32 + │ +160 │ fun test_warn_2(a: &mut E, b: &mut E) { + │ ^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:173:28 + │ +173 │ public fun test_warn_3(x: &mut u64) { + │ ^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:242:17 + │ +242 │ let u = &mut s; + │ ^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + +warning: [lint] Needless mutable reference or borrow: consider using immutable reference or borrow instead + ┌─ tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move:252:17 + │ +252 │ let u = &mut s; + │ ^^^^^^ + │ + = To suppress this warning, annotate the function/module with the attribute `#[lint::skip(needless_mutable_reference)]`. + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move b/third_party/move/move-compiler-v2/tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move new file mode 100644 index 0000000000000..980467bf51f68 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/lints/stackless_bytecode_lints/needless_mutable_reference_warn.move @@ -0,0 +1,255 @@ +module 0xc0ffee::m { + fun consume_mut(x: &mut u64) { + *x = 10; + } + + fun consume_immut(_x: &u64) {} + + fun test1_no_warn(x: u64) { + let y = &mut x; + *y = 10; + } + + fun test1_warn(x: u64): u64 { + let y = &mut x; + *y + } + + fun test2_no_warn(x: u64) { + let y = &mut x; + consume_mut(y); + } + + fun test2_warn(x: u64) { + let y = &mut x; + consume_immut(y); + } + + struct S { + x: u64, + y: U, + } + + struct U { + u: u64, + } + + fun test3_no_warn(s: &mut S) { + s.y.u = 42; + } + + fun test3_warn(s: &mut S): u64 { + s.y.u + } + + fun test4_no_warn(s: &mut S): u64 { + s.y.u = 42; + s.x + } + + fun test5_no_warn(s: &mut S) { + let t = s; + consume_mut(&mut t.y.u); + } + + fun test6_no_warn() { + let x = 1; + let z = 2; + let y = &mut x; + consume_immut(y); + y = &mut z; + *y = 5; + } +} + + +module 0xc0ffee::n { + struct R has key, store { + x: u64 + } + + struct S has key { + r: R + } + + public fun test_no_warn_1(addr: address) acquires R { + let r = borrow_global_mut(addr); + r.x = 5; + } + + public fun test_no_warn_2(addr: address): u64 acquires R { + let r = borrow_global_mut(addr); + let y = &mut r.x; + *y = 5; + *y + } + + public fun test_no_warn_3(addr: address) acquires S { + let s = borrow_global_mut(addr); + let y = &mut s.r; + y.x = 5; + } + + fun helper_mut(r: &mut R) { + r.x = 5; + } + + fun helper_immut(_r: &R) {} + + public fun test_no_warn_4(addr: address, p: bool) acquires R { + let r = borrow_global_mut(addr); + if (p) { + helper_mut(r); + } else { + helper_immut(r); + } + } + + public fun test_warn_1(addr: address) acquires R { + let r = borrow_global_mut(addr); + helper_immut(r); + } + + public fun test_warn_2(addr: address): u64 acquires R { + let r = borrow_global_mut(addr); + let y = r.x; + y + } + + fun test_warn_3(s: &mut S, p: bool, addr: address): u64 acquires S { + let ref = borrow_global_mut(addr); + if (p) { + ref = s; + }; + ref.r.x + } + + fun test_no_warn_5(p: bool, a: address, s: &S): u64 acquires S { + if (p) { + s = borrow_global(a); + }; + let y = &s.r; + y.x + } +} + +module 0xc0ffee::o { + enum E has drop { + A(u64), + B(u64), + } + + fun test_no_warn_1(e1: E, e2: E) { + let a = &mut e1; + let b = &mut a.0; + *b = 5; + b = &mut e2.0; + *b = 1; + } + + fun test_warn_1(e1: E, e2: E, p: bool): u64 { + let a; + if (p) { + a = &mut e1.0; + } else { + a = &mut e2.0; + }; + *a + } + + fun test_warn_2(a: &mut E, b: &mut E) { + let x = 1; + loop { + let temp = a; + a = b; + b = temp; + x = x + 1; + if (x == 10) { + break; + } + } + } + + public fun test_warn_3(x: &mut u64) { + let y = x; + x = y; // Produces a cycle in the `derived_edges`. + } + + public fun test_no_warn_3(x: &mut u64) { + let y = x; + x = y; + *x = 5; + } + + #[lint::skip(needless_mutable_reference)] + fun test_no_warn_4(e1: E, e2: E, p: bool): u64 { + let a; + if (p) { + a = &mut e1.0; + } else { + a = &mut e2.0; + }; + *a + } + + struct S has drop { + x: u64, + } + + fun test_warn_5(s: S): u64 { + *&mut s.x + } + + fun test_no_warn_5(s: S): S { + *&mut s + } + + struct U has copy, drop { + x: u64, + } + + fun test_no_warn_6(u: U): U { + *&mut u + } + + // This should produce a warning once `vector::borrow_mut` is added to origins. + fun test_warn_7(): u64 { + let x = vector[1, 5, 5]; + let y = &mut x[0]; + *y + } +} + +module 0xc0ffee::more_struct_tests { + struct S has copy, drop { + x: u64 + } + + fun consume_mut(s: &mut S) { + s.x = 10; + } + + fun consume_immut(s: &S): u64 { + s.x + } + + fun test1_no_warn(s: S) { + let u = &mut s; + *u = S { x: 10 }; + } + + fun test1_warn(s: S): S { + let u = &mut s; + *u + } + + fun test2_no_warn(s: S) { + let u = &mut s; + consume_mut(u); + } + + fun test2_warn(s: S) { + let u = &mut s; + consume_immut(u); + } +} diff --git a/third_party/move/move-compiler-v2/tests/live-var/mut_inline_typed.exp b/third_party/move/move-compiler-v2/tests/live-var/mut_inline_typed.exp new file mode 100644 index 0000000000000..294f89be7fbf0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/live-var/mut_inline_typed.exp @@ -0,0 +1,291 @@ +============ initial bytecode ================ + +[variant baseline] +fun m::foo(): u64 { + var $t0: u64 + var $t1: vector + var $t2: &mut vector + var $t3: u64 + var $t4: &mut vector + var $t5: u64 + var $t6: u64 + var $t7: &vector + var $t8: bool + var $t9: bool + var $t10: bool + var $t11: &u64 + var $t12: &u64 + var $t13: &vector + var $t14: u64 + var $t15: u64 + var $t16: u64 + var $t17: u64 + var $t18: u64 + var $t19: u64 + var $t20: u64 + var $t21: bool + var $t22: bool + var $t23: &u64 + var $t24: &u64 + var $t25: &vector + var $t26: u64 + var $t27: u64 + var $t28: u64 + var $t29: u64 + var $t30: u64 + var $t31: u64 + var $t32: &u64 + var $t33: &vector + var $t34: u64 + 0: $t1 := ["1", "2", "3"] + 1: $t2 := borrow_local($t1) + 2: $t4 := infer($t2) + 3: $t5 := 0 + 4: $t7 := freeze_ref(implicit)($t4) + 5: $t6 := vector::length($t7) + 6: label L0 + 7: $t8 := <($t5, $t6) + 8: if ($t8) goto 9 else goto 27 + 9: label L2 + 10: $t13 := freeze_ref(implicit)($t4) + 11: $t12 := vector::borrow($t13, $t5) + 12: $t11 := infer($t12) + 13: $t14 := read_ref($t11) + 14: $t15 := 1 + 15: $t10 := >($t14, $t15) + 16: $t9 := !($t10) + 17: if ($t9) goto 18 else goto 21 + 18: label L5 + 19: goto 31 + 20: goto 22 + 21: label L6 + 22: label L7 + 23: $t17 := 1 + 24: $t16 := +($t5, $t17) + 25: $t5 := infer($t16) + 26: goto 29 + 27: label L3 + 28: goto 31 + 29: label L4 + 30: goto 6 + 31: label L1 + 32: $t18 := infer($t5) + 33: $t20 := 1 + 34: $t19 := +($t5, $t20) + 35: $t5 := infer($t19) + 36: label L8 + 37: $t21 := <($t5, $t6) + 38: if ($t21) goto 39 else goto 59 + 39: label L10 + 40: $t25 := freeze_ref(implicit)($t4) + 41: $t24 := vector::borrow($t25, $t5) + 42: $t23 := infer($t24) + 43: $t26 := read_ref($t23) + 44: $t27 := 1 + 45: $t22 := >($t26, $t27) + 46: if ($t22) goto 47 else goto 53 + 47: label L13 + 48: vector::swap($t4, $t18, $t5) + 49: $t29 := 1 + 50: $t28 := +($t18, $t29) + 51: $t18 := infer($t28) + 52: goto 54 + 53: label L14 + 54: label L15 + 55: $t31 := 1 + 56: $t30 := +($t5, $t31) + 57: $t5 := infer($t30) + 58: goto 61 + 59: label L11 + 60: goto 63 + 61: label L12 + 62: goto 36 + 63: label L9 + 64: $t3 := infer($t18) + 65: $t33 := freeze_ref(implicit)($t2) + 66: $t34 := 0 + 67: $t32 := vector::borrow($t33, $t34) + 68: $t0 := read_ref($t32) + 69: return $t0 +} + +============ after LiveVarAnalysisProcessor: ================ + +[variant baseline] +fun m::foo(): u64 { + var $t0: u64 + var $t1: vector + var $t2: &mut vector + var $t3: u64 + var $t4: &mut vector + var $t5: u64 + var $t6: u64 + var $t7: &vector + var $t8: bool + var $t9: bool + var $t10: bool + var $t11: &u64 + var $t12: &u64 + var $t13: &vector + var $t14: u64 + var $t15: u64 + var $t16: u64 + var $t17: u64 + var $t18: u64 + var $t19: u64 + var $t20: u64 + var $t21: bool + var $t22: bool + var $t23: &u64 + var $t24: &u64 + var $t25: &vector + var $t26: u64 + var $t27: u64 + var $t28: u64 + var $t29: u64 + var $t30: u64 + var $t31: u64 + var $t32: &u64 + var $t33: &vector + var $t34: u64 + # live vars: + 0: $t1 := ["1", "2", "3"] + # live vars: $t1 + 1: $t2 := borrow_local($t1) + # live vars: $t2 + 2: $t4 := infer($t2) + # live vars: $t2, $t4 + 3: $t5 := 0 + # live vars: $t2, $t4, $t5 + 4: $t7 := freeze_ref(implicit)($t4) + # live vars: $t2, $t4, $t5, $t7 + 5: $t6 := vector::length($t7) + # live vars: $t2, $t4, $t5, $t6 + 6: label L0 + # live vars: $t2, $t4, $t5, $t6 + 7: $t8 := <($t5, $t6) + # live vars: $t2, $t4, $t5, $t6, $t8 + 8: if ($t8) goto 9 else goto 27 + # live vars: $t2, $t4, $t5, $t6 + 9: label L2 + # live vars: $t2, $t4, $t5, $t6 + 10: $t13 := freeze_ref(implicit)($t4) + # live vars: $t2, $t4, $t5, $t6, $t13 + 11: $t12 := vector::borrow($t13, $t5) + # live vars: $t2, $t4, $t5, $t6, $t12 + 12: $t11 := infer($t12) + # live vars: $t2, $t4, $t5, $t6, $t11 + 13: $t14 := read_ref($t11) + # live vars: $t2, $t4, $t5, $t6, $t14 + 14: $t15 := 1 + # live vars: $t2, $t4, $t5, $t6, $t14, $t15 + 15: $t10 := >($t14, $t15) + # live vars: $t2, $t4, $t5, $t6, $t10 + 16: $t9 := !($t10) + # live vars: $t2, $t4, $t5, $t6, $t9 + 17: if ($t9) goto 18 else goto 21 + # live vars: $t2, $t4, $t5, $t6 + 18: label L5 + # live vars: $t2, $t4, $t5, $t6 + 19: goto 31 + # live vars: $t2, $t4, $t5, $t6 + 20: goto 22 + # live vars: $t2, $t4, $t5, $t6 + 21: label L6 + # live vars: $t2, $t4, $t5, $t6 + 22: label L7 + # live vars: $t2, $t4, $t5, $t6 + 23: $t17 := 1 + # live vars: $t2, $t4, $t5, $t6, $t17 + 24: $t16 := +($t5, $t17) + # live vars: $t2, $t4, $t6, $t16 + 25: $t5 := infer($t16) + # live vars: $t2, $t4, $t5, $t6 + 26: goto 29 + # live vars: $t2, $t4, $t5, $t6 + 27: label L3 + # live vars: $t2, $t4, $t5, $t6 + 28: goto 31 + # live vars: $t2, $t4, $t5, $t6 + 29: label L4 + # live vars: $t2, $t4, $t5, $t6 + 30: goto 6 + # live vars: $t2, $t4, $t5, $t6 + 31: label L1 + # live vars: $t2, $t4, $t5, $t6 + 32: $t18 := infer($t5) + # live vars: $t2, $t4, $t5, $t6, $t18 + 33: $t20 := 1 + # live vars: $t2, $t4, $t5, $t6, $t18, $t20 + 34: $t19 := +($t5, $t20) + # live vars: $t2, $t4, $t6, $t18, $t19 + 35: $t5 := infer($t19) + # live vars: $t2, $t4, $t5, $t6, $t18 + 36: label L8 + # live vars: $t2, $t4, $t5, $t6, $t18 + 37: $t21 := <($t5, $t6) + # live vars: $t2, $t4, $t5, $t6, $t18, $t21 + 38: if ($t21) goto 39 else goto 59 + # live vars: $t2, $t4, $t5, $t6, $t18 + 39: label L10 + # live vars: $t2, $t4, $t5, $t6, $t18 + 40: $t25 := freeze_ref(implicit)($t4) + # live vars: $t2, $t4, $t5, $t6, $t18, $t25 + 41: $t24 := vector::borrow($t25, $t5) + # live vars: $t2, $t4, $t5, $t6, $t18, $t24 + 42: $t23 := infer($t24) + # live vars: $t2, $t4, $t5, $t6, $t18, $t23 + 43: $t26 := read_ref($t23) + # live vars: $t2, $t4, $t5, $t6, $t18, $t26 + 44: $t27 := 1 + # live vars: $t2, $t4, $t5, $t6, $t18, $t26, $t27 + 45: $t22 := >($t26, $t27) + # live vars: $t2, $t4, $t5, $t6, $t18, $t22 + 46: if ($t22) goto 47 else goto 53 + # live vars: $t2, $t4, $t5, $t6, $t18 + 47: label L13 + # live vars: $t2, $t4, $t5, $t6, $t18 + 48: vector::swap($t4, $t18, $t5) + # live vars: $t2, $t4, $t5, $t6, $t18 + 49: $t29 := 1 + # live vars: $t2, $t4, $t5, $t6, $t18, $t29 + 50: $t28 := +($t18, $t29) + # live vars: $t2, $t4, $t5, $t6, $t28 + 51: $t18 := infer($t28) + # live vars: $t2, $t4, $t5, $t6, $t18 + 52: goto 54 + # live vars: $t2, $t4, $t5, $t6, $t18 + 53: label L14 + # live vars: $t2, $t4, $t5, $t6, $t18 + 54: label L15 + # live vars: $t2, $t4, $t5, $t6, $t18 + 55: $t31 := 1 + # live vars: $t2, $t4, $t5, $t6, $t18, $t31 + 56: $t30 := +($t5, $t31) + # live vars: $t2, $t4, $t6, $t18, $t30 + 57: $t5 := infer($t30) + # live vars: $t2, $t4, $t5, $t6, $t18 + 58: goto 61 + # live vars: $t2, $t4, $t5, $t6, $t18 + 59: label L11 + # live vars: $t2, $t18 + 60: goto 63 + # live vars: $t2, $t4, $t5, $t6, $t18 + 61: label L12 + # live vars: $t2, $t4, $t5, $t6, $t18 + 62: goto 36 + # live vars: $t2, $t18 + 63: label L9 + # live vars: $t2, $t18 + 64: $t3 := infer($t18) + # live vars: $t2 + 65: $t33 := freeze_ref(implicit)($t2) + # live vars: $t33 + 66: $t34 := 0 + # live vars: $t33, $t34 + 67: $t32 := vector::borrow($t33, $t34) + # live vars: $t32 + 68: $t0 := read_ref($t32) + # live vars: $t0 + 69: return $t0 +} diff --git a/third_party/move/move-compiler-v2/tests/live-var/mut_inline_typed.move b/third_party/move/move-compiler-v2/tests/live-var/mut_inline_typed.move new file mode 100644 index 0000000000000..89bc2d57d9728 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/live-var/mut_inline_typed.move @@ -0,0 +1,34 @@ +module 0x42::m { + + use 0x1::vector; + + inline fun partition( + v: &mut vector, + pred: |&Element|bool + ): u64 { + let i = 0; + let len = vector::length(v); + while (i < len) { + if (!pred(vector::borrow(v, i))) break; + i = i + 1; + }; + let p = i; + i = i + 1; + while (i < len) { + if (pred(vector::borrow(v, i))) { + vector::swap(v, p, i); + p = p + 1; + }; + i = i + 1; + }; + p + } + + fun foo(): u64 { + let v = vector[1,2,3]; + let r = &mut v; + partition(r, |e: &u64| *e > 1); + *vector::borrow(r, 0) + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_comment_following.exp b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_comment_following.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_comment_following.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_comment_following.move b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_comment_following.move new file mode 100644 index 0000000000000..2c0e0883b3169 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_comment_following.move @@ -0,0 +1,9 @@ +//# run +script { + fun main(): () { + for/**/( i in 0..10) {}; + for/**/ ( i in 0..10) {}; + for /**/( i in 0..10) {}; + for /**/ ( i in 0..10) {}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_lparen_following.exp b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_lparen_following.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_lparen_following.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_lparen_following.move b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_lparen_following.move new file mode 100644 index 0000000000000..0b7b2778d6dc6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/for_loop_lparen_following.move @@ -0,0 +1,6 @@ +//# run +script { + fun main(): () { + for( i in 0..10) {}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/control_flow/infinite_loop_with_dead_exits.exp b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/infinite_loop_with_dead_exits.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/infinite_loop_with_dead_exits.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/control_flow/infinite_loop_with_dead_exits.move b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/infinite_loop_with_dead_exits.move new file mode 100644 index 0000000000000..7ce003f46bb7b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/control_flow/infinite_loop_with_dead_exits.move @@ -0,0 +1,18 @@ +address 0x42 { +module M { + + fun t1() { + loop { + continue; + break + }; + } + + fun t2() { + loop { + if (return) break; + } + } + +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_2.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_2.exp new file mode 100644 index 0000000000000..b6602cb3117bd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_2.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/friend_cycle_2.move:8:5 + │ +4 │ friend 0x2::B; + │ -------------- '0x2::B' is a friend of '0x2::A' + · +8 │ friend 0x2::A; + │ ^^^^^^^^^^^^^^ '0x2::A' is a friend of '0x2::B'. This 'friend' relationship creates a dependency cycle. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_2.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_2.move new file mode 100644 index 0000000000000..4663735fb163d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_2.move @@ -0,0 +1,11 @@ +address 0x2 { + +module A { + friend 0x2::B; +} + +module B { + friend 0x2::A; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_3.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_3.exp new file mode 100644 index 0000000000000..777ff515e6632 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_3.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/friend_cycle_3.move:8:5 + │ + 4 │ friend 0x2::B; + │ -------------- '0x2::B' is a friend of '0x2::A' + · + 8 │ friend 0x2::C; + │ ^^^^^^^^^^^^^^ '0x2::C' is a friend of '0x2::B'. This 'friend' relationship creates a dependency cycle. + · +12 │ friend 0x2::A; + │ -------------- '0x2::A' is a friend of '0x2::C' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_3.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_3.move new file mode 100644 index 0000000000000..238219e4d0383 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/friend_cycle_3.move @@ -0,0 +1,15 @@ +address 0x2 { + +module A { + friend 0x2::B; +} + +module B { + friend 0x2::C; +} + +module C { + friend 0x2::A; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_friend_cycles.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_friend_cycles.exp new file mode 100644 index 0000000000000..27a198daac647 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_friend_cycles.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/intersecting_friend_cycles.move:8:5 + │ + 4 │ friend 0x2::B; + │ -------------- '0x2::B' is a friend of '0x2::A' + · + 8 │ friend 0x2::C; + │ ^^^^^^^^^^^^^^ '0x2::C' is a friend of '0x2::B'. This 'friend' relationship creates a dependency cycle. + · +13 │ friend 0x2::A; + │ -------------- '0x2::A' is a friend of '0x2::C' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_friend_cycles.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_friend_cycles.move new file mode 100644 index 0000000000000..f74c3033e4f50 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_friend_cycles.move @@ -0,0 +1,25 @@ +address 0x2 { + +module A { + friend 0x2::B; +} + +module B { + friend 0x2::C; + friend 0x2::D; +} + +module C { + friend 0x2::A; +} + + +module D { + friend 0x2::E; +} + +module E { + friend 0x2::B; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_use_cycles.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_use_cycles.exp new file mode 100644 index 0000000000000..6211024d9f26c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_use_cycles.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/intersecting_use_cycles.move:10:14 + │ + 5 │ fun b(): 0x2::B::S { abort 0 } + │ --------- '0x2::B' uses '0x2::A' + · +10 │ fun c(): 0x2::C::S { abort 0 } + │ ^^^^^^^^^ '0x2::C' uses '0x2::B'. This 'use' relationship creates a dependency cycle. + · +17 │ fun A(): 0x2::A::S { abort 0 } + │ --------- '0x2::A' uses '0x2::C' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_use_cycles.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_use_cycles.move new file mode 100644 index 0000000000000..1b8ce2b20254c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/intersecting_use_cycles.move @@ -0,0 +1,31 @@ +address 0x2 { + +module A { + struct S {} + fun b(): 0x2::B::S { abort 0 } +} + +module B { + struct S {} + fun c(): 0x2::C::S { abort 0 } + + fun d(): 0x2::D::S { abort 0 } +} + +module C { + struct S {} + fun A(): 0x2::A::S { abort 0 } +} + + +module D { + struct S {} + fun e(): 0x2::E::S { abort 0 } +} + +module E { + struct S {} + fun b(): 0x2::B::S { abort 0 } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_friend_cycles.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_friend_cycles.exp new file mode 100644 index 0000000000000..3dca480e59c00 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_friend_cycles.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/multiple_friend_cycles.move:8:5 + │ +4 │ friend 0x2::B; + │ -------------- '0x2::B' is a friend of '0x2::A' + · +8 │ friend 0x2::A; + │ ^^^^^^^^^^^^^^ '0x2::A' is a friend of '0x2::B'. This 'friend' relationship creates a dependency cycle. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_friend_cycles.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_friend_cycles.move new file mode 100644 index 0000000000000..4187964cc96af --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_friend_cycles.move @@ -0,0 +1,31 @@ +address 0x2 { + +module A { + friend 0x2::B; +} + +module B { + friend 0x2::A; + friend 0x2::C; +} + +module C { + friend 0x2::B; +} + + +module D { + friend 0x2::B; + friend 0x2::E; + friend 0x2::F; +} + +module E { + friend 0x2::F; +} + +module F { + friend 0x2::D; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_use_cycles.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_use_cycles.exp new file mode 100644 index 0000000000000..bde8d2ea8eb70 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_use_cycles.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/multiple_use_cycles.move:25:14 + │ +25 │ fun f(): 0x2::F::S { abort 0 } + │ ^^^^^^^^^ '0x2::F' uses '0x2::D'. This 'use' relationship creates a dependency cycle. + · +35 │ fun d(): 0x2::D::S { abort 0 } + │ --------- '0x2::D' uses '0x2::F' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_use_cycles.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_use_cycles.move new file mode 100644 index 0000000000000..049e50352ce6c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/multiple_use_cycles.move @@ -0,0 +1,38 @@ +address 0x2 { + +module A { + struct S {} + fun b(): 0x2::B::S { abort 0 } +} + +module B { + struct S {} + fun a(): 0x2::A::S { abort 0 } + fun c(): 0x2::C::S { abort 0 } +} + +module C { + struct S {} + fun b(): 0x2::B::S { abort 0 } +} + + +module D { + struct S {} + fun b(): 0x2::B::S { abort 0 } + + fun e(): 0x2::E::S { abort 0 } + fun f(): 0x2::F::S { abort 0 } +} + +module E { + struct S {} + fun f(): 0x2::F::S { abort 0 } +} + +module F { + struct S {} + fun d(): 0x2::D::S { abort 0 } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_2.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_2.exp new file mode 100644 index 0000000000000..4141dc86f8631 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_2.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/use_cycle_2.move:5:9 + │ + 5 │ 0x2::B::foo() + │ ^^^^^^^^^^^ '0x2::B' uses '0x2::A'. This 'use' relationship creates a dependency cycle. + · +11 │ 0x2::A::foo() + │ ----------- '0x2::A' uses '0x2::B' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_2.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_2.move new file mode 100644 index 0000000000000..d0e4104aa6751 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_2.move @@ -0,0 +1,15 @@ +address 0x2 { + +module A { + public fun foo() { + 0x2::B::foo() + } +} + +module B { + public fun foo() { + 0x2::A::foo() + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_3.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_3.exp new file mode 100644 index 0000000000000..311763f924a40 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_3.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/use_cycle_3.move:95:16 + │ + 85 │ fun foo(): 0x4::A::S { + │ --------- '0x4::A' uses '0x4::C' + · + 95 │ fun foo(): 0x4::C::S { + │ ^^^^^^^^^ '0x4::C' uses '0x4::B'. This 'use' relationship creates a dependency cycle. + · +106 │ fun foo(): 0x4::B::S { + │ --------- '0x4::B' uses '0x4::A' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_3.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_3.move new file mode 100644 index 0000000000000..fcf23ef7b2734 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_cycle_3.move @@ -0,0 +1,111 @@ +address 0x2 { + +module A { + use 0x2::B; + + struct S has drop {} + + public fun s(): S { S{} } + + fun foo(): B::S { + 0x2::B::s() + } +} + +module B { + use 0x2::C; + + struct S has drop {} + + public fun s(): S { S{} } + + fun foo(): C::S { + 0x2::C::s() + } +} + +module C { + use 0x2::A; + + struct S has drop {} + + public fun s(): S { S{} } + + fun foo(): A::S { + 0x2::A::s() + } +} + +} + +address 0x3 { + +module A { + + struct S has drop {} + + public fun s(): S { S{} } + + fun foo() { + 0x3::B::s(); + } +} + +module C { + + struct S has drop {} + + public fun s(): S { S{} } + + fun foo() { + 0x3::A::s(); + } +} + +module B { + + struct S has drop {} + + public fun s(): S { S{} } + + fun foo() { + 0x3::C::s(); + } +} + +} + +address 0x4 { + +module C { + struct S has drop {} + + public fun s(): S { S{} } + + fun foo(): 0x4::A::S { + 0x4::A::s() + } +} + +module B { + struct S has drop {} + + public fun s(): S { S{} } + + fun foo(): 0x4::C::S { + 0x4::C::s() + } +} + +module A { + + struct S{} + + public fun s(): S { S{} } + + fun foo(): 0x4::B::S { + 0x4::B::s() + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_direct.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_direct.exp new file mode 100644 index 0000000000000..65d2cedf8a998 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_direct.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/use_friend_direct.move:8:9 + │ +5 │ friend B; + │ --------- '0x2::B' is a friend of '0x2::A' + · +8 │ B::b() + │ ^^^^ '0x2::B' uses '0x2::A'. This 'use' relationship creates a dependency cycle. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_direct.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_direct.move new file mode 100644 index 0000000000000..b27b520207bff --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_direct.move @@ -0,0 +1,16 @@ +address 0x2 { + +module A { + use 0x2::B; + friend B; + + public fun a() { + B::b() + } +} + +module B { + public fun b() {} +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_friend.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_friend.exp new file mode 100644 index 0000000000000..48ae052528aad --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_friend.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/use_friend_transitive_by_friend.move:14:5 + │ + 6 │ friend B; + │ --------- '0x2::B' is a friend of '0x2::A' + · + 9 │ C::c() + │ ---- '0x2::C' uses '0x2::A' + · +14 │ friend 0x2::C; + │ ^^^^^^^^^^^^^^ '0x2::C' is a friend of '0x2::B'. This 'friend' relationship creates a dependency cycle. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_friend.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_friend.move new file mode 100644 index 0000000000000..c27300e226439 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_friend.move @@ -0,0 +1,21 @@ +address 0x2 { + +module A { + use 0x2::B; + use 0x2::C; + friend B; + + public fun a() { + C::c() + } +} + +module B { + friend 0x2::C; +} + +module C { + public fun c() {} +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_use.exp b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_use.exp new file mode 100644 index 0000000000000..7039befdc91ae --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_use.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/dependencies/use_friend_transitive_by_use.move:16:9 + │ + 6 │ friend C; + │ --------- '0x2::C' is a friend of '0x2::A' + · + 9 │ B::b() + │ ---- '0x2::B' uses '0x2::A' + · +16 │ C::c() + │ ^^^^ '0x2::C' uses '0x2::B'. This 'use' relationship creates a dependency cycle. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_use.move b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_use.move new file mode 100644 index 0000000000000..2e6d3514b16bb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_use.move @@ -0,0 +1,24 @@ +address 0x2 { + +module A { + use 0x2::B; + use 0x2::C; + friend C; + + public fun a() { + B::b() + } +} + +module B { + use 0x2::C; + public fun b() { + C::c() + } +} + +module C { + public fun c() {} +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives.move new file mode 100644 index 0000000000000..f853c119c01fc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives.move @@ -0,0 +1,54 @@ +module 0x1::M { + +} + +address 0x2 { + +module M { + struct X {} + + public fun x(): X { + X { } + } + +} + +} + +address 0x3{} +address 0x4{} +address 0x2{} +address 0x4{ + +module M { + use 0x2::M; + + struct X {} + + public fun x(): X { + X {} + } + + public fun both(): (X, M::X) { + (X { }, M::x()) + } + +} + +} + +address 0x2 { + +module M2 { + use 0x2::M as M1; + use 0x4::M as M3; + + struct X {} + + public fun x(): (M1::X, X, M3::X) { + (M1::x(), X {}, M3::x()) + } + +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives_empty.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives_empty.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives_empty.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives_empty.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives_empty.move new file mode 100644 index 0000000000000..440dbabf6c71b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/address_directives_empty.move @@ -0,0 +1,4 @@ +address 0x3 {} +address 0x4 {} +address 0x2 {} +address 0x4 {} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/almost_invalid_local_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/almost_invalid_local_name.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/almost_invalid_local_name.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/almost_invalid_local_name.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/almost_invalid_local_name.move new file mode 100644 index 0000000000000..b3b3210d447d2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/almost_invalid_local_name.move @@ -0,0 +1,21 @@ +module 0x8675309::M { + struct F has drop { No: u64 } + + fun t(_No: u64) { + } + + fun t2() { + let _No = 100; + } + + fun t3() { + let _No; + _No = 100; + } + + fun t4() { + let _No = 100; + F { No: _No }; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/assign_non_simple_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/assign_non_simple_name.exp new file mode 100644 index 0000000000000..eb7b73c8908fb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/assign_non_simple_name.exp @@ -0,0 +1,84 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:6:15 + │ +6 │ use 0x42::X; + │ ^ Unused 'use' of alias 'X'. Consider removing it + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:16:9 + │ +16 │ X::S = (); + │ ^^^^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. 'X::S {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:17:9 + │ +17 │ Self::S = (); + │ ^^^^^^^^^^^^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. 'Self::S {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:18:9 + │ +18 │ Self::R = (); + │ ^^^^^^^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. 'Self::R {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:22:9 + │ +22 │ 0x42::X::S = (); + │ ^^^^^^^^^^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. '0x42::X::S {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:23:9 + │ +23 │ 0x42::M::S = (); + │ ^^^^^^^^^^^^^^^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. '0x42::M::S {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:24:9 + │ +24 │ 0x42::M::R = (); + │ ^^^^^^^^^^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. '0x42::M::R {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:28:9 + │ +28 │ x = (); + │ ^^^^^^ Unexpected assignment of instantiated type without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. 'x {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:29:9 + │ +29 │ S = (); + │ ^^^^^^ Unexpected assignment of instantiated type without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. 'S {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:33:9 + │ +33 │ X = (); + │ ^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. '0x42::X::S {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:34:9 + │ +34 │ S = (); + │ ^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. '0x42::M::S {}' + +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/assign_non_simple_name.move:35:9 + │ +35 │ R = (); + │ ^ Unexpected assignment of module access without fields outside of a spec context. +If you are trying to unpack a struct, try adding fields, e.g. '0x42::M::R {}' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/assign_non_simple_name.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/assign_non_simple_name.move new file mode 100644 index 0000000000000..c2f18d3b9dd83 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/assign_non_simple_name.move @@ -0,0 +1,42 @@ +address 0x42 { +module X { + struct S {} +} +module M { + use 0x42::X; + use 0x42::X::S as X; + + struct R {} + struct S { f: T } + + + fun t() { + // Assign to qualified name + // should fail in non spec context + X::S = (); + Self::S = (); + Self::R = (); + + // Assign to fully qualified name + // should fail in non spec context + 0x42::X::S = (); + 0x42::M::S = (); + 0x42::M::R = (); + + // Assign to name with type args, qualified/nonqualified/struct doesnt matter + // should fail in non spec context + x = (); + S = (); + + // Assign to a name that is aliased in local context + // should fail in non spec context + X = (); + S = (); + R = (); + + // Assign to a name that starts with A-Z + // Should fail with unbound local even though it is not a valid local name + Y = 0; + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_duplicate_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_duplicate_struct.exp new file mode 100644 index 0000000000000..bd45e9a44b21d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_duplicate_struct.exp @@ -0,0 +1,27 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/constant_duplicate_struct.move:4:11 + │ +3 │ struct C { } + │ - Alias previously defined here +4 │ const C: u64 = 0; + │ ^ Duplicate module member or alias 'C'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/expansion/constant_duplicate_struct.move:11:15 + │ +11 │ use 0x42::mod1; + │ ^^^^ Unused 'use' of alias 'mod1'. Consider removing it + +warning: unused alias + ┌─ tests/more-v1/expansion/constant_duplicate_struct.move:30:15 + │ +30 │ use 0x42::mod1; + │ ^^^^ Unused 'use' of alias 'mod1'. Consider removing it + +error: invalid name + ┌─ tests/more-v1/expansion/constant_duplicate_struct.move:31:26 + │ +31 │ use 0x42::mod1::C as mod1; + │ ^^^^ Invalid constant alias name 'mod1'. Constant alias names must start with 'A'..'Z' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_duplicate_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_duplicate_struct.move new file mode 100644 index 0000000000000..0d4bfec6ba069 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_duplicate_struct.move @@ -0,0 +1,43 @@ +address 0x42 { +module mod1 { + struct C { } + const C: u64 = 0; + public fun mod1() {} +} +} + +address 0x41 { +module N { + use 0x42::mod1; + use 0x42::mod1::C as D; + use 0x42::mod1::C as C; + use 0x42::mod1::mod1; + + fun f1(): 0x42::mod1::C { + mod1(); + C; + { + use 0x42::mod1::C; + C + }; + D + } +} +} + + +script { + use 0x42::mod1; + use 0x42::mod1::C as mod1; + use 0x42::mod1::C as C; + use 0x42::mod1::mod1; + + fun f1(): 0x42::mod1::C { + mod1(); + C; + { + use 0x42::mod1::C; + C + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_alias_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_alias_names.exp new file mode 100644 index 0000000000000..b998314c29d68 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_alias_names.exp @@ -0,0 +1,37 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_alias_names.move:8:24 + │ +8 │ use 0x42::N::{C as c1, C as _C1, C as Self}; + │ ^^ Invalid constant alias name 'c1'. Constant alias names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_alias_names.move:8:33 + │ +8 │ use 0x42::N::{C as c1, C as _C1, C as Self}; + │ ^^^ Invalid constant alias name '_C1'. Constant alias names must start with 'A'..'Z' + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/constant_invalid_alias_names.move:8:43 + │ +8 │ use 0x42::N::{C as c1, C as _C1, C as Self}; + │ ^^^^ Invalid constant alias name 'Self'. 'Self' is restricted and cannot be used to name a constant alias + +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_alias_names.move:13:24 + │ +13 │ use 0x42::N::{C as c1, C as _C1, C as Self}; + │ ^^ Invalid constant alias name 'c1'. Constant alias names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_alias_names.move:13:33 + │ +13 │ use 0x42::N::{C as c1, C as _C1, C as Self}; + │ ^^^ Invalid constant alias name '_C1'. Constant alias names must start with 'A'..'Z' + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/constant_invalid_alias_names.move:13:43 + │ +13 │ use 0x42::N::{C as c1, C as _C1, C as Self}; + │ ^^^^ Invalid constant alias name 'Self'. 'Self' is restricted and cannot be used to name a constant alias diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_alias_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_alias_names.move new file mode 100644 index 0000000000000..83c21df7967a6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_alias_names.move @@ -0,0 +1,15 @@ +address 0x42 { + +module N { + const C: bool = false; +} + +module M { + use 0x42::N::{C as c1, C as _C1, C as Self}; +} +} + +script { + use 0x42::N::{C as c1, C as _C1, C as Self}; + fun main() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_names.exp new file mode 100644 index 0000000000000..058f645483fa1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_names.exp @@ -0,0 +1,37 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_names.move:3:11 + │ +3 │ const c1: u64 = 0; + │ ^^ Invalid constant name 'c1'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_names.move:4:11 + │ +4 │ const _C1: u64 = 0; + │ ^^^ Invalid constant name '_C1'. Constant names must start with 'A'..'Z' + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/constant_invalid_names.move:5:11 + │ +5 │ const Self: u64 = 0; + │ ^^^^ Invalid constant name 'Self'. 'Self' is restricted and cannot be used to name a constant + +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_names.move:11:11 + │ +11 │ const c1: u64 = 0; + │ ^^ Invalid constant name 'c1'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/constant_invalid_names.move:12:11 + │ +12 │ const _C1: u64 = 0; + │ ^^^ Invalid constant name '_C1'. Constant names must start with 'A'..'Z' + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/constant_invalid_names.move:13:11 + │ +13 │ const Self: u64 = 0; + │ ^^^^ Invalid constant name 'Self'. 'Self' is restricted and cannot be used to name a constant diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_names.move new file mode 100644 index 0000000000000..5f6ee2e3a8147 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/constant_invalid_names.move @@ -0,0 +1,15 @@ +address 0x42 { +module M { + const c1: u64 = 0; + const _C1: u64 = 0; + const Self: u64 = 0; +} +} + + +script { + const c1: u64 = 0; + const _C1: u64 = 0; + const Self: u64 = 0; + fun main() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_abilities.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_abilities.exp new file mode 100644 index 0000000000000..189b152a05545 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_abilities.exp @@ -0,0 +1,57 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_abilities.move:4:26 + │ +4 │ struct Foo has copy, copy {} + │ ---- ^^^^ Duplicate 'copy' ability modifier + │ │ + │ Ability previously given here + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_abilities.move:5:26 + │ +5 │ struct Bar { f: T } + │ ---- ^^^^ Duplicate 'drop' ability constraint + │ │ + │ Ability previously given here + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_abilities.move:6:24 + │ +6 │ fun baz() {} + │ ----- ^^^^^ Duplicate 'store' ability constraint + │ │ + │ Ability previously given here + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_abilities.move:9:28 + │ +9 │ invariant exists(0x1) == exists(0x1); + │ --- ^^^ Duplicate 'key' ability constraint + │ │ + │ Ability previously given here + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_abilities.move:10:26 + │ +10 │ axiom exists(0x2); + │ ----- ^^^^^ Duplicate 'store' ability constraint + │ │ + │ Ability previously given here + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_abilities.move:10:40 + │ +10 │ axiom exists(0x2); + │ --- ^^^ Duplicate 'key' ability constraint + │ │ + │ Ability previously given here + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_abilities.move:15:23 + │ +15 │ fun main() {} + │ --- ^^^ Duplicate 'key' ability constraint + │ │ + │ Ability previously given here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_abilities.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_abilities.move new file mode 100644 index 0000000000000..821e63955ff79 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_abilities.move @@ -0,0 +1,16 @@ +address 0x42 { +module M { + // invalid duplicate abilities + struct Foo has copy, copy {} + struct Bar { f: T } + fun baz() {} + + spec module { + invariant exists(0x1) == exists(0x1); + axiom exists(0x2); + } +} +} +script { + fun main() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_alias.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_alias.exp new file mode 100644 index 0000000000000..1e40e9af507f9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_alias.exp @@ -0,0 +1,15 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/duplicate_alias.move:8:19 + │ +8 │ use 0x2::Y as Z; + │ ^ Unused 'use' of alias 'Z'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_alias.move:8:19 + │ +7 │ use 0x2::X as Z; + │ - Alias previously defined here +8 │ use 0x2::Y as Z; + │ ^ Duplicate module alias 'Z'. Module aliases must be unique within a given namespace diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_alias.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_alias.move new file mode 100644 index 0000000000000..b0187d1625bba --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_alias.move @@ -0,0 +1,11 @@ +address 0x2 { + +module X {} +module Y {} + +module M { + use 0x2::X as Z; + use 0x2::Y as Z; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field.exp new file mode 100644 index 0000000000000..eac872b145ed5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_field.move:4:9 + │ +3 │ f: u64, + │ - Field previously defined here +4 │ f: u64, + │ ^ Duplicate definition for field 'f' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field.move new file mode 100644 index 0000000000000..661314b8d7604 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + struct S { + f: u64, + f: u64, + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_assign.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_assign.exp new file mode 100644 index 0000000000000..286f8c565d980 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_assign.exp @@ -0,0 +1,11 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_field_assign.move:5:9 + │ +5 │ S { f, f } = S { f: 0 }; + │ ^^^^^^^^^^ + │ │ │ │ + │ │ │ Duplicate assignment binding given for field 'f' + │ │ Field previously defined here + │ Invalid deconstructing assignment diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_assign.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_assign.move new file mode 100644 index 0000000000000..43e69fcd0f4b3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_assign.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + struct S { f: u64 } + fun foo() { + let f; + S { f, f } = S { f: 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_pack.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_pack.exp new file mode 100644 index 0000000000000..658a42a9bf84e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_pack.exp @@ -0,0 +1,11 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_field_pack.move:4:9 + │ +4 │ S { f: 0, f: 0 }; + │ ^^^^^^^^^^^^^^^^ + │ │ │ │ + │ │ │ Duplicate argument given for field 'f' + │ │ Field previously defined here + │ Invalid construction diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_pack.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_pack.move new file mode 100644 index 0000000000000..53da0dac86269 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_pack.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + struct S has drop { f: u64 } + fun foo() { + S { f: 0, f: 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_unpack.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_unpack.exp new file mode 100644 index 0000000000000..f0713fabc4a90 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_unpack.exp @@ -0,0 +1,11 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_field_unpack.move:4:13 + │ +4 │ let S { f, f } = S { f: 0 }; + │ ^^^^^^^^^^ + │ │ │ │ + │ │ │ Duplicate binding given for field 'f' + │ │ Field previously defined here + │ Invalid deconstruction binding diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_unpack.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_unpack.move new file mode 100644 index 0000000000000..ce9b99a3d02b6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_field_unpack.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + struct S { f: u64 } + fun foo() { + let S { f, f } = S { f: 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_function_in_module.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_function_in_module.exp new file mode 100644 index 0000000000000..2e849229a68be --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_function_in_module.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_function_in_module.move:3:9 + │ +2 │ fun foo() { } + │ --- Alias previously defined here +3 │ fun foo() { } + │ ^^^ Duplicate module member or alias 'foo'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_function_in_module.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_function_in_module.move new file mode 100644 index 0000000000000..75b46aca9e804 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_function_in_module.move @@ -0,0 +1,4 @@ +module 0x8675309::M { + fun foo() { } + fun foo() { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module.exp new file mode 100644 index 0000000000000..d8c6bcb99f600 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_module.move:2:19 + │ +1 │ module 0x8675309::M {} + │ - Module previously defined here, with '0x8675309::M' +2 │ module 0x8675309::M {} + │ ^ Duplicate definition for module '0x8675309::M' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module.move new file mode 100644 index 0000000000000..1c62000d61fff --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module.move @@ -0,0 +1,2 @@ +module 0x8675309::M {} +module 0x8675309::M {} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module_after_mapping.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module_after_mapping.exp new file mode 100644 index 0000000000000..9d7a60a164639 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module_after_mapping.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_module_after_mapping.move:5:11 + │ +4 │ module A::M {} + │ - Module previously defined here, with '(A=0x42)::M' +5 │ module B::M {} + │ ^ Duplicate definition for module '(B=0x42)::M' + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_module_after_mapping.move:9:11 + │ +8 │ module 0x1::M {} + │ - Module previously defined here, with '0x1::M' +9 │ module M::M {} + │ ^ Duplicate definition for module '(M=0x1)::M' + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_module_after_mapping.move:13:14 + │ +12 │ module K::M {} + │ - Module previously defined here, with '(K=0x19)::M' +13 │ module 0x19::M {} + │ ^ Duplicate definition for module '0x19::M' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module_after_mapping.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module_after_mapping.move new file mode 100644 index 0000000000000..109000e7ef62e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_module_after_mapping.move @@ -0,0 +1,13 @@ +// Duplicate modules need to be checked with respect to name=>value mapping + +// Both modules named +module A::M {} +module B::M {} + +// Anon, named +module 0x1::M {} +module M::M {} + +// Named, Anon +module K::M {} +module 0x19::M {} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_struct.exp new file mode 100644 index 0000000000000..3630233d59369 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_struct.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/duplicate_struct.move:3:12 + │ +2 │ struct S {} + │ - Alias previously defined here +3 │ struct S {} + │ ^ Duplicate module member or alias 'S'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_struct.move new file mode 100644 index 0000000000000..6a5f4dc30a1c4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/duplicate_struct.move @@ -0,0 +1,4 @@ +module 0x8675309::M { + struct S {} + struct S {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/entry_main.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/entry_main.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/entry_main.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/entry_main.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/entry_main.move new file mode 100644 index 0000000000000..77174396e95f4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/entry_main.move @@ -0,0 +1,4 @@ +script { +entry fun main() { +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_duplicates.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_duplicates.exp new file mode 100644 index 0000000000000..5555d55474cbf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_duplicates.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/friend_decl_aliased_duplicates.move:7:5 + │ +6 │ friend 0x42::A; + │ --------------- Friend previously declared here +7 │ friend AliasedA; + │ ^^^^^^^^^^^^^^^^ Duplicate friend declaration '0x42::A'. Friend declarations in a module must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_duplicates.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_duplicates.move new file mode 100644 index 0000000000000..03caa75a38aaf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_duplicates.move @@ -0,0 +1,9 @@ +address 0x42 { +module A {} + +module M { + use 0x42::A as AliasedA; + friend 0x42::A; + friend AliasedA; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_function.exp new file mode 100644 index 0000000000000..44ebd1d040538 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_function.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/expansion/friend_decl_aliased_function.move:8:12 + │ +8 │ friend a; + │ ^ Unbound module alias 'a' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_function.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_function.move new file mode 100644 index 0000000000000..0dcf0b363c6dc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_function.move @@ -0,0 +1,14 @@ +address 0x42 { +module A { + public fun a() {} +} + +module M { + use 0x42::A::a; + friend a; + + public(friend) fun m() { + a() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_struct.exp new file mode 100644 index 0000000000000..1fec4ffad6deb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_struct.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/expansion/friend_decl_aliased_struct.move:8:12 + │ +8 │ friend A; + │ ^ Unbound module alias 'A' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_struct.move new file mode 100644 index 0000000000000..2fc7aaaf64ac3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_struct.move @@ -0,0 +1,12 @@ +address 0x42 { +module A { + struct A {} +} + +module M { + use 0x42::A::A; + friend A; + + public(friend) fun m(_a: A) {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_imported_duplicates.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_imported_duplicates.exp new file mode 100644 index 0000000000000..b38e01c6fb564 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_imported_duplicates.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/friend_decl_imported_duplicates.move:7:5 + │ +6 │ friend 0x42::A; + │ --------------- Friend previously declared here +7 │ friend A; + │ ^^^^^^^^^ Duplicate friend declaration '0x42::A'. Friend declarations in a module must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_imported_duplicates.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_imported_duplicates.move new file mode 100644 index 0000000000000..68b2da04d3173 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_imported_duplicates.move @@ -0,0 +1,9 @@ +address 0x42 { +module A {} + +module M { + use 0x42::A; + friend 0x42::A; + friend A; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_inner_scope_alias.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_inner_scope_alias.exp new file mode 100644 index 0000000000000..47ed073614d52 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_inner_scope_alias.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/expansion/friend_decl_inner_scope_alias.move:7:12 + │ +7 │ friend A; + │ ^ Unbound module alias 'A' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_inner_scope_alias.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_inner_scope_alias.move new file mode 100644 index 0000000000000..2294ef20d528f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_inner_scope_alias.move @@ -0,0 +1,14 @@ +address 0x42 { +module A { + public fun a() {} +} + +module M { + friend A; + + public(friend) fun m() { + use 0x42::A; + A::a() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_nonexistent_alias.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_nonexistent_alias.exp new file mode 100644 index 0000000000000..e93a2c6f59eb7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_nonexistent_alias.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/expansion/friend_decl_nonexistent_alias.move:3:12 + │ +3 │ friend Nonexistent; + │ ^^^^^^^^^^^ Unbound module alias 'Nonexistent' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_nonexistent_alias.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_nonexistent_alias.move new file mode 100644 index 0000000000000..bad55ea0a4e28 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_nonexistent_alias.move @@ -0,0 +1,5 @@ +address 0x42 { +module M { + friend Nonexistent; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_qualified_duplicates.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_qualified_duplicates.exp new file mode 100644 index 0000000000000..bcacef15ae8d0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_qualified_duplicates.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/friend_decl_qualified_duplicates.move:6:5 + │ +5 │ friend 0x42::A; + │ --------------- Friend previously declared here +6 │ friend 0x42::A; + │ ^^^^^^^^^^^^^^^ Duplicate friend declaration '0x42::A'. Friend declarations in a module must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_qualified_duplicates.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_qualified_duplicates.move new file mode 100644 index 0000000000000..6dcc4f12d6b76 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/friend_decl_qualified_duplicates.move @@ -0,0 +1,8 @@ +address 0x42 { +module A {} + +module M { + friend 0x42::A; + friend 0x42::A; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/function_invalid_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/function_invalid_names.exp new file mode 100644 index 0000000000000..09baa6da29592 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/function_invalid_names.exp @@ -0,0 +1,37 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/function_invalid_names.move:3:9 + │ +3 │ fun _foo() {} + │ ^^^^ Invalid function name '_foo'. Function names cannot start with '_' + +error: invalid name + ┌─ tests/more-v1/expansion/function_invalid_names.move:4:9 + │ +4 │ fun _() {} + │ ^ Invalid function name '_'. Function names cannot start with '_' + +error: invalid name + ┌─ tests/more-v1/expansion/function_invalid_names.move:5:9 + │ +5 │ fun ___() {} + │ ^^^ Invalid function name '___'. Function names cannot start with '_' + +error: invalid name + ┌─ tests/more-v1/expansion/function_invalid_names.move:10:9 + │ +10 │ fun _foo() {} + │ ^^^^ Invalid function name '_foo'. Function names cannot start with '_' + +error: invalid name + ┌─ tests/more-v1/expansion/function_invalid_names.move:13:9 + │ +13 │ fun _() {} + │ ^ Invalid function name '_'. Function names cannot start with '_' + +error: invalid name + ┌─ tests/more-v1/expansion/function_invalid_names.move:16:9 + │ +16 │ fun ___() {} + │ ^^^ Invalid function name '___'. Function names cannot start with '_' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/function_invalid_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/function_invalid_names.move new file mode 100644 index 0000000000000..a3e893bac0611 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/function_invalid_names.move @@ -0,0 +1,17 @@ +address 0x42 { +module M { + fun _foo() {} + fun _() {} + fun ___() {} +} +} + +script { + fun _foo() {} +} +script { + fun _() {} +} +script { + fun ___() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/hexstring_bad_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/hexstring_bad_value.exp new file mode 100644 index 0000000000000..3b3de51dfb946 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/hexstring_bad_value.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid hex string + ┌─ tests/more-v1/expansion/hexstring_bad_value.move:3:11 + │ +3 │ x"g0" + │ ^ Invalid hexadecimal character: 'g' + +error: invalid hex string + ┌─ tests/more-v1/expansion/hexstring_bad_value.move:6:9 + │ +6 │ x"123" + │ ^^^^^^ Odd number of characters in hex string. Expected 2 hexadecimal digits for each byte diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/hexstring_bad_value.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/hexstring_bad_value.move new file mode 100644 index 0000000000000..842322209aa53 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/hexstring_bad_value.move @@ -0,0 +1,8 @@ +module 0x8675309::M { + public fun bad_value(): vector { + x"g0" + } + public fun odd_length(): vector { + x"123" + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_local_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_local_name.exp new file mode 100644 index 0000000000000..5262c25d270ca --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_local_name.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/invalid_local_name.move:4:11 + │ +4 │ fun t(No: u64) { + │ ^^ Invalid local variable name 'No'. Local variable names must start with 'a'..'z' (or '_') + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/invalid_local_name.move:23:13 + │ +23 │ let vector; + │ ^^^^^^ Invalid variable name 'vector'. 'vector' is restricted and cannot be used to name a variable diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_local_name.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_local_name.move new file mode 100644 index 0000000000000..3b11cf38c5e01 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_local_name.move @@ -0,0 +1,26 @@ +module 0x8675309::M { + struct F has drop { No: u64 } + + fun t(No: u64) { + No; + } + + fun t2() { + let No; + No = 100; + } + + fun t3() { + let No = 100; + F { No }; + } + + fun t4() { + let _No; + } + + fun t5() { + let vector; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_spec_schema_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_spec_schema_name.exp new file mode 100644 index 0000000000000..a907746f6bfb6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_spec_schema_name.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/invalid_spec_schema_name.move:2:17 + │ +2 │ spec schema foo { + │ ^^^ Invalid schema name 'foo'. Schema names must start with 'A'..'Z' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_spec_schema_name.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_spec_schema_name.move new file mode 100644 index 0000000000000..7bf7aeca33f9b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_spec_schema_name.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + spec schema foo { + ensures true; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_struct_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_struct_name.exp new file mode 100644 index 0000000000000..6f169a9f5b538 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_struct_name.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/invalid_struct_name.move:2:12 + │ +2 │ struct no {} + │ ^^ Invalid struct name 'no'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/invalid_struct_name.move:9:12 + │ +9 │ struct no2 {} + │ ^^^ Invalid struct name 'no2'. Struct names must start with 'A'..'Z' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_struct_name.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_struct_name.move new file mode 100644 index 0000000000000..725b16ada6995 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_struct_name.move @@ -0,0 +1,17 @@ +module 0x8675309::M { + struct no {} + struct X { f: no } + + fun mk(x: no): no { + no {} + } + + struct no2 {} + struct Y { f: no } + + fun mk2(x: no2): no2 { + let no2 {} = x; + no2 {} + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.exp new file mode 100644 index 0000000000000..e0bfa09209478 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.move:4:11 + │ +4 │ 0 { f } = 0; + │ ^ + │ │ + │ Unexpected '{' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.move new file mode 100644 index 0000000000000..eaffa813bd34e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.move @@ -0,0 +1,6 @@ +module M { + fun foo() { + let f = 0; + 0 { f } = 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.exp new file mode 100644 index 0000000000000..e998ac10068d8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.move:3:11 + │ +3 │ 0 {} = 0; + │ ^ + │ │ + │ Unexpected '{' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.move new file mode 100644 index 0000000000000..0b2e5c47b73d7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.move @@ -0,0 +1,9 @@ +module M { + fun foo() { + 0 {} = 0; + + foo() = 0; + + foo().bar() = 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.exp new file mode 100644 index 0000000000000..5aba2d4c927a7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid assignment + ┌─ tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.move:4:9 + │ +4 │ Self::f() = 0; + │ ^^^^^^^^^ Invalid assignment syntax. Expected: a local, a field write, or a deconstructing assignment diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.move new file mode 100644 index 0000000000000..2bb2c34bd62f4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + fun foo() { + Self::f {} = 0; + Self::f() = 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/mdot_with_non_address_exp.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/mdot_with_non_address_exp.exp new file mode 100644 index 0000000000000..1042d1925936a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/mdot_with_non_address_exp.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/mdot_with_non_address_exp.move:9:13 + │ +9 │ 01u8::X::bar() + │ ^^ + │ │ + │ Unexpected '::' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/mdot_with_non_address_exp.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/mdot_with_non_address_exp.move new file mode 100644 index 0000000000000..b47bd9114aea2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/mdot_with_non_address_exp.move @@ -0,0 +1,21 @@ +address 0x2 { + +module X { + fun bar() { } +} +module M { + + fun foo() { + 01u8::X::bar() + } + + fun bar() { + false::X::bar() + } + + fun baz() { + foo().bar().X::bar() + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_alias_as_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_alias_as_type.exp new file mode 100644 index 0000000000000..063f5027ff345 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_alias_as_type.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/module_alias_as_type.move:6:14 + │ +6 │ use 0x2::X; + │ ^ Unused 'use' of alias 'X'. Consider removing it + +error: undeclared `0x2::M::X` + ┌─ tests/more-v1/expansion/module_alias_as_type.move:7:16 + │ +7 │ fun foo(x: X) {} + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_alias_as_type.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_alias_as_type.move new file mode 100644 index 0000000000000..7dfad08b90238 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_alias_as_type.move @@ -0,0 +1,10 @@ +address 0x2 { + +module X {} + +module M { + use 0x2::X; + fun foo(x: X) {} +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_invalid_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_invalid_names.exp new file mode 100644 index 0000000000000..be52859917b28 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_invalid_names.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/module_invalid_names.move:2:8 + │ +2 │ module _m { + │ ^^ Invalid module name '_m'. Module names cannot start with '_' + +error: invalid name + ┌─ tests/more-v1/expansion/module_invalid_names.move:4:8 + │ +4 │ module _ { + │ ^ Invalid module name '_'. Module names cannot start with '_' + +error: invalid name + ┌─ tests/more-v1/expansion/module_invalid_names.move:6:8 + │ +6 │ module ___ { + │ ^^^ Invalid module name '___'. Module names cannot start with '_' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_invalid_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_invalid_names.move new file mode 100644 index 0000000000000..2ed661988522d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/module_invalid_names.move @@ -0,0 +1,8 @@ +address 0x42 { +module _m { +} +module _ { +} +module ___ { +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/multiple_alias.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/multiple_alias.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/multiple_alias.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/multiple_alias.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/multiple_alias.move new file mode 100644 index 0000000000000..2b7ddd1422f34 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/multiple_alias.move @@ -0,0 +1,26 @@ +address 0x2 { + +module M { + use 0x2::X; + use 0x2::X as X2; + + struct F { + f: 0x2::X::S, + g: X::S, + h: X2::S, + } + + fun foo(_x: 0x2::X::S, _y: X::S, _z: X2::S): (0x2::X::S, X::S, X2::S) { + let a : 0x2::X::S = 0x2::X::foo(); + let b : X::S = X::foo(); + let c : X2::S = X2::foo(); + (a, b, c) + } +} + +module X { + struct S has drop {} + public fun foo(): S { S{} } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/no_address.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/no_address.exp new file mode 100644 index 0000000000000..465a7ed2b7cf0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/no_address.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/expansion/no_address.move:1:8 + │ +1 │ module M {} + │ ^ Invalid module declaration. The module does not have a specified address. Either declare it inside of an 'address
{' block or declare it with an address 'module
::M'' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/no_address.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/no_address.move new file mode 100644 index 0000000000000..2e94b1c7f2f78 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/no_address.move @@ -0,0 +1 @@ +module M {} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_long.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_long.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_long.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_long.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_long.move new file mode 100644 index 0000000000000..87c9d16a6297d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_long.move @@ -0,0 +1,8 @@ +module 0x8675309::M { + fun foo() { + 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001; + 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001; + (340282366920938463463374607431768211454: u128); + (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF: u128); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long.exp new file mode 100644 index 0000000000000..9fc62fbd6fd75 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long.move:3:9 + │ +3 │ 0x1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid number literal. The given literal is too large to fit into the largest possible integer type, 'u256' + +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long.move:4:9 + │ +4 │ 340282366920938463463374607431768211456340282366920938463463374607431768211456340282366920938463463374607431768211456; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid number literal. The given literal is too large to fit into the largest possible integer type, 'u256' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long.move new file mode 100644 index 0000000000000..2abb369f03f44 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long.move @@ -0,0 +1,6 @@ +module 0x42::M { + fun foo() { + 0x1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + 340282366920938463463374607431768211456340282366920938463463374607431768211456340282366920938463463374607431768211456; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u128.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u128.exp new file mode 100644 index 0000000000000..74b08c71d8e09 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u128.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long_u128.move:4:9 + │ +4 │ 0x1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu128; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid number literal. The given literal is too large to fit into 'u128' + +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long_u128.move:6:9 + │ +6 │ 340282366920938463463374607431768211456u128; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid number literal. The given literal is too large to fit into 'u128' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u128.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u128.move new file mode 100644 index 0000000000000..4f73c51151230 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u128.move @@ -0,0 +1,8 @@ +module 0x42::M { + fun long_u128() { + 0x0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu128; + 0x1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu128; + 340282366920938463463374607431768211455u128; + 340282366920938463463374607431768211456u128; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u64.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u64.exp new file mode 100644 index 0000000000000..775cecbdcdd15 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u64.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long_u64.move:4:9 + │ +4 │ 0x1FFFFFFFFFFFFFFFFu64; + │ ^^^^^^^^^^^^^^^^^^^^^^ Invalid number literal. The given literal is too large to fit into 'u64' + +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long_u64.move:6:9 + │ +6 │ 18446744073709551616u64; + │ ^^^^^^^^^^^^^^^^^^^^^^^ Invalid number literal. The given literal is too large to fit into 'u64' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u64.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u64.move new file mode 100644 index 0000000000000..886b5fab13fdc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u64.move @@ -0,0 +1,8 @@ +module 0x42::M { + fun long_u64() { + 0x0FFFFFFFFFFFFFFFFu64; + 0x1FFFFFFFFFFFFFFFFu64; + 18446744073709551615u64; + 18446744073709551616u64; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u8.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u8.exp new file mode 100644 index 0000000000000..ed2b7b67bfdd9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u8.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long_u8.move:4:9 + │ +4 │ 0x1FFu8; + │ ^^^^^^^ Invalid number literal. The given literal is too large to fit into 'u8' + +error: invalid number literal + ┌─ tests/more-v1/expansion/number_literal_too_long_u8.move:6:9 + │ +6 │ 256u8; + │ ^^^^^ Invalid number literal. The given literal is too large to fit into 'u8' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u8.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u8.move new file mode 100644 index 0000000000000..f09b1e73f32d2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u8.move @@ -0,0 +1,8 @@ +module 0x42::M { + fun long_u8() { + 0x0FFu8; + 0x1FFu8; + 255u8; + 256u8; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_all_field_cases.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_all_field_cases.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_all_field_cases.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_all_field_cases.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_all_field_cases.move new file mode 100644 index 0000000000000..fec2428fed1ea --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_all_field_cases.move @@ -0,0 +1,14 @@ +module 0x8675309::M { + struct T has drop {} + struct S has drop { f: u64, g: u64 } + fun foo() { + let f = 0; + let g = 1; + T {}; + T { }; + S { f, g }; + S { f: 0, g: 0}; + S { g: 0, f }; + S { g, f: 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_block_expr.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_block_expr.exp new file mode 100644 index 0000000000000..f7a69092900a0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_block_expr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/pack_no_fields_block_expr.move:4:21 + │ +4 │ let s = S { let x = 0; x }; + │ ^^^ + │ │ + │ Unexpected 'let' + │ Expected an identifier diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_block_expr.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_block_expr.move new file mode 100644 index 0000000000000..758bed953c9ab --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_block_expr.move @@ -0,0 +1,7 @@ +module M { + struct S {} + fun foo() { + let s = S { let x = 0; x }; + let s = S { let y = 0; let z = 0; x + foo() }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_expr.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_expr.exp new file mode 100644 index 0000000000000..d6f5dc5906c98 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_expr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/pack_no_fields_single_block_expr.move:4:21 + │ +4 │ let s = S { false }; + │ ^^^^^ + │ │ + │ Unexpected 'false' + │ Expected an identifier diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_expr.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_expr.move new file mode 100644 index 0000000000000..11b314a7f2507 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_expr.move @@ -0,0 +1,7 @@ +module M { + struct S { f: u64 } + fun foo() { + let s = S { false }; + let s = S { 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_other_expr.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_other_expr.exp new file mode 100644 index 0000000000000..5b679e85b3b4c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_other_expr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/pack_no_fields_single_block_other_expr.move:6:19 + │ +6 │ let s = S 0; + │ ^ + │ │ + │ Unexpected '0' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_other_expr.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_other_expr.move new file mode 100644 index 0000000000000..40776049ecb55 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_other_expr.move @@ -0,0 +1,11 @@ +module M { + struct S { f: u64 } + struct G {} + fun foo() { + let f = 0; + let s = S 0; + let s = S f; + let g = G (); + let g = G { {} }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_friend_main.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_friend_main.exp new file mode 100644 index 0000000000000..5d1f1f6c388bb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_friend_main.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unnecessary or extraneous item + ┌─ tests/more-v1/expansion/public_friend_main.move:2:1 + │ +2 │ public(friend) fun main() { + │ ^^^^^^^^^^^^^^ Invalid 'public(friend)' visibility modifier. Script functions are not callable from other Move functions. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_friend_main.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_friend_main.move new file mode 100644 index 0000000000000..4b31281eed4f6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_friend_main.move @@ -0,0 +1,4 @@ +script { +public(friend) fun main() { +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_main.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_main.exp new file mode 100644 index 0000000000000..da45ba2ca0cc7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_main.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unnecessary or extraneous item + ┌─ tests/more-v1/expansion/public_main.move:2:1 + │ +2 │ public fun main() { + │ ^^^^^^ Invalid 'public' visibility modifier. Script functions are not callable from other Move functions. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_main.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_main.move new file mode 100644 index 0000000000000..bf3b9fee50c4e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/public_main.move @@ -0,0 +1,4 @@ +script { +public fun main() { +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_address_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_address_names.exp new file mode 100644 index 0000000000000..b4df8d5dafe03 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_address_names.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_address_names.move:1:8 + │ +1 │ module Self::A {} + │ ^^^^ Invalid address name 'Self'. 'Self' is restricted and cannot be used to name an address + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_address_names.move:2:8 + │ +2 │ module vector::A {} + │ ^^^^^^ Invalid address name 'vector'. 'vector' is restricted and cannot be used to name an address diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_address_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_address_names.move new file mode 100644 index 0000000000000..7adb250c5c607 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_address_names.move @@ -0,0 +1,2 @@ +module Self::A {} +module vector::A {} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_alias_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_alias_names.exp new file mode 100644 index 0000000000000..c0ca11b5e66b2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_alias_names.exp @@ -0,0 +1,169 @@ + +Diagnostics: +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:9:16 + │ +9 │ foo as address, + │ ^^^^^^^ Invalid function alias name 'address'. 'address' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:10:16 + │ +10 │ foo as signer, + │ ^^^^^^ Invalid function alias name 'signer'. 'signer' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:11:16 + │ +11 │ foo as u8, + │ ^^ Invalid function alias name 'u8'. 'u8' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:12:16 + │ +12 │ foo as u64, + │ ^^^ Invalid function alias name 'u64'. 'u64' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:13:16 + │ +13 │ foo as u128, + │ ^^^^ Invalid function alias name 'u128'. 'u128' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:14:16 + │ +14 │ foo as vector, + │ ^^^^^^ Invalid function alias name 'vector'. 'vector' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:15:16 + │ +15 │ foo as move_to, + │ ^^^^^^^ Invalid function alias name 'move_to'. 'move_to' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:16:16 + │ +16 │ foo as move_from, + │ ^^^^^^^^^ Invalid function alias name 'move_from'. 'move_from' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:17:16 + │ +17 │ foo as borrow_global, + │ ^^^^^^^^^^^^^ Invalid function alias name 'borrow_global'. 'borrow_global' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:18:16 + │ +18 │ foo as borrow_global_mut, + │ ^^^^^^^^^^^^^^^^^ Invalid function alias name 'borrow_global_mut'. 'borrow_global_mut' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:19:16 + │ +19 │ foo as exists, + │ ^^^^^^ Invalid function alias name 'exists'. 'exists' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:20:16 + │ +20 │ foo as freeze, + │ ^^^^^^ Invalid function alias name 'freeze'. 'freeze' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:21:16 + │ +21 │ foo as assert, + │ ^^^^^^ Invalid function alias name 'assert'. 'assert' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:22:16 + │ +22 │ foo as Self, + │ ^^^^ Invalid function alias name 'Self'. 'Self' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:30:16 + │ +30 │ foo as address, + │ ^^^^^^^ Invalid function alias name 'address'. 'address' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:31:16 + │ +31 │ foo as signer, + │ ^^^^^^ Invalid function alias name 'signer'. 'signer' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:32:16 + │ +32 │ foo as u8, + │ ^^ Invalid function alias name 'u8'. 'u8' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:33:16 + │ +33 │ foo as u64, + │ ^^^ Invalid function alias name 'u64'. 'u64' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:34:16 + │ +34 │ foo as u128, + │ ^^^^ Invalid function alias name 'u128'. 'u128' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:35:16 + │ +35 │ foo as vector, + │ ^^^^^^ Invalid function alias name 'vector'. 'vector' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:36:16 + │ +36 │ foo as move_to, + │ ^^^^^^^ Invalid function alias name 'move_to'. 'move_to' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:37:16 + │ +37 │ foo as move_from, + │ ^^^^^^^^^ Invalid function alias name 'move_from'. 'move_from' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:38:16 + │ +38 │ foo as borrow_global, + │ ^^^^^^^^^^^^^ Invalid function alias name 'borrow_global'. 'borrow_global' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:39:16 + │ +39 │ foo as borrow_global_mut, + │ ^^^^^^^^^^^^^^^^^ Invalid function alias name 'borrow_global_mut'. 'borrow_global_mut' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:40:16 + │ +40 │ foo as exists, + │ ^^^^^^ Invalid function alias name 'exists'. 'exists' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:41:16 + │ +41 │ foo as freeze, + │ ^^^^^^ Invalid function alias name 'freeze'. 'freeze' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:42:16 + │ +42 │ foo as assert, + │ ^^^^^^ Invalid function alias name 'assert'. 'assert' is restricted and cannot be used to name a function alias + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_alias_names.move:43:16 + │ +43 │ foo as Self, + │ ^^^^ Invalid function alias name 'Self'. 'Self' is restricted and cannot be used to name a function alias diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_alias_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_alias_names.move new file mode 100644 index 0000000000000..7c1614dbfa4c6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_alias_names.move @@ -0,0 +1,46 @@ +address 0x2 { + +module N { + fun foo() {} +} + +module M { + use 0x2::N::{ + foo as address, + foo as signer, + foo as u8, + foo as u64, + foo as u128, + foo as vector, + foo as move_to, + foo as move_from, + foo as borrow_global, + foo as borrow_global_mut, + foo as exists, + foo as freeze, + foo as assert, + foo as Self, + }; +} + +} + +script { + use 0x2::N::{ + foo as address, + foo as signer, + foo as u8, + foo as u64, + foo as u128, + foo as vector, + foo as move_to, + foo as move_from, + foo as borrow_global, + foo as borrow_global_mut, + foo as exists, + foo as freeze, + foo as assert, + foo as Self, + }; + fun main() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_constant_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_constant_names.exp new file mode 100644 index 0000000000000..26017e45b477c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_constant_names.exp @@ -0,0 +1,169 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:5:11 + │ +5 │ const address: u64 = 0; + │ ^^^^^^^ Invalid constant name 'address'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:6:11 + │ +6 │ const signer: u64 = 0; + │ ^^^^^^ Invalid constant name 'signer'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:7:11 + │ +7 │ const u8: u64 = 0; + │ ^^ Invalid constant name 'u8'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:8:11 + │ +8 │ const u64: u64 = 0; + │ ^^^ Invalid constant name 'u64'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:9:11 + │ +9 │ const u128: u64 = 0; + │ ^^^^ Invalid constant name 'u128'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:10:11 + │ +10 │ const vector: u64 = 0; + │ ^^^^^^ Invalid constant name 'vector'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:11:11 + │ +11 │ const move_to: u64 = 0; + │ ^^^^^^^ Invalid constant name 'move_to'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:12:11 + │ +12 │ const move_from: u64 = 0; + │ ^^^^^^^^^ Invalid constant name 'move_from'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:13:11 + │ +13 │ const borrow_global: u64 = 0; + │ ^^^^^^^^^^^^^ Invalid constant name 'borrow_global'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:14:11 + │ +14 │ const borrow_global_mut: u64 = 0; + │ ^^^^^^^^^^^^^^^^^ Invalid constant name 'borrow_global_mut'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:15:11 + │ +15 │ const exists: u64 = 0; + │ ^^^^^^ Invalid constant name 'exists'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:16:11 + │ +16 │ const freeze: u64 = 0; + │ ^^^^^^ Invalid constant name 'freeze'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:17:11 + │ +17 │ const assert: u64 = 0; + │ ^^^^^^ Invalid constant name 'assert'. Constant names must start with 'A'..'Z' + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:19:11 + │ +19 │ const Self: u64 = 0; + │ ^^^^ Invalid constant name 'Self'. 'Self' is restricted and cannot be used to name a constant + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:26:11 + │ +26 │ const address: u64 = 0; + │ ^^^^^^^ Invalid constant name 'address'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:27:11 + │ +27 │ const signer: u64 = 0; + │ ^^^^^^ Invalid constant name 'signer'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:28:11 + │ +28 │ const u8: u64 = 0; + │ ^^ Invalid constant name 'u8'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:29:11 + │ +29 │ const u64: u64 = 0; + │ ^^^ Invalid constant name 'u64'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:30:11 + │ +30 │ const u128: u64 = 0; + │ ^^^^ Invalid constant name 'u128'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:31:11 + │ +31 │ const vector: u64 = 0; + │ ^^^^^^ Invalid constant name 'vector'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:32:11 + │ +32 │ const move_to: u64 = 0; + │ ^^^^^^^ Invalid constant name 'move_to'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:33:11 + │ +33 │ const move_from: u64 = 0; + │ ^^^^^^^^^ Invalid constant name 'move_from'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:34:11 + │ +34 │ const borrow_global: u64 = 0; + │ ^^^^^^^^^^^^^ Invalid constant name 'borrow_global'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:35:11 + │ +35 │ const borrow_global_mut: u64 = 0; + │ ^^^^^^^^^^^^^^^^^ Invalid constant name 'borrow_global_mut'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:36:11 + │ +36 │ const exists: u64 = 0; + │ ^^^^^^ Invalid constant name 'exists'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:37:11 + │ +37 │ const freeze: u64 = 0; + │ ^^^^^^ Invalid constant name 'freeze'. Constant names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:38:11 + │ +38 │ const assert: u64 = 0; + │ ^^^^^^ Invalid constant name 'assert'. Constant names must start with 'A'..'Z' + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_constant_names.move:40:11 + │ +40 │ const Self: u64 = 0; + │ ^^^^ Invalid constant name 'Self'. 'Self' is restricted and cannot be used to name a constant diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_constant_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_constant_names.move new file mode 100644 index 0000000000000..1040b00243431 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_constant_names.move @@ -0,0 +1,42 @@ +address 0x2 { + +module M { + // restricted names are invalid due to not starting with A-Z + const address: u64 = 0; + const signer: u64 = 0; + const u8: u64 = 0; + const u64: u64 = 0; + const u128: u64 = 0; + const vector: u64 = 0; + const move_to: u64 = 0; + const move_from: u64 = 0; + const borrow_global: u64 = 0; + const borrow_global_mut: u64 = 0; + const exists: u64 = 0; + const freeze: u64 = 0; + const assert: u64 = 0; + // restricted + const Self: u64 = 0; +} + +} + +script { + // restricted names are invalid due to not starting with A-Z + const address: u64 = 0; + const signer: u64 = 0; + const u8: u64 = 0; + const u64: u64 = 0; + const u128: u64 = 0; + const vector: u64 = 0; + const move_to: u64 = 0; + const move_from: u64 = 0; + const borrow_global: u64 = 0; + const borrow_global_mut: u64 = 0; + const exists: u64 = 0; + const freeze: u64 = 0; + const assert: u64 = 0; + // restricted + const Self: u64 = 0; + fun main() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_function_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_function_names.exp new file mode 100644 index 0000000000000..9d59ec01e4a44 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_function_names.exp @@ -0,0 +1,169 @@ + +Diagnostics: +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:2:9 + │ +2 │ fun address() { abort 0 } + │ ^^^^^^^ Invalid function name 'address'. 'address' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:3:9 + │ +3 │ fun signer() { abort 0 } + │ ^^^^^^ Invalid function name 'signer'. 'signer' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:4:9 + │ +4 │ fun u8() { abort 0 } + │ ^^ Invalid function name 'u8'. 'u8' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:5:9 + │ +5 │ fun u64() { abort 0 } + │ ^^^ Invalid function name 'u64'. 'u64' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:6:9 + │ +6 │ fun u128() { abort 0 } + │ ^^^^ Invalid function name 'u128'. 'u128' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:7:9 + │ +7 │ fun vector() { abort 0 } + │ ^^^^^^ Invalid function name 'vector'. 'vector' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:8:9 + │ +8 │ fun move_to() { abort 0 } + │ ^^^^^^^ Invalid function name 'move_to'. 'move_to' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:9:9 + │ +9 │ fun move_from() { abort 0 } + │ ^^^^^^^^^ Invalid function name 'move_from'. 'move_from' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:10:9 + │ +10 │ fun borrow_global() { abort 0 } + │ ^^^^^^^^^^^^^ Invalid function name 'borrow_global'. 'borrow_global' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:11:9 + │ +11 │ fun borrow_global_mut() { abort 0 } + │ ^^^^^^^^^^^^^^^^^ Invalid function name 'borrow_global_mut'. 'borrow_global_mut' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:12:9 + │ +12 │ fun exists() { abort 0 } + │ ^^^^^^ Invalid function name 'exists'. 'exists' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:13:9 + │ +13 │ fun freeze() { abort 0 } + │ ^^^^^^ Invalid function name 'freeze'. 'freeze' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:14:9 + │ +14 │ fun assert() { abort 0 } + │ ^^^^^^ Invalid function name 'assert'. 'assert' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:15:9 + │ +15 │ fun Self() { abort 0} + │ ^^^^ Invalid function name 'Self'. 'Self' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:18:14 + │ +18 │ script { fun address() { abort 0 } } + │ ^^^^^^^ Invalid function name 'address'. 'address' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:19:14 + │ +19 │ script { fun signer() { abort 0 } } + │ ^^^^^^ Invalid function name 'signer'. 'signer' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:20:14 + │ +20 │ script { fun u8() { abort 0 } } + │ ^^ Invalid function name 'u8'. 'u8' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:21:14 + │ +21 │ script { fun u64() { abort 0 } } + │ ^^^ Invalid function name 'u64'. 'u64' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:22:14 + │ +22 │ script { fun u128() { abort 0 } } + │ ^^^^ Invalid function name 'u128'. 'u128' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:23:14 + │ +23 │ script { fun vector() { abort 0 } } + │ ^^^^^^ Invalid function name 'vector'. 'vector' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:24:14 + │ +24 │ script { fun move_to() { abort 0 } } + │ ^^^^^^^ Invalid function name 'move_to'. 'move_to' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:25:14 + │ +25 │ script { fun move_from() { abort 0 } } + │ ^^^^^^^^^ Invalid function name 'move_from'. 'move_from' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:26:14 + │ +26 │ script { fun borrow_global() { abort 0 } } + │ ^^^^^^^^^^^^^ Invalid function name 'borrow_global'. 'borrow_global' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:27:14 + │ +27 │ script { fun borrow_global_mut() { abort 0 } } + │ ^^^^^^^^^^^^^^^^^ Invalid function name 'borrow_global_mut'. 'borrow_global_mut' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:28:14 + │ +28 │ script { fun exists() { abort 0 } } + │ ^^^^^^ Invalid function name 'exists'. 'exists' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:29:14 + │ +29 │ script { fun freeze() { abort 0 } } + │ ^^^^^^ Invalid function name 'freeze'. 'freeze' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:30:14 + │ +30 │ script { fun assert() { abort 0 } } + │ ^^^^^^ Invalid function name 'assert'. 'assert' is restricted and cannot be used to name a function + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_function_names.move:31:14 + │ +31 │ script { fun Self() { abort 0} } + │ ^^^^ Invalid function name 'Self'. 'Self' is restricted and cannot be used to name a function diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_function_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_function_names.move new file mode 100644 index 0000000000000..05bfbe92b1ead --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_function_names.move @@ -0,0 +1,31 @@ +module 0x8675309::M { + fun address() { abort 0 } + fun signer() { abort 0 } + fun u8() { abort 0 } + fun u64() { abort 0 } + fun u128() { abort 0 } + fun vector() { abort 0 } + fun move_to() { abort 0 } + fun move_from() { abort 0 } + fun borrow_global() { abort 0 } + fun borrow_global_mut() { abort 0 } + fun exists() { abort 0 } + fun freeze() { abort 0 } + fun assert() { abort 0 } + fun Self() { abort 0} +} + +script { fun address() { abort 0 } } +script { fun signer() { abort 0 } } +script { fun u8() { abort 0 } } +script { fun u64() { abort 0 } } +script { fun u128() { abort 0 } } +script { fun vector() { abort 0 } } +script { fun move_to() { abort 0 } } +script { fun move_from() { abort 0 } } +script { fun borrow_global() { abort 0 } } +script { fun borrow_global_mut() { abort 0 } } +script { fun exists() { abort 0 } } +script { fun freeze() { abort 0 } } +script { fun assert() { abort 0 } } +script { fun Self() { abort 0} } diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_alias_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_alias_names.exp new file mode 100644 index 0000000000000..7bd17acc5595e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_alias_names.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_module_alias_names.move:3:20 + │ +3 │ use 0x42::M as Self; + │ ^^^^ Invalid module alias name 'Self'. 'Self' is restricted and cannot be used to name a module alias + +warning: unused alias + ┌─ tests/more-v1/expansion/restricted_module_alias_names.move:5:20 + │ +5 │ use 0x42::M as vector; + │ ^^^^^^ Unused 'use' of alias 'vector'. Consider removing it diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_alias_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_alias_names.move new file mode 100644 index 0000000000000..d772e30e08b96 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_alias_names.move @@ -0,0 +1,6 @@ +module 0x42::M { + // not allowed + use 0x42::M as Self; + // now allowed + use 0x42::M as vector; +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_names.exp new file mode 100644 index 0000000000000..13fbf02334d08 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_names.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_module_names.move:2:14 + │ +2 │ module 0x42::Self {} + │ ^^^^ Invalid module name 'Self'. 'Self' is restricted and cannot be used to name a module diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_names.move new file mode 100644 index 0000000000000..5405c0d33a6b7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_module_names.move @@ -0,0 +1,4 @@ +// not allowed +module 0x42::Self {} +// now allowed +module 0x42::vector {} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_names_valid.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_names_valid.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_names_valid.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_names_valid.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_names_valid.move new file mode 100644 index 0000000000000..441aafb1cf6bb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_names_valid.move @@ -0,0 +1,72 @@ +address 0x2 { +module N { + public fun t(): u64 { 0 } +} + +module M { + use 0x2::N::{ + Self as address, + Self as signer, + Self as u8, + Self as u64, + Self as u128, + // vector now keyworded in expressions, so this would be unusable + // Self as vector, + Self as move_to, + Self as move_from, + Self as borrow_global, + Self as borrow_global_mut, + Self as exists, + Self as freeze, + Self as assert, + }; + + fun t(): u64 { + + let address = 0; + let signer = 0; + let u8 = 0; + let u64 = 0; + let u128 = 0; + // vector now keyworded in expressions, so this would be unusable + // let vector = 0; + let move_to = 0; + let move_from = 0; + let borrow_global = 0; + let borrow_global_mut = 0; + let exists = 0; + let freeze = 0; + let assert = 0; + + address::t() + + signer::t() + + u8::t() + + u64::t() + + u128::t() + + // vector now keyworded in expressions, so this would fail in parsing + // vector::t() + + move_to::t() + + move_from::t() + + borrow_global::t() + + borrow_global_mut::t() + + exists::t() + + freeze::t() + + assert::t(); + + address + + signer + + u8 + + u64 + + u128 + + // vector now keyworded in expressions, so this would fail in parsing + // vector + + move_to + + move_from + + borrow_global + + borrow_global_mut + + exists + + freeze + + assert + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_struct_names.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_struct_names.exp new file mode 100644 index 0000000000000..f6341fa89c352 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_struct_names.exp @@ -0,0 +1,79 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:2:12 + │ +2 │ struct address {} + │ ^^^^^^^ Invalid struct name 'address'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:3:12 + │ +3 │ struct signer {} + │ ^^^^^^ Invalid struct name 'signer'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:4:12 + │ +4 │ struct u8 {} + │ ^^ Invalid struct name 'u8'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:5:12 + │ +5 │ struct u64 {} + │ ^^^ Invalid struct name 'u64'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:6:12 + │ +6 │ struct u128 {} + │ ^^^^ Invalid struct name 'u128'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:7:12 + │ +7 │ struct vector { f: T } + │ ^^^^^^ Invalid struct name 'vector'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:9:12 + │ +9 │ struct move_to {} + │ ^^^^^^^ Invalid struct name 'move_to'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:10:12 + │ +10 │ struct move_from {} + │ ^^^^^^^^^ Invalid struct name 'move_from'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:11:12 + │ +11 │ struct borrow_global {} + │ ^^^^^^^^^^^^^ Invalid struct name 'borrow_global'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:12:12 + │ +12 │ struct borrow_global_mut {} + │ ^^^^^^^^^^^^^^^^^ Invalid struct name 'borrow_global_mut'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:13:12 + │ +13 │ struct exists {} + │ ^^^^^^ Invalid struct name 'exists'. Struct names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:14:12 + │ +14 │ struct freeze {} + │ ^^^^^^ Invalid struct name 'freeze'. Struct names must start with 'A'..'Z' + +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/restricted_struct_names.move:15:12 + │ +15 │ struct Self {} + │ ^^^^ Invalid struct name 'Self'. 'Self' is restricted and cannot be used to name a struct diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_struct_names.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_struct_names.move new file mode 100644 index 0000000000000..ff27f019fc3d9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/restricted_struct_names.move @@ -0,0 +1,16 @@ +module 0x8675309::M { + struct address {} + struct signer {} + struct u8 {} + struct u64 {} + struct u128 {} + struct vector { f: T } + + struct move_to {} + struct move_from {} + struct borrow_global {} + struct borrow_global_mut {} + struct exists {} + struct freeze {} + struct Self {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_in_spec_context.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_in_spec_context.exp new file mode 100644 index 0000000000000..5e7b3c6e4324f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_in_spec_context.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/expansion/spec_block_in_spec_context.move:5:13 + │ +5 │ spec {}; + │ ^^^^^^^ 'spec' blocks cannot be used inside of a spec context diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_in_spec_context.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_in_spec_context.move new file mode 100644 index 0000000000000..c07844a473aca --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_in_spec_context.move @@ -0,0 +1,16 @@ +address 0x42 { +module M { + spec module { + fun S(): () { + spec {}; + } + } + + fun t(): () { + spec {}; + } + + fun a() {} + fun z() {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses.exp new file mode 100644 index 0000000000000..e9ce332b090f0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/expansion/spec_block_uses.move:12:32 + │ +12 │ ensures exists>(0x1) == exists(0x1); + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/expansion/spec_block_uses.move:12:50 + │ +12 │ ensures exists>(0x1) == exists(0x1); + │ ^^^ + +error: `ensures` not allowed in module context + ┌─ tests/more-v1/expansion/spec_block_uses.move:12:9 + │ +12 │ ensures exists>(0x1) == exists(0x1); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses.move new file mode 100644 index 0000000000000..e7ebc0a6b31e6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses.move @@ -0,0 +1,20 @@ +address 0x2 { +module M { + struct S {} + struct R { f: T } + + fun t1(): (R, S) { + abort 0 + } + + spec module { + use 0x2::M::{S as R, R as S}; + ensures exists>(0x1) == exists(0x1); + } + + fun t2(): (R, S) { + abort 0 + } + +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses_shadows_defines.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses_shadows_defines.exp new file mode 100644 index 0000000000000..45e1e9794cb53 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses_shadows_defines.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/expansion/spec_block_uses_shadows_defines.move:16:32 + │ +16 │ ensures exists>(0x1) == exists(0x1); + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/expansion/spec_block_uses_shadows_defines.move:16:50 + │ +16 │ ensures exists>(0x1) == exists(0x1); + │ ^^^ + +error: `ensures` not allowed in module context + ┌─ tests/more-v1/expansion/spec_block_uses_shadows_defines.move:16:9 + │ +16 │ ensures exists>(0x1) == exists(0x1); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses_shadows_defines.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses_shadows_defines.move new file mode 100644 index 0000000000000..26179025eb52c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_block_uses_shadows_defines.move @@ -0,0 +1,24 @@ +address 0x2 { +module M { + struct R1 {} + struct R2 { f: T } + + fun t1(): (R2, R1) { + abort 0 + } + + spec module { + use 0x2::M::{R1 as R, R2 as S}; + // TODO syntax change to move spec heleprs outside of blocks + fun S(): bool { false } + fun R(): bool { false } + + ensures exists>(0x1) == exists(0x1); + } + + fun t2(): (R2, R1) { + abort 0 + } + +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_function_member_conflicts.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_function_member_conflicts.exp new file mode 100644 index 0000000000000..9c1d0cf81f539 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_function_member_conflicts.exp @@ -0,0 +1,46 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_function_member_conflicts.move:7:12 + │ +5 │ fun Foo(): bool { true } + │ --- Alias previously defined here +6 │ } +7 │ struct Foo {} + │ ^^^ Duplicate module member or alias 'Foo'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_function_member_conflicts.move:14:17 + │ +12 │ fun Foo(): bool { true } + │ --- Alias previously defined here +13 │ } +14 │ spec schema Foo { + │ ^^^ Duplicate module member or alias 'Foo'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_function_member_conflicts.move:23:9 + │ +21 │ fun Foo(): bool { true } + │ --- Alias previously defined here +22 │ } +23 │ fun Foo() {} + │ ^^^ Duplicate module member or alias 'Foo'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_function_member_conflicts.move:30:9 + │ +28 │ fun foo(): bool { true } + │ --- Alias previously defined here +29 │ } +30 │ fun foo() {} + │ ^^^ Duplicate module member or alias 'foo'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_function_member_conflicts.move:38:13 + │ +35 │ fun foo(): bool { true } + │ --- Alias previously defined here + · +38 │ fun foo(): bool { true } + │ ^^^ Duplicate module member or alias 'foo'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_function_member_conflicts.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_function_member_conflicts.move new file mode 100644 index 0000000000000..623e437824a52 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_function_member_conflicts.move @@ -0,0 +1,41 @@ +address 0x2 { + +module X1 { + spec module { + fun Foo(): bool { true } + } + struct Foo {} +} + +module X2 { + spec module { + fun Foo(): bool { true } + } + spec schema Foo { + ensures true; + } +} + +module X3 { + spec module { + fun Foo(): bool { true } + } + fun Foo() {} +} + +module X4 { + spec module { + fun foo(): bool { true } + } + fun foo() {} +} + +module X5 { + spec module { + fun foo(): bool { true } + } + spec module { + fun foo(): bool { true } + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_schema_member_conflicts.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_schema_member_conflicts.exp new file mode 100644 index 0000000000000..ebf3d60d1ee1a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_schema_member_conflicts.exp @@ -0,0 +1,37 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_schema_member_conflicts.move:7:12 + │ +4 │ spec schema Foo { + │ --- Alias previously defined here + · +7 │ struct Foo {} + │ ^^^ Duplicate module member or alias 'Foo'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_schema_member_conflicts.move:14:17 + │ +11 │ spec schema Foo { + │ --- Alias previously defined here + · +14 │ spec schema Foo { + │ ^^^ Duplicate module member or alias 'Foo'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_schema_member_conflicts.move:23:9 + │ +20 │ spec schema Foo { + │ --- Alias previously defined here + · +23 │ fun Foo() {} + │ ^^^ Duplicate module member or alias 'Foo'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/spec_schema_member_conflicts.move:31:13 + │ +27 │ spec schema Foo { + │ --- Alias previously defined here + · +31 │ fun Foo(): bool { false } + │ ^^^ Duplicate module member or alias 'Foo'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_schema_member_conflicts.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_schema_member_conflicts.move new file mode 100644 index 0000000000000..0bc5c8d890e55 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/spec_schema_member_conflicts.move @@ -0,0 +1,35 @@ +address 0x2 { + +module X1 { + spec schema Foo { + ensures true; + } + struct Foo {} +} + +module X2 { + spec schema Foo { + ensures true; + } + spec schema Foo { + ensures true; + } +} + +module X3 { + spec schema Foo { + ensures true; + } + fun Foo() {} +} + +module X4 { + spec schema Foo { + ensures true; + } + spec module { + fun Foo(): bool { false } + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_fields.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_fields.exp new file mode 100644 index 0000000000000..79a613885e55a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_fields.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/standalone_fields.move:3:11 + │ +3 │ {f: 1, g: 0}; + │ ^ + │ │ + │ Unexpected ':' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_fields.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_fields.move new file mode 100644 index 0000000000000..f4615afc93541 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_fields.move @@ -0,0 +1,5 @@ +module M { + fun foo() { + {f: 1, g: 0}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_mname_with_type_args.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_mname_with_type_args.exp new file mode 100644 index 0000000000000..d8b9cb0d290bc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_mname_with_type_args.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `M` + ┌─ tests/more-v1/expansion/standalone_mname_with_type_args.move:3:21 + │ +3 │ let _ = 0 + M; + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_mname_with_type_args.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_mname_with_type_args.move new file mode 100644 index 0000000000000..88dad3d31a8c2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_mname_with_type_args.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + fun foo() { + let _ = 0 + M; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_name_with_type_args.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_name_with_type_args.exp new file mode 100644 index 0000000000000..6b542362b8c83 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_name_with_type_args.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `n` + ┌─ tests/more-v1/expansion/standalone_name_with_type_args.move:3:17 + │ +3 │ let _ = n; + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_name_with_type_args.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_name_with_type_args.move new file mode 100644 index 0000000000000..84114721a9fd6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/standalone_name_with_type_args.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + fun foo() { + let _ = n; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/top_level_not_named_main.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/top_level_not_named_main.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/top_level_not_named_main.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/top_level_not_named_main.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/top_level_not_named_main.move new file mode 100644 index 0000000000000..fc7d4932fb9b1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/top_level_not_named_main.move @@ -0,0 +1,4 @@ +script { +fun foo() { +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/type_arguments_on_field_access.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/type_arguments_on_field_access.exp new file mode 100644 index 0000000000000..1f1ba4c262973 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/type_arguments_on_field_access.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/type_arguments_on_field_access.move:6:17 + │ +6 │ x.f; + │ ^ + │ │ + │ Unexpected ';' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/type_arguments_on_field_access.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/type_arguments_on_field_access.move new file mode 100644 index 0000000000000..a9ef62a5c183f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/type_arguments_on_field_access.move @@ -0,0 +1,8 @@ +module M { + struct X {} + struct S { f: X } + fun foo() { + let x = S { f: X{} }; + x.f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_module_alias_in_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_module_alias_in_type.exp new file mode 100644 index 0000000000000..6749e935f7fc2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_module_alias_in_type.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/expansion/unbound_module_alias_in_type.move:2:16 + │ +2 │ fun foo(x: X::T) {} + │ ^ Unbound module or type alias 'X' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_module_alias_in_type.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_module_alias_in_type.move new file mode 100644 index 0000000000000..f6b8471effca2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_module_alias_in_type.move @@ -0,0 +1,3 @@ +module 0x8675309::M { + fun foo(x: X::T) {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_named_address.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_named_address.exp new file mode 100644 index 0000000000000..572dac106a685 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_named_address.exp @@ -0,0 +1,55 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/expansion/unbound_named_address.move:3:9 + │ +3 │ use B::X; + │ ^^^^ Invalid 'use'. Unbound module: '(B=0x42)::X' + +error: address with no value + ┌─ tests/more-v1/expansion/unbound_named_address.move:5:12 + │ +5 │ friend C::M; + │ ^ address 'C' is not assigned a value + +error: address with no value + ┌─ tests/more-v1/expansion/unbound_named_address.move:6:12 + │ +6 │ friend D::M::foo; + │ ^ address 'D' is not assigned a value + +error: unexpected name in this position + ┌─ tests/more-v1/expansion/unbound_named_address.move:6:18 + │ +6 │ friend D::M::foo; + │ ^^^ Unexpected module member access. Expected a module identifier only + +error: address with no value + ┌─ tests/more-v1/expansion/unbound_named_address.move:9:12 + │ +9 │ x: E::M::S, + │ ^ address 'E' is not assigned a value + +error: address with no value + ┌─ tests/more-v1/expansion/unbound_named_address.move:13:17 + │ +13 │ let x = F::M::S {}; + │ ^ address 'F' is not assigned a value + +error: address with no value + ┌─ tests/more-v1/expansion/unbound_named_address.move:14:9 + │ +14 │ G::M::foo(); + │ ^ address 'G' is not assigned a value + +error: address with no value + ┌─ tests/more-v1/expansion/unbound_named_address.move:15:17 + │ +15 │ let c = H::M::C; + │ ^ address 'H' is not assigned a value + +error: address with no value + ┌─ tests/more-v1/expansion/unbound_named_address.move:16:18 + │ +16 │ let a = @I; // suggests declaration + │ ^ address 'I' is not assigned a value. Try assigning it a value when calling the compiler diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_named_address.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_named_address.move new file mode 100644 index 0000000000000..934fb5a113d9d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unbound_named_address.move @@ -0,0 +1,18 @@ +// Unbound address in all cases +module A::M { // suggests declaration + use B::X; + + friend C::M; + friend D::M::foo; + + struct S { + x: E::M::S, + } + + fun foo() { + let x = F::M::S {}; + G::M::foo(); + let c = H::M::C; + let a = @I; // suggests declaration + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_all_field_cases.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_all_field_cases.exp new file mode 100644 index 0000000000000..0fc2634c256ff --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_all_field_cases.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: invalid assignment + ┌─ tests/more-v1/expansion/unpack_all_field_cases.move:11:16 + │ +11 │ S { f: 0, g: 0} = copy s; + │ ^ Invalid assignment syntax. Expected: a local, a field write, or a deconstructing assignment + +error: invalid assignment + ┌─ tests/more-v1/expansion/unpack_all_field_cases.move:12:16 + │ +12 │ S { g: 0, f } = copy s; + │ ^ Invalid assignment syntax. Expected: a local, a field write, or a deconstructing assignment + +error: invalid assignment + ┌─ tests/more-v1/expansion/unpack_all_field_cases.move:13:19 + │ +13 │ S { g, f: 0 } = copy s; + │ ^ Invalid assignment syntax. Expected: a local, a field write, or a deconstructing assignment diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_all_field_cases.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_all_field_cases.move new file mode 100644 index 0000000000000..5de06de653567 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_all_field_cases.move @@ -0,0 +1,15 @@ +module 0x8675309::M { + struct T {} + struct S has copy, drop { f: u64, g: u64 } + fun foo() { + let f; + let g; + let s = S{ f: 0, g: 0}; + T {} = T{}; + T { } = T{}; + S { f, g } = copy s; + S { f: 0, g: 0} = copy s; + S { g: 0, f } = copy s; + S { g, f: 0 } = copy s; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_expr.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_expr.exp new file mode 100644 index 0000000000000..27288e2e8e345 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_expr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/unpack_assign_block_expr.move:4:13 + │ +4 │ S { let f = 0; } = S { f: 0 }; + │ ^^^ + │ │ + │ Unexpected 'let' + │ Expected an identifier diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_expr.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_expr.move new file mode 100644 index 0000000000000..53509f43aa5c1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_expr.move @@ -0,0 +1,6 @@ +module M { + struct S { f: u64 } + fun foo() { + S { let f = 0; } = S { f: 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_single_expr.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_single_expr.exp new file mode 100644 index 0000000000000..7adf50ba574df --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_single_expr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/unpack_assign_block_single_expr.move:4:13 + │ +4 │ S { 0 } = S { f: 0 }; + │ ^ + │ │ + │ Unexpected '0' + │ Expected an identifier diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_single_expr.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_single_expr.move new file mode 100644 index 0000000000000..26d0861123820 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_single_expr.move @@ -0,0 +1,6 @@ +module M { + struct S { f: u64 } + fun foo() { + S { 0 } = S { f: 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_other_expr.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_other_expr.exp new file mode 100644 index 0000000000000..3dc5e2b43765d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_other_expr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/unpack_assign_other_expr.move:9:11 + │ +9 │ S f = S { f: 0 }; + │ ^ + │ │ + │ Unexpected 'f' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_other_expr.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_other_expr.move new file mode 100644 index 0000000000000..ccaf27d7b87a8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/unpack_assign_other_expr.move @@ -0,0 +1,14 @@ +module M { + struct G {} + struct S { f: u64 } + fun foo() { + let f: u64; + S ( f ) = S { f: 0 }; + + let f: u64; + S f = S { f: 0 }; + + G () = G {}; + G {{}} = G{}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function.move new file mode 100644 index 0000000000000..0c705c6aca197 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function.move @@ -0,0 +1,29 @@ +address 0x2 { +module X { + public fun u(): u64 { + 0 + } + public fun a(): address { + @0x0 + } + public fun bar() {} +} + +module M { + use 0x2::X::{u, u as U, u as get_u, a, a as A, a as get_a}; + fun t() { + (u(): u64); + (U(): u64); + (get_u(): u64); + (a(): address); + (A(): address); + (get_a(): address); + } + + use 0x2::X::bar as baz; + fun bar() { + baz() + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_overlap_with_module.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_overlap_with_module.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_overlap_with_module.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_overlap_with_module.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_overlap_with_module.move new file mode 100644 index 0000000000000..56c85bf2926c3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_overlap_with_module.move @@ -0,0 +1,13 @@ +address 0x2 { +module X { + public fun u() {} +} + +module M { + use 0x2::X::{Self, u as X}; + fun foo() { + X(); + X::u() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_function.exp new file mode 100644 index 0000000000000..07aff1144a381 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_function.exp @@ -0,0 +1,24 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_function_same_name_as_function.move:10:9 + │ + 9 │ use 0x2::X::u; + │ - Alias previously defined here +10 │ fun u() { + │ ^ Duplicate module member or alias 'u'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/expansion/use_function_same_name_as_function.move:17:22 + │ +17 │ use 0x2::X::u as bar; + │ ^^^ Unused 'use' of alias 'bar'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_function_same_name_as_function.move:17:22 + │ +15 │ fun bar() { + │ --- Alias previously defined here +16 │ } +17 │ use 0x2::X::u as bar; + │ ^^^ Duplicate module member or alias 'bar'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_function.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_function.move new file mode 100644 index 0000000000000..30683c18e6b6b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_function.move @@ -0,0 +1,20 @@ +address 0x2 { +module X { + public fun u(): u64 { + 0 + } +} + +module M { + use 0x2::X::u; + fun u() { + } +} + +module N { + fun bar() { + } + use 0x2::X::u as bar; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_struct.exp new file mode 100644 index 0000000000000..f4a1994ae68c9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_struct.exp @@ -0,0 +1,27 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_function_same_name_as_struct.move:9:17 + │ +9 │ use 0x2::X::u; + │ ^ Unused 'use' of alias 'u'. Consider removing it + +error: invalid name + ┌─ tests/more-v1/expansion/use_function_same_name_as_struct.move:10:12 + │ +10 │ struct u {} + │ ^ Invalid struct name 'u'. Struct names must start with 'A'..'Z' + +warning: unused alias + ┌─ tests/more-v1/expansion/use_function_same_name_as_struct.move:15:22 + │ +15 │ use 0x2::X::u as Bar; + │ ^^^ Unused 'use' of alias 'Bar'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_function_same_name_as_struct.move:15:22 + │ +14 │ struct Bar {} + │ --- Alias previously defined here +15 │ use 0x2::X::u as Bar; + │ ^^^ Duplicate module member or alias 'Bar'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_struct.move new file mode 100644 index 0000000000000..b899be77f6f9c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_struct.move @@ -0,0 +1,18 @@ +address 0x2 { +module X { + public fun u(): u64 { + 0 + } +} + +module M { + use 0x2::X::u; + struct u {} +} + +module N { + struct Bar {} + use 0x2::X::u as Bar; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_tparam_shadows.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_tparam_shadows.exp new file mode 100644 index 0000000000000..42e6105cb7b5f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_tparam_shadows.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_function_tparam_shadows.move:7:17 + │ +7 │ use 0x2::X::foo; + │ ^^^ Unused 'use' of alias 'foo'. Consider removing it + +error: no function named `foo` found + ┌─ tests/more-v1/expansion/use_function_tparam_shadows.move:10:9 + │ +10 │ foo() + │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_tparam_shadows.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_tparam_shadows.move new file mode 100644 index 0000000000000..6cd4d9f507497 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_tparam_shadows.move @@ -0,0 +1,13 @@ +address 0x2 { +module X { + fun foo() {} +} + +module M { + use 0x2::X::foo; + + fun bar() { + foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_unbound.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_unbound.exp new file mode 100644 index 0000000000000..4d9f2b1ef2a58 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_unbound.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unbound module member + ┌─ tests/more-v1/expansion/use_function_unbound.move:6:17 + │ +2 │ module X { + │ - Module '0x2::X' declared here + · +6 │ use 0x2::X::u; + │ ^ Invalid 'use'. Unbound member 'u' in module '0x2::X' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_unbound.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_unbound.move new file mode 100644 index 0000000000000..4824e058bd978 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_function_unbound.move @@ -0,0 +1,12 @@ +address 0x2 { +module X { +} + +module M { + use 0x2::X::u; + + fun bar() { + u() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope.move new file mode 100644 index 0000000000000..db3f09095d176 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope.move @@ -0,0 +1,27 @@ +address 0x2 { +module M { + struct S1 has drop { b: bool } + struct S2 has drop { u: u64 } + fun check(): bool { + false + } + fun num(): u64 { + 0 + } + + fun t() { + use 0x2::M::{check as num, num as check, S1 as S2, S2 as S1}; + num() && false; + check() + 1; + S1 { u: 0 }; + S2 { b: false }; + { + use 0x2::M::{check, num, S1, S2}; + check() && false; + num() + 1; + S2 { u: 0 }; + S1 { b: false }; + } + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_duplicates.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_duplicates.exp new file mode 100644 index 0000000000000..e2f9bab83364c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_duplicates.exp @@ -0,0 +1,29 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_inner_scope_duplicates.move:13:43 + │ +13 │ use 0x2::M::{check as foo, num as foo}; + │ ^^^ Unused 'use' of alias 'foo'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_inner_scope_duplicates.move:13:43 + │ +13 │ use 0x2::M::{check as foo, num as foo}; + │ --- ^^^ Duplicate module member or alias 'foo'. Top level names in a namespace must be unique + │ │ + │ Alias previously defined here + +warning: unused alias + ┌─ tests/more-v1/expansion/use_inner_scope_duplicates.move:15:23 + │ +15 │ use 0x2::M as N; + │ ^ Unused 'use' of alias 'N'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_inner_scope_duplicates.move:15:23 + │ +14 │ use 0x2::M as N; + │ - Alias previously defined here +15 │ use 0x2::M as N; + │ ^ Duplicate module alias 'N'. Module aliases must be unique within a given namespace diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_duplicates.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_duplicates.move new file mode 100644 index 0000000000000..14998f052c828 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_duplicates.move @@ -0,0 +1,19 @@ +address 0x2 { +module M { + struct S1 { b: bool } + struct S2 { u: u64 } + fun check(): bool { + false + } + fun num(): u64 { + 0 + } + + fun t() { + use 0x2::M::{check as foo, num as foo}; + use 0x2::M as N; + use 0x2::M as N; + + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_invalid.exp new file mode 100644 index 0000000000000..941dfcb72b4e4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_invalid.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: invalid use of reserved name + ┌─ tests/more-v1/expansion/use_inner_scope_invalid.move:17:23 + │ +17 │ use 0x2::M as Self; + │ ^^^^ Invalid module alias name 'Self'. 'Self' is restricted and cannot be used to name a module alias + +error: invalid name + ┌─ tests/more-v1/expansion/use_inner_scope_invalid.move:18:28 + │ +18 │ use 0x2::M::{S1 as s1, Foo as foo}; + │ ^^ Invalid struct alias name 's1'. Struct alias names must start with 'A'..'Z' + +error: invalid name + ┌─ tests/more-v1/expansion/use_inner_scope_invalid.move:18:39 + │ +18 │ use 0x2::M::{S1 as s1, Foo as foo}; + │ ^^^ Invalid schema alias name 'foo'. Schema alias names must start with 'A'..'Z' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_invalid.move new file mode 100644 index 0000000000000..188d6103e0672 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_invalid.move @@ -0,0 +1,22 @@ +address 0x2 { +module M { + struct S1 { b: bool } + struct S2 { u: u64 } + fun check(): bool { + false + } + fun num(): u64 { + 0 + } + + spec schema Foo { + ensures true; + } + + fun t() { + use 0x2::M as Self; + use 0x2::M::{S1 as s1, Foo as foo}; + + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_shadows.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_shadows.exp new file mode 100644 index 0000000000000..03a309fd9897f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_shadows.exp @@ -0,0 +1,12 @@ + +Diagnostics: +note: unused schema M::Foo + ┌─ tests/more-v1/expansion/use_inner_scope_shadows.move:12:5 + │ +12 │ ╭ spec schema Foo { +13 │ │ ensures true; +14 │ │ } + │ ╰─────^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_shadows.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_shadows.move new file mode 100644 index 0000000000000..d7b8cfae19821 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_shadows.move @@ -0,0 +1,42 @@ +address 0x2 { +module M { + struct S1 has drop { b: bool } + struct S2 has drop { u: u64 } + struct S3 has drop { a: address } + fun check(): bool { + false + } + fun num(u: u64): u64 { + u + 1 + } + spec schema Foo { + ensures true; + } + + fun t(): S3 { + use 0x2::M::{check as num, num as t, S1 as S2, S2 as Foo, S3 as T}; + num() && true; + t(0) + 1; + S2 { b: false }; + Foo { u: 0 }; + T { a: @0x0 } + } + + fun t2(x: T) { + { + use 0x2::M::{check as num, num as t, S1 as S2, S2 as Foo, S3 as T}; + num() && true; + t(0) + 1; + S2 { b: false }; + Foo { u: 0 }; + T { a: @0x0 } + }; + check() && true; + num(0) + 1; + t2(x); + S1 { b: false }; + S2 { u: 0 }; + S3 { a: @0x0 }; + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unbound.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unbound.exp new file mode 100644 index 0000000000000..050d918f03c94 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unbound.exp @@ -0,0 +1,16 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/expansion/use_inner_scope_unbound.move:13:13 + │ +13 │ use 0x2::N; + │ ^^^^^^ Invalid 'use'. Unbound module: '0x2::N' + +error: unbound module member + ┌─ tests/more-v1/expansion/use_inner_scope_unbound.move:14:21 + │ + 2 │ module M { + │ - Module '0x2::M' declared here + · +14 │ use 0x2::M::foo; + │ ^^^ Invalid 'use'. Unbound member 'foo' in module '0x2::M' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unbound.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unbound.move new file mode 100644 index 0000000000000..3675df1e5b4d7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unbound.move @@ -0,0 +1,18 @@ +address 0x2 { +module M { + struct S1 { b: bool } + struct S2 { u: u64 } + fun check(): bool { + false + } + fun num(): u64 { + 0 + } + + fun t() { + use 0x2::N; + use 0x2::M::foo; + + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unused.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unused.exp new file mode 100644 index 0000000000000..96bb50e6f94a6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unused.exp @@ -0,0 +1,22 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_inner_scope_unused.move:13:23 + │ +13 │ use 0x2::M as X; + │ ^ Unused 'use' of alias 'X'. Consider removing it + +warning: unused alias + ┌─ tests/more-v1/expansion/use_inner_scope_unused.move:14:31 + │ +14 │ use 0x2::M::{check as f, S1 as S8}; + │ ^ Unused 'use' of alias 'f'. Consider removing it + +warning: unused alias + ┌─ tests/more-v1/expansion/use_inner_scope_unused.move:14:40 + │ +14 │ use 0x2::M::{check as f, S1 as S8}; + │ ^^ Unused 'use' of alias 'S8'. Consider removing it + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unused.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unused.move new file mode 100644 index 0000000000000..8f7804586c642 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unused.move @@ -0,0 +1,18 @@ +address 0x2 { +module M { + struct S1 { b: bool } + struct S2 { u: u64 } + fun check(): bool { + false + } + fun num(): u64 { + 0 + } + + fun t() { + use 0x2::M as X; + use 0x2::M::{check as f, S1 as S8}; + + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self.move new file mode 100644 index 0000000000000..21cdb9ac61c68 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self.move @@ -0,0 +1,15 @@ +address 0x2 { +module X { + struct S {} + public fun foo() {} +} + +module M { + use 0x2::X::Self; + + struct S { f: X::S } + fun foo() { + X::foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as.move new file mode 100644 index 0000000000000..95a5be8518114 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as.move @@ -0,0 +1,16 @@ +address 0x2 { + module X { + struct S {} + public fun foo() {} + } + + module M { + use 0x2::X::{Self as B, foo, S}; + + struct X { f: B::S, f2: S } + fun bar() { + B::foo(); + foo() + } + } + } diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid.exp new file mode 100644 index 0000000000000..a3917dfeee3f3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_nested_self_as_invalid.move:8:26 + │ +8 │ use 0x2::X::{Self as B, foo, S}; + │ ^ Unused 'use' of alias 'B'. Consider removing it + +error: unbound module + ┌─ tests/more-v1/expansion/use_nested_self_as_invalid.move:12:9 + │ +12 │ X::foo(); + │ ^ Unbound module or type alias 'X' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid.move new file mode 100644 index 0000000000000..aee8cbf91bd5d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid.move @@ -0,0 +1,16 @@ +address 0x2 { +module X { + struct S {} + public fun foo() {} +} + +module M { + use 0x2::X::{Self as B, foo, S}; + + struct X { f: X::S, f2: S } + fun bar() { + X::foo(); + foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.exp new file mode 100644 index 0000000000000..1c31a70df0708 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_nested_self_as_invalid2.move:8:26 + │ +8 │ use 0x2::X::{Self as B, foo, S}; + │ ^ Unused 'use' of alias 'B'. Consider removing it + +error: variants not allowed in this context + ┌─ tests/more-v1/expansion/use_nested_self_as_invalid2.move:10:19 + │ +10 │ struct X { f: X::S, f2: S } + │ ^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.move new file mode 100644 index 0000000000000..58bb11f6ca5c1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.move @@ -0,0 +1,16 @@ +address 0x2 { +module X { + struct S {} + public fun foo() {} +} + +module M { + use 0x2::X::{Self as B, foo, S}; + + struct X { f: X::S, f2: S } + fun bar() { + // X::foo(); + foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_duplicate.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_duplicate.exp new file mode 100644 index 0000000000000..c1a2fefe28dd3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_duplicate.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_nested_self_duplicate.move:9:14 + │ +8 │ use 0x2::X; + │ - Alias previously defined here +9 │ use 0x2::X::Self; + │ ^ Duplicate module alias 'X'. Module aliases must be unique within a given namespace diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_duplicate.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_duplicate.move new file mode 100644 index 0000000000000..e3132e781dfa9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_duplicate.move @@ -0,0 +1,16 @@ +address 0x2 { +module X { + struct S {} + public fun foo() {} +} + +module M { + use 0x2::X; + use 0x2::X::Self; + + struct S { f: X::S } + fun foo() { + X::foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function.move new file mode 100644 index 0000000000000..170f9cdf2e0f1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function.move @@ -0,0 +1,20 @@ +address 0x2 { +module X { + spec module { + fun foo(): bool { true } + fun bar(): bool { true } + } +} + +module M { + use 0x2::X::{foo, bar as baz}; + fun t() { + } + + spec t { + ensures foo(); + ensures baz(); + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function_as_normal_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function_as_normal_function.exp new file mode 100644 index 0000000000000..8f8735e26b9c8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function_as_normal_function.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/use_spec_function_as_normal_function.move:4:16 + │ +4 │ define foo(): bool { true } + │ ^^^ + │ │ + │ Unexpected 'foo' + │ Expected ':' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function_as_normal_function.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function_as_normal_function.move new file mode 100644 index 0000000000000..65160cc131844 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_function_as_normal_function.move @@ -0,0 +1,17 @@ +address 0x2 { +module X { + spec module { + define foo(): bool { true } + define bar(): bool { true } + } +} + +module M { + use 0x2::X::{foo, bar as baz}; + fun t() { + foo(); + baz(); + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema.exp new file mode 100644 index 0000000000000..ee36d9089644a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema.exp @@ -0,0 +1,29 @@ + +Diagnostics: +note: unused schema X::Foo + ┌─ tests/more-v1/expansion/use_spec_schema.move:3:5 + │ +3 │ ╭ spec schema Foo { +4 │ │ ensures true; +5 │ │ } + │ ╰─────^ + +note: unused schema X::Bar + ┌─ tests/more-v1/expansion/use_spec_schema.move:7:5 + │ +7 │ ╭ spec schema Bar { +8 │ │ ensures true; +9 │ │ } + │ ╰─────^ + +error: the `apply` schema weaving operator can only be used inside a `spec module` block + ┌─ tests/more-v1/expansion/use_spec_schema.move:19:9 + │ +19 │ apply Foo to t; + │ ^^^^^^^^^^^^^^^^^^ + +error: the `apply` schema weaving operator can only be used inside a `spec module` block + ┌─ tests/more-v1/expansion/use_spec_schema.move:20:9 + │ +20 │ apply Baz to t; + │ ^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema.move new file mode 100644 index 0000000000000..6e697daf890e6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema.move @@ -0,0 +1,24 @@ +address 0x2 { +module X { + spec schema Foo { + ensures true; + } + + spec schema Bar { + ensures true; + } +} + +module M { + use 0x2::X::{Foo, Bar as Baz}; + struct S {} + fun t() { + } + + spec t { + apply Foo to t; + apply Baz to t; + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_as_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_as_struct.exp new file mode 100644 index 0000000000000..9d02cf2fc44b4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_as_struct.exp @@ -0,0 +1,21 @@ + +Diagnostics: +note: unused schema X::Foo + ┌─ tests/more-v1/expansion/use_spec_schema_as_struct.move:3:5 + │ +3 │ ╭ spec schema Foo { +4 │ │ ensures true; +5 │ │ } + │ ╰─────^ + +error: type cannot have type arguments + ┌─ tests/more-v1/expansion/use_spec_schema_as_struct.move:10:14 + │ +10 │ fun t(): Foo { + │ ^^^ + +error: undeclared `0x2::X::Foo` + ┌─ tests/more-v1/expansion/use_spec_schema_as_struct.move:10:14 + │ +10 │ fun t(): Foo { + │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_as_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_as_struct.move new file mode 100644 index 0000000000000..6a14ba51e9a22 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_as_struct.move @@ -0,0 +1,15 @@ +address 0x2 { +module X { + spec schema Foo { + ensures true; + } +} + +module M { + use 0x2::X::Foo; + fun t(): Foo { + abort 0 + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_invalid_as.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_invalid_as.exp new file mode 100644 index 0000000000000..8735ec5b42ed5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_invalid_as.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid name + ┌─ tests/more-v1/expansion/use_spec_schema_invalid_as.move:9:25 + │ +9 │ use 0x2::X::{Foo as foo}; + │ ^^^ Invalid schema alias name 'foo'. Schema alias names must start with 'A'..'Z' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_invalid_as.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_invalid_as.move new file mode 100644 index 0000000000000..862da74d0c173 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_spec_schema_invalid_as.move @@ -0,0 +1,17 @@ +address 0x2 { +module X { + spec schema Foo { + ensures true; + } +} + +module M { + use 0x2::X::{Foo as foo}; + struct S {} + + spec t { + apply foo to t; + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct.move new file mode 100644 index 0000000000000..19a13670db16d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct.move @@ -0,0 +1,21 @@ +address 0x2 { +module X { + struct U {} + struct R {} +} + +module M { + use 0x2::X::{U, U as U2}; + + fun f(u: U, r: R) { + g(u, r) + } + + fun g(u: U2, r: R2) { + f(u, r) + } + + use 0x2::X::{R, R as R2}; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_invalid_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_invalid_name.exp new file mode 100644 index 0000000000000..8a64219c3ab89 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_invalid_name.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unbound module member + ┌─ tests/more-v1/expansion/use_struct_invalid_name.move:7:17 + │ +2 │ module X { + │ - Module '0x2::X' declared here + · +7 │ use 0x2::X::u; + │ ^ Invalid 'use'. Unbound member 'u' in module '0x2::X' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_invalid_name.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_invalid_name.move new file mode 100644 index 0000000000000..80a1a213ac1aa --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_invalid_name.move @@ -0,0 +1,10 @@ +address 0x2 { +module X { + struct S {} +} + +module M { + use 0x2::X::u; + struct X { f: u } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_overlap_with_module.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_overlap_with_module.exp new file mode 100644 index 0000000000000..ea5bd62d87125 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_overlap_with_module.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_struct_overlap_with_module.move:7:14 + │ +7 │ use 0x2::X::{Self, S as X}; + │ ^ Unused 'use' of alias 'X'. Consider removing it + +error: variants not allowed in this context + ┌─ tests/more-v1/expansion/use_struct_overlap_with_module.move:8:27 + │ +8 │ struct A { f1: X, f2: X::S } + │ ^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_overlap_with_module.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_overlap_with_module.move new file mode 100644 index 0000000000000..b5bf9a383661b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_overlap_with_module.move @@ -0,0 +1,10 @@ +address 0x2 { +module X { + struct S {} +} + +module M { + use 0x2::X::{Self, S as X}; + struct A { f1: X, f2: X::S } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_function.exp new file mode 100644 index 0000000000000..7453adb0ba371 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_function.exp @@ -0,0 +1,49 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_function.move:10:9 + │ + 8 │ use 0x2::X::{U, U as U2}; + │ - Alias previously defined here + 9 │ +10 │ fun U() {} + │ ^ Duplicate module member or alias 'U'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_function.move:11:9 + │ + 8 │ use 0x2::X::{U, U as U2}; + │ -- Alias previously defined here + · +11 │ fun U2() {} + │ ^^ Duplicate module member or alias 'U2'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/expansion/use_struct_same_name_as_function.move:15:18 + │ +15 │ use 0x2::X::{R, R as R2}; + │ ^ Unused 'use' of alias 'R'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_function.move:15:18 + │ +12 │ fun R() {} + │ - Alias previously defined here + · +15 │ use 0x2::X::{R, R as R2}; + │ ^ Duplicate module member or alias 'R'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/expansion/use_struct_same_name_as_function.move:15:26 + │ +15 │ use 0x2::X::{R, R as R2}; + │ ^^ Unused 'use' of alias 'R2'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_function.move:15:26 + │ +13 │ fun R2() {} + │ -- Alias previously defined here +14 │ +15 │ use 0x2::X::{R, R as R2}; + │ ^^ Duplicate module member or alias 'R2'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_function.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_function.move new file mode 100644 index 0000000000000..417a475de9cad --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_function.move @@ -0,0 +1,18 @@ +address 0x2 { +module X { + struct U {} + struct R {} +} + +module M { + use 0x2::X::{U, U as U2}; + + fun U() {} + fun U2() {} + fun R() {} + fun R2() {} + + use 0x2::X::{R, R as R2}; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_struct.exp new file mode 100644 index 0000000000000..cb370e24327a6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_struct.exp @@ -0,0 +1,49 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_struct.move:10:12 + │ + 8 │ use 0x2::X::{U, U as U2}; + │ - Alias previously defined here + 9 │ +10 │ struct U {} + │ ^ Duplicate module member or alias 'U'. Top level names in a namespace must be unique + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_struct.move:11:12 + │ + 8 │ use 0x2::X::{U, U as U2}; + │ -- Alias previously defined here + · +11 │ struct U2 {} + │ ^^ Duplicate module member or alias 'U2'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/expansion/use_struct_same_name_as_struct.move:15:18 + │ +15 │ use 0x2::X::{R, R as R2}; + │ ^ Unused 'use' of alias 'R'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_struct.move:15:18 + │ +13 │ struct R {} + │ - Alias previously defined here +14 │ +15 │ use 0x2::X::{R, R as R2}; + │ ^ Duplicate module member or alias 'R'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/expansion/use_struct_same_name_as_struct.move:15:26 + │ +15 │ use 0x2::X::{R, R as R2}; + │ ^^ Unused 'use' of alias 'R2'. Consider removing it + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/expansion/use_struct_same_name_as_struct.move:15:26 + │ +12 │ struct R2 {} + │ -- Alias previously defined here + · +15 │ use 0x2::X::{R, R as R2}; + │ ^^ Duplicate module member or alias 'R2'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_struct.move new file mode 100644 index 0000000000000..d7a1c8cccb96b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_struct.move @@ -0,0 +1,18 @@ +address 0x2 { +module X { + struct U {} + struct R {} +} + +module M { + use 0x2::X::{U, U as U2}; + + struct U {} + struct U2 {} + struct R2 {} + struct R {} + + use 0x2::X::{R, R as R2}; +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_tparam_shadows.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_tparam_shadows.exp new file mode 100644 index 0000000000000..ab068b5a5bc7d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_tparam_shadows.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: cannot return `S` from a function with result type `X::S` + ┌─ tests/more-v1/expansion/use_struct_tparam_shadows.move:12:9 + │ +12 │ x + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_tparam_shadows.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_tparam_shadows.move new file mode 100644 index 0000000000000..cb5090274132b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_tparam_shadows.move @@ -0,0 +1,15 @@ +address 0x2 { +module X { + struct S {} +} + +module M { + use 0x2::X::S; + + struct X { f: S } + + fun foo(x: S): 0x2::X::S { + x + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_unbound.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_unbound.exp new file mode 100644 index 0000000000000..e4784b0c72eeb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_unbound.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unbound module member + ┌─ tests/more-v1/expansion/use_struct_unbound.move:6:17 + │ +2 │ module X { + │ - Module '0x2::X' declared here + · +6 │ use 0x2::X::S; + │ ^ Invalid 'use'. Unbound member 'S' in module '0x2::X' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_unbound.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_unbound.move new file mode 100644 index 0000000000000..e84aec5dde598 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_struct_unbound.move @@ -0,0 +1,10 @@ +address 0x2 { +module X { +} + +module M { + use 0x2::X::S; + + struct X { f: S } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/weird_apply_assign.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/weird_apply_assign.exp new file mode 100644 index 0000000000000..97a43642a2c26 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/weird_apply_assign.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/expansion/weird_apply_assign.move:7:11 + │ +7 │ S f = S { f: 0 }; + │ ^ + │ │ + │ Unexpected 'f' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/weird_apply_assign.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/weird_apply_assign.move new file mode 100644 index 0000000000000..97b17a761bd6a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/weird_apply_assign.move @@ -0,0 +1,9 @@ +module M { + struct S { f: u64 } + fun foo() { + let f: u64; + { f } = S { f: 0 }; + + S f = S { f: 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/copy_after_move.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/copy_after_move.exp new file mode 100644 index 0000000000000..2bdda8f8fa69e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/copy_after_move.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/liveness/copy_after_move.move:4:9 + │ +4 │ move x; + │ ^^^^^^ attempted to move here +5 │ copy x; + │ ------ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/copy_after_move.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/copy_after_move.move new file mode 100644 index 0000000000000..5d88b7157627c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/copy_after_move.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + fun t0() { + let x = 0; + move x; + copy x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch.move new file mode 100644 index 0000000000000..c6a2b28b585cf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch.move @@ -0,0 +1,54 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + *x_ref = 0; + }; + _ = x; + _ = move x; + } + + fun t1(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + } else { + *x_ref = 0; + }; + _ = x; + _ = move x; + } + + fun t2(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + *move x_ref = 0; + }; + _ = x; + _ = move x; + } + + fun t3(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + *move x_ref = 0; + } else { + _ = move x_ref; + }; + _ = x; + _ = move x; + } + + fun t4(cond: bool) { + let x = cond; + let x_ref = &x; + if (*x_ref) { + } else { + }; + _ = x; + _ = move x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both.move new file mode 100644 index 0000000000000..54aed54badf7b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both.move @@ -0,0 +1,26 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + *x_ref = 0; + } else { + _ = x_ref; + }; + _ = x; + _ = move x; + } + + fun t1(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + _ = x_ref; + } else { + *x_ref = 0; + }; + _ = x; + _ = move x; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both_invalid.exp new file mode 100644 index 0000000000000..59718b6b99cfd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both_invalid.exp @@ -0,0 +1,47 @@ + +Diagnostics: +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_both_invalid.move:10:9 + │ + 4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · +10 │ _ = x; + │ ^ copy attempted here +11 │ _ = move x; +12 │ *x_ref = 0; + │ ---------- conflicting reference `x_ref` used here + +error: cannot move local `x` which is still borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_both_invalid.move:11:13 + │ + 4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · +11 │ _ = move x; + │ ^^^^^^ move attempted here +12 │ *x_ref = 0; + │ ---------- conflicting reference `x_ref` used here + +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_both_invalid.move:23:9 + │ +17 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · +23 │ _ = x; + │ ^ copy attempted here +24 │ _ = move x; +25 │ _ = *x_ref; + │ ------ conflicting reference `x_ref` used here + +error: cannot move local `x` which is still borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_both_invalid.move:24:13 + │ +17 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · +24 │ _ = move x; + │ ^^^^^^ move attempted here +25 │ _ = *x_ref; + │ ------ conflicting reference `x_ref` used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both_invalid.move new file mode 100644 index 0000000000000..120725fe4003d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both_invalid.move @@ -0,0 +1,28 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + *x_ref = 0; + } else { + _ = x_ref; + }; + _ = x; + _ = move x; + *x_ref = 0; + } + + fun t1(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + _ = x_ref; + } else { + *x_ref = 0; + }; + _ = x; + _ = move x; + _ = *x_ref; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_invalid.exp new file mode 100644 index 0000000000000..0e5d4fef001ca --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_invalid.exp @@ -0,0 +1,47 @@ + +Diagnostics: +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_invalid.move:8:9 + │ + 4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · + 8 │ _ = x; + │ ^ copy attempted here + 9 │ _ = move x; +10 │ *x_ref = 0; + │ ---------- conflicting reference `x_ref` used here + +error: cannot move local `x` which is still borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_invalid.move:9:13 + │ + 4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · + 9 │ _ = move x; + │ ^^^^^^ move attempted here +10 │ *x_ref = 0; + │ ---------- conflicting reference `x_ref` used here + +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_invalid.move:20:9 + │ +15 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · +20 │ _ = x; + │ ^ copy attempted here +21 │ _ = move x; +22 │ _ = *x_ref; + │ ------ conflicting reference `x_ref` used here + +error: cannot move local `x` which is still borrowed + ┌─ tests/more-v1/liveness/dead_refs_branch_invalid.move:21:13 + │ +15 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · +21 │ _ = move x; + │ ^^^^^^ move attempted here +22 │ _ = *x_ref; + │ ------ conflicting reference `x_ref` used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_invalid.move new file mode 100644 index 0000000000000..f3f5dad35b600 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_invalid.move @@ -0,0 +1,25 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + *x_ref = 0; + }; + _ = x; + _ = move x; + *x_ref = 0; + } + + fun t1(cond: bool) { + let x = 0; + let x_ref = &mut x; + if (cond) { + } else { + *x_ref = 0; + }; + _ = x; + _ = move x; + _ = *x_ref; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop.move new file mode 100644 index 0000000000000..f90eac37daecc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop.move @@ -0,0 +1,43 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + while (cond) { + _ = x_ref; + }; + _ = x; + _ = move x; + } + + fun t1() { + let x = 0; + let x_ref = &mut x; + loop { + _ = x_ref; + break + }; + _ = x; + _ = move x; + } + + fun t2(cond: bool) { + let x = 0; + let x_ref = &mut x; + loop { + if (cond) break else { _ = x_ref; } + }; + _ = x; + _ = move x; + } + + fun t4(cond: bool) { + let x = cond; + let x_ref = &x; + while (*x_ref) { + + }; + _ = x; + _ = move x; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop_invalid.exp new file mode 100644 index 0000000000000..7f00a7aa3c531 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop_invalid.exp @@ -0,0 +1,34 @@ + +Diagnostics: +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_loop_invalid.move:6:13 + │ +4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +5 │ while (cond) { +6 │ _ = x; + │ ^ copy attempted here +7 │ _ = x_ref; + │ - conflicting reference `x_ref` used here + +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_loop_invalid.move:16:12 + │ +13 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +14 │ loop { +15 │ _ = x_ref; + │ - conflicting reference `x_ref` used here +16 │ _ = x; + │ ^ copy attempted here + +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_loop_invalid.move:25:13 + │ +22 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +23 │ loop { +24 │ if (cond) break else { _ = x_ref; }; + │ - conflicting reference `x_ref` used here +25 │ _ = x; + │ ^ copy attempted here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop_invalid.move new file mode 100644 index 0000000000000..9d7473ec352f6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_loop_invalid.move @@ -0,0 +1,28 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + while (cond) { + _ = x; + _ = x_ref; + } + } + + fun t1() { + let x = 0; + let x_ref = &mut x; + loop { + _ = x_ref; + _ = x; + } + } + + fun t2(cond: bool) { + let x = 0; + let x_ref = &mut x; + loop { + if (cond) break else { _ = x_ref; }; + _ = x; + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested.move new file mode 100644 index 0000000000000..ccb1d953fa8cf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested.move @@ -0,0 +1,36 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + while (cond) { + while (cond) { + _ = x_ref + } + }; + _ = x; + _ = move x; + } + + fun t1() { + let x = 0; + let x_ref = &mut x; + loop { + _ = x_ref; + loop { + _ = x_ref; + break + }; + break + }; + _ = x; + _ = move x; + } + + fun t2(cond: bool) { + let x = 0; + let x_ref = &mut x; + loop { + if (cond) { _ = x; break } else { while (!cond) { _ = x_ref } } + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested_invalid.exp new file mode 100644 index 0000000000000..59800ddbffb18 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested_invalid.exp @@ -0,0 +1,36 @@ + +Diagnostics: +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_nested_invalid.move:9:13 + │ +4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here + · +7 │ _ = x_ref + │ - conflicting reference `x_ref` used here +8 │ }; +9 │ _ = x; + │ ^ copy attempted here + +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_nested_invalid.move:19:16 + │ +15 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +16 │ loop { +17 │ _ = x_ref; + │ - conflicting reference `x_ref` used here +18 │ loop { +19 │ _ = x; + │ ^ copy attempted here + +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_nested_invalid.move:29:67 + │ +27 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +28 │ loop { +29 │ if (cond) { _ = x_ref; break } else { while (!cond) { _ = x } } + │ - ^ copy attempted here + │ │ + │ conflicting reference `x_ref` used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested_invalid.move new file mode 100644 index 0000000000000..17d45cb5078e6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_nested_invalid.move @@ -0,0 +1,32 @@ +module 0x8675309::M { + fun t0(cond: bool) { + let x = 0; + let x_ref = &mut x; + while (cond) { + while (cond) { + _ = x_ref + }; + _ = x; + } + } + + fun t1() { + let x = 0; + let x_ref = &mut x; + loop { + _ = x_ref; + loop { + _ = x; + break + } + } + } + + fun t2(cond: bool) { + let x = 0; + let x_ref = &mut x; + loop { + if (cond) { _ = x_ref; break } else { while (!cond) { _ = x } } + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple.move new file mode 100644 index 0000000000000..7cc0a574935dc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple.move @@ -0,0 +1,9 @@ +module 0x8675309::M { + fun t() { + let x = 0; + let x_ref = &mut x; + *x_ref = 0; + _ = x; + _ = move x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple_invalid.exp new file mode 100644 index 0000000000000..1015623e8f40d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple_invalid.exp @@ -0,0 +1,45 @@ + +Diagnostics: +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_simple_invalid.move:5:9 + │ +4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +5 │ _ = x; + │ ^ copy attempted here +6 │ _ = move x; +7 │ *x_ref = 0; + │ ---------- conflicting reference `x_ref` used here + +error: cannot move local `x` which is still borrowed + ┌─ tests/more-v1/liveness/dead_refs_simple_invalid.move:6:13 + │ +4 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +5 │ _ = x; +6 │ _ = move x; + │ ^^^^^^ move attempted here +7 │ *x_ref = 0; + │ ---------- conflicting reference `x_ref` used here + +error: cannot copy local `x` which is still mutably borrowed + ┌─ tests/more-v1/liveness/dead_refs_simple_invalid.move:13:9 + │ +12 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +13 │ _ = x; + │ ^ copy attempted here +14 │ _ = move x; +15 │ _ = *x_ref; + │ ------ conflicting reference `x_ref` used here + +error: cannot move local `x` which is still borrowed + ┌─ tests/more-v1/liveness/dead_refs_simple_invalid.move:14:13 + │ +12 │ let x_ref = &mut x; + │ ------ local `x` previously mutably borrowed here +13 │ _ = x; +14 │ _ = move x; + │ ^^^^^^ move attempted here +15 │ _ = *x_ref; + │ ------ conflicting reference `x_ref` used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple_invalid.move new file mode 100644 index 0000000000000..e883e95009cd9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/dead_refs_simple_invalid.move @@ -0,0 +1,18 @@ +module 0x8675309::M { + fun t0() { + let x = 0; + let x_ref = &mut x; + _ = x; + _ = move x; + *x_ref = 0; + } + + fun t1() { + let x = 0; + let x_ref = &mut x; + _ = x; + _ = move x; + _ = *x_ref; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/explicit_last_copy.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/explicit_last_copy.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/explicit_last_copy.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/explicit_last_copy.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/explicit_last_copy.move new file mode 100644 index 0000000000000..5682fc85520dd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/explicit_last_copy.move @@ -0,0 +1,52 @@ +module 0x8675309::M { + fun t0() { + let x = 0; + copy x; + } + + fun t1() { + let x = 0; + let x = copy x; + x; + } + + fun t2(cond: bool) { + if (cond) { + let x = 0; + copy x; + } + } + + fun t3(cond: bool) { + let x = 0; + copy x; + if (cond) { + copy x; + } + } + + fun t4(cond: bool) { + let x = 0; + if (cond) { + copy x; + } else { + copy x; + } + } + + fun t5(cond: bool) { + let x = 0; + while (cond) { + copy x; + }; + } + + fun t6(cond: bool) { + let x = 0; + while (cond) { + copy x; + }; + copy x; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/loop_weirdness.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/loop_weirdness.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/loop_weirdness.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/loop_weirdness.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/loop_weirdness.move new file mode 100644 index 0000000000000..669c383ab90ee --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/loop_weirdness.move @@ -0,0 +1,16 @@ +module 0x8675309::M { + fun t() { + let x = 0; + let t = 1; + + if (x >= 0) { + loop { + let my_local = 0; + if (my_local >= 0) { break; }; + }; + x = 1 + }; + t; + x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/move_in_infinite_loop_branched.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/move_in_infinite_loop_branched.exp new file mode 100644 index 0000000000000..64bac7fb7aa0b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/move_in_infinite_loop_branched.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/liveness/move_in_infinite_loop_branched.move:5:28 + │ +5 │ loop { let y = move x; y / y; } + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/liveness/move_in_infinite_loop_branched.move:7:28 + │ +7 │ loop { let y = move x; y % y; } + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/move_in_infinite_loop_branched.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/move_in_infinite_loop_branched.move new file mode 100644 index 0000000000000..5ec84ca166f64 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/move_in_infinite_loop_branched.move @@ -0,0 +1,10 @@ +script { + fun main(cond: bool) { + let x = 0; + if (cond) { + loop { let y = move x; y / y; } + } else { + loop { let y = move x; y % y; } + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref.exp new file mode 100644 index 0000000000000..c4ecdd80bca73 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref.exp @@ -0,0 +1,21 @@ + +Diagnostics: +error: cannot transfer mutable local `x` since it is borrowed + ┌─ tests/more-v1/liveness/mut_ref.move:41:9 + │ +41 │ some2(x, x); // expected error because multiple use + │ ^^^^^^^^^^^ + │ │ + │ transfer attempted here + │ previously mutably borrowed here + +error: cannot transfer mutable local `x` since it is borrowed + ┌─ tests/more-v1/liveness/mut_ref.move:64:13 + │ +62 │ let y = x; // expected error because of implicit copy + │ - previously mutably borrowed here +63 │ if (cond) { +64 │ some(x); + │ ^^^^^^^ transfer attempted here +65 │ some(y) + │ ------- conflicting reference `y` used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref.move new file mode 100644 index 0000000000000..c99d27ccec901 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref.move @@ -0,0 +1,71 @@ +module 0x42::m { + + struct R has key { + v: u64 + } + + fun some(_r: &mut R) {} + + fun some2(_r: &mut R, _t: &mut R) {} + + fun id(r: &mut R): &mut R { r } + + fun f1_ok() { + let r = R { v: 0 }; + let x = &mut r; + // expected ok since x is used and assigned again + some(x); + some(x); + } + + fun f1a_ok() { + let r = R { v: 0 }; + let x = &mut r; + *x; // Expected ok because x is only read; ability analysis will check whether read is ok + some(x); + some(x); + } + + fun f1b_ok() { + let r = R { v: 0 }; + let x = &mut r; + some(x); + *x; // Same as f1aok + some(x); + } + + + fun f2_fail() { + let r = R { v: 0 }; + let x = &mut r; + some2(x, x); // expected error because multiple use + } + + fun f3_ok() { + let r = R { v: 0 }; + let x = &mut r; + some(x); // expected ok + x = &mut r; + some(x); + } + + fun f4_ok() { + let r = R { v: 0 }; + let x = &mut r; + x = id(x); // expected ok + some(x); + } + + fun f5_fail(cond: bool) { + let r = R { v: 0 }; + let x = &mut r; + let y = x; // expected error because of implicit copy + if (cond) { + some(x); + some(y) + } else { + some(y); + some(x); + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.exp new file mode 100644 index 0000000000000..9d2cce8b6b8c3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.exp @@ -0,0 +1,55 @@ + +Diagnostics: +error: local `r` of type `m::R` does not have the `drop` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:15:17 + │ +15 │ let x = &mut r; + │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used + +error: local `r` of type `m::R` does not have the `drop` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:23:17 + │ +23 │ let x = &mut r; + │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used + +error: local `x` of type `m::R` does not have the `copy` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:24:9 + │ +24 │ *x; // Expected ok because x is only read; ability analysis will check whether read is ok + │ ^^ reference content copied here + +error: value of type `m::R` does not have the `drop` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:24:9 + │ +24 │ *x; // Expected ok because x is only read; ability analysis will check whether read is ok + │ ^^ implicitly dropped here since it is no longer used + +error: local `r` of type `m::R` does not have the `drop` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:31:17 + │ +31 │ let x = &mut r; + │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used + +error: local `x` of type `m::R` does not have the `copy` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:33:9 + │ +33 │ *x; // Same as f1aok + │ ^^ reference content copied here + +error: value of type `m::R` does not have the `drop` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:33:9 + │ +33 │ *x; // Same as f1aok + │ ^^ implicitly dropped here since it is no longer used + +error: local `r` of type `m::R` does not have the `drop` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:42:13 + │ +42 │ x = &mut r; + │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used + +error: local `r` of type `m::R` does not have the `drop` ability + ┌─ tests/more-v1/liveness/mut_ref2.move:48:17 + │ +48 │ let x = &mut r; + │ ^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.move new file mode 100644 index 0000000000000..955f12948dab7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/mut_ref2.move @@ -0,0 +1,52 @@ +module 0x42::m { + + struct R has key { + v: u64 + } + + fun some(_r: &mut R) {} + + fun some2(_r: &mut R, _t: &mut R) {} + + fun id(r: &mut R): &mut R { r } + + fun f1_ok() { + let r = R { v: 0 }; + let x = &mut r; + // expected ok since x is used and assigned again + some(x); + some(x); + } + + fun f1a_ok() { + let r = R { v: 0 }; + let x = &mut r; + *x; // Expected ok because x is only read; ability analysis will check whether read is ok + some(x); + some(x); + } + + fun f1b_ok() { + let r = R { v: 0 }; + let x = &mut r; + some(x); + *x; // Same as f1aok + some(x); + } + + + fun f3_ok() { + let r = R { v: 0 }; + let x = &mut r; + some(x); // expected ok + x = &mut r; + some(x); + } + + fun f4_ok() { + let r = R { v: 0 }; + let x = &mut r; + x = id(x); // expected ok + some(x); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi.move new file mode 100644 index 0000000000000..481e987c4cf8a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi.move @@ -0,0 +1,58 @@ +script { + fun main() { + return; + } +} + +script { + fun main() { + abort 0; + } +} + +script { + fun main() { + { return }; + } +} + +script { + fun main() { + { abort 0 }; + } +} + + +script { + fun main(cond: bool) { + if (cond) { + return; + } else { + () + } + } +} + +script { + fun main(cond: bool) { + { + if (cond) { + return + } else { + abort 0 + }; + } + } +} + +script { + fun main(cond: bool) { + { + if (cond) { + abort 0; + } else { + return; + }; + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi_loops.exp b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi_loops.exp new file mode 100644 index 0000000000000..adce287375efe --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi_loops.exp @@ -0,0 +1,18 @@ + +Diagnostics: +warning: Unused local variable `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/liveness/trailing_semi_loops.move:27:17 + │ +27 │ let x: u64 = if (true) break else break; + │ ^ + + +Diagnostics: +warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/liveness/trailing_semi_loops.move:76:17 + │ +76 │ x = 2; + │ ^^^^^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi_loops.move b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi_loops.move new file mode 100644 index 0000000000000..6d324afb88248 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/liveness/trailing_semi_loops.move @@ -0,0 +1,106 @@ +script { + fun main() { + loop (); + } +} + +script { + fun main() { + { (loop (): ()) }; + } +} + +script { + fun main() { + loop { + let x = 0; + 0 + x + 0; + }; + } +} + +script { + fun main() { + loop { + // TODO can probably improve this message, + // but its different than the normal trailing case + let x: u64 = if (true) break else break; + } + } +} + +script { + fun main() { + loop { + break; + } + } +} + +script { + fun main(cond: bool) { + loop { + if (cond) { + break; + } else { + () + } + } + } +} + +script { + fun main(cond: bool) { + loop { + if (cond) continue else break; + } + } +} + +script { + fun main(cond: bool) { + loop { + if (cond) abort 0 else return; + } + } +} + +script { + fun main(cond: bool) { + let x; + loop { + if (cond) { + x = 1; + break + } else { + x = 2; + continue + }; + }; + x; + } +} + +script { + fun main(cond: bool) { + loop { + if (cond) { + break; + } else { + continue; + }; + } + } +} + +script { + fun main(cond: bool) { + loop { + if (cond) { + return; + } else { + abort 0; + }; + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.exp new file mode 100644 index 0000000000000..be7644dd18716 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.exp @@ -0,0 +1,59 @@ + +Diagnostics: +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/assign_partial_resource.move:6:21 + │ +6 │ if (cond) { r = R{}; }; + │ ^^^^^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/assign_partial_resource.move:13:29 + │ +13 │ if (cond) {} else { r = R{}; }; + │ ^^^^^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/assign_partial_resource.move:20:24 + │ +20 │ while (cond) { r = R{} }; + │ ^^^^^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/assign_partial_resource.move:27:16 + │ +27 │ loop { r = R{} } + │ ^^^^^^^ + + +Diagnostics: +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_partial_resource.move:6:21 + │ +6 │ if (cond) { r = R{}; }; + │ ^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_partial_resource.move:13:29 + │ +13 │ if (cond) {} else { r = R{}; }; + │ ^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_partial_resource.move:20:24 + │ +20 │ while (cond) { r = R{} }; + │ ^^^^^^^ implicitly dropped here since it is no longer used + +error: local `x` of type `T` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_partial_resource.move:31:21 + │ +31 │ if (cond) { x = y }; + │ ^^^^^ implicitly dropped here since it is no longer used + +error: local `y` of type `T` does not have the `copy` ability + ┌─ tests/more-v1/locals/assign_partial_resource.move:31:21 + │ +31 │ if (cond) { x = y }; + │ ^^^^^ copy needed here because value is still in use +32 │ (x, y) + │ - used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.move new file mode 100644 index 0000000000000..6b77947727f1e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_partial_resource.move @@ -0,0 +1,34 @@ +module 0x8675309::M { + struct R {} + + fun t1(cond: bool) { + let r: R; + if (cond) { r = R{}; }; + r = R{}; + R{} = r; + } + + fun t2(cond: bool) { + let r: R; + if (cond) {} else { r = R{}; }; + r = R{}; + R{} = r; + } + + fun t3(cond: bool) { + let r: R; + while (cond) { r = R{} }; + r = R{}; + R{} = r; + } + + fun t4() { + let r: R; + loop { r = R{} } + } + + fun t5(cond: bool, x: T, y: T): (T, T) { + if (cond) { x = y }; + (x, y) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.exp new file mode 100644 index 0000000000000..b99889c927077 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.exp @@ -0,0 +1,39 @@ + +Diagnostics: +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/assign_resource.move:5:17 + │ +5 │ let r = R{}; + │ ^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/assign_resource.move:29:17 + │ +29 │ let r = R{}; + │ ^^^ + + +Diagnostics: +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_resource.move:5:17 + │ +5 │ let r = R{}; + │ ^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_resource.move:12:19 + │ +12 │ if (cond) { r = R{}; }; + │ ^^^^^^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_resource.move:18:27 + │ +18 │ if (cond) {} else { r = R{}; }; + │ ^^^^^^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/assign_resource.move:24:24 + │ +24 │ while (cond) { r = R{} }; + │ ^^^^^^^ implicitly dropped here since it is no longer used diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.move new file mode 100644 index 0000000000000..cd6ace6d63360 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/assign_resource.move @@ -0,0 +1,37 @@ +module 0x8675309::M { + struct R {} + + fun t0() { + let r = R{}; + r = R{}; + R{} = r; + } + + fun t1(cond: bool) { + let r = R{}; + if (cond) { r = R{}; }; + R{} = r; + } + + fun t2(cond: bool) { + let r = R{}; + if (cond) {} else { r = R{}; }; + R{} = r; + } + + fun t3(cond: bool) { + let r = R{}; + while (cond) { r = R{} }; + R{} = r; + } + + fun t4() { + let r = R{}; + loop { r = R{}; R {} = r } + } + + fun t5(x: T, y: T): T { + x = y; + x + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.exp new file mode 100644 index 0000000000000..c26fec6cde656 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.exp @@ -0,0 +1,91 @@ + +Diagnostics: +warning: Unused local variable `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource.move:5:13 + │ +5 │ let r = R{}; + │ ^ + +warning: Unused local variable `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource.move:29:20 + │ +29 │ loop { let r = R{}; } + │ ^ + + +Diagnostics: +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource.move:5:17 + │ +5 │ let r = R{}; + │ ^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource.move:15:21 + │ +15 │ if (cond) { r = R{}; }; + │ ^^^^^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource.move:20:29 + │ +20 │ if (cond) {} else { r = R{}; }; + │ ^^^^^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource.move:25:24 + │ +25 │ while (cond) { r = R{} }; + │ ^^^^^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource.move:29:24 + │ +29 │ loop { let r = R{}; } + │ ^^^ + + +Diagnostics: +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource.move:5:17 + │ +5 │ let r = R{}; + │ ^^^ implicitly dropped here since it is no longer used + +error: local `_r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource.move:10:18 + │ +10 │ let _r = R{}; + │ ^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource.move:15:21 + │ +15 │ if (cond) { r = R{}; }; + │ ^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource.move:20:29 + │ +20 │ if (cond) {} else { r = R{}; }; + │ ^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource.move:25:24 + │ +25 │ while (cond) { r = R{} }; + │ ^^^^^^^ implicitly dropped here since it is no longer used + +error: value of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource.move:33:17 + │ +33 │ let _ = &R{}; + │ ^^^^ still borrowed but will be implicitly dropped later since it is no longer used + +error: local `_x` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource.move:36:22 + │ +36 │ fun t7(_x: R) { + │ ╭──────────────────────^ +37 │ │ } + │ ╰─────^ implicitly dropped here since it is no longer used diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.move new file mode 100644 index 0000000000000..4121a8c05ea11 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource.move @@ -0,0 +1,39 @@ +module 0x8675309::M { + struct R {} + + fun t0() { + let r = R{}; + } + + fun t1() { + // prefixing an unused resource with _ does not work + let _r = R{}; + } + + fun t2(cond: bool) { + let r; + if (cond) { r = R{}; }; + } + + fun t3(cond: bool) { + let r; + if (cond) {} else { r = R{}; }; + } + + fun t4(cond: bool) { + let r; + while (cond) { r = R{} }; + } + + fun t5() { + loop { let r = R{}; } + } + + fun t6() { + let _ = &R{}; + } + + fun t7(_x: R) { + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.exp new file mode 100644 index 0000000000000..e6c1bf612b336 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.exp @@ -0,0 +1,83 @@ + +Diagnostics: +warning: Unused local variable `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:5:13 + │ +5 │ let r = R{}; + │ ^ + +warning: Unused local variable `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:28:13 + │ +28 │ let r = R{}; + │ ^ + +warning: Unused local variable `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:33:13 + │ +33 │ let x = &R{}; + │ ^ + + +Diagnostics: +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:5:17 + │ +5 │ let r = R{}; + │ ^^^ + +warning: Unused assignment to `r`. Consider removing or prefixing with an underscore: `_r` + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:28:17 + │ +28 │ let r = R{}; + │ ^^^ + +warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:33:17 + │ +33 │ let x = &R{}; + │ ^^^^ + + +Diagnostics: +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:5:17 + │ +5 │ let r = R{}; + │ ^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:11:21 + │ +11 │ if (cond) { return () }; + │ ^^^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:17:29 + │ +17 │ if (cond) {} else { return () }; + │ ^^^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:23:24 + │ +23 │ while (cond) { return () }; + │ ^^^^^^^^^ implicitly dropped here since it is no longer used + +error: local `r` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:28:17 + │ +28 │ let r = R{}; + │ ^^^ implicitly dropped here since it is no longer used + +error: value of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:33:17 + │ +33 │ let x = &R{}; + │ ^^^^ implicitly dropped here since it is no longer used + +error: local `_x` of type `M::R` does not have the `drop` ability + ┌─ tests/more-v1/locals/unused_resource_explicit_return.move:38:9 + │ +38 │ return () + │ ^^^^^^^^^ implicitly dropped here since it is no longer used diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.move new file mode 100644 index 0000000000000..cb70af3240e97 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.move @@ -0,0 +1,40 @@ +module 0x8675309::M { + struct R {} + + fun t0() { + let r = R{}; + return () + } + + fun t1(cond: bool) { + let r = R {}; + if (cond) { return () }; + R {} = r; + } + + fun t2(cond: bool) { + let r = R{}; + if (cond) {} else { return () }; + R {} = r; + } + + fun t3(cond: bool) { + let r = R {}; + while (cond) { return () }; + R {} = r; + } + + fun t4() { + let r = R{}; + loop { return () } + } + + fun t5() { + let x = &R{}; + return () + } + + fun t6(_x: R) { + return () + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if.exp new file mode 100644 index 0000000000000..e99dac5a1a2b9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if.move:4:25 + │ +4 │ if (cond) { _ = move x }; + │ ^^^^^^ attempted to move here +5 │ let _ = move x + 1; + │ ------ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if.move:10:25 + │ +10 │ if (cond) { _ = move x }; + │ ^^^^^^ attempted to move here +11 │ let _ = x + 1; + │ ----- used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if.move:16:25 + │ +16 │ if (cond) { _ = move x }; + │ ^^^^^^ attempted to move here +17 │ let _ = &x; + │ -- used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if.move new file mode 100644 index 0000000000000..dacda0340e63b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if.move @@ -0,0 +1,20 @@ +module 0x8675309::M { + fun tmove(cond: bool) { + let x = 0; + if (cond) { _ = move x }; + let _ = move x + 1; + } + + fun tcopy(cond: bool) { + let x = 0; + if (cond) { _ = move x }; + let _ = x + 1; + } + + fun tborrow(cond: bool) { + let x = 0; + if (cond) { _ = move x }; + let _ = &x; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if_else.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if_else.exp new file mode 100644 index 0000000000000..6d3f341daa7d9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if_else.exp @@ -0,0 +1,73 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:4:25 + │ +4 │ if (cond) { _ = move x } else { _ = move x }; + │ ^^^^^^ attempted to move here +5 │ let _ = move x + 1; + │ ------ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:4:45 + │ +4 │ if (cond) { _ = move x } else { _ = move x }; + │ ^^^^^^ attempted to move here +5 │ let _ = move x + 1; + │ ------ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:10:25 + │ +10 │ if (cond) { _ = move x } else { _ = x }; + │ ^^^^^^ attempted to move here +11 │ let _ = move x + 1; + │ ------ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:16:25 + │ +16 │ if (cond) { _ = move x } else { _ = move x }; + │ ^^^^^^ attempted to move here +17 │ let _ = x + 1; + │ ----- used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:16:45 + │ +16 │ if (cond) { _ = move x } else { _ = move x }; + │ ^^^^^^ attempted to move here +17 │ let _ = x + 1; + │ ----- used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:23:25 + │ +23 │ if (cond) { _ = move x } else { _ = x }; + │ ^^^^^^ attempted to move here +24 │ let _ = x + 1; + │ ----- used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:29:25 + │ +29 │ if (cond) { _ = move x } else { _ = move x }; + │ ^^^^^^ attempted to move here +30 │ let _ = &x; + │ -- used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:29:45 + │ +29 │ if (cond) { _ = move x } else { _ = move x }; + │ ^^^^^^ attempted to move here +30 │ let _ = &x; + │ -- used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_if_else.move:35:25 + │ +35 │ if (cond) { _ = move x } else { _ = x }; + │ ^^^^^^ attempted to move here +36 │ let _ = &x; + │ -- used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if_else.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if_else.move new file mode 100644 index 0000000000000..d3e6f60cf672d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_if_else.move @@ -0,0 +1,39 @@ +module 0x8675309::M { + fun tmove1(cond: bool) { + let x = 0; + if (cond) { _ = move x } else { _ = move x }; + let _ = move x + 1; + } + + fun tmove2(cond: bool) { + let x = 0; + if (cond) { _ = move x } else { _ = x }; + let _ = move x + 1; + } + + fun tcopy1(cond: bool) { + let x = 0; + if (cond) { _ = move x } else { _ = move x }; + let _ = x + 1; + } + + fun tcopy2(cond: bool) { + + let x = 0; + if (cond) { _ = move x } else { _ = x }; + let _ = x + 1; + } + + fun tborrow1(cond: bool) { + let x = 0; + if (cond) { _ = move x } else { _ = move x }; + let _ = &x; + } + + fun tborrow2(cond: bool) { + let x = 0; + if (cond) { _ = move x } else { _ = x }; + let _ = &x; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_loop.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_loop.exp new file mode 100644 index 0000000000000..944931b6c14aa --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_loop.exp @@ -0,0 +1,43 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_loop.move:4:20 + │ +4 │ loop { _ = move x } + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_loop.move:9:37 + │ +9 │ loop { if (cond) break; _ = move x } + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_loop.move:14:31 + │ +14 │ loop { let y = x; _ = move x; y; } + │ - ^^^^^^ attempted to move here + │ │ + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_loop.move:19:51 + │ +19 │ loop { let y = x; if (cond) continue; _ = move x; y; } + │ - ^^^^^^ attempted to move here + │ │ + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_loop.move:24:44 + │ +24 │ loop { let y = &x; _ = move y; _ = move x } + │ -- ^^^^^^ attempted to move here + │ │ + │ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_loop.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_loop.move new file mode 100644 index 0000000000000..57084fe076145 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_loop.move @@ -0,0 +1,32 @@ +module 0x8675309::M { + fun tmove1() { + let x = 0; + loop { _ = move x } + } + + fun tmove2(cond: bool) { + let x = 0; + loop { if (cond) break; _ = move x } + } + + fun tcopy1() { + let x = 0; + loop { let y = x; _ = move x; y; } + } + + fun tcopy2(cond: bool) { + let x = 0; + loop { let y = x; if (cond) continue; _ = move x; y; } + } + + fun tborrow1() { + let x = 0; + loop { let y = &x; _ = move y; _ = move x } + } + + fun tborrow2(cond: bool) { + let x = 0; + loop { let y = &x; _ = move y; if (cond) {_ = move x }; break } + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_simple.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_simple.exp new file mode 100644 index 0000000000000..696c6dd3054de --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_simple.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_simple.move:6:9 + │ +6 │ move x; + │ ^^^^^^ attempted to move here +7 │ let _ = move x + 1; + │ ------ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_simple.move:16:9 + │ +16 │ move x; + │ ^^^^^^ attempted to move here +17 │ let _ = x + 1; + │ ----- used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_simple.move:26:9 + │ +26 │ move x; + │ ^^^^^^ attempted to move here +27 │ let _ = &x; + │ -- used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_simple.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_simple.move new file mode 100644 index 0000000000000..bf4e34d12d05b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_simple.move @@ -0,0 +1,34 @@ +module 0x8675309::M { + struct S has copy, drop {} + + fun tmove() { + let x = 0; + move x; + let _ = move x + 1; + + let s = S{}; + let _s2 = s; + let _s3 = s; + } + + fun tcopy() { + let x = 0; + move x; + let _ = x + 1; + + let s = S{}; + let _s2 = s; + let _s3 = copy s; + } + + fun tborrow() { + let x = 0; + move x; + let _ = &x; + + let s = S{}; + let _s2 = s; + let _s3 = &s; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_while.exp b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_while.exp new file mode 100644 index 0000000000000..ef68d4843b0ae --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_while.exp @@ -0,0 +1,43 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_while.move:4:28 + │ +4 │ while (cond) { _ = move x }; + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_while.move:9:45 + │ +9 │ while (cond) { if (cond) break; _ = move x }; + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_while.move:14:39 + │ +14 │ while (cond) { let y = x; _ = move x; y; }; + │ - ^^^^^^ attempted to move here + │ │ + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_while.move:19:59 + │ +19 │ while (cond) { let y = x; if (cond) continue; _ = move x; y; }; + │ - ^^^^^^ attempted to move here + │ │ + │ used here + +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/locals/use_after_move_while.move:24:52 + │ +24 │ while (cond) { let y = &x; _ = move y; _ = move x }; + │ -- ^^^^^^ attempted to move here + │ │ + │ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_while.move b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_while.move new file mode 100644 index 0000000000000..181c0bdaa7ec6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/locals/use_after_move_while.move @@ -0,0 +1,32 @@ +module 0x8675309::M { + fun tmove1(cond: bool) { + let x = 0; + while (cond) { _ = move x }; + } + + fun tmove2(cond: bool) { + let x = 0; + while (cond) { if (cond) break; _ = move x }; + } + + fun tcopy1(cond: bool) { + let x = 0; + while (cond) { let y = x; _ = move x; y; }; + } + + fun tcopy2(cond: bool) { + let x = 0; + while (cond) { let y = x; if (cond) continue; _ = move x; y; }; + } + + fun tborrow1(cond: bool) { + let x = 0; + while (cond) { let y = &x; _ = move y; _ = move x }; + } + + fun tborrow2(cond: bool) { + let x = 0; + while (cond) { let y = &x; _ = move y; if (cond) { _ = move x }; break }; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_constraint_trailing_plus.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_constraint_trailing_plus.exp new file mode 100644 index 0000000000000..a02484f55d274 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_constraint_trailing_plus.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/ability_constraint_trailing_plus.move:4:22 + │ +4 │ fun foo() {} + │ ^ Unexpected '>'. Expected a type ability, one of: 'copy', 'drop', 'store', or 'key' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_constraint_trailing_plus.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_constraint_trailing_plus.move new file mode 100644 index 0000000000000..b0784f5463147 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_constraint_trailing_plus.move @@ -0,0 +1,6 @@ +address 0x42 { +module M { + // unexpected trailing plus + fun foo() {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_modifier_trailing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_modifier_trailing_comma.exp new file mode 100644 index 0000000000000..d558cc6604c47 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_modifier_trailing_comma.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/ability_modifier_trailing_comma.move:4:32 + │ +4 │ struct Foo has copy, drop, {} + │ ^ Unexpected '{'. Expected a type ability, one of: 'copy', 'drop', 'store', or 'key' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_modifier_trailing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_modifier_trailing_comma.move new file mode 100644 index 0000000000000..c509d1208c8a0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/ability_modifier_trailing_comma.move @@ -0,0 +1,6 @@ +address 0x42 { +module M { + // invalid trailing comma + struct Foo has copy, drop, {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long.move new file mode 100644 index 0000000000000..bae137078f679 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long.move @@ -0,0 +1,4 @@ +// Addresses are at most 32 bytes long. +address 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF { + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal.move new file mode 100644 index 0000000000000..3d4beb78ce5bc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal.move @@ -0,0 +1,3 @@ +address 115792089237316195423570985008687907853269984665640564039457584007913129639935 { + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal_exp.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal_exp.exp new file mode 100644 index 0000000000000..fdee671fa5401 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal_exp.exp @@ -0,0 +1,10 @@ + +Diagnostics: +warning: Unused local variable `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/parser/address_almost_too_long_decimal_exp.move:4:13 + │ +4 │ let x = @115792089237316195423570985008687907853269984665640564039457584007913129639935; + │ ^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal_exp.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal_exp.move new file mode 100644 index 0000000000000..0e8a1f6a6f493 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @115792089237316195423570985008687907853269984665640564039457584007913129639935; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_exp.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_exp.exp new file mode 100644 index 0000000000000..9c1d1516468d2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_exp.exp @@ -0,0 +1,10 @@ + +Diagnostics: +warning: Unused local variable `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/parser/address_almost_too_long_exp.move:4:13 + │ +4 │ let x = @0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + │ ^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_exp.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_exp.move new file mode 100644 index 0000000000000..39d883afdb267 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_almost_too_long_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long.exp new file mode 100644 index 0000000000000..0dfff1373fb23 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_just_too_long.move:2:9 + │ +2 │ address 0x10000000000000000000000000000000000000000000000000000000000000000 { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long.move new file mode 100644 index 0000000000000..ce9f217c553ff --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long.move @@ -0,0 +1,4 @@ +// Addresses are at most 32 bytes long. +address 0x10000000000000000000000000000000000000000000000000000000000000000 { + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal.exp new file mode 100644 index 0000000000000..3fd977c188e0b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_just_too_long_decimal.move:1:9 + │ +1 │ address 115792089237316195423570985008687907853269984665640564039457584007913129639936 { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal.move new file mode 100644 index 0000000000000..79f930637ae0a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal.move @@ -0,0 +1,3 @@ +address 115792089237316195423570985008687907853269984665640564039457584007913129639936 { + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal_exp.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal_exp.exp new file mode 100644 index 0000000000000..7fa82a62d3cf8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal_exp.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_just_too_long_decimal_exp.move:4:18 + │ +4 │ let x = @115792089237316195423570985008687907853269984665640564039457584007913129639936; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal_exp.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal_exp.move new file mode 100644 index 0000000000000..7279fd444c282 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @115792089237316195423570985008687907853269984665640564039457584007913129639936; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_exp.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_exp.exp new file mode 100644 index 0000000000000..a2e76559aa881 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_exp.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_just_too_long_exp.move:4:18 + │ +4 │ let x = @0x10000000000000000000000000000000000000000000000000000000000000000; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_exp.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_exp.move new file mode 100644 index 0000000000000..169636f02c202 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_just_too_long_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @0x10000000000000000000000000000000000000000000000000000000000000000; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_misspelled.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_misspelled.exp new file mode 100644 index 0000000000000..c62f7579c40ec --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_misspelled.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/address_misspelled.move:1:1 + │ +1 │ addrexx 0x1: + │ ^^^^^^^ Invalid code unit. Expected 'address', 'module', or 'script'. Got 'addrexx' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_misspelled.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_misspelled.move new file mode 100644 index 0000000000000..544f1ea64f1fa --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_misspelled.move @@ -0,0 +1 @@ +addrexx 0x1: diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_not_hex.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_not_hex.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_not_hex.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_not_hex.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_not_hex.move new file mode 100644 index 0000000000000..249619a650c26 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_not_hex.move @@ -0,0 +1,3 @@ +address 1 { + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long.exp new file mode 100644 index 0000000000000..2c1aea87f614c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_too_long.move:2:9 + │ +2 │ address 0x112233445566778899101122334455667788992011223344556677889930112233 { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long.move new file mode 100644 index 0000000000000..a87cadca53176 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long.move @@ -0,0 +1,4 @@ +// Addresses are at most 32 bytes long. +address 0x112233445566778899101122334455667788992011223344556677889930112233 { + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal.exp new file mode 100644 index 0000000000000..bc49b545ebf58 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_too_long_decimal.move:1:9 + │ +1 │ address 1983934734707648152487488126467385770325287564619460388105773776639483347804723 { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal.move new file mode 100644 index 0000000000000..723c0e14c9db6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal.move @@ -0,0 +1,3 @@ +address 1983934734707648152487488126467385770325287564619460388105773776639483347804723 { + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal_exp.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal_exp.exp new file mode 100644 index 0000000000000..a6d1be07172c2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal_exp.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_too_long_decimal_exp.move:4:18 + │ +4 │ let x = @1983934734707648152487488126467385770325287564619460388105773776639483347804723; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal_exp.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal_exp.move new file mode 100644 index 0000000000000..075c04280e5f0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_decimal_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @1983934734707648152487488126467385770325287564619460388105773776639483347804723; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_exp.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_exp.exp new file mode 100644 index 0000000000000..a96a542ec537c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_exp.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid address + ┌─ tests/more-v1/parser/address_too_long_exp.move:4:18 + │ +4 │ let x = @0x112233445566778899101122334455667788992011223344556677889930112233; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_exp.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_exp.move new file mode 100644 index 0000000000000..7f34521c783bc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/address_too_long_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @0x112233445566778899101122334455667788992011223344556677889930112233; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/break_with_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/break_with_value.exp new file mode 100644 index 0000000000000..ab64095a75a4e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/break_with_value.exp @@ -0,0 +1,12 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/break_with_value.move:3:22 + │ +3 │ loop { break 0 }; + │ ^ + │ │ + │ Unexpected '0' + │ Expected the end of an expression + │ + = 'break' with a value is not yet supported diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/break_with_value.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/break_with_value.move new file mode 100644 index 0000000000000..c37d4dd02fbfb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/break_with_value.move @@ -0,0 +1,5 @@ +module 0x42::M { + fun t(cond: bool) { + loop { break 0 }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_escaped_sequence.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_escaped_sequence.exp new file mode 100644 index 0000000000000..9482a30a90c8c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_escaped_sequence.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid byte string + ┌─ tests/more-v1/parser/byte_string_invalid_escaped_sequence.move:3:15 + │ +3 │ b"libr\a" + │ ^^ Invalid escape sequence: '\a' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_escaped_sequence.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_escaped_sequence.move new file mode 100644 index 0000000000000..0d8f3fef47439 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_escaped_sequence.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + public fun bad_value1(): vector { + b"libr\a" + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_hex.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_hex.exp new file mode 100644 index 0000000000000..25b5f775a66d2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_hex.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid byte string + ┌─ tests/more-v1/parser/byte_string_invalid_hex.move:3:18 + │ +3 │ b"diem \xG0" + │ ^ Invalid hexadecimal character: 'G' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_hex.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_hex.move new file mode 100644 index 0000000000000..278d1fac17b50 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_invalid_hex.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + public fun bad_value(): vector { + b"diem \xG0" + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_success.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_success.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_success.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_success.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_success.move new file mode 100644 index 0000000000000..b5eb37aa01a2f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_success.move @@ -0,0 +1,20 @@ +module 0x8675309::M { + public fun byte_string(): vector { + b"Diem" + } + public fun byte_string_with_quotes(): vector { + b"\"Diem\"" + } + public fun byte_string_with_escaped_sequence(): vector { + b"Hello\n diem. \n Newline; \r Carriage return; \t Tab; \\ Backslash; \0 Null" + } + public fun empty_byte_string(): vector { + b"" + } + public fun byte_string_with_hex(): vector { + b"\x00\x01\x02" + } + public fun escaped_backslash_before_quote(): vector { + b"\\" + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof1.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof1.exp new file mode 100644 index 0000000000000..60b6f4889bde9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof1.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid byte string + ┌─ tests/more-v1/parser/byte_string_token_eof1.move:3:9 + │ +3 │ b"diem\" + │ ^^^^^^^^ Missing closing quote (") after byte string diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof1.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof1.move new file mode 100644 index 0000000000000..642d99d9e29b1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof1.move @@ -0,0 +1,5 @@ +module M { + public fun bad_value(): vector { + b"diem\" + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof2.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof2.exp new file mode 100644 index 0000000000000..ed5e5ae885139 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof2.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid byte string + ┌─ tests/more-v1/parser/byte_string_token_eof2.move:3:9 + │ +3 │ b"Diem + │ ^^^^^^ Missing closing quote (") after byte string diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof2.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof2.move new file mode 100644 index 0000000000000..eaed8acdaf0bc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof2.move @@ -0,0 +1,5 @@ +module M { + public fun bad_value(): vector { + b"Diem + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof3.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof3.exp new file mode 100644 index 0000000000000..c179b62cc6a59 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof3.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: invalid byte string + ┌─ tests/more-v1/parser/byte_string_token_eof3.move:3:11 + │ +3 │ b"\x0"; + │ ^^^ Invalid escape: '\x0'. Hex literals are represented by two symbols: [\x00-\xFF]. + +error: invalid byte string + ┌─ tests/more-v1/parser/byte_string_token_eof3.move:4:11 + │ +4 │ b"\x" + │ ^^ Invalid escape: '\x'. Hex literals are represented by two symbols: [\x00-\xFF]. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof3.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof3.move new file mode 100644 index 0000000000000..2cc2b61467734 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/byte_string_token_eof3.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + public fun bad_value(): vector { + b"\x0"; + b"\x" + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_nested_unbalanced.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_nested_unbalanced.exp new file mode 100644 index 0000000000000..82f353249d2fc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_nested_unbalanced.exp @@ -0,0 +1,10 @@ + +Diagnostics: +warning: invalid documentation comment + ┌─ tests/more-v1/parser/comments_nested_unbalanced.move:1:4 + │ +1 │ /* /** /** * / */ /** */ + │ ^^ Unclosed block comment + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_nested_unbalanced.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_nested_unbalanced.move new file mode 100644 index 0000000000000..e3fb891968754 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_nested_unbalanced.move @@ -0,0 +1 @@ +/* /** /** * / */ /** */ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_ok.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_ok.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_ok.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_ok.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_ok.move new file mode 100644 index 0000000000000..314fbd306bbcd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_ok.move @@ -0,0 +1,21 @@ +/// This is a test. +module 0x8675309::M { + /** + * One can have /* nested */ + * // block comments + */ + fun f() { } + + /* This is a nested /* regular comment // */ */ + fun g() {} + + // This is a line comment which contains unbalanced /* delimiter. + fun h() {} + + // Comments in strings are not comments at all. + fun str(): vector { + b"http://diem.com" + } + + // This is a regular comment which appears where a doc comment would not be allowed. +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_unbalanced.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_unbalanced.exp new file mode 100644 index 0000000000000..8dc8a9dd09e70 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_unbalanced.exp @@ -0,0 +1,10 @@ + +Diagnostics: +warning: invalid documentation comment + ┌─ tests/more-v1/parser/comments_unbalanced.move:3:5 + │ +3 │ /** This comment must be closed. + │ ^^^ Unclosed block comment + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_unbalanced.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_unbalanced.move new file mode 100644 index 0000000000000..b2215a556b474 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/comments_unbalanced.move @@ -0,0 +1,5 @@ +/// This is a test. +module M { + /** This comment must be closed. + fun f() { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_native.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_native.exp new file mode 100644 index 0000000000000..ebe7621418362 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_native.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid modifier + ┌─ tests/more-v1/parser/constant_native.move:3:5 + │ +3 │ native const Foo: u64 = 0; + │ ^^^^^^ Invalid constant declaration. 'native' constants are not supported diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_native.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_native.move new file mode 100644 index 0000000000000..a8400bbfb6594 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_native.move @@ -0,0 +1,4 @@ +module 0x42::M { + // native modifiers on constants fail during parsing + native const Foo: u64 = 0; +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_public.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_public.exp new file mode 100644 index 0000000000000..830eb028f660e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_public.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid modifier + ┌─ tests/more-v1/parser/constant_public.move:3:5 + │ +3 │ public const Foo: u64 = 0; + │ ^^^^^^ Invalid constant declaration. Constants cannot have visibility modifiers as they are always internal diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_public.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_public.move new file mode 100644 index 0000000000000..ebec7b24b4179 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_public.move @@ -0,0 +1,4 @@ +module 0x42::M { + // visibility modifiers on constants fail during parsing + public const Foo: u64 = 0; +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_values.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_values.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_values.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_values.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_values.move new file mode 100644 index 0000000000000..34db1a5471a11 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constant_values.move @@ -0,0 +1,20 @@ +module 0x8675309::M { + fun int8(): u8 { + 1u8 + } + fun int64(): u64 { + 2 + 3u64 + } + fun int128(): u128 { + 4u128 + } + fun int16(): u16 { + 123u16 + } + fun int32(): u32 { + 84 + 53u32 + } + fun int256(): u256 { + 4u256 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_blocks.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_blocks.exp new file mode 100644 index 0000000000000..b37d6382cbd7e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_blocks.exp @@ -0,0 +1,76 @@ + +Diagnostics: +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_blocks.move:5:23 + │ +5 │ const C1: u64 = { u() }; + │ ^^^ + │ │ + │ Invalid call or operation in constant + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_blocks.move:7:24 + │ +7 │ const C3: bool = { loop () }; + │ ^^^^^^^ + │ │ + │ Invalid statement or expression in constant + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_blocks.move:8:22 + │ +8 │ const C4: u8 = { if (false) 0 else 1 }; + │ ^^^^^^^^^^^^^^^^^^^ + │ │ + │ Invalid statement or expression in constant + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_blocks.move:9:40 + │ +9 │ const C5: vector> = { abort 0 }; + │ ^^^^^^^ + │ │ + │ Invalid call or operation in constant + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_blocks.move:11:20 + │ +11 │ const C7: () = { + │ ╭────────────────────────^ + │ │ ╭──────────────────────' + │ │ │ ╭────────────────────' +12 │ │ │ │ let x = 0; +13 │ │ │ │ let y = 1; +14 │ │ │ │ x + y; + │ │ │ │ - - Invalid statement or expression in constant + │ │ │ │ │ + │ │ │ │ Invalid statement or expression in constant +15 │ │ │ │ }; + │ ╰─│─│─────^ + │ ╰─│─────' Invalid statement or expression in constant + │ ╰─────' Invalid statement or expression in constant + +error: Invalid type for constant + ┌─ tests/more-v1/parser/constants_blocks.move:11:20 + │ +11 │ ╭ const C7: () = { + │ ╭──────────────────────^ +12 │ │ │ let x = 0; +13 │ │ │ let y = 1; +14 │ │ │ x + y; +15 │ │ │ }; + │ ╰─│─────^ + │ ╰──────' Expected one of `u8`, `u16, `u32`, `u64`, `u128`, `u256`, `bool`, `address`, or `vector<_>` with valid element type. + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_blocks.move:16:25 + │ +16 │ const C8: address = { + │ ╭─────────────────────────^ +17 │ │ 0; +18 │ │ 1 + 1; +19 │ │ u(); + │ │ --- Invalid call or operation in constant +20 │ │ @0x0 +21 │ │ }; + │ ╰─────^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_blocks.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_blocks.move new file mode 100644 index 0000000000000..1e00bf44bbffb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_blocks.move @@ -0,0 +1,23 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C1: u64 = { u() }; + const C2: u64 = { 0 + 1 * 2 % 3 / 4 >> 1 << 2 }; + const C3: bool = { loop () }; + const C4: u8 = { if (false) 0 else 1 }; + const C5: vector> = { abort 0 }; + const C6: u128 = { 0 }; + const C7: () = { + let x = 0; + let y = 1; + x + y; + }; + const C8: address = { + 0; + 1 + 1; + u(); + @0x0 + }; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_simple.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_simple.exp new file mode 100644 index 0000000000000..51a3aa2b397ac --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_simple.exp @@ -0,0 +1,45 @@ + +Diagnostics: +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_simple.move:5:21 + │ +5 │ const C1: u64 = u(); + │ ^^^ + │ │ + │ Invalid call or operation in constant + +error: Invalid expression in `const`. Operator `-` result value out of range for `u64` + ┌─ tests/more-v1/parser/constants_simple.move:6:21 + │ +6 │ const C2: u64 = 0 + 1 * 2 % 3 / 4 - 5 >> 6 << 7; + │ ^^^^^^^^^^^^^^^^^^^^^ + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_simple.move:7:22 + │ +7 │ const C3: bool = loop (); + │ ^^^^^^^ + │ │ + │ Invalid statement or expression in constant + +error: undeclared `cond` + ┌─ tests/more-v1/parser/constants_simple.move:8:24 + │ +8 │ const C4: u8 = if (cond) 0 else 1; + │ ^^^^ + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_simple.move:8:20 + │ +8 │ const C4: u8 = if (cond) 0 else 1; + │ ^^^^^^^^^^^^^^^^^^ + │ │ + │ Invalid statement or expression in constant + +error: Not a valid constant expression. + ┌─ tests/more-v1/parser/constants_simple.move:9:38 + │ +9 │ const C5: vector> = abort 0; + │ ^^^^^^^ + │ │ + │ Invalid call or operation in constant diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_simple.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_simple.move new file mode 100644 index 0000000000000..dc5e980cf6a65 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_simple.move @@ -0,0 +1,16 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C1: u64 = u(); + const C2: u64 = 0 + 1 * 2 % 3 / 4 - 5 >> 6 << 7; + const C3: bool = loop (); + const C4: u8 = if (cond) 0 else 1; + const C5: vector> = abort 0; + const C6: u128 = 0; + const C7: u256 = 4 / 3 + 4 - 1 << 143; + const C8: u16 = 123; + const C9: u32 = (453 as u32); + +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_standalone_let.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_standalone_let.exp new file mode 100644 index 0000000000000..9986d195f1bcf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_standalone_let.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/constants_standalone_let.move:4:21 + │ +4 │ const C1: u64 = let x = 0; + │ ^^^ + │ │ + │ Unexpected 'let' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_standalone_let.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_standalone_let.move new file mode 100644 index 0000000000000..4b4768cb6dba3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/constants_standalone_let.move @@ -0,0 +1,6 @@ +address 0x42 { +module M { + + const C1: u64 = let x = 0; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_as_term.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_as_term.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_as_term.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_as_term.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_as_term.move new file mode 100644 index 0000000000000..4b6193fbe5ac0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_as_term.move @@ -0,0 +1,15 @@ +module 0x42::M { + + fun foo(_: &u64) {} + + fun t(cond: bool) { + 1 + if (cond) 0 else { 1 } + 2; + 1 + loop {} + 2; + 1 + return + 0; + + foo(&if (cond) 0 else 1); + foo(&loop {}); + foo(&return); + foo(&abort 0); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity.move new file mode 100644 index 0000000000000..c9f44701b396b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity.move @@ -0,0 +1,10 @@ +// tests that control structures are right associative when not immediately followed by a block + +module 0x42::M { + fun t(cond: bool) { + let _: u64 = 1 + if (cond) 0 else 10 + 10; + let _: bool = true || if (cond) false else 10 == 10; + let _: bool = if (cond) 10 else { 10 } == 10; + let _: u64 = if (cond) 0 else { 10 } + 1; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_else_after_if_block.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_else_after_if_block.exp new file mode 100644 index 0000000000000..a033d0c493724 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_else_after_if_block.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/control_exp_associativity_else_after_if_block.move:13:28 + │ +13 │ if (cond) { s1 }.f else s2.f + │ ^^^^ + │ │ + │ Unexpected 'else' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_else_after_if_block.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_else_after_if_block.move new file mode 100644 index 0000000000000..cf1c1d789c9a5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_else_after_if_block.move @@ -0,0 +1,17 @@ +// tests that control structures are right associative when not immediately followed by a block + +module 0x42::M { + + struct S has copy, drop { f: u64 } + + fun t(cond: bool, s1: S, s2: S) { + // (if (cond) s1 else s2).f + let _: u64 = if (cond) { s1 } else { s2 }.f; + + // (if (cond) s1).f else (s2.f) + // so parsing error + if (cond) { s1 }.f else s2.f + + + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_field_access.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_field_access.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_field_access.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_field_access.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_field_access.move new file mode 100644 index 0000000000000..8581cea7fdd1b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_field_access.move @@ -0,0 +1,16 @@ +// tests that control structures are right associative when not immediately followed by a block + +// valid usage with field access + +module 0x42::M { + + struct S has copy, drop { f: u64 } + + fun t(cond: bool, s1: S, s2: S) { + let _: u64 = if (cond) 0 else s2.f; + let _: u64 = if (cond) s1.f else s2.f; + let _: u64 = if (cond) s1 else { s2 }.f; + let _: u64 = if (cond) { s1 } else { s2 }.f; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_typing_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_typing_invalid.exp new file mode 100644 index 0000000000000..ad86e8fecd6fb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_typing_invalid.exp @@ -0,0 +1,31 @@ + +Diagnostics: +error: expected expression with no value but found `u64` + ┌─ tests/more-v1/parser/control_exp_associativity_typing_invalid.move:12:9 + │ +12 │ if (cond) bar() + 1; + │ ^^^^^^^^^^^^^^^^^^^ + +error: cannot use `()` with an operator which expects a value of type `integer` + ┌─ tests/more-v1/parser/control_exp_associativity_typing_invalid.move:15:9 + │ +15 │ if (cond) { foo() } + 1; + │ ^^^^^^^^^^^^^^^^^^^ + +error: expected expression with no value but found `u64` + ┌─ tests/more-v1/parser/control_exp_associativity_typing_invalid.move:19:22 + │ +19 │ while (cond) bar() + 2; + │ ^^^^^^^^^ + +error: cannot use `()` with an operator which expects a value of type `integer` + ┌─ tests/more-v1/parser/control_exp_associativity_typing_invalid.move:22:9 + │ +22 │ while (cond) { foo() } + 2; + │ ^^^^^^^^^^^^^^^^^^^^^^ + +error: expected expression with no value but found `u64` + ┌─ tests/more-v1/parser/control_exp_associativity_typing_invalid.move:26:14 + │ +26 │ loop bar() + 2; + │ ^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_typing_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_typing_invalid.move new file mode 100644 index 0000000000000..69b19a99d035d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_typing_invalid.move @@ -0,0 +1,29 @@ +// tests that control structures are right associative when not immediately followed by a block + +// these cases do not type check + +module 0x42::M { + fun foo() {} + fun bar(): u64 { 0 } + + fun t(cond: bool) { + // if (cond) (bar() + 1); + // so error about incompatible branches + if (cond) bar() + 1; + // (if (cond) bar()) + 1; + // so error about wrong argument to + + if (cond) { foo() } + 1; + + // while (cond) (bar() + 1); + // so error about invalid loop body type + while (cond) bar() + 2; + // (while (cond) foo()) + 2 + // so error about wrong argument to + + while (cond) { foo() } + 2; + + // loop (bar() + 1); + // so error about invalid loop body type + loop bar() + 2; + // loop { foo() } + 2; would type check + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_unreachable_code.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_unreachable_code.exp new file mode 100644 index 0000000000000..ba672da351641 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_unreachable_code.exp @@ -0,0 +1,10 @@ + +Diagnostics: +warning: Unused parameter `cond`. Consider removing or prefixing with an underscore: `_cond` + ┌─ tests/more-v1/parser/control_exp_associativity_unreachable_code.move:9:11 + │ +9 │ fun t(cond: bool): u64 { + │ ^^^^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_unreachable_code.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_unreachable_code.move new file mode 100644 index 0000000000000..e7f8b2cab4571 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/control_exp_associativity_unreachable_code.move @@ -0,0 +1,27 @@ +// tests that control structures are right associative when not immediately followed by a block + +// these cases type check, but have dead code + +module 0x42::M { + fun foo() {} + fun bar(): u64 { 0 } + + fun t(cond: bool): u64 { + // loop + 1 + loop { foo() } + 2; + 1 + loop foo(); + loop { foo() } + 1; + + // return + return 1 + 2; + return { 1 + 2 }; + return { 1 } && false; + + // abort + abort 1 + 2; + abort { 1 + 2 }; + abort { 1 } && false; + + 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/decimal_address.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/decimal_address.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/decimal_address.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/decimal_address.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/decimal_address.move new file mode 100644 index 0000000000000..d8b4056394a42 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/decimal_address.move @@ -0,0 +1,16 @@ +// Addresses can be decimal numbers +address 123 { +module M { + struct S {} + public fun nop() {} + public fun bar(): S { S{} } +} +} +module 123::N { + use 123::M; + use 123::M::S; + fun foo(): 123::M::S { + M::nop(); + (123::M::bar(): S) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/doc_comments_placement.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/doc_comments_placement.exp new file mode 100644 index 0000000000000..7866f566fda93 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/doc_comments_placement.exp @@ -0,0 +1,34 @@ + +Diagnostics: +warning: invalid documentation comment + ┌─ tests/more-v1/parser/doc_comments_placement.move:6:5 + │ +6 │ /** There can be no doc comment on uses. */ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Documentation comment cannot be matched to a language item + +warning: invalid documentation comment + ┌─ tests/more-v1/parser/doc_comments_placement.move:16:9 + │ +16 │ /// There can be no doc comment after last field. + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Documentation comment cannot be matched to a language item + +warning: invalid documentation comment + ┌─ tests/more-v1/parser/doc_comments_placement.move:23:9 + │ +23 │ /// There can be no doc comment after last block member. + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Documentation comment cannot be matched to a language item + +warning: invalid documentation comment + ┌─ tests/more-v1/parser/doc_comments_placement.move:26:5 + │ +26 │ /// There can be no doc comment after last module item. + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Documentation comment cannot be matched to a language item + +warning: invalid documentation comment + ┌─ tests/more-v1/parser/doc_comments_placement.move:29:1 + │ +29 │ /// There can be no doc comment at end of file. + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Documentation comment cannot be matched to a language item + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/doc_comments_placement.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/doc_comments_placement.move new file mode 100644 index 0000000000000..b7a80591f30fa --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/doc_comments_placement.move @@ -0,0 +1,29 @@ +/// This is documentation for module M. + +/// Documentation comments can have multiple blocks. +/** They may use different limiters. */ +module 0x42::M { + /** There can be no doc comment on uses. */ + use std::option::Option; + + /// This is f. + fun f() { } + + /// This is T + struct T { + /// This is a field of T. + f: Option, + /// There can be no doc comment after last field. + } + + /// This is some spec. + spec module { + /// This is a pragma. + pragma verify = true; + /// There can be no doc comment after last block member. + } + + /// There can be no doc comment after last module item. +} + +/// There can be no doc comment at end of file. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/duplicate_entry_modifier.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/duplicate_entry_modifier.exp new file mode 100644 index 0000000000000..d17d8ac2f4684 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/duplicate_entry_modifier.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/parser/duplicate_entry_modifier.move:2:11 + │ +2 │ entry entry fun foo() {} + │ ----- ^^^^^ Duplicate 'entry' modifier + │ │ + │ 'entry' modifier previously given here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/duplicate_entry_modifier.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/duplicate_entry_modifier.move new file mode 100644 index 0000000000000..c0193914b03ea --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/duplicate_entry_modifier.move @@ -0,0 +1,3 @@ +module 0x2::M { + entry entry fun foo() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/empty_file.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/empty_file.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/empty_file.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/empty_file.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/empty_file.move new file mode 100644 index 0000000000000..238961cacd2fd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/empty_file.move @@ -0,0 +1 @@ +// The grammar allows a module file to be empty. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_const.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_const.exp new file mode 100644 index 0000000000000..6d25585b9d2bc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_const.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid modifier + ┌─ tests/more-v1/parser/entry_const.move:3:5 + │ +3 │ entry const S: u64 = 0; + │ ^^^^^ Invalid constant declaration. 'entry' is used only on functions diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_const.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_const.move new file mode 100644 index 0000000000000..915964c468a03 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_const.move @@ -0,0 +1,4 @@ +module 0x2::M { + // invalid modifier + entry const S: u64 = 0; +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_function.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_function.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_function.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_function.move new file mode 100644 index 0000000000000..c2c9505e937ba --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_function.move @@ -0,0 +1,10 @@ +module 0x8675309::M { + public entry fun f0() {} + entry public fun f1() {} + entry fun f2() {} + native entry fun f3(); + entry native fun f4(); + entry native public fun f5(); + native entry public fun f6(); + native public entry fun f7(); +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_struct.exp new file mode 100644 index 0000000000000..8a890796cd466 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_struct.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid modifier + ┌─ tests/more-v1/parser/entry_struct.move:3:5 + │ +3 │ entry struct S {} + │ ^^^^^ Invalid type declaration. 'entry' is used only on functions diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_struct.move new file mode 100644 index 0000000000000..4371a5fe82d09 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/entry_struct.move @@ -0,0 +1,4 @@ +module 0x2::M { + // invalid modifier + entry struct S {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_braces.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_braces.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_braces.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_braces.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_braces.move new file mode 100644 index 0000000000000..9fb277bb192ed --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_braces.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + fun f(v: u64) { + // Braces or parenthesis are not required for a control expression + // inside an "abort" expression. + abort if (v == 0) 10 else v + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_missing_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_missing_value.exp new file mode 100644 index 0000000000000..330a214bbe703 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_missing_value.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/expr_abort_missing_value.move:5:5 + │ +5 │ } + │ ^ + │ │ + │ Unexpected '}' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_missing_value.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_missing_value.move new file mode 100644 index 0000000000000..bf7c75da2dd8d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_abort_missing_value.move @@ -0,0 +1,6 @@ +module M { + fun f(v: u64) { + // Aborts always require a value + if (v > 100) abort + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_braces.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_braces.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_braces.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_braces.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_braces.move new file mode 100644 index 0000000000000..d8fe6771090f0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_braces.move @@ -0,0 +1,9 @@ +module 0x8675309::M { + fun f(cond: bool) { + // Braces or parenthesis are not required for a control expression + // inside an "if" expression. + if (cond) { if (cond) () }; + if (cond) ( if (cond) () ); + if (cond) if (cond) () + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_missing_parens.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_missing_parens.exp new file mode 100644 index 0000000000000..5ae7815a34ed6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_missing_parens.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/expr_if_missing_parens.move:4:12 + │ +4 │ if v < 3 () + │ ^ + │ │ + │ Unexpected 'v' + │ Expected '(' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_missing_parens.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_missing_parens.move new file mode 100644 index 0000000000000..3e8fee7af9e54 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_if_missing_parens.move @@ -0,0 +1,6 @@ +module M { + fun f(v: u64) { + // Test an "if" expression missing parenthesis around the condition + if v < 3 () + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_loop_braces.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_loop_braces.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_loop_braces.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_loop_braces.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_loop_braces.move new file mode 100644 index 0000000000000..07468763040a2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_loop_braces.move @@ -0,0 +1,9 @@ +module 0x8675309::M { + fun f(v: u64) { + // Braces or parenthesis are not required for a control expression + // inside a "loop" expression. + loop { if (v < 10) break }; + loop ( if (v < 10) break ); + loop if (v < 10) break + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_braces.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_braces.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_braces.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_braces.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_braces.move new file mode 100644 index 0000000000000..b7d98247ec447 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_braces.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + fun f(v: u64): u64 { + // Braces or parenthesis are not required for a control expression + // inside a "return" expression. + return if (v > 10) 10 else v + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_missing_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_missing_value.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_missing_value.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_missing_value.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_missing_value.move new file mode 100644 index 0000000000000..1b3e861d9fd40 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_return_missing_value.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + fun f(v: u64) { + // Check a return without the optional return value + if (v > 100) return + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_negation.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_negation.exp new file mode 100644 index 0000000000000..7f19856978851 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_negation.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/expr_unary_negation.move:5:19 + │ +5 │ assert!(((1 - -2) == 3) && (-(1 - 2) == 1), 100); + │ ^ + │ │ + │ Unexpected '-' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_negation.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_negation.move new file mode 100644 index 0000000000000..30885131fddfc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_negation.move @@ -0,0 +1,7 @@ +script { + +fun main() { + // Unary negation is not supported. + assert!(((1 - -2) == 3) && (-(1 - 2) == 1), 100); +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_ops.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_ops.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_ops.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_ops.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_ops.move new file mode 100644 index 0000000000000..2401f9aa19d84 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_unary_ops.move @@ -0,0 +1,12 @@ +module 0x8675309::M { + fun f(v: u64) { + let x = *&mut *&v; // Test borrows and dereferences + x; + } + fun annotated(v: u64): u64 { + (v : u64) // Test an expression annotated with a type + } + fun cast(v: u64): u64 { + (v as u64) // Test a type cast + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_braces.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_braces.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_braces.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_braces.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_braces.move new file mode 100644 index 0000000000000..33721b0ce6cbe --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_braces.move @@ -0,0 +1,9 @@ +module 0x8675309::M { + fun f(v: u64) { + // Braces or parenthesis are not required for a control expression + // inside a "while" expression. + while (v < 10) { v = v + 1 }; + while (v < 10) ( v = v + 1 ); + while (v < 10) v = v + 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_missing_parens.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_missing_parens.exp new file mode 100644 index 0000000000000..d839ed2ca82ef --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_missing_parens.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/expr_while_missing_parens.move:4:15 + │ +4 │ while v < 3 { v = v + 1 } + │ ^ + │ │ + │ Unexpected 'v' + │ Expected '(' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_missing_parens.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_missing_parens.move new file mode 100644 index 0000000000000..7b063837c1c1c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/expr_while_missing_parens.move @@ -0,0 +1,6 @@ +module M { + fun f(v: u64) { + // Test a "while" expression missing parenthesis around the condition + while v < 3 { v = v + 1 } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/extra_text_after_main.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/extra_text_after_main.exp new file mode 100644 index 0000000000000..f40002c4da074 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/extra_text_after_main.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/extra_text_after_main.move:6:1 + │ +6 │ fun foo() { + │ ^^^ Unexpected characters after end of 'script' function diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/extra_text_after_main.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/extra_text_after_main.move new file mode 100644 index 0000000000000..6812c00e3b86f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/extra_text_after_main.move @@ -0,0 +1,8 @@ +// There should not be any tokens after the top-level main function. +script { +fun main() { +} + +fun foo() { +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_address_only.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_address_only.exp new file mode 100644 index 0000000000000..036f672693cc7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_address_only.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/friend_decl_address_only.move:3:16 + │ +3 │ friend 0x42; + │ ----^ Unexpected ';' + │ │ + │ Expected '::' after an address in a module access chain diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_address_only.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_address_only.move new file mode 100644 index 0000000000000..f20dd1e6f9e72 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_address_only.move @@ -0,0 +1,5 @@ +address 0x42 { +module M { + friend 0x42; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_inside_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_inside_function.exp new file mode 100644 index 0000000000000..c8892b5f47c8b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_inside_function.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/friend_decl_inside_function.move:6:9 + │ +6 │ friend 0x42::A; + │ ^^^^^^ + │ │ + │ Unexpected 'friend' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_inside_function.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_inside_function.move new file mode 100644 index 0000000000000..09ff00ec34bb5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_inside_function.move @@ -0,0 +1,9 @@ +address 0x42 { +module A {} + +module M { + fun M() { + friend 0x42::A; + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_missing_semicolon.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_missing_semicolon.exp new file mode 100644 index 0000000000000..51d330af31f30 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_missing_semicolon.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/friend_decl_missing_semicolon.move:6:1 + │ +6 │ } + │ ^ + │ │ + │ Unexpected '}' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_missing_semicolon.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_missing_semicolon.move new file mode 100644 index 0000000000000..2e92ac6cf8ceb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_missing_semicolon.move @@ -0,0 +1,7 @@ +address 0x42 { +module A {} + +module M { + friend 0x42::A +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_more_than_one_module.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_more_than_one_module.exp new file mode 100644 index 0000000000000..99330ffdbfc89 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_more_than_one_module.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/friend_decl_more_than_one_module.move:7:14 + │ +7 │ friend A 0x42::B; + │ ^^^^ + │ │ + │ Unexpected '0x42' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_more_than_one_module.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_more_than_one_module.move new file mode 100644 index 0000000000000..59cbcb1c407d7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_more_than_one_module.move @@ -0,0 +1,9 @@ +address 0x42 { +module A {} +module B {} + +module M { + use 0x42::A; + friend A 0x42::B; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_function.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_function.exp new file mode 100644 index 0000000000000..9ece64ac17fe3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_function.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected name in this position + ┌─ tests/more-v1/parser/friend_decl_qualified_function.move:7:21 + │ +7 │ friend 0x42::A::a; + │ ^ Unexpected module member access. Expected a module identifier only diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_function.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_function.move new file mode 100644 index 0000000000000..ff40c83628bf0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_function.move @@ -0,0 +1,9 @@ +address 0x42 { +module A { + fun a() {} +} + +module M { + friend 0x42::A::a; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_struct.exp new file mode 100644 index 0000000000000..e4af595962cd3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_struct.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected name in this position + ┌─ tests/more-v1/parser/friend_decl_qualified_struct.move:7:21 + │ +7 │ friend 0x42::A::A; + │ ^ Unexpected module member access. Expected a module identifier only diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_struct.move new file mode 100644 index 0000000000000..7237c60e51b26 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_struct.move @@ -0,0 +1,9 @@ +address 0x42 { +module A { + struct A {} +} + +module M { + friend 0x42::A::A; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_valid.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_valid.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_valid.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_valid.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_valid.move new file mode 100644 index 0000000000000..6efd20a39941e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/friend_decl_valid.move @@ -0,0 +1,18 @@ +address 0x42 { +module A {} +module B {} +module C {} + +module M { + // friend with fully qualified module id + friend 0x42::A; + + // friend with imported name + use 0x42::B; + friend B; + + // friend with asliased name + use 0x42::C as AliasedC; + friend AliasedC; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_bad_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_bad_name.exp new file mode 100644 index 0000000000000..e0af042a3e84f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_bad_name.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_acquires_bad_name.move:3:22 + │ +3 │ fun f() acquires { + │ ^ + │ │ + │ Unexpected '{' + │ Expected an access specifier diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_bad_name.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_bad_name.move new file mode 100644 index 0000000000000..26c52483555fc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_bad_name.move @@ -0,0 +1,5 @@ +module M { + // Test for an invalid (i.e., missing) resource name + fun f() acquires { + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_missing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_missing_comma.exp new file mode 100644 index 0000000000000..c48ec6ce6a674 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_missing_comma.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_acquires_missing_comma.move:5:25 + │ +5 │ fun f() acquires X1 X2 { + │ ^^ + │ │ + │ Unexpected 'X2' + │ Expected '{' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_missing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_missing_comma.move new file mode 100644 index 0000000000000..f72d37b3f6f1d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_missing_comma.move @@ -0,0 +1,9 @@ +module M { + struct X1 {} + struct X2 {} + // Test a missing comma in the acquires list. + fun f() acquires X1 X2 { + borrow_global_mut(0x1); + borrow_global_mut(0x1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_trailing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_trailing_comma.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_trailing_comma.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_trailing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_trailing_comma.move new file mode 100644 index 0000000000000..6b0ff89cac7f3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_acquires_trailing_comma.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + struct X has key {} + // Test a trailing comma in the acquires list. + fun f() acquires X, { + borrow_global_mut(@0x1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_incomplete.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_incomplete.exp new file mode 100644 index 0000000000000..e6f480266a413 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_incomplete.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_incomplete.move:5:1 + │ +5 │ + │ ^ + │ + │ Unexpected end-of-file + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_incomplete.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_incomplete.move new file mode 100644 index 0000000000000..b7cb01a835432 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_incomplete.move @@ -0,0 +1,4 @@ +script { +fun main() { +// } +//} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_native_with_body.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_native_with_body.exp new file mode 100644 index 0000000000000..15e0f89289b14 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_native_with_body.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_native_with_body.move:3:21 + │ +3 │ native fun fn() {} + │ ^ + │ │ + │ Unexpected '{' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_native_with_body.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_native_with_body.move new file mode 100644 index 0000000000000..a021597728afd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_native_with_body.move @@ -0,0 +1,4 @@ +module M { + // Native functions should not specify a function body. + native fun fn() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_commas.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_commas.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_commas.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_commas.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_commas.move new file mode 100644 index 0000000000000..3b390715123ad --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_commas.move @@ -0,0 +1,3 @@ +module 0x8675309::M { + fun g(_q1: &mut u64, _q2: u64,) { } // Trailing commas are OK +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_missing.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_missing.exp new file mode 100644 index 0000000000000..8835992d06719 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_missing.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_params_missing.move:3:12 + │ +3 │ fun fn { } + │ ^ + │ │ + │ Unexpected '{' + │ Expected '(' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_missing.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_missing.move new file mode 100644 index 0000000000000..06ceea855eb17 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_params_missing.move @@ -0,0 +1,4 @@ +module M { + // The function parameters (in parens) must always be specified. + fun fn { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_public_native.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_public_native.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_public_native.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_public_native.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_public_native.move new file mode 100644 index 0000000000000..716bbd8a1f5da --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_public_native.move @@ -0,0 +1,4 @@ +module 0x42::M { + // visibility can come before native. previously not allowed + public native fun f(); +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_trailing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_trailing_comma.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_trailing_comma.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_trailing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_trailing_comma.move new file mode 100644 index 0000000000000..6000129d04523 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_trailing_comma.move @@ -0,0 +1,4 @@ +module 0x8675309::M { + // Trailing commas are *not* allowed in multi-value types. + fun f(): (u64, u64,) { (1, 2) } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type.move new file mode 100644 index 0000000000000..904eda4482784 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type.move @@ -0,0 +1,12 @@ +module 0x8675309::M { + // Test a unit return value. + fun f1(): () { } + + // Test a single type return value. + fun f2(): u64 { 1 } + fun f3(): (u64) { 1 } + fun f4(p: &u64): &u64 { p } + + // Test multiple return values. + fun f5(): (u64, u64) { (1, 2) } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type_missing.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type_missing.exp new file mode 100644 index 0000000000000..eafddaecaadec --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type_missing.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_return_type_missing.move:3:14 + │ +3 │ fun f(): { } + │ ^ + │ │ + │ Unexpected '{' + │ Expected a type name diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type_missing.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type_missing.move new file mode 100644 index 0000000000000..06edfac300d1e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_return_type_missing.move @@ -0,0 +1,4 @@ +module M { + // Test a missing return type (but with a colon) + fun f(): { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_empty.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_empty.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_empty.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_empty.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_empty.move new file mode 100644 index 0000000000000..2d77127c627df --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_empty.move @@ -0,0 +1,4 @@ +module 0x8675309::M { + // Test an empty list of type parameters. + fun fn<>() { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_extra_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_extra_comma.exp new file mode 100644 index 0000000000000..1013660e11caf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_extra_comma.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_type_extra_comma.move:2:12 + │ +2 │ fun fn<,T>() { } // Test a comma before the first type parameter + │ ^ Expected a type parameter diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_extra_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_extra_comma.move new file mode 100644 index 0000000000000..975400e9e7669 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_extra_comma.move @@ -0,0 +1,3 @@ +module M { + fun fn<,T>() { } // Test a comma before the first type parameter +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_missing_angle.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_missing_angle.exp new file mode 100644 index 0000000000000..686ee1256018c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_missing_angle.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_type_missing_angle.move:3:19 + │ +3 │ fun fn' + │ │ + │ To match this '<' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_missing_angle.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_missing_angle.move new file mode 100644 index 0000000000000..83c3441a37c89 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_missing_angle.move @@ -0,0 +1,4 @@ +module M { + // Test a missing ">" after the type parameters. + fun fn { f: T } + fun fn() { } + fun caller() { + fn>(); // make sure '>>' is not parsed as a shift operator + fn>(); // also test with trailing comma + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_trailing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_trailing_comma.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_trailing_comma.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_trailing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_trailing_comma.move new file mode 100644 index 0000000000000..5246ac45ed57b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_type_trailing_comma.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + fun fn() { } // Test a trailing comma in the type parameters + fun caller() { + fn() + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_empty.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_empty.exp new file mode 100644 index 0000000000000..aa914f18aabe4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_empty.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_visibility_empty.move:2:5 + │ +2 │ public() fun f() {} + │ ^^^^^^^^ Invalid visibility modifier. Consider removing it or using 'public', 'public(friend)', or 'public(package)' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_empty.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_empty.move new file mode 100644 index 0000000000000..d85f127fab76f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_empty.move @@ -0,0 +1,3 @@ +module M { + public() fun f() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_friend.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_friend.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_friend.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_friend.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_friend.move new file mode 100644 index 0000000000000..175201bf6b113 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_friend.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + public(friend) fun f() {} + public (friend) fun g() {} + public ( friend ) fun h() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_invalid.exp new file mode 100644 index 0000000000000..bd0ae0651717e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_invalid.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_visibility_invalid.move:2:5 + │ +2 │ public(invalid_modifier) fun f() {} + │ ^^^^^^^^^^^^^^^^^^^^^^^^ Invalid visibility modifier. Consider removing it or using 'public', 'public(friend)', or 'public(package)' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_invalid.move new file mode 100644 index 0000000000000..dc5007051e99b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_invalid.move @@ -0,0 +1,3 @@ +module M { + public(invalid_modifier) fun f() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_multiple.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_multiple.exp new file mode 100644 index 0000000000000..047a43efe1662 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_multiple.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_visibility_multiple.move:2:19 + │ +2 │ public(script script) fun f() {} + │ ^^^^^^ + │ │ + │ Unexpected 'script' + │ Expected ')' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_multiple.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_multiple.move new file mode 100644 index 0000000000000..3934025902be9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_multiple.move @@ -0,0 +1,3 @@ +module M { + public(script script) fun f() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_script.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_script.exp new file mode 100644 index 0000000000000..72171af95ee33 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_script.exp @@ -0,0 +1,22 @@ + +Diagnostics: +warning: DEPRECATED. will be removed + ┌─ tests/more-v1/parser/function_visibility_script.move:2:5 + │ +2 │ public(script) fun f() {} + │ ^^^^^^^^^^^^^^ 'public(script)' is deprecated in favor of the 'entry' modifier. Replace with 'public entry' + +warning: DEPRECATED. will be removed + ┌─ tests/more-v1/parser/function_visibility_script.move:3:5 + │ +3 │ public (script) fun g() {} + │ ^^^^^^^^^^^^^^^ 'public(script)' is deprecated in favor of the 'entry' modifier. Replace with 'public entry' + +warning: DEPRECATED. will be removed + ┌─ tests/more-v1/parser/function_visibility_script.move:4:5 + │ +4 │ public ( script ) fun h() {} + │ ^^^^^^^^^^^^^^^^^ 'public(script)' is deprecated in favor of the 'entry' modifier. Replace with 'public entry' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_script.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_script.move new file mode 100644 index 0000000000000..a6db257e07cc8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_visibility_script.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + public(script) fun f() {} + public (script) fun g() {} + public ( script ) fun h() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_without_body.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_without_body.exp new file mode 100644 index 0000000000000..fdbf83b7f34bb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_without_body.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/function_without_body.move:3:13 + │ +3 │ fun fn(); + │ ^ + │ │ + │ Unexpected ';' + │ Expected '{' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/function_without_body.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_without_body.move new file mode 100644 index 0000000000000..635b2746b7add --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/function_without_body.move @@ -0,0 +1,4 @@ +module M { + // Non-native functions must specify the function body. + fun fn(); +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access.exp new file mode 100644 index 0000000000000..5ad3e88019ec1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/global_access.move:13:24 + │ +13 │ let _ : bool = ::exists(0x0); + │ ^^ + │ │ + │ Unexpected '::' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access.move new file mode 100644 index 0000000000000..5e8b0b3c0bb53 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access.move @@ -0,0 +1,30 @@ +module M { + struct R {} + + fun exists(): u64 { 0 } + fun move_to(): u64 { 0 } + fun borrow_global(): u64 { 0 } + fun borrow_global_mut(): u64 { 0 } + fun move_from(): u64 { 0 } + fun freeze(): u64 { 0 } + + fun t(account: &signer) acquires Self::R { + let _ : u64 = exists(); + let _ : bool = ::exists(0x0); + + let _ : u64 = move_to(); + let () = ::move_to(account, Self::R{}); + + let _ : u64 = borrow_global(); + let _ : &Self::R = ::borrow_global(0x0); + + let _ : u64 = move_from(); + let Self::R {} = ::move_from(0x0); + + let _ : u64 = borrow_global(); + let r : &mut Self::R = ::borrow_global_mut(0x0); + + let _ : u64 = freeze(); + let _ : &Self::R = ::freeze(r); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_pack.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_pack.exp new file mode 100644 index 0000000000000..0544878e5276e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_pack.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/global_access_pack.move:3:9 + │ +3 │ ::S { } + │ ^^ + │ │ + │ Unexpected '::' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_pack.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_pack.move new file mode 100644 index 0000000000000..e43daeb2f6fd1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_pack.move @@ -0,0 +1,5 @@ +module M { + fun foo() { + ::S { } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_value.exp new file mode 100644 index 0000000000000..084e84a9ab2d5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_value.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/global_access_value.move:3:13 + │ +3 │ 1 + ::global_value + │ ^^ + │ │ + │ Unexpected '::' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_value.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_value.move new file mode 100644 index 0000000000000..22e84f8aa4651 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/global_access_value.move @@ -0,0 +1,5 @@ +module M { + fun foo(): u64 { + 1 + ::global_value + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring.move new file mode 100644 index 0000000000000..5b3352afd665f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + public fun hexstring(): vector { + x"abcd" + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_missing_quote.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_missing_quote.exp new file mode 100644 index 0000000000000..05c5bed66d5d8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_missing_quote.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid hex string + ┌─ tests/more-v1/parser/hexstring_missing_quote.move:3:9 + │ +3 │ x"abcd + │ ^^^^^^ Missing closing quote (") after byte string diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_missing_quote.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_missing_quote.move new file mode 100644 index 0000000000000..6fa4b1b75c390 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_missing_quote.move @@ -0,0 +1,5 @@ +module M { + public fun missing_quote(): vector { + x"abcd + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof1.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof1.exp new file mode 100644 index 0000000000000..7910f94c3c9b0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof1.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid hex string + ┌─ tests/more-v1/parser/hexstring_token_eof1.move:3:9 + │ +3 │ x" + │ ^^ Missing closing quote (") after byte string diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof1.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof1.move new file mode 100644 index 0000000000000..86bd981a40ac9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof1.move @@ -0,0 +1,3 @@ +module M { + public fun foo(): vector { + x" diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof2.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof2.exp new file mode 100644 index 0000000000000..0d36686ff0154 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof2.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid hex string + ┌─ tests/more-v1/parser/hexstring_token_eof2.move:3:9 + │ +3 │ x"abcd + │ ^^^^^^ Missing closing quote (") after byte string diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof2.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof2.move new file mode 100644 index 0000000000000..c2672fe9ead56 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/hexstring_token_eof2.move @@ -0,0 +1,3 @@ +module M { + public fun foo(): vector { + x"abcd diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp new file mode 100644 index 0000000000000..eb41afe8197db --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_call_lhs_complex_expression.move:3:29 + │ +3 │ (if (true) 5 else 0)(); + │ ^ + │ │ + │ Unexpected '(' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.move new file mode 100644 index 0000000000000..8451f7c0455f9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.move @@ -0,0 +1,6 @@ +module M { + fun foo() { + (if (true) 5 else 0)(); + (while (false) {})(0, 1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp new file mode 100644 index 0000000000000..222dec853b372 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_call_lhs_parens_around_name.move:3:14 + │ +3 │ (foo)() + │ ^ + │ │ + │ Unexpected '(' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.move new file mode 100644 index 0000000000000..ec2118f3a371b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.move @@ -0,0 +1,5 @@ +module M { + fun foo() { + (foo)() + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp new file mode 100644 index 0000000000000..332165ecd3108 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_call_lhs_return.move:3:20 + │ +3 │ (return ())(0, 1); + │ ^ + │ │ + │ Unexpected '(' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.move new file mode 100644 index 0000000000000..c82b6fae4edcb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.move @@ -0,0 +1,5 @@ +module M { + fun foo() { + (return ())(0, 1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp new file mode 100644 index 0000000000000..d17d58623b224 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_call_lhs_value.move:3:10 + │ +3 │ 5(); + │ ^ + │ │ + │ Unexpected '(' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.move new file mode 100644 index 0000000000000..d952ee68335a1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.move @@ -0,0 +1,6 @@ +module M { + fun foo() { + 5(); + 5(0, 1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character.exp new file mode 100644 index 0000000000000..a498247233080 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid character + ┌─ tests/more-v1/parser/invalid_character.move:1:12 + │ +1 │ address 0x1~ + │ ^ Invalid character: '~' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character.move new file mode 100644 index 0000000000000..47d7420022c76 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character.move @@ -0,0 +1 @@ +address 0x1~ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_comment.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_comment.exp new file mode 100644 index 0000000000000..ec363d0a07755 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_comment.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid character + ┌─ tests/more-v1/parser/invalid_character_comment.move:3:44 + │ +3 │ // Non-ASCII characters in comments (e.g., ф) are also not allowed. + │ ^ Invalid character 'ф' found when reading file. Only ASCII printable characters, tabs (\t), lf (\n) and crlf (\r\n) are permitted. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_comment.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_comment.move new file mode 100644 index 0000000000000..2491cf56b176f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_comment.move @@ -0,0 +1,7 @@ +address 0x1 { + +// Non-ASCII characters in comments (e.g., ф) are also not allowed. +module Temp { +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_non_ascii.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_non_ascii.exp new file mode 100644 index 0000000000000..45a7c379e7350 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_non_ascii.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid character + ┌─ tests/more-v1/parser/invalid_character_non_ascii.move:5:4 + │ +5 │ ф + │ ^ Invalid character 'ф' found when reading file. Only ASCII printable characters, tabs (\t), lf (\n) and crlf (\r\n) are permitted. diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_non_ascii.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_non_ascii.move new file mode 100644 index 0000000000000..dacd4e6f2118a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_character_non_ascii.move @@ -0,0 +1,8 @@ +address 0x1 { + +// Check that we provide good error messages for non-ASCII characters. +module Temp { + ф +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_assignment.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_assignment.exp new file mode 100644 index 0000000000000..53ee1faa460e4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_assignment.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_named_address_assignment.move:1:14 + │ +1 │ address Addr = 0x1; // Named address assignments are not allowed + │ ^ + │ │ + │ Unexpected '=' + │ Expected '{' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_assignment.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_assignment.move new file mode 100644 index 0000000000000..de91e491f52fe --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_assignment.move @@ -0,0 +1 @@ +address Addr = 0x1; // Named address assignments are not allowed diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_declaration.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_declaration.exp new file mode 100644 index 0000000000000..e32cdaa95d06c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_declaration.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_named_address_declaration.move:3:13 + │ +3 │ address Addr; + │ ^ + │ │ + │ Unexpected ';' + │ Expected '{' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_declaration.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_declaration.move new file mode 100644 index 0000000000000..2b34716c0cf4a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_named_address_declaration.move @@ -0,0 +1,3 @@ +// Named addresses do not need to be declared nor can they be declared in Move +// source. +address Addr; diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_pack_mname_non_addr.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_pack_mname_non_addr.exp new file mode 100644 index 0000000000000..c1c3e54cd27ad --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_pack_mname_non_addr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_pack_mname_non_addr.move:4:14 + │ +4 │ false::M::S { } + │ ^^ + │ │ + │ Unexpected '::' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_pack_mname_non_addr.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_pack_mname_non_addr.move new file mode 100644 index 0000000000000..b89cf567a1ec7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_pack_mname_non_addr.move @@ -0,0 +1,10 @@ +module M { + struct S {} + fun foo() { + false::M::S { } + } + + fun bar() { + fun bar()::bar()::M::S { } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.exp new file mode 100644 index 0000000000000..0d8605a5438e1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.move:4:14 + │ +4 │ false::M { f } = 0; + │ ^^ + │ │ + │ Unexpected '::' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.move new file mode 100644 index 0000000000000..d549c6e970d18 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.move @@ -0,0 +1,13 @@ +module M { + fun foo() { + let f = 0; + false::M { f } = 0; + + let f = 0; + 0::M { f } = 0; + + let f = 0; + foo().M { f } = 0; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.exp new file mode 100644 index 0000000000000..75dec6def7fe2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.move:11:14 + │ +11 │ X::S 0 = 0; + │ ^ + │ │ + │ Unexpected '0' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.move new file mode 100644 index 0000000000000..428fb2c4318dc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.move @@ -0,0 +1,17 @@ +address 0x2 { + +module X {} + +module M { + use 0x2::X; + + fun foo() { + X::S () = 0; + + X::S 0 = 0; + + X::S { 0 } = 0; + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/lambda_no_param.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/lambda_no_param.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/lambda_no_param.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/lambda_no_param.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/lambda_no_param.move new file mode 100644 index 0000000000000..033b7a9896201 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/lambda_no_param.move @@ -0,0 +1,17 @@ +module 0xdecafbad::m { + inline fun foo(f: ||) { + f(); + } + + public fun one() { + foo(|| {}); + } + + inline fun bar(f:||u64): u64 { + f() + } + + public fun two(x:u64): u64 { + bar(||x) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/less_than_space.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/less_than_space.exp new file mode 100644 index 0000000000000..1b133be6edc53 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/less_than_space.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/less_than_space.move:5:18 + │ +5 │ if (v< 10) return v; + │ - --^ Unexpected ')' + │ │ │ + │ │ Expected '::' after an address in a module access chain + │ Perhaps you need a blank space before this '<' operator? diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/less_than_space.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/less_than_space.move new file mode 100644 index 0000000000000..0638e4ac42c87 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/less_than_space.move @@ -0,0 +1,8 @@ +module 0x42::M { + fun f(v: u64): u64 { + if (v < 5) return 5; + // Check for a useful diagnostic message when missing a space before '<' + if (v< 10) return v; + 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding.move new file mode 100644 index 0000000000000..0baf67239640c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding.move @@ -0,0 +1,36 @@ +module 0x8675309::M { + struct R has copy, drop { + f: u64 + } + struct Generic has copy, drop { + g: T + } + fun f() { + let () = (); + let (): () = (); + // Test with whitespace between parenthesis. + let ( ) = ( ); + let ( ): ( ) = ( ); + let v1 = 1; + let v2: u64 = 2; + let (v3) = 3; // for consistency, check a single variable inside parens + let (x1, x2) = (1, 2); + let (x3, x4): (u64, u64) = (3, 4); + v1; + v2; + v3; + x1; + x2; + x3; + x4; + } + fun g(r: R, g: Generic) { + let R { f } = copy r; + let (R { f: f1 }, R { f: f2 }) = (copy r, move r); + let Generic { g: R { f: f3 } } = g; + f; + f1; + f2; + f3; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_bad_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_bad_name.exp new file mode 100644 index 0000000000000..3ae05269d2cb9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_bad_name.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/let_binding_bad_name.move:4:13 + │ +4 │ let {}; + │ ^ + │ │ + │ Unexpected '{' + │ Expected a variable or struct or variant name diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_bad_name.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_bad_name.move new file mode 100644 index 0000000000000..1268590c1be8e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_bad_name.move @@ -0,0 +1,6 @@ +module M { + fun f() { + // Test for a bad variable or struct type name + let {}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_fields.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_fields.exp new file mode 100644 index 0000000000000..9b81b8c2ca188 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_fields.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/parser/let_binding_missing_fields.move:1:8 + │ +1 │ module M { + │ ^ Invalid module declaration. The module does not have a specified address. Either declare it inside of an 'address
{' block or declare it with an address 'module
::M'' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_fields.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_fields.move new file mode 100644 index 0000000000000..b063a76338215 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_fields.move @@ -0,0 +1,8 @@ +module M { + struct Generic { + g: T + } + fun g(g: Generic) { + let Generic = g; // Test a type name with no field bindings + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_paren.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_paren.exp new file mode 100644 index 0000000000000..99f5429fa8c4e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_paren.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/let_binding_missing_paren.move:3:21 + │ +3 │ let (x1, x2 = (1, 2); // Test a missing right parenthesis + │ - ^ Expected ')' + │ │ + │ To match this '(' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_paren.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_paren.move new file mode 100644 index 0000000000000..3fe0d128c2260 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_paren.move @@ -0,0 +1,5 @@ +module M { + fun f() { + let (x1, x2 = (1, 2); // Test a missing right parenthesis + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_semicolon.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_semicolon.exp new file mode 100644 index 0000000000000..6aa20abf68d82 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_semicolon.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/let_binding_missing_semicolon.move:4:5 + │ +4 │ } + │ ^ + │ │ + │ Unexpected '}' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_semicolon.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_semicolon.move new file mode 100644 index 0000000000000..202da1b2e4814 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_semicolon.move @@ -0,0 +1,5 @@ +module M { + fun f() { + let x // Test a missing semicolon + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_type.exp new file mode 100644 index 0000000000000..71fac9323f182 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_type.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/let_binding_missing_type.move:3:17 + │ +3 │ let x : = 0; // Test a missing let type (but with a colon) + │ ^ + │ │ + │ Unexpected '=' + │ Expected a type name diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_type.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_type.move new file mode 100644 index 0000000000000..9961158d470dc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_missing_type.move @@ -0,0 +1,5 @@ +module M { + fun f() { + let x : = 0; // Test a missing let type (but with a colon) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_trailing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_trailing_comma.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_trailing_comma.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_trailing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_trailing_comma.move new file mode 100644 index 0000000000000..b8e325a43dee3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/let_binding_trailing_comma.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + fun f() { + let (x1, x2,) = (1, 2); // Test a trailing comma in the let binding + x1; + x2; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/missing_angle_brace_close.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/missing_angle_brace_close.exp new file mode 100644 index 0000000000000..a02d9739752fc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/missing_angle_brace_close.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/missing_angle_brace_close.move:3:22 + │ +3 │ let x = t' + │ │ + │ To match this '<' + │ Perhaps you need a blank space before this '<' operator? diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/missing_angle_brace_close.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/missing_angle_brace_close.move new file mode 100644 index 0000000000000..f187f973d2747 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/missing_angle_brace_close.move @@ -0,0 +1,5 @@ +module M { + fun foo() { + let x = t { + b"http://diem.com" + } + + // This is a regular comment which appears where a doc comment would not be allowed. +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/not_doc_comment.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/not_doc_comment.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/not_doc_comment.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/not_doc_comment.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/not_doc_comment.move new file mode 100644 index 0000000000000..30876031ab80a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/not_doc_comment.move @@ -0,0 +1,5 @@ +module 0xdecafbad::m { + /**/ + fun /**/foo() { } + /* /**/ */ +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading.exp new file mode 100644 index 0000000000000..f63e161b99bea --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `_0x0u8` + ┌─ tests/more-v1/parser/num_hex_literal_underscore_leading.move:4:17 + │ +4 │ let _ = _0x0u8; + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading.move new file mode 100644 index 0000000000000..3022ad9d64593 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading.move @@ -0,0 +1,6 @@ +module 0x42::M { + fun t() { + // Leading underscore not allowed + let _ = _0x0u8; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.exp new file mode 100644 index 0000000000000..b204159c55a22 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `_0x76` + ┌─ tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.move:4:17 + │ +4 │ let _ = _0x76; + │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.move new file mode 100644 index 0000000000000..521d669858e3e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.move @@ -0,0 +1,6 @@ +module 0x42::M { + fun t() { + // Leading underscore not allowed + let _ = _0x76; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_trailing.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_trailing.exp new file mode 100644 index 0000000000000..a6c5b1fcf86b5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_trailing.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/num_hex_literal_underscore_trailing.move:4:22 + │ +4 │ let _ = 0x0u8_; + │ ^ + │ │ + │ Unexpected '_' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_trailing.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_trailing.move new file mode 100644 index 0000000000000..c6d4a0abee4b1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_trailing.move @@ -0,0 +1,6 @@ +module 0x42::M { + fun t() { + // Trailing underscore after bit-width suffix not allowed + let _ = 0x0u8_; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore.move new file mode 100644 index 0000000000000..12173339df90d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore.move @@ -0,0 +1,43 @@ +module 0x42::M { + fun t() { + // Single underscore separations allowed + let _ = 8_5u128; + let _ = 8_5; + let _: u8 = 8_5; + let _ = 0x8_5u128; + let _ = 0x8_5; + let _: u8 = 0x8_5; + + // Multiple underscore separations allowed + let _ = 02345677_15463636363_36464784848_456847568568775u256; + let _ = 0_1_3_4; + let _: u64 = 0_1_3_4; + let _ = 0x02345677_15463636363_36464784848_456847568568775u256; + let _ = 0x0_1_3_4; + let _: u64 = 0x0_1_3_4; + + // Single trailing allowed + let _ = 567_u64; + let _ = 567_; + let _: u64 = 5_6_7; + let _ = 0x567_u64; + let _ = 0x567_; + let _: u64 = 0x5_6_7; + + // Multiple trailing allowed + let _ = 567___u32; + let _ = 567___; + let _: u64 = 567___; + let _ = 0x567___u32; + let _ = 0x567___; + let _: u64 = 0x567___; + + // Multiple underscore in tandem allowed + let _ = 0__8u16; + let _ = 0__8; + let _: u8 = 0__8; + let _ = 0x0__8u16; + let _ = 0x0__8; + let _: u8 = 0x0__8; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading.exp new file mode 100644 index 0000000000000..518f918e4de20 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `_0u8` + ┌─ tests/more-v1/parser/num_literal_underscore_leading.move:4:17 + │ +4 │ let _ = _0u8; + │ ^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading.move new file mode 100644 index 0000000000000..556ebaffcf7eb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading.move @@ -0,0 +1,6 @@ +module 0x42::M { + fun t() { + // Leading underscore not allowed + let _ = _0u8; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.exp new file mode 100644 index 0000000000000..c5e5139770d50 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `_76` + ┌─ tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.move:4:17 + │ +4 │ let _ = _76; + │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.move new file mode 100644 index 0000000000000..5c26884a47822 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.move @@ -0,0 +1,6 @@ +module 0x42::M { + fun t() { + // Leading underscore not allowed + let _ = _76; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_trailing.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_trailing.exp new file mode 100644 index 0000000000000..c61b24b5e8eef --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_trailing.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/num_literal_underscore_trailing.move:4:20 + │ +4 │ let _ = 0u8_; + │ ^ + │ │ + │ Unexpected '_' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_trailing.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_trailing.move new file mode 100644 index 0000000000000..f464a0c1af68d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/num_literal_underscore_trailing.move @@ -0,0 +1,6 @@ +module 0x42::M { + fun t() { + // Trailing underscore after bit-width suffix not allowed + let _ = 0u8_; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_invalid_keyword.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_invalid_keyword.exp new file mode 100644 index 0000000000000..bc639191a9f4e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_invalid_keyword.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/phantom_param_invalid_keyword.move:2:25 + │ +2 │ struct S { + │ - ^ Expected '>' + │ │ + │ To match this '<' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_invalid_keyword.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_invalid_keyword.move new file mode 100644 index 0000000000000..d9581bcb19bea --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_invalid_keyword.move @@ -0,0 +1,5 @@ +module M { + struct S { + a: T1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_missing_type_var.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_missing_type_var.exp new file mode 100644 index 0000000000000..57b80eb271f2d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_missing_type_var.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/phantom_param_missing_type_var.move:2:25 + │ +2 │ struct S { + │ ^ + │ │ + │ Unexpected '>' + │ Expected an identifier diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_missing_type_var.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_missing_type_var.move new file mode 100644 index 0000000000000..c3b3eb3144777 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/phantom_param_missing_type_var.move @@ -0,0 +1,5 @@ +module M { + struct S { + f1: u64 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/preserve_address_syntax.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/preserve_address_syntax.exp new file mode 100644 index 0000000000000..704f1708a9af5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/preserve_address_syntax.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: no function named `M::foo` found + ┌─ tests/more-v1/parser/preserve_address_syntax.move:5:9 + │ +5 │ 0x00042::M::foo(); + │ ^^^^^^^^^^^^^^^^^ + +error: no function named `N::bar` found + ┌─ tests/more-v1/parser/preserve_address_syntax.move:6:9 + │ +6 │ 000112::N::bar(); + │ ^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/preserve_address_syntax.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/preserve_address_syntax.move new file mode 100644 index 0000000000000..86e4412182be7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/preserve_address_syntax.move @@ -0,0 +1,8 @@ +// make sure addresses are printed as parsed +// but zeros are still trimmed +script { + fun ex() { + 0x00042::M::foo(); + 000112::N::bar(); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/return_in_binop.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/return_in_binop.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/return_in_binop.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/return_in_binop.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/return_in_binop.move new file mode 100644 index 0000000000000..9cdee087b0f78 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/return_in_binop.move @@ -0,0 +1,20 @@ +module 0x42::M { + fun t() { + return >> 0; + return << 0; + return || false; + return && false; + return + 0; + return - 0; + return % 0; + return / 1; + return < 0; + return > 0; + return <= 0; + return == 0; + return >= 0; + return != 0; + return | 0; + return ^ 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_emits_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_emits_fail.exp new file mode 100644 index 0000000000000..dd3842a8ffd81 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_emits_fail.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/spec_parsing_emits_fail.move:3:19 + │ +3 │ emits _msg; + │ ^ + │ │ + │ Unexpected ';' + │ Expected 'to' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_emits_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_emits_fail.move new file mode 100644 index 0000000000000..0760332a8880d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_emits_fail.move @@ -0,0 +1,8 @@ +module M { + spec with_emits { + emits _msg; + } + fun with_emits(_guid: vector, _msg: T, x: u64): u64 { + x + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_fun_type_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_fun_type_fail.exp new file mode 100644 index 0000000000000..e023799381a93 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_fun_type_fail.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: Only inline functions may have function-typed parameters, but non-inline function `M::fun_type_in_prog` has a function parameter: + ┌─ tests/more-v1/parser/spec_parsing_fun_type_fail.move:2:9 + │ +2 │ fun fun_type_in_prog(p: |u64|u64) { + │ ^^^^^^^^^^^^^^^^ - Parameter `p` has function-valued type `|u64|u64`. + +warning: Unused parameter `p`. Consider removing or prefixing with an underscore: `_p` + ┌─ tests/more-v1/parser/spec_parsing_fun_type_fail.move:2:26 + │ +2 │ fun fun_type_in_prog(p: |u64|u64) { + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_fun_type_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_fun_type_fail.move new file mode 100644 index 0000000000000..8fa45abafdb76 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_fun_type_fail.move @@ -0,0 +1,4 @@ +module 0x8675309::M { + fun fun_type_in_prog(p: |u64|u64) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_generic_condition_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_generic_condition_fail.exp new file mode 100644 index 0000000000000..c00fb5061447c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_generic_condition_fail.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/spec_parsing_generic_condition_fail.move:3:16 + │ +3 │ ensures exists(0x1) <==> exists(0x1); + │ ^ + │ │ + │ Unexpected '<' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_generic_condition_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_generic_condition_fail.move new file mode 100644 index 0000000000000..e71b2d1a4b9fe --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_generic_condition_fail.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + spec schema InvalidGenericEnsures { + ensures exists(0x1) <==> exists(0x1); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_implies_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_implies_fail.exp new file mode 100644 index 0000000000000..d83b203d441bc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_implies_fail.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/parser/spec_parsing_implies_fail.move:3:15 + │ +3 │ let _ = x ==> x; + │ ^^^^^^^ `==>` operator only allowed in specifications diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_implies_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_implies_fail.move new file mode 100644 index 0000000000000..9bd1e22414ebb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_implies_fail.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + fun implies_in_prog(x: bool) { + let _ = x ==> x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_index_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_index_fail.exp new file mode 100644 index 0000000000000..c19a88eaeeacc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_index_fail.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/more-v1/parser/spec_parsing_index_fail.move:3:15 + │ +3 │ let _ = x[1]; + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_index_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_index_fail.move new file mode 100644 index 0000000000000..ef8fccec95648 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_index_fail.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + fun index_in_prog(x: u64) { + let _ = x[1]; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_inside_fun.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_inside_fun.exp new file mode 100644 index 0000000000000..cdf4d35640eb7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_inside_fun.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: cannot use `()` with an operator which expects a value of type `integer` + ┌─ tests/more-v1/parser/spec_parsing_inside_fun.move:32:9 + │ +32 │ spec {} + 1; + │ ^^^^^^^ + +error: cannot use `()` with an operator which expects a value of type `bool` + ┌─ tests/more-v1/parser/spec_parsing_inside_fun.move:33:9 + │ +33 │ spec {} && spec {}; + │ ^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_inside_fun.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_inside_fun.move new file mode 100644 index 0000000000000..7b493a41ae255 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_inside_fun.move @@ -0,0 +1,36 @@ +module 0x8675309::M { + fun specs_in_fun(x: u64, n: u64) { + // an ordinary assume + spec { + assume x > 42; + }; + + // loop invariant is written in a spec block inside the loop condition + while ({spec {assert x < 42;}; n < 64}) { + spec { + assert x > 42; + assert 0 < x; + }; + n = n + 1 + }; + + // an ordinary assert + spec { + assert x > 42; + }; + + // loop invariant is written in a spec block at the beginning of loop body + loop { + spec { + assert x > 42; + assert 0 < x; + }; + n = n + 1 + }; + + // the following should parse successfully but fail typing + spec {} + 1; + spec {} && spec {}; + &mut spec {}; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_ok.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_ok.exp new file mode 100644 index 0000000000000..729c903a835a0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_ok.exp @@ -0,0 +1,235 @@ + +Diagnostics: +error: type cannot have type arguments + ┌─ tests/more-v1/parser/spec_parsing_ok.move:15:30 + │ +15 │ native fun all(x: SomeCollection, predicate: |T|bool): bool; + │ ^^^^^^^^^^^^^^ + +error: undeclared `0x8675309::M::SomeCollection` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:15:30 + │ +15 │ native fun all(x: SomeCollection, predicate: |T|bool): bool; + │ ^^^^^^^^^^^^^^ + +error: undeclared `RET` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:48:17 + │ +48 │ ensures RET == x + 1; + │ ^^^ + +error: undeclared `RET` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:57:17 + │ +57 │ ensures RET == x/y; + │ ^^^ + +error: undeclared `RET` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:58:24 + │ +58 │ ensures x/y == RET; + │ ^^^ + +error: undeclared `RET` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:69:17 + │ +69 │ ensures RET = {let y = x; y + 1}; + │ ^^^ + +error: expected `bool` but found a value of type `()` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:69:17 + │ +69 │ ensures RET = {let y = x; y + 1}; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expression construct not supported in specifications + ┌─ tests/more-v1/parser/spec_parsing_ok.move:69:17 + │ +69 │ ensures RET = {let y = x; y + 1}; + │ ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot pass `|(num, num)|num` to a function which expects argument of type `|(num, num)|bool` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:77:24 + │ +77 │ ensures all(x, |y, z| x + y + z); + │ ^^^^^^^^^^^^^^^^ + +error: undeclared `RET` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:84:17 + │ +84 │ ensures RET = x[1] && x[0..3]; + │ ^^^ + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:84:23 + │ +84 │ ensures RET = x[1] && x[0..3]; + │ ^ + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:84:31 + │ +84 │ ensures RET = x[1] && x[0..3]; + │ ^ + +error: cannot use `vector<_>` with an operator which expects a value of type `bool` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:84:31 + │ +84 │ ensures RET = x[1] && x[0..3]; + │ ^^^^^^^ + +error: expected `bool` but found a value of type `()` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:84:17 + │ +84 │ ensures RET = x[1] && x[0..3]; + │ ^^^^^^^^^^^^^^^^^^^^^ + +error: expression construct not supported in specifications + ┌─ tests/more-v1/parser/spec_parsing_ok.move:84:17 + │ +84 │ ensures RET = x[1] && x[0..3]; + │ ^^^^^^^^^^^^^^^^^^^^^ + +error: undeclared `RET` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:91:27 + │ +91 │ ensures x > 0 ==> RET == x - 1; + │ ^^^ + +error: undeclared `RET` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:92:28 + │ +92 │ ensures x == 0 ==> RET == x; + │ ^^^ + +error: undeclared `generic` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:112:26 + │ +112 │ invariant update generic = 23; + │ ^^^^^^^^^^^^ + +error: expected `bool` but found a value of type `()` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:112:26 + │ +112 │ invariant update generic = 23; + │ ^^^^^^^^^^^^^^^^^ + +error: expression construct not supported in specifications + ┌─ tests/more-v1/parser/spec_parsing_ok.move:112:26 + │ +112 │ invariant update generic = 23; + │ ^^^^^^^^^^^^^^^^^ + +error: undeclared struct `M::generic` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:113:26 + │ +113 │ invariant update Self::generic = 24; + │ ^^^^^^^^^^^^^ + +error: expected `bool` but found a value of type `()` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:113:26 + │ +113 │ invariant update Self::generic = 24; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + +error: expression construct not supported in specifications + ┌─ tests/more-v1/parser/spec_parsing_ok.move:113:26 + │ +113 │ invariant update Self::generic = 24; + │ ^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:124:28 + │ +124 │ requires global(0x0).f == global(0x1).f; + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:124:48 + │ +124 │ requires global(0x0).f == global(0x1).f; + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:125:27 + │ +125 │ ensures global(0x0).f == global(0x1).f; + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:125:47 + │ +125 │ ensures global(0x0).f == global(0x1).f; + │ ^^^ + +error: `foo` not declared in schema + ┌─ tests/more-v1/parser/spec_parsing_ok.move:129:39 + │ +129 │ include ModuleInvariant{foo:bar, x:y}; + │ ^^^ + +error: undeclared `bar` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:129:43 + │ +129 │ include ModuleInvariant{foo:bar, x:y}; + │ ^^^ + +error: `x` not declared in schema + ┌─ tests/more-v1/parser/spec_parsing_ok.move:129:48 + │ +129 │ include ModuleInvariant{foo:bar, x:y}; + │ ^ + +error: undeclared `y` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:129:50 + │ +129 │ include ModuleInvariant{foo:bar, x:y}; + │ ^ + +error: property `do_not_verify` is not valid in this context + ┌─ tests/more-v1/parser/spec_parsing_ok.move:135:9 + │ +135 │ pragma do_not_verify, timeout = 60; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: property `timeout` is not valid in this context + ┌─ tests/more-v1/parser/spec_parsing_ok.move:135:9 + │ +135 │ pragma do_not_verify, timeout = 60; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:142:37 + │ +142 │ invariant exists(0x0) <==> exists(0x0); + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:142:57 + │ +142 │ invariant exists(0x0) <==> exists(0x0); + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:143:45 + │ +143 │ invariant exists(0x0) && exists(0x1) <==> exists(0x1) && exists(0x0); + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:143:63 + │ +143 │ invariant exists(0x0) && exists(0x1) <==> exists(0x1) && exists(0x0); + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:143:83 + │ +143 │ invariant exists(0x0) && exists(0x1) <==> exists(0x1) && exists(0x0); + │ ^^^ + +error: cannot use `u256` with an operator which expects a value of type `address` + ┌─ tests/more-v1/parser/spec_parsing_ok.move:143:101 + │ +143 │ invariant exists(0x0) && exists(0x1) <==> exists(0x1) && exists(0x0); + │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_ok.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_ok.move new file mode 100644 index 0000000000000..da4138cdf8603 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_ok.move @@ -0,0 +1,153 @@ +// These are some basic parsing tests for specifications which are expected to succeed. +// Full testing of spec parsing correctness is done outside of this crate. +// +// Note that even though we only test parsing, we still need to ensure that the move code (not the specification) +// is type checking correctly, because with no parsing error, the test harness +// will run subsequent phases of the move-compiler compiler. +// +// For parse failures, see the `spec_*_fail.move` test cases. + +module 0x8675309::M { + spec module { + global expected_coin_sum: u64; + global other: bool; + + native fun all(x: SomeCollection, predicate: |T|bool): bool; + + fun spec_fun_using_spec_constructs(x: u64, y: u64) : u64 { + // This function would crash in phases after expansion if we would pass it on as a regular function. Testing + // here that we don't pass it on. + let _ = |z| z + 1; + let _ = x .. y; + x + } + } + + struct T has key {x: u64} + struct R has key {x: u64} + + struct SomeCoin { + x : u64, + y: u64, + } + + spec SomeCoin { + // Data invariants + invariant x > 0; + invariant x == y; + } + + spec with_aborts_if { + aborts_if x == 0; + } + fun with_aborts_if(x: u64): u64 { + x + } + + spec with_ensures { + ensures RET == x + 1; + } + fun with_ensures(x: u64): u64 { + x + 1 + } + + spec with_multiple_conditions_and_acquires { + aborts_if y == 0; + aborts_if 0 == y; + ensures RET == x/y; + ensures x/y == RET; + } + + fun with_multiple_conditions_and_acquires(addr: address, x: u64, y: u64): u64 + acquires T, R { + let _ = borrow_global_mut(addr); + let _ = borrow_global_mut(addr); + x / y + } + + spec using_block { + ensures RET = {let y = x; y + 1}; + } + fun using_block(x: u64): u64 { + x + 1 + } + + spec using_lambda + { + ensures all(x, |y, z| x + y + z); + } + fun using_lambda(x: u64): u64 { + x + } + + spec using_index_and_range { + ensures RET = x[1] && x[0..3]; + } + fun using_index_and_range(x: u64): u64 { + x + } + + spec using_implies { + ensures x > 0 ==> RET == x - 1; + ensures x == 0 ==> RET == x; + } + fun using_implies(x: u64): u64 { + x + } + + spec with_emits { + emits _msg to _guid; + emits _msg to _guid if true; + emits _msg to _guid if x > 7; + } + fun with_emits(_guid: vector, _msg: T, x: u64): u64 { + x + } + + spec module { + global x: u64; + local y: u64; + z: u64; + global generic: u64; + invariant update generic = 23; + invariant update Self::generic = 24; + } + + fun some_generic() { + } + spec some_generic { + ensures generic == 1; + ensures Self::generic == 1; + } + + spec schema ModuleInvariant { + requires global(0x0).f == global(0x1).f; + ensures global(0x0).f == global(0x1).f; + } + + spec some_generic { + include ModuleInvariant{foo:bar, x:y}; + } + + spec module { + apply ModuleInvariant to *foo*; + apply ModuleInvariant to *foo*, bar except public *, internal baz; + pragma do_not_verify, timeout = 60; + } + + spec module { + invariant forall x: num, y: num, z: num : x == y && y == z ==> x == z; + invariant forall x: num : exists y: num : y >= x; + invariant exists x in 1..10, y in 8..12 : x == y; + invariant exists(0x0) <==> exists(0x0); + invariant exists(0x0) && exists(0x1) <==> exists(0x1) && exists(0x0); + } + + spec module { + fun spec_fun_non_zero(): num; + axiom spec_fun_non_zero() > 0; + + fun spec_fun_identity(x: T): T; + axiom forall x: T: spec_fun_identity(x) == x; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_old_fun_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_old_fun_fail.exp new file mode 100644 index 0000000000000..a4958b23f0092 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_old_fun_fail.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/spec_parsing_old_fun_fail.move:5:10 + │ +5 │ spec fun with_aborts_if { + │ ^^^ + │ │ + │ Unexpected 'fun' + │ Expected only 'spec', drop the 'fun' keyword diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_old_fun_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_old_fun_fail.move new file mode 100644 index 0000000000000..8622c620f791b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_old_fun_fail.move @@ -0,0 +1,12 @@ +// Tests error reporting for use of old spec fun syntax. + +module 0x8675309::M { + + spec fun with_aborts_if { + aborts_if x == 0; + } + fun with_aborts_if(x: u64): u64 { + x + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_quantifier_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_quantifier_fail.exp new file mode 100644 index 0000000000000..d4407070eb19a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_quantifier_fail.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/spec_parsing_quantifier_fail.move:3:33 + │ +3 │ invariant forall x: num y: num : x == y; + │ ^ + │ │ + │ Unexpected 'y' + │ Expected ':' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_quantifier_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_quantifier_fail.move new file mode 100644 index 0000000000000..858972a6b4419 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_quantifier_fail.move @@ -0,0 +1,5 @@ +module M { + spec module { + invariant forall x: num y: num : x == y; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_range_fail.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_range_fail.exp new file mode 100644 index 0000000000000..5a64824eb05c9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_range_fail.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: syntax item restricted to spec contexts + ┌─ tests/more-v1/parser/spec_parsing_range_fail.move:3:15 + │ +3 │ let _ = 1 .. 2; + │ ^^^^^^ `..` operator only allowed in specifications diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_range_fail.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_range_fail.move new file mode 100644 index 0000000000000..d02e0adb0962e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/spec_parsing_range_fail.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + fun range_in_prog(x: u64) { + let _ = 1 .. 2; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_field_missing_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_field_missing_type.exp new file mode 100644 index 0000000000000..60611ff82959f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_field_missing_type.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/struct_field_missing_type.move:2:18 + │ +2 │ struct S { f } // Each field must specify a type + │ ^ + │ │ + │ Unexpected '}' + │ Expected ':' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_field_missing_type.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_field_missing_type.move new file mode 100644 index 0000000000000..fa6bef679905a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_field_missing_type.move @@ -0,0 +1,3 @@ +module M { + struct S { f } // Each field must specify a type +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_missing_lbrace.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_missing_lbrace.exp new file mode 100644 index 0000000000000..4adcb2d647b56 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_missing_lbrace.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/struct_missing_lbrace.move:3:5 + │ +2 │ struct S { f: u64 // } + │ - To match this '{' +3 │ fun f() {} + │ ^ Expected '}' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_missing_lbrace.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_missing_lbrace.move new file mode 100644 index 0000000000000..8aca7c6743679 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_missing_lbrace.move @@ -0,0 +1,4 @@ +module M { + struct S { f: u64 // } + fun f() {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_missing_semicolon.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_missing_semicolon.exp new file mode 100644 index 0000000000000..0cf2be6ace8f0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_missing_semicolon.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/struct_native_missing_semicolon.move:3:1 + │ +3 │ } + │ ^ + │ │ + │ Unexpected '}' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_missing_semicolon.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_missing_semicolon.move new file mode 100644 index 0000000000000..0acdc6d66bd52 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_missing_semicolon.move @@ -0,0 +1,3 @@ +module M { + native struct S // ; +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_with_fields.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_with_fields.exp new file mode 100644 index 0000000000000..68ff2eb63c519 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_with_fields.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/struct_native_with_fields.move:3:21 + │ +3 │ native struct S { f: u64 } + │ ^ + │ │ + │ Unexpected '{' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_with_fields.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_with_fields.move new file mode 100644 index 0000000000000..e29d1ad9ded47 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_native_with_fields.move @@ -0,0 +1,4 @@ +module M { + // Native structs should not specify fields. + native struct S { f: u64 } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_public.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_public.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_public.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_public.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_public.move new file mode 100644 index 0000000000000..656037e8ce2dd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_public.move @@ -0,0 +1,4 @@ +module 0x42::M { + // visibility modifiers on structs fail during parsing + public struct Foo {} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_trailing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_trailing_comma.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_trailing_comma.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_trailing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_trailing_comma.move new file mode 100644 index 0000000000000..0fbed4ccb4573 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_trailing_comma.move @@ -0,0 +1,3 @@ +module 0x8675309::M { + struct S { f: u64, g: u64, } // Test a trailing comma after the last field +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_empty.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_empty.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_empty.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_empty.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_empty.move new file mode 100644 index 0000000000000..4915e40df1d81 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_empty.move @@ -0,0 +1,4 @@ +module 0x8675309::M { + // Test an empty list of type parameters. + struct S<> { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_extra_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_extra_comma.exp new file mode 100644 index 0000000000000..8be6ec9f25cdb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_extra_comma.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/struct_type_extra_comma.move:2:14 + │ +2 │ struct S<,T> { } // Test a comma before the first type parameter + │ ^ Expected a type parameter diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_extra_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_extra_comma.move new file mode 100644 index 0000000000000..dad273524c7f1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_extra_comma.move @@ -0,0 +1,3 @@ +module M { + struct S<,T> { } // Test a comma before the first type parameter +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_missing_angle.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_missing_angle.exp new file mode 100644 index 0000000000000..5d287d823e1e0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_missing_angle.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/struct_type_missing_angle.move:3:21 + │ +3 │ struct S' + │ │ + │ To match this '<' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_missing_angle.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_missing_angle.move new file mode 100644 index 0000000000000..e5e26f9a160dd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_missing_angle.move @@ -0,0 +1,4 @@ +module M { + // Test a missing ">" after the type parameters. + struct S { } + │ ^^^^^^^^ Unexpected 'copyable'. Expected a type ability, one of: 'copy', 'drop', 'store', or 'key' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_copy_constraint.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_copy_constraint.move new file mode 100644 index 0000000000000..f5b81f77c70ef --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_copy_constraint.move @@ -0,0 +1,4 @@ +module M { + // Check misspelling of "copy" constraint. + struct S { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_key_constraint.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_key_constraint.exp new file mode 100644 index 0000000000000..d52a911f6d8ae --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_key_constraint.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/struct_type_misspelled_key_constraint.move:3:17 + │ +3 │ struct S { } + │ ^^ Unexpected 'ky'. Expected a type ability, one of: 'copy', 'drop', 'store', or 'key' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_key_constraint.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_key_constraint.move new file mode 100644 index 0000000000000..ed682228342a5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_key_constraint.move @@ -0,0 +1,4 @@ +module M { + // Check misspelling of "key" constraint. + struct S { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_trailing_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_trailing_comma.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_trailing_comma.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_trailing_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_trailing_comma.move new file mode 100644 index 0000000000000..57595ffba5fd3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_type_trailing_comma.move @@ -0,0 +1,3 @@ +module 0x8675309::M { + struct S { f1: T1, f2: T2 } // Test a trailing comma in the type parameters +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_without_fields.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_without_fields.exp new file mode 100644 index 0000000000000..e9c836d29e0b7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_without_fields.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: invalid 'module' declaration + ┌─ tests/more-v1/parser/struct_without_fields.move:1:8 + │ +1 │ module M { + │ ^ Invalid module declaration. The module does not have a specified address. Either declare it inside of an 'address
{' block or declare it with an address 'module
::M'' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_without_fields.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_without_fields.move new file mode 100644 index 0000000000000..626d7c0e9a698 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/struct_without_fields.move @@ -0,0 +1,4 @@ +module M { + // Non-native structs must specify the list of fields. + struct S; +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/testonly.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/testonly.exp new file mode 100644 index 0000000000000..cb4d92559c5c8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/testonly.exp @@ -0,0 +1,16 @@ + +Diagnostics: +warning: unknown attribute + ┌─ tests/more-v1/parser/testonly.move:5:7 + │ +5 │ #[testonly] + │ ^^^^^^^^ Attribute name 'testonly' is unknown (use --skip-attribute-checks CLI option to ignore); known attributes are '{"bytecode_instruction", "deprecated", "expected_failure", "lint::skip", "native_interface", "test", "test_only", "verify_only"}'. + +warning: unknown attribute + ┌─ tests/more-v1/parser/testonly.move:15:7 + │ +15 │ #[view] + │ ^^^^ Attribute name 'view' is unknown (use --skip-attribute-checks CLI option to ignore); known attributes are '{"bytecode_instruction", "deprecated", "expected_failure", "lint::skip", "native_interface", "test", "test_only", "verify_only"}'. + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/testonly.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/testonly.move new file mode 100644 index 0000000000000..6631942d17dc6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/testonly.move @@ -0,0 +1,19 @@ +module 0x1::A { + #[test] + fun a() { } + + #[testonly] + public fun a_call() { + abort 0 + } + + #[test_only] + public fun b_call() { + abort 0 + } + + #[view] + public fun c_call() { + abort 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp new file mode 100644 index 0000000000000..b9eafd1f9f753 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/unexpected_token_after_ability_function_constraint.move:4:21 + │ +4 │ fun foo() {} + │ ^ + │ │ + │ Unexpected '&' + │ Expected one of: '+', '>', or ',' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.move new file mode 100644 index 0000000000000..0fb8d6b3f33eb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.move @@ -0,0 +1,6 @@ +address 0x42 { +module M { + // incorrect delim for ability constraint + fun foo() {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_modifier.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_modifier.exp new file mode 100644 index 0000000000000..65a6781561791 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_modifier.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/unexpected_token_after_ability_modifier.move:4:25 + │ +4 │ struct Foo has copy & drop {} + │ ^ + │ │ + │ Unexpected '&' + │ Expected one of: ',', '{', or ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_modifier.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_modifier.move new file mode 100644 index 0000000000000..40c7354699824 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_modifier.move @@ -0,0 +1,6 @@ +address 0x42 { +module M { + // incorrect delim for ability modifiers + struct Foo has copy & drop {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_function_constraint.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_function_constraint.exp new file mode 100644 index 0000000000000..e1ef733267053 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_function_constraint.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/unknown_ability_name_function_constraint.move:4:16 + │ +4 │ fun foo() {} + │ ^^^^ Unexpected 'blah'. Expected a type ability, one of: 'copy', 'drop', 'store', or 'key' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_function_constraint.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_function_constraint.move new file mode 100644 index 0000000000000..94044e5e4eeb4 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_function_constraint.move @@ -0,0 +1,6 @@ +address 0x42 { +module M { + // invalid constraint + fun foo() {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_modifier.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_modifier.exp new file mode 100644 index 0000000000000..2cea9056361cf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_modifier.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/unknown_ability_name_modifier.move:4:20 + │ +4 │ struct Foo has blah {} + │ ^^^^ Unexpected 'blah'. Expected a type ability, one of: 'copy', 'drop', 'store', or 'key' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_modifier.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_modifier.move new file mode 100644 index 0000000000000..3b234ce31ab72 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unknown_ability_name_modifier.move @@ -0,0 +1,6 @@ +address 0x42 { +module M { + // invalid ability name + struct Foo has blah {} +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope.exp new file mode 100644 index 0000000000000..3a656a83268e2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope.exp @@ -0,0 +1,97 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:5:13 + │ +5 │ use 0x2::Mango; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x2::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:6:13 + │ +6 │ use 0x2::Mango as M; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x2::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:7:13 + │ +7 │ use 0x2::Mango::baz; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x2::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:8:13 + │ +8 │ use 0x2::Salsa::{Self, foo as bar, foo}; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x2::Salsa' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:10:17 + │ +10 │ use 0x2::Mango; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x2::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:11:17 + │ +11 │ use 0x3::Mango as M; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:12:17 + │ +12 │ use 0x3::Mango::baz; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:13:17 + │ +13 │ use 0x3::Salsa::{Self, foo as bar, foo}; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Salsa' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:27:53 + │ +27 │ use 0x2::Mango; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x2::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:28:53 + │ +28 │ use 0x3::Mango as M; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:29:53 + │ +29 │ use 0x3::Mango::baz; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:30:53 + │ +30 │ use 0x3::Salsa::{Self, foo as bar, foo}; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Salsa' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:43:17 + │ +43 │ use 0x2::Mango; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x2::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:44:17 + │ +44 │ use 0x3::Mango as M; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:45:17 + │ +45 │ use 0x3::Mango::baz; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Mango' + +error: unbound module + ┌─ tests/more-v1/parser/use_inner_scope.move:46:17 + │ +46 │ use 0x3::Salsa::{Self, foo as bar, foo}; + │ ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x3::Salsa' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope.move new file mode 100644 index 0000000000000..383a18a6cbc1b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope.move @@ -0,0 +1,51 @@ +address 0x2 { +module M { + + fun t() { + use 0x2::Mango; + use 0x2::Mango as M; + use 0x2::Mango::baz; + use 0x2::Salsa::{Self, foo as bar, foo}; + let x = { + use 0x2::Mango; + use 0x3::Mango as M; + use 0x3::Mango::baz; + use 0x3::Salsa::{Self, foo as bar, foo}; + + 0 + }; + { + { + { + { + { + { + { + { + { + { + use 0x2::Mango; + use 0x3::Mango as M; + use 0x3::Mango::baz; + use 0x3::Salsa::{Self, foo as bar, foo}; + } + } + } + } + } + } + } + } + } + }; + + while (true) { + use 0x2::Mango; + use 0x3::Mango as M; + use 0x3::Mango::baz; + use 0x3::Salsa::{Self, foo as bar, foo}; + + } + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid.exp new file mode 100644 index 0000000000000..c5cce2afad325 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/use_inner_scope_invalid.move:6:9 + │ +6 │ use 0x1::M::foo; + │ ^^^ + │ │ + │ Unexpected 'use' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid.move new file mode 100644 index 0000000000000..100cf42d311cb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid.move @@ -0,0 +1,9 @@ +address 0x2 { +module M { + fun t() { + let x = 0; + + use 0x1::M::foo; + foo(x) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid_inner.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid_inner.exp new file mode 100644 index 0000000000000..e72c80ff3710f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid_inner.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/use_inner_scope_invalid_inner.move:4:19 + │ +4 │ if (cond) use 0x2::M; + │ ^^^ + │ │ + │ Unexpected 'use' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid_inner.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid_inner.move new file mode 100644 index 0000000000000..70a4283a3911b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid_inner.move @@ -0,0 +1,6 @@ +address 0x2 { +module M { + fun t() { + if (cond) use 0x2::M; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member.move new file mode 100644 index 0000000000000..285da306d713d --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member.move @@ -0,0 +1,37 @@ +address 0x1 { + +module X { + struct S {} + public fun foo() {} +} + +module Y { + struct S {} + public fun foo() {} +} + +module Z { + struct S {} + public fun foo() {} +} + +module M { + + struct A { f1: XS, f2: S, f3: Z} + + use 0x1::X::{S as XS, foo}; + use 0x1::Z::{ + S as Z, + foo as zfoo, + }; + + public fun m() { + foo(); + Foo(); + zfoo(); + } + + use 0x1::Y::S; + use 0x1::Y::foo as Foo; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_comma.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_comma.exp new file mode 100644 index 0000000000000..18a6d2549d879 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_comma.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/use_module_member_invalid_comma.move:4:26 + │ +4 │ use 0x1::X::{S as XS,,}; + │ ^ Expected a module member alias diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_comma.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_comma.move new file mode 100644 index 0000000000000..dbf7005b7f2a1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_comma.move @@ -0,0 +1,5 @@ + +module M { + + use 0x1::X::{S as XS,,}; +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_close_brace.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_close_brace.exp new file mode 100644 index 0000000000000..20faa845696b9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_close_brace.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/use_module_member_invalid_missing_close_brace.move:6:5 + │ +4 │ use 0x1::X::{S as XS + │ - To match this '{' +5 │ +6 │ fun foo() { + │ ^ Expected '}' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_close_brace.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_close_brace.move new file mode 100644 index 0000000000000..e009dd193ff10 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_close_brace.move @@ -0,0 +1,9 @@ + +module M { + + use 0x1::X::{S as XS + + fun foo() { + + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_semicolon.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_semicolon.exp new file mode 100644 index 0000000000000..8fc0b0e82dc69 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_semicolon.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/use_module_member_invalid_missing_semicolon.move:5:1 + │ +5 │ } + │ ^ + │ │ + │ Unexpected '}' + │ Expected ';' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_semicolon.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_semicolon.move new file mode 100644 index 0000000000000..9d7795fcad6de --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_semicolon.move @@ -0,0 +1,5 @@ + +module M { + + use 0x1::X::{S as XS,} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_address.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_address.exp new file mode 100644 index 0000000000000..b1d03f91feb55 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_address.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/use_with_address.move:2:1 + │ +2 │ use 0x1::Module; + │ ^^^ Invalid code unit. Expected 'address', 'module', or 'script'. Got 'use' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_address.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_address.move new file mode 100644 index 0000000000000..90d309732efc5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_address.move @@ -0,0 +1,3 @@ +// Top-level "use" are currently meaningless. The feature might be added some day +use 0x1::Module; +address 0x2 {} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_main.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_main.exp new file mode 100644 index 0000000000000..bd792374546fd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_main.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/parser/use_with_main.move:3:5 + │ +3 │ use 0x0::Module; + │ ^^^^^^^^^^^ Invalid 'use'. Unbound module: '0x0::Module' + +error: unbound module + ┌─ tests/more-v1/parser/use_with_main.move:4:5 + │ +4 │ use 0xaBcD::Module as M; + │ ^^^^^^^^^^^^^^ Invalid 'use'. Unbound module: '0xABCD::Module' + +error: unbound module + ┌─ tests/more-v1/parser/use_with_main.move:5:5 + │ +5 │ use 0x0000::Z; + │ ^^^^^^^^^ Invalid 'use'. Unbound module: '0x0::Z' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_main.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_main.move new file mode 100644 index 0000000000000..fba072387f2a6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_main.move @@ -0,0 +1,8 @@ +// Test various "use" declarations at the file level. +script { +use 0x0::Module; +use 0xaBcD::Module as M; +use 0x0000::Z; +fun main() { +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_module.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_module.exp new file mode 100644 index 0000000000000..84c5f25da4505 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_module.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/use_with_module.move:2:1 + │ +2 │ use 0x1::Module; + │ ^^^ Invalid code unit. Expected 'address', 'module', or 'script'. Got 'use' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_module.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_module.move new file mode 100644 index 0000000000000..1624d8ab693d1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/use_with_module.move @@ -0,0 +1,4 @@ +// Top-level "use" are currently meaningless. The feature might be added some day +use 0x1::Module; +module M { +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_args.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_args.exp new file mode 100644 index 0000000000000..610fe096db4b3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_args.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/vector_literal_unclosed_args.move:5:5 + │ +5 │ } + │ ^ + │ │ + │ Unexpected '}' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_args.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_args.move new file mode 100644 index 0000000000000..11595991cefff --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_args.move @@ -0,0 +1,6 @@ +module 0x42::Test { + fun t() { + // test missing ] + let v = vector[ + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_type_args.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_type_args.exp new file mode 100644 index 0000000000000..bd0f0baad005c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_type_args.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/parser/vector_literal_unclosed_type_args.move:4:27 + │ +4 │ let v = vector' + │ │ + │ To match this '<' + │ Perhaps you need a blank space before this '<' operator? diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_type_args.move b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_type_args.move new file mode 100644 index 0000000000000..0d9abe4500f65 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_type_args.move @@ -0,0 +1,6 @@ +module 0x42::Test { + fun t() { + // test missing > + let v = vector(signer::address_of(account)); + } +} + +// check: DUPLICATE_ACQUIRES_RESOURCE_ANNOTATION_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.exp new file mode 100644 index 0000000000000..88853308cc0ea --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: function acquires global `Tester::Pair` which is currently borrowed + ┌─ tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.move:32:9 + │ +29 │ let p1 = borrow_global(addr1); + │ -------------------------- struct `Tester::Pair` previously borrowed here + · +32 │ eq_helper(p1, addr2) + │ ^^^^^^^^^^^^^^^^^^^^ function called here + · +35 │ fun eq_helper(p1: &Pair, addr2: address): bool acquires Pair { + │ ----- access declared here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.move new file mode 100644 index 0000000000000..dd1b238af8caf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.move @@ -0,0 +1,44 @@ +address 0x42 { + +module A { + struct Coin has store { u: u64 } + + public fun new(): Coin { + Coin { u: 1 } + } + + public fun join(c1: Coin, c2: Coin): Coin { + let Coin { u: u1 } = c1; + let Coin { u: u2 } = c2; + Coin { u: u1 + u2 } + } + + public fun split(c1: Coin, amt: u64): (Coin, Coin) { + let Coin { u } = c1; + assert!(u >= amt, 42); + (Coin { u: u - amt }, Coin { u: amt }) + } +} + +module Tester { + use 0x42::A; + + struct Pair has key { x: A::Coin, y: A::Coin } + + fun test_eq(addr1: address, addr2: address): bool acquires Pair { + let p1 = borrow_global(addr1); + // It is lossy in the sense that this could be acceptable if we had 'acquires imm Pair' or + // something to indicate the "acquires" are immutable + eq_helper(p1, addr2) + } + + fun eq_helper(p1: &Pair, addr2: address): bool acquires Pair { + let p2 = borrow_global(addr2); + p1 == p2 + } + +} + +// check: GLOBAL_REFERENCE_ERROR + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.exp new file mode 100644 index 0000000000000..1457d68893313 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unexpected token + ┌─ tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.move:6:1 + │ +6 │ } + │ ^ + │ │ + │ Unexpected '}' + │ Expected an expression term diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.move new file mode 100644 index 0000000000000..b3c48f2602279 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.move @@ -0,0 +1,7 @@ +// check: NEGATIVE_STACK_SIZE_WITHIN_BLOCK +script { + +fun main() { + abort +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.exp new file mode 100644 index 0000000000000..4362ea3b66639 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.move:7:13 + │ + 7 │ y = move x; + │ ^^^^^^ attempted to move here + · +12 │ assert!(x == 5, 42); + │ ------ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.move new file mode 100644 index 0000000000000..9eef4f406c644 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.move @@ -0,0 +1,16 @@ +script { +fun main() { + let x; + let y; + if (true) { + x = 1; + y = move x; + y; + } else { + x = 0; + }; + assert!(x == 5, 42); +} +} + +// check: COPYLOC_UNAVAILABLE_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/break_unreachable.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/break_unreachable.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/break_unreachable.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/break_unreachable.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/break_unreachable.move new file mode 100644 index 0000000000000..03fa7fda81f91 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/break_unreachable.move @@ -0,0 +1,13 @@ +script { +fun main() { + let x; + while (true) { + x = 3; + x; + break; + x = 5; + x; + break + }; +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/consume_stack.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/consume_stack.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/consume_stack.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/consume_stack.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/consume_stack.move new file mode 100644 index 0000000000000..3abe2fb0a4658 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/consume_stack.move @@ -0,0 +1,18 @@ +module 0x8675309::M { + struct R has key { data: vector } + + fun is_ok_(_addr: &address, _data: &vector): bool { + true + } + + public fun is_ok(addr: address): bool acquires R { + is_ok_(&addr, &borrow_global(@0x1D8).data) + } + + // ImmBorrowLoc(0), + // LdConst(1), + // ImmBorrowGlobal(StructDefinitionIndex(4)), + // ImmBorrowField(FieldHandleIndex(0)), + // Call(45), + // Ret, +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return.move new file mode 100644 index 0000000000000..095f865471667 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return.move @@ -0,0 +1,6 @@ +module 0x8675309::Test { + public fun t(): u64 { + return 100; + return 0 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return_local.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return_local.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return_local.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return_local.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return_local.move new file mode 100644 index 0000000000000..4993383688560 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return_local.move @@ -0,0 +1,7 @@ +script { +fun main() { + return (); + assert!(false, 42); + return () +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.exp new file mode 100644 index 0000000000000..c598f2de532cf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.exp @@ -0,0 +1,9 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.move:4:30 + │ +4 │ let y = if (true) 0 else move x; y; + │ ^^^^^^ attempted to move here +5 │ assert!(x == 0, 42); + │ ------ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.move new file mode 100644 index 0000000000000..8fc23e2f6ef4e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.move @@ -0,0 +1,9 @@ +script { +fun main() { + let x = 0; + let y = if (true) 0 else move x; y; + assert!(x == 0, 42); +} +} + +// check: COPYLOC_UNAVAILABLE_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.exp new file mode 100644 index 0000000000000..b2ffe2bcdfd57 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.move:4:23 + │ +4 │ let y = if (true) move x else 0; + │ ^^^^^^ attempted to move here +5 │ y; +6 │ assert!(x == 0, 42); + │ ------ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.move new file mode 100644 index 0000000000000..867d9fc6731cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.move @@ -0,0 +1,10 @@ +script { +fun main() { + let x = 0; + let y = if (true) move x else 0; + y; + assert!(x == 0, 42); +} +} + +// check: COPYLOC_UNAVAILABLE_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.exp new file mode 100644 index 0000000000000..aacd970467d78 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.move:5:17 + │ +5 │ let y = move x; + │ ^^^^^^ attempted to move here + · +8 │ assert!(x == 0, 42); + │ ------ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.move new file mode 100644 index 0000000000000..21b2a26eb847e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.move @@ -0,0 +1,12 @@ +script { +fun main() { + let x = 0; + if (true) { + let y = move x; + y; + }; + assert!(x == 0, 42); +} +} + +// check: COPYLOC_UNAVAILABLE_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.exp new file mode 100644 index 0000000000000..d31eb5b7e945a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.exp @@ -0,0 +1,10 @@ + +Diagnostics: +warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.move:5:3 + │ +5 │ x = 7 + │ ^^^^^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.move new file mode 100644 index 0000000000000..2caf0afac6287 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.move @@ -0,0 +1,9 @@ +script { +fun main() { + let x: u64; + return (); + x = 7 +} +} + +// check: INVALID_FALL_THROUGH diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.exp new file mode 100644 index 0000000000000..f8df53a4e418c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.exp @@ -0,0 +1,10 @@ + +Diagnostics: +warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.move:5:3 + │ +5 │ x = 7; + │ ^^^^^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.move new file mode 100644 index 0000000000000..6728e45ffd234 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.move @@ -0,0 +1,9 @@ +script { +fun main() { + let x: u64; + if (true) return () else return (); + x = 7; +} +} + +// check: INVALID_FALL_THROUGH diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/join_failure.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/join_failure.exp new file mode 100644 index 0000000000000..343b321419f6e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/join_failure.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: cannot move local `r` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/join_failure.move:8:22 + │ + 8 │ R{ f } = move r; + │ ^^^^^^ attempted to move here + · +13 │ R{ f: _ } = move r; + │ ------ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/join_failure.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/join_failure.move new file mode 100644 index 0000000000000..67c2e25284daf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/join_failure.move @@ -0,0 +1,16 @@ +module 0x8675309::M { + struct R { f:bool } + fun t0() { + let r = R{ f: false }; + let f; + + if (true) { + R{ f } = move r; + } else { + R{ f } = move r; + r = R{ f: false }; + }; + R{ f: _ } = move r; + f; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local.exp new file mode 100644 index 0000000000000..8dd7497d49847 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/while_move_local.move:7:13 + │ +7 │ y = move x; + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local.move new file mode 100644 index 0000000000000..42a1042b1ddb2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local.move @@ -0,0 +1,15 @@ +script { +fun main() { + let x = 0; + let y; + let b = true; + while (copy b) { + y = move x; + y; + b = false + } +} +} +// TODO: fix verifier remove identical errors +// check: MOVELOC_UNAVAILABLE_ERROR +// check: MOVELOC_UNAVAILABLE_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.exp new file mode 100644 index 0000000000000..031b636530bfe --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: cannot move local `x` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.move:8:17 + │ +8 │ y = move x; + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here + +error: cannot move local `y` since it is still in use + ┌─ tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.move:10:17 + │ +10 │ x = move y; + │ ^^^^^^ + │ │ + │ attempted to move here + │ used here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.move new file mode 100644 index 0000000000000..44aaf50d1e011 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.move @@ -0,0 +1,18 @@ +script { +fun main() { + let x = 0; + let y = 0; + let b = true; + while (true) { + if (b) { + y = move x; + } else { + x = move y; + }; + b = false; + } +} +} +// TODO: fix verifier remove identical errors +// check: MOVELOC_UNAVAILABLE_ERROR +// check: MOVELOC_UNAVAILABLE_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/double_signer.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/double_signer.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/double_signer.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/double_signer.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/double_signer.move new file mode 100644 index 0000000000000..2466020082e50 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/double_signer.move @@ -0,0 +1,16 @@ +// script functions no longer have any built in checks outside of visibility rules + +script { + fun t0(_s: signer, _s2: signer) { + } +} + +script { + fun t1(_s: signer, _s2: signer, _u: u64) { + } +} + +script { + fun t2(_s: signer, _u: u64, _s2: signer) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/keyword.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/keyword.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/keyword.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/keyword.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/keyword.move new file mode 100644 index 0000000000000..c1828d57fadba --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/keyword.move @@ -0,0 +1,5 @@ +module 0x8675309::M { + fun foo(signer: address) { + signer; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/misplaced_signer_arg.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/misplaced_signer_arg.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/misplaced_signer_arg.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/misplaced_signer_arg.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/misplaced_signer_arg.move new file mode 100644 index 0000000000000..f1080132339a6 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/misplaced_signer_arg.move @@ -0,0 +1,11 @@ +// script functions no longer have any built in checks outside of visibility rules + +script { + fun t0(_u: u64, _s: signer) { + } +} + +script { + fun t1(_u: u64, _s: signer, _u2: u64) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_mutable_signer.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_mutable_signer.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_mutable_signer.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_mutable_signer.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_mutable_signer.move new file mode 100644 index 0000000000000..9de81010c8fdf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_mutable_signer.move @@ -0,0 +1,15 @@ +module 0x8675309::M { + struct R has key { f: bool } + fun t0(s: &mut signer) { + // implicit freeze + move_to(s, R { f: false }) + } +} + +module 0x8675309::N { + struct R has key { f: T } + fun t0(s: &mut signer) { + // implicit freeze + () = move_to(s, R { f: false }) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_sender.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_sender.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_sender.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_sender.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_sender.move new file mode 100644 index 0000000000000..48e8a53f231fb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_sender.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + // TODO(tmn) update when abilities hit + // resource struct R { s: signer } + // fun t(s1: &signer, s: signer) { + // move_to(s1, R { s }) + // } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_valid.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_valid.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_valid.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_valid.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_valid.move new file mode 100644 index 0000000000000..a276be6a01966 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_valid.move @@ -0,0 +1,15 @@ +module 0x8675309::M { + struct R has key { f: bool } + fun t0(s: &signer, r: R) { + move_to(s, r); + move_to(s, R { f: false }) + } +} + +module 0x8675309::N { + struct R has key { f: T } + fun t0(s: &signer, r: R) { + move_to(s, r); + move_to(s, R { f: false }) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc.move new file mode 100644 index 0000000000000..234662e456cb0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + fun t(s1: signer, s2: signer): signer { + s1 = s2; + s1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc_partial.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc_partial.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc_partial.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc_partial.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc_partial.move new file mode 100644 index 0000000000000..e7ac90ac092cd --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc_partial.move @@ -0,0 +1,13 @@ +module 0x8675309::M { + fun consume(s: signer) { + consume(move s) + } + + fun t(cond: bool, s1: signer, s2: signer) { + if (cond) consume(s1); + s1 = s2; + consume(s1); + } +} + +// check: STLOC_UNSAFE_TO_DESTROY_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/transitive.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/transitive.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/transitive.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/transitive.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/transitive.move new file mode 100644 index 0000000000000..2fe351b162b07 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/transitive.move @@ -0,0 +1,9 @@ +module 0x8675309::M { + struct S has drop { + f: T, + } + + fun t(s: signer) { + let _ = S { f: s }; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/triple_signer.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/triple_signer.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/triple_signer.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/triple_signer.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/triple_signer.move new file mode 100644 index 0000000000000..6acb1df050cb2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/triple_signer.move @@ -0,0 +1,26 @@ +// script functions no longer have any built in checks outside of visibility rules + +script { + fun t0(_s: signer, _s2: signer, _s3: signer) { + } +} + +script { + fun t1(_s: signer, _s2: signer, _s3: signer, _u: u64) { + } +} + +script { + fun t1(_s: signer, _s2: signer, _u: u64, _s3: signer) { + } +} + +script { + fun t2(_u: u64, _s2: signer) { + } +} + +script { + fun t2(_s: signer, _u: u64, _s2: signer) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused.move new file mode 100644 index 0000000000000..4081de578c31f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused.move @@ -0,0 +1,4 @@ +module 0x8675309::M { + fun t(_s: signer) { + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused_partial.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused_partial.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused_partial.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused_partial.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused_partial.move new file mode 100644 index 0000000000000..a1faf3252c609 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused_partial.move @@ -0,0 +1,9 @@ +module 0x8675309::M { + fun consume(s: signer) { + consume(move s) + } + + fun t(cond: bool, s: signer) { + if (cond) consume(s) + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/write_ref.exp b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/write_ref.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/write_ref.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/write_ref.move b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/write_ref.move new file mode 100644 index 0000000000000..4851c60a46adc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/write_ref.move @@ -0,0 +1,7 @@ +module 0x8675309::M { + fun t(sref: &mut signer, s: signer) { + *sref = s; + } +} + +// check: WRITEREF_RESOURCE_ERROR diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/abort_any_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/abort_any_type.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/abort_any_type.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/abort_any_type.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/abort_any_type.move new file mode 100644 index 0000000000000..4b56d87c55fee --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/abort_any_type.move @@ -0,0 +1,16 @@ +module 0x8675309::M { + struct Coin {} + + fun t0() { + 0 + (abort 0); + } + + fun t1() { + foo(abort 0); + } + + + fun foo(c: Coin) { + Coin {} = c; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/borrow_divergent.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/borrow_divergent.exp new file mode 100644 index 0000000000000..71fb1791e58ee --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/borrow_divergent.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: unable to infer instantiation of type `_` (consider providing type arguments or annotating the type) + ┌─ tests/more-v1/typing/borrow_divergent.move:4:13 + │ +4 │ &break; + │ ^^^^^ + +error: unable to infer instantiation of type `_` (consider providing type arguments or annotating the type) + ┌─ tests/more-v1/typing/borrow_divergent.move:11:12 + │ +11 │ &{ return }; + │ ^^^^^^ + +error: unable to infer instantiation of type `_` (consider providing type arguments or annotating the type) + ┌─ tests/more-v1/typing/borrow_divergent.move:18:21 + │ +18 │ &(if (cond) return else return); + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/borrow_divergent.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/borrow_divergent.move new file mode 100644 index 0000000000000..63f053ac92c64 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/borrow_divergent.move @@ -0,0 +1,20 @@ +script { + fun main1() { + loop { + &break; + } + } +} + +script { + fun main2() { + &{ return }; + } +} + + +script { + fun main3(cond: bool) { + &(if (cond) return else return); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.exp new file mode 100644 index 0000000000000..aa5ea1af47f67 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.exp @@ -0,0 +1,12 @@ + +Diagnostics: +error: type `R` is missing required ability `copy` + ┌─ tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.move:6:21 + │ +2 │ struct CupC { f: T } + │ - declaration of type parameter `T` + · +6 │ let x: CupC = abort 0; + │ ^ + │ + = required by instantiating type parameter `T:copy` of struct `CupC` diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.move new file mode 100644 index 0000000000000..fd6a7fd41b224 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.move @@ -0,0 +1,8 @@ +module 0x8675309::M { + struct CupC { f: T } + struct R {} + + fun foo() { + let x: CupC = abort 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_annotation.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_annotation.exp new file mode 100644 index 0000000000000..8eece9cdbae8c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_annotation.exp @@ -0,0 +1,12 @@ + +Diagnostics: +error: type `R` is missing required ability `copy` + ┌─ tests/more-v1/typing/constraints_not_satisfied_type_annotation.move:7:31 + │ +2 │ struct CupC { f: T } + │ - declaration of type parameter `T` + · +7 │ ignore((abort 0: CupC)); + │ ^ + │ + = required by instantiating type parameter `T:copy` of struct `CupC` diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_annotation.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_annotation.move new file mode 100644 index 0000000000000..b088cc493325a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_annotation.move @@ -0,0 +1,14 @@ +module 0x8675309::M { + struct CupC { f: T } + struct C {} + struct R {} + + fun foo() { + ignore((abort 0: CupC)); + } + + fun ignore(_x: T) { + abort 0 + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.exp new file mode 100644 index 0000000000000..cff6d0ad2c3e5 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.exp @@ -0,0 +1,12 @@ + +Diagnostics: +error: type `R` is missing required ability `drop` + ┌─ tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.move:8:18 + │ +2 │ struct CupD has drop { f: T } + │ - declaration of type parameter `T` + · +8 │ Box>{ f: abort 0 }; + │ ^ + │ + = required by instantiating type parameter `T:drop` of struct `CupD` diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.move new file mode 100644 index 0000000000000..1f814e8060362 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.move @@ -0,0 +1,12 @@ +module 0x8675309::M { + struct CupD has drop { f: T } + struct R {} + + struct Box has drop { f: T } + + fun foo() { + Box>{ f: abort 0 }; + Box{ f: R{} }; + } + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/declare_pop_resource.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/declare_pop_resource.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/declare_pop_resource.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/declare_pop_resource.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/declare_pop_resource.move new file mode 100644 index 0000000000000..0061073184089 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/declare_pop_resource.move @@ -0,0 +1,11 @@ +module 0x8675309::M { + struct R {f: u64} + + fun t0() { + let _: R; + // the following is an invalid binding too but its error message will + // not show because the compilation fails early at the typing phase + let _r: R; + let (_, _):(R, R); + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.exp new file mode 100644 index 0000000000000..697fe50a4037f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.exp @@ -0,0 +1,29 @@ + +Diagnostics: +error: invalid access specifier + ┌─ tests/more-v1/typing/invalid_type_acquire.move:18:9 + │ +18 │ T, + │ ^ + +error: invalid access specifier + ┌─ tests/more-v1/typing/invalid_type_acquire.move:19:9 + │ +19 │ u64, + │ ^^^ + +error: type `u64` is missing required ability `key` + ┌─ tests/more-v1/typing/invalid_type_acquire.move:32:36 + │ +32 │ destroy(account, move_from(a)); + │ ^^^ + │ + = required by instantiating type parameter `T:key` of function `move_from` + +error: type `S` is missing required ability `key` + ┌─ tests/more-v1/typing/invalid_type_acquire.move:34:36 + │ +34 │ destroy(account, move_from(a)); + │ ^ + │ + = required by instantiating type parameter `T:key` of function `move_from` diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.move new file mode 100644 index 0000000000000..d4c4102329caa --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.move @@ -0,0 +1,62 @@ +address 0x2 { + +module X { + struct R has key, store {} +} + +module M { + use 0x2::X; + + struct S has store {} + struct R has key {v: T} + + fun destroy(account: &signer, v: T) { + move_to(account, R { v }) + } + + fun t0() acquires + T, + u64, + X::R, + S, + { + } + + fun any(): T { + abort 0 + } + + fun t1(account: &signer, a: address) { + destroy(account, move_from(a)); + destroy(account, move_from(a)); + destroy(account, move_from(a)); + destroy(account, move_from(a)); + destroy(account, move_from(a)); + + borrow_global(a); + borrow_global(a); + borrow_global(a); + borrow_global(a); + borrow_global(a); + + borrow_global_mut(a); + borrow_global_mut(a); + borrow_global_mut(a); + borrow_global_mut(a); + borrow_global_mut(a); + + exists(a); + exists(a); + exists(a); + exists(a); + exists(a); + + move_to(account, any()); + move_to(account, any()); + move_to(account, any()); + move_to(account, any()); + move_to(account, any()); + } +} + +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/non_phantom_in_phantom_pos.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/non_phantom_in_phantom_pos.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/non_phantom_in_phantom_pos.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/non_phantom_in_phantom_pos.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/non_phantom_in_phantom_pos.move new file mode 100644 index 0000000000000..b5c2327b9a4c1 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/non_phantom_in_phantom_pos.move @@ -0,0 +1,18 @@ +module 0x42::M { + struct S1 { f: T2 } + + // T1 is only being used in phantom position + struct S2 { + a: S1 + } + + // This is ok, because T is used both in phantom and non-phantom position. + struct S3 { + a: S1 + } + + // Invalid position inside another type + struct S4 { + a: S2, T2> + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/unused_non_phantom_param.exp b/third_party/move/move-compiler-v2/tests/more-v1/typing/unused_non_phantom_param.exp new file mode 100644 index 0000000000000..513c04fd63adb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/unused_non_phantom_param.exp @@ -0,0 +1,12 @@ + +Diagnostics: +warning: unused type parameter + ┌─ tests/more-v1/typing/unused_non_phantom_param.move:2:18 + │ +2 │ struct S { + │ ^^ + │ │ + │ Unused type parameter `T2`. Consider declaring it as phantom + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/typing/unused_non_phantom_param.move b/third_party/move/move-compiler-v2/tests/more-v1/typing/unused_non_phantom_param.move new file mode 100644 index 0000000000000..bda68114d96c3 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/typing/unused_non_phantom_param.move @@ -0,0 +1,6 @@ +module 0x42::M { + struct S { + a: u64, + b: T1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/v2-not-supported/no_receiver_calls.exp b/third_party/move/move-compiler-v2/tests/more-v1/v2-not-supported/no_receiver_calls.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/v2-not-supported/no_receiver_calls.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/v2-not-supported/no_receiver_calls.move b/third_party/move/move-compiler-v2/tests/more-v1/v2-not-supported/no_receiver_calls.move new file mode 100644 index 0000000000000..f442a7c6e5ddf --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/v2-not-supported/no_receiver_calls.move @@ -0,0 +1,10 @@ +module 0x42::m { + struct T has drop {} + + fun receiver(self: &T, _x: u64) { abort 1 } + + fun call_receiver(t: T) { + t.receiver(1); + receiver(&t, 1) + } +} diff --git a/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.exp b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.exp new file mode 100644 index 0000000000000..e829d1d59c332 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:6:9 + │ +6 │ &mut (&s).v; + │ ^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:10:9 + │ +10 │ &mut (&s.x).f; + │ ^^^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:15:9 + │ +15 │ &mut sref.v; + │ ^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:20:9 + │ +20 │ &mut xref.f; + │ ^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move new file mode 100644 index 0000000000000..335087ed41dc0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move @@ -0,0 +1,27 @@ +module 0x8675309::M { + struct X { f: u64 } + struct S { v: u64, x: X } + fun t() { + let s = S { v: 0, x: X { f: 0 }}; + &mut (&s).v; + } + fun t1a() { + let s = S { v: 0, x: X { f: 0 }}; + &mut (&s.x).f; + } + fun t1b() { + let s = S { v: 0, x: X { f: 0 }}; + let sref = &s; + &mut sref.v; + } + fun t1c() { + let s = S { v: 0, x: X { f: 0 }}; + let xref = &s.x; + &mut xref.f; + } + + fun t2(s: &S, x: &X) { + x.f = x.f + 1; + s.x.f = s.x.f + 1 + } +} diff --git a/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.no-opt.exp b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.no-opt.exp new file mode 100644 index 0000000000000..e829d1d59c332 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.no-opt.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:6:9 + │ +6 │ &mut (&s).v; + │ ^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:10:9 + │ +10 │ &mut (&s.x).f; + │ ^^^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:15:9 + │ +15 │ &mut sref.v; + │ ^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:20:9 + │ +20 │ &mut xref.f; + │ ^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.old.exp b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.old.exp new file mode 100644 index 0000000000000..e829d1d59c332 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.old.exp @@ -0,0 +1,25 @@ + +Diagnostics: +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:6:9 + │ +6 │ &mut (&s).v; + │ ^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:10:9 + │ +10 │ &mut (&s.x).f; + │ ^^^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:15:9 + │ +15 │ &mut sref.v; + │ ^^^^^^^^^^^ + +error: cannot mutably borrow from an immutable ref + ┌─ tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.move:20:9 + │ +20 │ &mut xref.f; + │ ^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/testsuite.rs b/third_party/move/move-compiler-v2/tests/testsuite.rs index dc72e55436374..eb0d506c1f699 100644 --- a/third_party/move/move-compiler-v2/tests/testsuite.rs +++ b/third_party/move/move-compiler-v2/tests/testsuite.rs @@ -122,12 +122,12 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { ], // Need to exclude `inlining` because it is under checking // TODO: move `inlining` tests to top-level test directory - exclude: vec!["/inlining/"], + exclude: vec!["/inlining/", "/more-v1/"], exp_suffix: None, options: opts .clone() .set_experiment(Experiment::ACQUIRES_CHECK, false), - stop_after: StopAfter::AstPipeline, + stop_after: StopAfter::BytecodeGen, dump_ast: DumpLevel::EndStage, dump_bytecode: DumpLevel::None, dump_bytecode_filter: None, @@ -169,15 +169,10 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { exp_suffix: None, options: opts .clone() - // Need to turn off usage checks because they complain about - // lambda parameters outside of inline functions. Other checks - // also turned off for now since they mess up baseline. - .set_experiment(Experiment::CHECKS, false) - .set_experiment(Experiment::OPTIMIZE, false) - .set_experiment(Experiment::OPTIMIZE_WAITING_FOR_COMPARE_TESTS, false) - .set_experiment(Experiment::INLINING, false) - .set_experiment(Experiment::RECURSIVE_TYPE_CHECK, false) - .set_experiment(Experiment::SPEC_REWRITE, false) + .set_experiment(Experiment::LAMBDA_FIELDS, true) + .set_experiment(Experiment::LAMBDA_PARAMS, true) + .set_experiment(Experiment::LAMBDA_RESULTS, true) + .set_experiment(Experiment::LAMBDA_VALUES, true) .set_experiment(Experiment::LAMBDA_LIFTING, true), stop_after: StopAfter::AstPipeline, dump_ast: DumpLevel::AllStages, @@ -200,12 +195,26 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { dump_bytecode: DumpLevel::None, // do not dump anything dump_bytecode_filter: None, }, - // Tests for front-end, diagnostics (inlining, simplifier, folding, etc.) + // Tests for more-v1 tests + TestConfig { + name: "more-v1", + runner: |p| run_test(p, get_config_by_name("more-v1")), + include: vec!["/more-v1/"], + exclude: vec![], + exp_suffix: None, + options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), + // Run the entire compiler pipeline to double-check the result + stop_after: StopAfter::FileFormat, + dump_ast: DumpLevel::None, + dump_bytecode: DumpLevel::None, // do not dump anything + dump_bytecode_filter: None, + }, + // Tests for inlining, simplifier, and folding TestConfig { name: "inlining-et-al", runner: |p| run_test(p, get_config_by_name("inlining-et-al")), include: vec!["/inlining/", "/folding/", "/simplifier/"], - exclude: vec![], + exclude: vec!["/more-v1/"], exp_suffix: None, options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), // Run the entire compiler pipeline to double-check the result diff --git a/third_party/move/move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function2.exp b/third_party/move/move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function2.exp new file mode 100644 index 0000000000000..02135d33df18b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function2.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `0x1::B::Foo` + ┌─ tests/unit_test/notest/cross_module_members_non_test_function2.move:25:23 + │ +25 │ public fun bad(): Foo { + │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function2.move b/third_party/move/move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function2.move new file mode 100644 index 0000000000000..d182b6e683f9a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function2.move @@ -0,0 +1,29 @@ +// check that `use`'s are filtered out correctly in non-test mode +address 0x1 { +module A { + struct Foo has drop {} + + public fun build_foo(): Foo { Foo {} } +} + +module B { + use 0x1::A; + + #[test_only] + use 0x1::A::Foo; + + #[test_only] + fun x(_: Foo) { } + + #[test] + fun tester() { + x(A::build_foo()) + } + + // this should fail find the Foo result type as the use statement + // is test_only. + public fun bad(): Foo { + A::build_foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function2.exp b/third_party/move/move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function2.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function2.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function2.move b/third_party/move/move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function2.move new file mode 100644 index 0000000000000..d182b6e683f9a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function2.move @@ -0,0 +1,29 @@ +// check that `use`'s are filtered out correctly in non-test mode +address 0x1 { +module A { + struct Foo has drop {} + + public fun build_foo(): Foo { Foo {} } +} + +module B { + use 0x1::A; + + #[test_only] + use 0x1::A::Foo; + + #[test_only] + fun x(_: Foo) { } + + #[test] + fun tester() { + x(A::build_foo()) + } + + // this should fail find the Foo result type as the use statement + // is test_only. + public fun bad(): Foo { + A::build_foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/unused-assignment/typing/declare_duplicate_binding2.exp b/third_party/move/move-compiler-v2/tests/unused-assignment/typing/declare_duplicate_binding2.exp new file mode 100644 index 0000000000000..2734a0737489e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unused-assignment/typing/declare_duplicate_binding2.exp @@ -0,0 +1,19 @@ + +Diagnostics: +warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` + ┌─ tests/unused-assignment/typing/declare_duplicate_binding2.move:7:9 + │ +7 │ x = 0; + │ ^^^^^ + +warning: Unused assignment to `f`. Consider removing or prefixing with an underscore: `_f` + ┌─ tests/unused-assignment/typing/declare_duplicate_binding2.move:8:9 + │ +8 │ f = 0; + │ ^^^^^ + +warning: Unused assignment to `g`. Consider removing or prefixing with an underscore: `_g` + ┌─ tests/unused-assignment/typing/declare_duplicate_binding2.move:9:9 + │ +9 │ g = 0; + │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/unused-assignment/typing/declare_duplicate_binding2.move b/third_party/move/move-compiler-v2/tests/unused-assignment/typing/declare_duplicate_binding2.move new file mode 100644 index 0000000000000..9620607e1e8cb --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unused-assignment/typing/declare_duplicate_binding2.move @@ -0,0 +1,11 @@ +module 0x8675309::M { + struct R {f: u64} + + fun t0() { + let (x); + let (f, R{f: g}); + x = 0; + f = 0; + g = 0; + } +} diff --git a/third_party/move/move-compiler-v2/tests/unused-assignment/v1-locals/dont_warn_unused_self.exp b/third_party/move/move-compiler-v2/tests/unused-assignment/v1-locals/dont_warn_unused_self.exp new file mode 100644 index 0000000000000..d3c874d2060ee --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unused-assignment/v1-locals/dont_warn_unused_self.exp @@ -0,0 +1,7 @@ + +Diagnostics: +warning: Unused parameter `y`. Consider removing or prefixing with an underscore: `_y` + ┌─ tests/unused-assignment/v1-locals/dont_warn_unused_self.move:5:27 + │ +5 │ fun receiver(self: S, y: u64) { + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/unused-assignment/v1-locals/dont_warn_unused_self.move b/third_party/move/move-compiler-v2/tests/unused-assignment/v1-locals/dont_warn_unused_self.move new file mode 100644 index 0000000000000..8c63ab010d99e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unused-assignment/v1-locals/dont_warn_unused_self.move @@ -0,0 +1,11 @@ +module 0x42::m { + + struct S has drop { x: u64 } + + fun receiver(self: S, y: u64) { + } + + spec receiver(self: S, y: u64) { + requires true; + } +} diff --git a/third_party/move/move-compiler-v2/tests/v1.matched b/third_party/move/move-compiler-v2/tests/v1.matched index c225616340f64..67c42f306b459 100644 --- a/third_party/move/move-compiler-v2/tests/v1.matched +++ b/third_party/move/move-compiler-v2/tests/v1.matched @@ -1,6 +1,15 @@ +WARNING: test `move-compiler-v2/tests/live-var/mut_ref.move` and `move-compiler-v2/tests/more-v1/liveness/mut_ref.move` share common key `liveness/mut_ref.move`, discarding former one +WARNING: test `move-compiler-v2/tests/checking-lang-v1/struct_public.move` and `move-compiler-v2/tests/more-v1/parser/struct_public.move` share common key `parser/struct_public.move`, discarding former one +WARNING: test `move-compiler-v2/tests/checking-lang-v1/struct_without_fields.move` and `move-compiler-v2/tests/more-v1/parser/struct_without_fields.move` share common key `parser/struct_without_fields.move`, discarding former one +WARNING: test `move-compiler-v2/tests/checking-lang-v1/v1-typing/invalid_type_acquire.move` and `move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.move` share common key `typing/invalid_type_acquire.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/assign_partial_resource.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/assign_partial_resource.move` share common key `locals/assign_partial_resource.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/assign_resource.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/assign_resource.move` share common key `locals/assign_resource.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/unused_resource.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/unused_resource.move` share common key `locals/unused_resource.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/unused_resource_explicit_return.move` share common key `locals/unused_resource_explicit_return.move`, discarding former one move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_1.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_1.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_2.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_2.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_3.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_3.exp +move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_duplicate_annotation.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/borrow_global_acquires_duplicate_annotation.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_extraneous_annotation.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_extraneous_annotation.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_invalid_1.exp move-compiler-v2/tests/reference-safety/v1-borrow-tests/borrow_global_acquires_invalid_1.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_invalid_2.exp move-compiler-v2/tests/reference-safety/v1-borrow-tests/borrow_global_acquires_invalid_2.exp @@ -29,6 +38,7 @@ move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/factor_inva move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/factor_valid_1.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/factor_valid_1.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/factor_valid_2.exp move-compiler-v2/tests/reference-safety/v1-borrow-tests/factor_valid_2.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/imm_borrow_global_invalid.exp move-compiler-v2/tests/reference-safety/v1-borrow-tests/imm_borrow_global_invalid.exp +move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/borrow_tests/imm_borrow_global_lossy_acquire_invalid.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/imm_borrow_global_requires_acquire.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/imm_borrow_global_requires_acquire.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/imm_borrow_loc.exp move-compiler-v2/tests/reference-safety/v1-borrow-tests/imm_borrow_loc.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/imm_borrow_loc_trivial.exp move-compiler-v2/tests/reference-safety/v1-borrow-tests/imm_borrow_loc_trivial.exp @@ -131,19 +141,31 @@ move-compiler/tests/move_check/v2_tests/bytecode-generator/wildcard5.exp move- move-compiler/tests/move_check/v2_tests/bytecode-generator/wildcard6.exp move-compiler-v2/tests/bytecode-generator/wildcard6.exp move-compiler/tests/move_check/v2_tests/bytecode-generator/wildcard7.exp move-compiler-v2/tests/bytecode-generator/wildcard7.exp move-compiler/tests/move_check/v2_tests/bytecode-generator/wildcard8.exp move-compiler-v2/tests/bytecode-generator/wildcard8.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/abort_negative_stack_size.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/abort_negative_stack_size.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/assign_in_one_if_branch.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/assign_in_one_if_branch.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/assign_resource.exp move-compiler-v2/tests/ability-check/v1-borrow-tests/assign_resource.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/assign_wrong_if_branch.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/assign_wrong_if_branch.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/assign_wrong_if_branch_no_else.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/assign_wrong_if_branch_no_else.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/assign_wrong_type.exp move-compiler-v2/tests/checking/typing/v1-commands/assign_wrong_type.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/branch_assigns_then_moves.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/branch_assigns_then_moves.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/break_outside_loop.exp move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/break_outside_loop_in_else.exp move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_else.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/break_outside_loop_in_if.exp move-compiler-v2/tests/bytecode-generator/v1-commands/break_outside_loop_in_if.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/break_unreachable.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/break_unreachable.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/consume_stack.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/consume_stack.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/continue_outside_loop.exp move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/continue_outside_loop_in_if.exp move-compiler-v2/tests/bytecode-generator/v1-commands/continue_outside_loop_in_if.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/dead_return.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/dead_return_local.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/dead_return_local.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/else_assigns_if_doesnt.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/else_assigns_if_doesnt.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/else_moves_if_doesnt.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/else_moves_if_doesnt.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/if_assigns_else_doesnt.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/if_assigns_else_doesnt.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/if_assigns_no_else.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/if_assigns_no_else.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/if_moves_else_doesnt.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_else_doesnt.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/if_moves_no_else.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/if_moves_no_else.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/invalid_fallthrough2.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough2.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/invalid_fallthrough3.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/invalid_fallthrough3.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/join_failure.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/join_failure.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/mixed_lvalue.exp move-compiler-v2/tests/unused-assignment/v1-commands/mixed_lvalue.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/move_before_assign.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/move_before_assign.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/no_let_outside_if.exp move-compiler-v2/tests/checking/typing/v1-commands/no_let_outside_if.exp @@ -155,15 +177,33 @@ move-compiler/tests/move_check/translated_ir_tests/move/commands/unpack_extra_bi move-compiler/tests/move_check/translated_ir_tests/move/commands/unpack_missing_binding.exp move-compiler-v2/tests/checking/typing/v1-commands/unpack_missing_binding.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/unpack_wrong_type.exp move-compiler-v2/tests/checking/typing/v1-commands/unpack_wrong_type.exp move-compiler/tests/move_check/translated_ir_tests/move/commands/use_before_assign.exp move-compiler-v2/tests/uninit-use-checker/v1-commands/use_before_assign.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/while_move_local.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local.exp +move-compiler/tests/move_check/translated_ir_tests/move/commands/while_move_local_2.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/commands/while_move_local_2.exp +move-compiler/tests/move_check/control_flow/for_loop_comment_following.exp move-compiler-v2/tests/more-v1/control_flow/for_loop_comment_following.exp move-compiler/tests/move_check/control_flow/for_loop_empty_novar.exp move-compiler-v2/tests/checking/control_flow/for_loop_empty_novar.exp +move-compiler/tests/move_check/control_flow/for_loop_lparen_following.exp move-compiler-v2/tests/more-v1/control_flow/for_loop_lparen_following.exp move-compiler/tests/move_check/control_flow/for_type_mismatch.exp move-compiler-v2/tests/checking/control_flow/for_type_mismatch.exp +move-compiler/tests/move_check/control_flow/infinite_loop_with_dead_exits.exp move-compiler-v2/tests/more-v1/control_flow/infinite_loop_with_dead_exits.exp move-compiler/tests/move_check/control_flow/loop_after_loop.exp move-compiler-v2/tests/checking/control_flow/loop_after_loop.exp +move-compiler/tests/move_check/dependencies/friend_cycle_2.exp move-compiler-v2/tests/more-v1/dependencies/friend_cycle_2.exp +move-compiler/tests/move_check/dependencies/friend_cycle_3.exp move-compiler-v2/tests/more-v1/dependencies/friend_cycle_3.exp +move-compiler/tests/move_check/dependencies/intersecting_friend_cycles.exp move-compiler-v2/tests/more-v1/dependencies/intersecting_friend_cycles.exp +move-compiler/tests/move_check/dependencies/intersecting_use_cycles.exp move-compiler-v2/tests/more-v1/dependencies/intersecting_use_cycles.exp +move-compiler/tests/move_check/dependencies/multiple_friend_cycles.exp move-compiler-v2/tests/more-v1/dependencies/multiple_friend_cycles.exp +move-compiler/tests/move_check/dependencies/multiple_use_cycles.exp move-compiler-v2/tests/more-v1/dependencies/multiple_use_cycles.exp +move-compiler/tests/move_check/dependencies/use_cycle_2.exp move-compiler-v2/tests/more-v1/dependencies/use_cycle_2.exp +move-compiler/tests/move_check/dependencies/use_cycle_3.exp move-compiler-v2/tests/more-v1/dependencies/use_cycle_3.exp +move-compiler/tests/move_check/dependencies/use_friend_direct.exp move-compiler-v2/tests/more-v1/dependencies/use_friend_direct.exp +move-compiler/tests/move_check/dependencies/use_friend_transitive_by_friend.exp move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_friend.exp +move-compiler/tests/move_check/dependencies/use_friend_transitive_by_use.exp move-compiler-v2/tests/more-v1/dependencies/use_friend_transitive_by_use.exp +move-compiler/tests/move_check/deprecated/assert_function.exp move-compiler-v2/tests/deprecated/assert_function.exp move-compiler/tests/move_check/deprecated/deprecated_constant_duplicated_struct.exp move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct.exp move-compiler/tests/move_check/deprecated/deprecated_constant_duplicated_struct2.exp move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct2.exp move-compiler/tests/move_check/deprecated/deprecated_field_type.exp move-compiler-v2/tests/deprecated/deprecated_field_type.exp move-compiler/tests/move_check/deprecated/deprecated_field_type2.exp move-compiler-v2/tests/deprecated/deprecated_field_type2.exp move-compiler/tests/move_check/deprecated/deprecated_placement_address.exp move-compiler-v2/tests/deprecated/deprecated_placement_address.exp move-compiler/tests/move_check/deprecated/deprecated_placement_address_module_members.exp move-compiler-v2/tests/deprecated/deprecated_placement_address_module_members.exp +move-compiler/tests/move_check/deprecated/deprecated_placement_basecase.exp move-compiler-v2/tests/deprecated/deprecated_placement_basecase.exp move-compiler/tests/move_check/deprecated/deprecated_placement_members.exp move-compiler-v2/tests/deprecated/deprecated_placement_members.exp move-compiler/tests/move_check/deprecated/deprecated_placement_module.exp move-compiler-v2/tests/deprecated/deprecated_placement_module.exp move-compiler/tests/move_check/deprecated/deprecated_placement_module2.exp move-compiler-v2/tests/deprecated/deprecated_placement_module2.exp @@ -171,13 +211,116 @@ move-compiler/tests/move_check/deprecated/deprecated_placement_module_members.ex move-compiler/tests/move_check/deprecated/public_script.exp move-compiler-v2/tests/deprecated/public_script.exp move-compiler/tests/move_check/examples/multi_pool_money_market_token.exp move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp move-compiler/tests/move_check/examples/simple_money_market_token.exp move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp +move-compiler/tests/move_check/expansion/access_specifier_not_supported.exp move-compiler-v2/tests/checking-lang-v1/expansion/access_specifier_not_supported.exp +move-compiler/tests/move_check/expansion/address_directives.exp move-compiler-v2/tests/more-v1/expansion/address_directives.exp +move-compiler/tests/move_check/expansion/address_directives_empty.exp move-compiler-v2/tests/more-v1/expansion/address_directives_empty.exp +move-compiler/tests/move_check/expansion/almost_invalid_local_name.exp move-compiler-v2/tests/more-v1/expansion/almost_invalid_local_name.exp +move-compiler/tests/move_check/expansion/assign_non_simple_name.exp move-compiler-v2/tests/more-v1/expansion/assign_non_simple_name.exp +move-compiler/tests/move_check/expansion/constant_duplicate_struct.exp move-compiler-v2/tests/more-v1/expansion/constant_duplicate_struct.exp +move-compiler/tests/move_check/expansion/constant_invalid_alias_names.exp move-compiler-v2/tests/more-v1/expansion/constant_invalid_alias_names.exp +move-compiler/tests/move_check/expansion/constant_invalid_names.exp move-compiler-v2/tests/more-v1/expansion/constant_invalid_names.exp +move-compiler/tests/move_check/expansion/duplicate_abilities.exp move-compiler-v2/tests/more-v1/expansion/duplicate_abilities.exp +move-compiler/tests/move_check/expansion/duplicate_alias.exp move-compiler-v2/tests/more-v1/expansion/duplicate_alias.exp +move-compiler/tests/move_check/expansion/duplicate_field.exp move-compiler-v2/tests/more-v1/expansion/duplicate_field.exp +move-compiler/tests/move_check/expansion/duplicate_field_assign.exp move-compiler-v2/tests/more-v1/expansion/duplicate_field_assign.exp +move-compiler/tests/move_check/expansion/duplicate_field_pack.exp move-compiler-v2/tests/more-v1/expansion/duplicate_field_pack.exp +move-compiler/tests/move_check/expansion/duplicate_field_unpack.exp move-compiler-v2/tests/more-v1/expansion/duplicate_field_unpack.exp +move-compiler/tests/move_check/expansion/duplicate_function_in_module.exp move-compiler-v2/tests/more-v1/expansion/duplicate_function_in_module.exp +move-compiler/tests/move_check/expansion/duplicate_module.exp move-compiler-v2/tests/more-v1/expansion/duplicate_module.exp +move-compiler/tests/move_check/expansion/duplicate_module_after_mapping.exp move-compiler-v2/tests/more-v1/expansion/duplicate_module_after_mapping.exp +move-compiler/tests/move_check/expansion/duplicate_struct.exp move-compiler-v2/tests/more-v1/expansion/duplicate_struct.exp +move-compiler/tests/move_check/expansion/entry_main.exp move-compiler-v2/tests/more-v1/expansion/entry_main.exp +move-compiler/tests/move_check/expansion/friend_decl_aliased_duplicates.exp move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_duplicates.exp +move-compiler/tests/move_check/expansion/friend_decl_aliased_function.exp move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_function.exp +move-compiler/tests/move_check/expansion/friend_decl_aliased_struct.exp move-compiler-v2/tests/more-v1/expansion/friend_decl_aliased_struct.exp +move-compiler/tests/move_check/expansion/friend_decl_imported_duplicates.exp move-compiler-v2/tests/more-v1/expansion/friend_decl_imported_duplicates.exp +move-compiler/tests/move_check/expansion/friend_decl_inner_scope_alias.exp move-compiler-v2/tests/more-v1/expansion/friend_decl_inner_scope_alias.exp +move-compiler/tests/move_check/expansion/friend_decl_nonexistent_alias.exp move-compiler-v2/tests/more-v1/expansion/friend_decl_nonexistent_alias.exp +move-compiler/tests/move_check/expansion/friend_decl_qualified_duplicates.exp move-compiler-v2/tests/more-v1/expansion/friend_decl_qualified_duplicates.exp +move-compiler/tests/move_check/expansion/function_invalid_names.exp move-compiler-v2/tests/more-v1/expansion/function_invalid_names.exp +move-compiler/tests/move_check/expansion/hexstring_bad_value.exp move-compiler-v2/tests/more-v1/expansion/hexstring_bad_value.exp +move-compiler/tests/move_check/expansion/invalid_local_name.exp move-compiler-v2/tests/more-v1/expansion/invalid_local_name.exp +move-compiler/tests/move_check/expansion/invalid_spec_schema_name.exp move-compiler-v2/tests/more-v1/expansion/invalid_spec_schema_name.exp +move-compiler/tests/move_check/expansion/invalid_struct_name.exp move-compiler-v2/tests/more-v1/expansion/invalid_struct_name.exp +move-compiler/tests/move_check/expansion/invalid_unpack_assign_lhs_not_name.exp move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_not_name.exp +move-compiler/tests/move_check/expansion/invalid_unpack_assign_lhs_other_value.exp move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_lhs_other_value.exp +move-compiler/tests/move_check/expansion/invalid_unpack_assign_mdot_no_struct.exp move-compiler-v2/tests/more-v1/expansion/invalid_unpack_assign_mdot_no_struct.exp +move-compiler/tests/move_check/expansion/mdot_with_non_address_exp.exp move-compiler-v2/tests/more-v1/expansion/mdot_with_non_address_exp.exp +move-compiler/tests/move_check/expansion/module_alias_as_type.exp move-compiler-v2/tests/more-v1/expansion/module_alias_as_type.exp +move-compiler/tests/move_check/expansion/module_invalid_names.exp move-compiler-v2/tests/more-v1/expansion/module_invalid_names.exp +move-compiler/tests/move_check/expansion/multiple_alias.exp move-compiler-v2/tests/more-v1/expansion/multiple_alias.exp +move-compiler/tests/move_check/expansion/no_address.exp move-compiler-v2/tests/more-v1/expansion/no_address.exp +move-compiler/tests/move_check/expansion/number_literal_long.exp move-compiler-v2/tests/more-v1/expansion/number_literal_long.exp +move-compiler/tests/move_check/expansion/number_literal_too_long.exp move-compiler-v2/tests/more-v1/expansion/number_literal_too_long.exp +move-compiler/tests/move_check/expansion/number_literal_too_long_u128.exp move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u128.exp +move-compiler/tests/move_check/expansion/number_literal_too_long_u64.exp move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u64.exp +move-compiler/tests/move_check/expansion/number_literal_too_long_u8.exp move-compiler-v2/tests/more-v1/expansion/number_literal_too_long_u8.exp +move-compiler/tests/move_check/expansion/pack_all_field_cases.exp move-compiler-v2/tests/more-v1/expansion/pack_all_field_cases.exp +move-compiler/tests/move_check/expansion/pack_no_fields_block_expr.exp move-compiler-v2/tests/more-v1/expansion/pack_no_fields_block_expr.exp +move-compiler/tests/move_check/expansion/pack_no_fields_single_block_expr.exp move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_expr.exp +move-compiler/tests/move_check/expansion/pack_no_fields_single_block_other_expr.exp move-compiler-v2/tests/more-v1/expansion/pack_no_fields_single_block_other_expr.exp +move-compiler/tests/move_check/expansion/public_friend_main.exp move-compiler-v2/tests/more-v1/expansion/public_friend_main.exp +move-compiler/tests/move_check/expansion/public_main.exp move-compiler-v2/tests/more-v1/expansion/public_main.exp +move-compiler/tests/move_check/expansion/restricted_address_names.exp move-compiler-v2/tests/more-v1/expansion/restricted_address_names.exp +move-compiler/tests/move_check/expansion/restricted_alias_names.exp move-compiler-v2/tests/more-v1/expansion/restricted_alias_names.exp +move-compiler/tests/move_check/expansion/restricted_constant_names.exp move-compiler-v2/tests/more-v1/expansion/restricted_constant_names.exp +move-compiler/tests/move_check/expansion/restricted_function_names.exp move-compiler-v2/tests/more-v1/expansion/restricted_function_names.exp +move-compiler/tests/move_check/expansion/restricted_module_alias_names.exp move-compiler-v2/tests/more-v1/expansion/restricted_module_alias_names.exp +move-compiler/tests/move_check/expansion/restricted_module_names.exp move-compiler-v2/tests/more-v1/expansion/restricted_module_names.exp +move-compiler/tests/move_check/expansion/restricted_names_valid.exp move-compiler-v2/tests/more-v1/expansion/restricted_names_valid.exp +move-compiler/tests/move_check/expansion/restricted_struct_names.exp move-compiler-v2/tests/more-v1/expansion/restricted_struct_names.exp +move-compiler/tests/move_check/expansion/spec_block_in_spec_context.exp move-compiler-v2/tests/more-v1/expansion/spec_block_in_spec_context.exp +move-compiler/tests/move_check/expansion/spec_block_uses.exp move-compiler-v2/tests/more-v1/expansion/spec_block_uses.exp +move-compiler/tests/move_check/expansion/spec_block_uses_shadows_defines.exp move-compiler-v2/tests/more-v1/expansion/spec_block_uses_shadows_defines.exp +move-compiler/tests/move_check/expansion/spec_function_member_conflicts.exp move-compiler-v2/tests/more-v1/expansion/spec_function_member_conflicts.exp +move-compiler/tests/move_check/expansion/spec_schema_member_conflicts.exp move-compiler-v2/tests/more-v1/expansion/spec_schema_member_conflicts.exp +move-compiler/tests/move_check/expansion/standalone_fields.exp move-compiler-v2/tests/more-v1/expansion/standalone_fields.exp +move-compiler/tests/move_check/expansion/standalone_mname_with_type_args.exp move-compiler-v2/tests/more-v1/expansion/standalone_mname_with_type_args.exp +move-compiler/tests/move_check/expansion/standalone_name_with_type_args.exp move-compiler-v2/tests/more-v1/expansion/standalone_name_with_type_args.exp +move-compiler/tests/move_check/expansion/top_level_not_named_main.exp move-compiler-v2/tests/more-v1/expansion/top_level_not_named_main.exp +move-compiler/tests/move_check/expansion/type_arguments_on_field_access.exp move-compiler-v2/tests/more-v1/expansion/type_arguments_on_field_access.exp +move-compiler/tests/move_check/expansion/unbound_module_alias_in_type.exp move-compiler-v2/tests/more-v1/expansion/unbound_module_alias_in_type.exp +move-compiler/tests/move_check/expansion/unbound_named_address.exp move-compiler-v2/tests/more-v1/expansion/unbound_named_address.exp +move-compiler/tests/move_check/expansion/unpack_all_field_cases.exp move-compiler-v2/tests/more-v1/expansion/unpack_all_field_cases.exp +move-compiler/tests/move_check/expansion/unpack_assign_block_expr.exp move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_expr.exp +move-compiler/tests/move_check/expansion/unpack_assign_block_single_expr.exp move-compiler-v2/tests/more-v1/expansion/unpack_assign_block_single_expr.exp +move-compiler/tests/move_check/expansion/unpack_assign_other_expr.exp move-compiler-v2/tests/more-v1/expansion/unpack_assign_other_expr.exp +move-compiler/tests/move_check/expansion/use_function.exp move-compiler-v2/tests/more-v1/expansion/use_function.exp +move-compiler/tests/move_check/expansion/use_function_overlap_with_module.exp move-compiler-v2/tests/more-v1/expansion/use_function_overlap_with_module.exp +move-compiler/tests/move_check/expansion/use_function_same_name_as_function.exp move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_function.exp +move-compiler/tests/move_check/expansion/use_function_same_name_as_struct.exp move-compiler-v2/tests/more-v1/expansion/use_function_same_name_as_struct.exp +move-compiler/tests/move_check/expansion/use_function_tparam_shadows.exp move-compiler-v2/tests/more-v1/expansion/use_function_tparam_shadows.exp +move-compiler/tests/move_check/expansion/use_function_unbound.exp move-compiler-v2/tests/more-v1/expansion/use_function_unbound.exp +move-compiler/tests/move_check/expansion/use_inner_scope.exp move-compiler-v2/tests/more-v1/expansion/use_inner_scope.exp +move-compiler/tests/move_check/expansion/use_inner_scope_duplicates.exp move-compiler-v2/tests/more-v1/expansion/use_inner_scope_duplicates.exp +move-compiler/tests/move_check/expansion/use_inner_scope_invalid.exp move-compiler-v2/tests/more-v1/expansion/use_inner_scope_invalid.exp +move-compiler/tests/move_check/expansion/use_inner_scope_shadows.exp move-compiler-v2/tests/more-v1/expansion/use_inner_scope_shadows.exp +move-compiler/tests/move_check/expansion/use_inner_scope_unbound.exp move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unbound.exp +move-compiler/tests/move_check/expansion/use_inner_scope_unused.exp move-compiler-v2/tests/more-v1/expansion/use_inner_scope_unused.exp +move-compiler/tests/move_check/expansion/use_nested_self.exp move-compiler-v2/tests/more-v1/expansion/use_nested_self.exp +move-compiler/tests/move_check/expansion/use_nested_self_as.exp move-compiler-v2/tests/more-v1/expansion/use_nested_self_as.exp +move-compiler/tests/move_check/expansion/use_nested_self_as_invalid.exp move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid.exp +move-compiler/tests/move_check/expansion/use_nested_self_duplicate.exp move-compiler-v2/tests/more-v1/expansion/use_nested_self_duplicate.exp +move-compiler/tests/move_check/expansion/use_spec_function.exp move-compiler-v2/tests/more-v1/expansion/use_spec_function.exp +move-compiler/tests/move_check/expansion/use_spec_function_as_normal_function.exp move-compiler-v2/tests/more-v1/expansion/use_spec_function_as_normal_function.exp +move-compiler/tests/move_check/expansion/use_spec_schema.exp move-compiler-v2/tests/more-v1/expansion/use_spec_schema.exp +move-compiler/tests/move_check/expansion/use_spec_schema_as_struct.exp move-compiler-v2/tests/more-v1/expansion/use_spec_schema_as_struct.exp +move-compiler/tests/move_check/expansion/use_spec_schema_invalid_as.exp move-compiler-v2/tests/more-v1/expansion/use_spec_schema_invalid_as.exp +move-compiler/tests/move_check/expansion/use_struct.exp move-compiler-v2/tests/more-v1/expansion/use_struct.exp +move-compiler/tests/move_check/expansion/use_struct_invalid_name.exp move-compiler-v2/tests/more-v1/expansion/use_struct_invalid_name.exp +move-compiler/tests/move_check/expansion/use_struct_overlap_with_module.exp move-compiler-v2/tests/more-v1/expansion/use_struct_overlap_with_module.exp +move-compiler/tests/move_check/expansion/use_struct_same_name_as_function.exp move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_function.exp +move-compiler/tests/move_check/expansion/use_struct_same_name_as_struct.exp move-compiler-v2/tests/more-v1/expansion/use_struct_same_name_as_struct.exp +move-compiler/tests/move_check/expansion/use_struct_tparam_shadows.exp move-compiler-v2/tests/more-v1/expansion/use_struct_tparam_shadows.exp +move-compiler/tests/move_check/expansion/use_struct_unbound.exp move-compiler-v2/tests/more-v1/expansion/use_struct_unbound.exp +move-compiler/tests/move_check/expansion/weird_apply_assign.exp move-compiler-v2/tests/more-v1/expansion/weird_apply_assign.exp move-compiler/tests/move_check/folding/empty_vectors.exp move-compiler-v2/tests/folding/empty_vectors.exp move-compiler/tests/move_check/folding/empty_vectors2.exp move-compiler-v2/tests/folding/empty_vectors2.exp move-compiler/tests/move_check/folding/non_constant_empty_vec.exp move-compiler-v2/tests/folding/non_constant_empty_vec.exp move-compiler/tests/move_check/folding/nonempty_vectors.exp move-compiler-v2/tests/folding/nonempty_vectors.exp move-compiler/tests/move_check/folding/unfoldable_constants.exp move-compiler-v2/tests/folding/unfoldable_constants.exp move-compiler/tests/move_check/folding/unfoldable_constants_blocks.exp move-compiler-v2/tests/folding/unfoldable_constants_blocks.exp -move-compiler/tests/move_check/inlining/acquires_error_msg.exp move-compiler-v2/tests/checking/inlining/acquires_error_msg.exp +move-compiler/tests/move_check/inlining/acquires_error_msg_inline.exp move-compiler-v2/tests/checking/inlining/acquires_error_msg_inline.exp move-compiler/tests/move_check/inlining/break_continue_in_lambda.exp move-compiler-v2/tests/checking/inlining/break_continue_in_lambda.exp move-compiler/tests/move_check/inlining/bug_11112.exp move-compiler-v2/tests/checking/inlining/bug_11112.exp move-compiler/tests/move_check/inlining/bug_9717.exp move-compiler-v2/tests/checking/inlining/bug_9717.exp @@ -224,11 +367,28 @@ move-compiler/tests/move_check/translated_ir_tests/move/generics/instantiation_l move-compiler/tests/move_check/translated_ir_tests/move/generics/instantiation_loops/recursive_struct.exp move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_struct.exp move-compiler/tests/move_check/translated_ir_tests/move/generics/instantiation_loops/recursive_two_args_swapping_type_con.exp move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/recursive_two_args_swapping_type_con.exp move-compiler/tests/move_check/translated_ir_tests/move/generics/instantiation_loops/two_loops.exp move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/two_loops.exp +move-compiler/tests/move_check/liveness/copy_after_move.exp move-compiler-v2/tests/more-v1/liveness/copy_after_move.exp +move-compiler/tests/move_check/liveness/dead_refs_branch.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_branch.exp +move-compiler/tests/move_check/liveness/dead_refs_branch_both.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both.exp +move-compiler/tests/move_check/liveness/dead_refs_branch_both_invalid.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_both_invalid.exp +move-compiler/tests/move_check/liveness/dead_refs_branch_invalid.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_branch_invalid.exp +move-compiler/tests/move_check/liveness/dead_refs_loop.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_loop.exp +move-compiler/tests/move_check/liveness/dead_refs_loop_invalid.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_loop_invalid.exp +move-compiler/tests/move_check/liveness/dead_refs_nested.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_nested.exp +move-compiler/tests/move_check/liveness/dead_refs_nested_invalid.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_nested_invalid.exp +move-compiler/tests/move_check/liveness/dead_refs_simple.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_simple.exp +move-compiler/tests/move_check/liveness/dead_refs_simple_invalid.exp move-compiler-v2/tests/more-v1/liveness/dead_refs_simple_invalid.exp +move-compiler/tests/move_check/liveness/explicit_last_copy.exp move-compiler-v2/tests/more-v1/liveness/explicit_last_copy.exp +move-compiler/tests/move_check/liveness/loop_weirdness.exp move-compiler-v2/tests/more-v1/liveness/loop_weirdness.exp +move-compiler/tests/move_check/liveness/move_in_infinite_loop_branched.exp move-compiler-v2/tests/more-v1/liveness/move_in_infinite_loop_branched.exp move-compiler/tests/move_check/liveness/mut_inline.exp move-compiler-v2/tests/live-var/mut_inline.exp -move-compiler/tests/move_check/liveness/mut_ref.exp move-compiler-v2/tests/live-var/mut_ref.exp +move-compiler/tests/move_check/liveness/mut_ref.exp move-compiler-v2/tests/more-v1/liveness/mut_ref.exp +move-compiler/tests/move_check/liveness/trailing_semi.exp move-compiler-v2/tests/more-v1/liveness/trailing_semi.exp +move-compiler/tests/move_check/liveness/trailing_semi_loops.exp move-compiler-v2/tests/more-v1/liveness/trailing_semi_loops.exp move-compiler/tests/move_check/liveness/unused_assignment.exp move-compiler-v2/tests/unused-assignment/v1-liveness/unused_assignment.exp move-compiler/tests/move_check/locals/assign_partial_resource.exp move-compiler-v2/tests/unused-assignment/v1-locals/assign_partial_resource.exp move-compiler/tests/move_check/locals/assign_resource.exp move-compiler-v2/tests/unused-assignment/v1-locals/assign_resource.exp +move-compiler/tests/move_check/locals/dont_warn_unused_self.exp move-compiler-v2/tests/unused-assignment/v1-locals/dont_warn_unused_self.exp move-compiler/tests/move_check/locals/drop_conditional.exp move-compiler-v2/tests/ability-check/v1-locals/drop_conditional.exp move-compiler/tests/move_check/locals/eliminate_temps.exp move-compiler-v2/tests/reference-safety/v1-locals/eliminate_temps.exp move-compiler/tests/move_check/locals/reassign_parameter.exp move-compiler-v2/tests/ability-check/v1-locals/reassign_parameter.exp @@ -236,6 +396,11 @@ move-compiler/tests/move_check/locals/struct_use_before_assign.exp move-compil move-compiler/tests/move_check/locals/unused_copyable.exp move-compiler-v2/tests/unused-assignment/v1-locals/unused_copyable.exp move-compiler/tests/move_check/locals/unused_resource.exp move-compiler-v2/tests/unused-assignment/v1-locals/unused_resource.exp move-compiler/tests/move_check/locals/unused_resource_explicit_return.exp move-compiler-v2/tests/unused-assignment/v1-locals/unused_resource_explicit_return.exp +move-compiler/tests/move_check/locals/use_after_move_if.exp move-compiler-v2/tests/more-v1/locals/use_after_move_if.exp +move-compiler/tests/move_check/locals/use_after_move_if_else.exp move-compiler-v2/tests/more-v1/locals/use_after_move_if_else.exp +move-compiler/tests/move_check/locals/use_after_move_loop.exp move-compiler-v2/tests/more-v1/locals/use_after_move_loop.exp +move-compiler/tests/move_check/locals/use_after_move_simple.exp move-compiler-v2/tests/more-v1/locals/use_after_move_simple.exp +move-compiler/tests/move_check/locals/use_after_move_while.exp move-compiler-v2/tests/more-v1/locals/use_after_move_while.exp move-compiler/tests/move_check/locals/use_before_assign_if.exp move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_if.exp move-compiler/tests/move_check/locals/use_before_assign_if_else.exp move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_if_else.exp move-compiler/tests/move_check/locals/use_before_assign_loop.exp move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_loop.exp @@ -273,22 +438,206 @@ move-compiler/tests/move_check/naming/unresolved_type_with_args.exp move-compi move-compiler/tests/move_check/naming/vector_literal_type_arity.exp move-compiler-v2/tests/checking/typing/v1-naming/vector_literal_type_arity.exp move-compiler/tests/move_check/translated_ir_tests/move/operators/boolean_not_non_boolean.exp move-compiler-v2/tests/checking/typing/v1-operators/boolean_not_non_boolean.exp move-compiler/tests/move_check/translated_ir_tests/move/operators/casting_operators_types_mismatch.exp move-compiler-v2/tests/checking/typing/v1-operators/casting_operators_types_mismatch.exp +move-compiler/tests/move_check/parser/ability_constraint_trailing_plus.exp move-compiler-v2/tests/more-v1/parser/ability_constraint_trailing_plus.exp +move-compiler/tests/move_check/parser/ability_modifier_trailing_comma.exp move-compiler-v2/tests/more-v1/parser/ability_modifier_trailing_comma.exp move-compiler/tests/move_check/parser/acquires_list_generic.exp move-compiler-v2/tests/checking-lang-v1/acquires_list_generic.exp +move-compiler/tests/move_check/parser/address_almost_too_long.exp move-compiler-v2/tests/more-v1/parser/address_almost_too_long.exp +move-compiler/tests/move_check/parser/address_almost_too_long_decimal.exp move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal.exp +move-compiler/tests/move_check/parser/address_almost_too_long_decimal_exp.exp move-compiler-v2/tests/more-v1/parser/address_almost_too_long_decimal_exp.exp +move-compiler/tests/move_check/parser/address_almost_too_long_exp.exp move-compiler-v2/tests/more-v1/parser/address_almost_too_long_exp.exp +move-compiler/tests/move_check/parser/address_just_too_long.exp move-compiler-v2/tests/more-v1/parser/address_just_too_long.exp +move-compiler/tests/move_check/parser/address_just_too_long_decimal.exp move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal.exp +move-compiler/tests/move_check/parser/address_just_too_long_decimal_exp.exp move-compiler-v2/tests/more-v1/parser/address_just_too_long_decimal_exp.exp +move-compiler/tests/move_check/parser/address_just_too_long_exp.exp move-compiler-v2/tests/more-v1/parser/address_just_too_long_exp.exp +move-compiler/tests/move_check/parser/address_misspelled.exp move-compiler-v2/tests/more-v1/parser/address_misspelled.exp +move-compiler/tests/move_check/parser/address_not_hex.exp move-compiler-v2/tests/more-v1/parser/address_not_hex.exp +move-compiler/tests/move_check/parser/address_too_long.exp move-compiler-v2/tests/more-v1/parser/address_too_long.exp +move-compiler/tests/move_check/parser/address_too_long_decimal.exp move-compiler-v2/tests/more-v1/parser/address_too_long_decimal.exp +move-compiler/tests/move_check/parser/address_too_long_decimal_exp.exp move-compiler-v2/tests/more-v1/parser/address_too_long_decimal_exp.exp +move-compiler/tests/move_check/parser/address_too_long_exp.exp move-compiler-v2/tests/more-v1/parser/address_too_long_exp.exp +move-compiler/tests/move_check/parser/anonymous_field_fail.exp move-compiler-v2/tests/checking-lang-v1/anonymous_field_fail.exp move-compiler/tests/move_check/parser/aptos_stdlib_attributes.exp move-compiler-v2/tests/checking/attributes/aptos_stdlib_attributes.exp move-compiler/tests/move_check/parser/aptos_stdlib_attributes2.exp move-compiler-v2/tests/checking/attributes/aptos_stdlib_attributes2.exp move-compiler/tests/move_check/parser/attribute_no_closing_bracket.exp move-compiler-v2/tests/checking/attributes/attribute_no_closing_bracket.exp move-compiler/tests/move_check/parser/attribute_num_sign_no_bracket.exp move-compiler-v2/tests/checking/attributes/attribute_num_sign_no_bracket.exp move-compiler/tests/move_check/parser/attribute_placement.exp move-compiler-v2/tests/checking/attributes/attribute_placement.exp move-compiler/tests/move_check/parser/attribute_variants.exp move-compiler-v2/tests/checking/attributes/attribute_variants.exp +move-compiler/tests/move_check/parser/break_with_value.exp move-compiler-v2/tests/more-v1/parser/break_with_value.exp +move-compiler/tests/move_check/parser/byte_string_invalid_escaped_sequence.exp move-compiler-v2/tests/more-v1/parser/byte_string_invalid_escaped_sequence.exp +move-compiler/tests/move_check/parser/byte_string_invalid_hex.exp move-compiler-v2/tests/more-v1/parser/byte_string_invalid_hex.exp +move-compiler/tests/move_check/parser/byte_string_success.exp move-compiler-v2/tests/more-v1/parser/byte_string_success.exp +move-compiler/tests/move_check/parser/byte_string_token_eof1.exp move-compiler-v2/tests/more-v1/parser/byte_string_token_eof1.exp +move-compiler/tests/move_check/parser/byte_string_token_eof2.exp move-compiler-v2/tests/more-v1/parser/byte_string_token_eof2.exp +move-compiler/tests/move_check/parser/byte_string_token_eof3.exp move-compiler-v2/tests/more-v1/parser/byte_string_token_eof3.exp +move-compiler/tests/move_check/parser/comments_nested_unbalanced.exp move-compiler-v2/tests/more-v1/parser/comments_nested_unbalanced.exp +move-compiler/tests/move_check/parser/comments_ok.exp move-compiler-v2/tests/more-v1/parser/comments_ok.exp +move-compiler/tests/move_check/parser/comments_unbalanced.exp move-compiler-v2/tests/more-v1/parser/comments_unbalanced.exp +move-compiler/tests/move_check/parser/constant_native.exp move-compiler-v2/tests/more-v1/parser/constant_native.exp +move-compiler/tests/move_check/parser/constant_public.exp move-compiler-v2/tests/more-v1/parser/constant_public.exp +move-compiler/tests/move_check/parser/constant_values.exp move-compiler-v2/tests/more-v1/parser/constant_values.exp +move-compiler/tests/move_check/parser/constants_blocks.exp move-compiler-v2/tests/more-v1/parser/constants_blocks.exp +move-compiler/tests/move_check/parser/constants_simple.exp move-compiler-v2/tests/more-v1/parser/constants_simple.exp +move-compiler/tests/move_check/parser/constants_standalone_let.exp move-compiler-v2/tests/more-v1/parser/constants_standalone_let.exp +move-compiler/tests/move_check/parser/control_exp_as_term.exp move-compiler-v2/tests/more-v1/parser/control_exp_as_term.exp +move-compiler/tests/move_check/parser/control_exp_associativity.exp move-compiler-v2/tests/more-v1/parser/control_exp_associativity.exp +move-compiler/tests/move_check/parser/control_exp_associativity_else_after_if_block.exp move-compiler-v2/tests/more-v1/parser/control_exp_associativity_else_after_if_block.exp +move-compiler/tests/move_check/parser/control_exp_associativity_field_access.exp move-compiler-v2/tests/more-v1/parser/control_exp_associativity_field_access.exp +move-compiler/tests/move_check/parser/control_exp_associativity_typing_invalid.exp move-compiler-v2/tests/more-v1/parser/control_exp_associativity_typing_invalid.exp +move-compiler/tests/move_check/parser/control_exp_associativity_unreachable_code.exp move-compiler-v2/tests/more-v1/parser/control_exp_associativity_unreachable_code.exp +move-compiler/tests/move_check/parser/decimal_address.exp move-compiler-v2/tests/more-v1/parser/decimal_address.exp +move-compiler/tests/move_check/parser/doc_comments_placement.exp move-compiler-v2/tests/more-v1/parser/doc_comments_placement.exp +move-compiler/tests/move_check/parser/dotdot_not_supported.exp move-compiler-v2/tests/checking-lang-v1/dotdot_not_supported.exp move-compiler/tests/move_check/parser/duplicate_attributes.exp move-compiler-v2/tests/checking/attributes/duplicate_attributes.exp +move-compiler/tests/move_check/parser/duplicate_entry_modifier.exp move-compiler-v2/tests/more-v1/parser/duplicate_entry_modifier.exp +move-compiler/tests/move_check/parser/empty_file.exp move-compiler-v2/tests/more-v1/parser/empty_file.exp +move-compiler/tests/move_check/parser/entry_const.exp move-compiler-v2/tests/more-v1/parser/entry_const.exp +move-compiler/tests/move_check/parser/entry_function.exp move-compiler-v2/tests/more-v1/parser/entry_function.exp +move-compiler/tests/move_check/parser/entry_struct.exp move-compiler-v2/tests/more-v1/parser/entry_struct.exp +move-compiler/tests/move_check/parser/expr_abort_braces.exp move-compiler-v2/tests/more-v1/parser/expr_abort_braces.exp +move-compiler/tests/move_check/parser/expr_abort_missing_value.exp move-compiler-v2/tests/more-v1/parser/expr_abort_missing_value.exp +move-compiler/tests/move_check/parser/expr_if_braces.exp move-compiler-v2/tests/more-v1/parser/expr_if_braces.exp +move-compiler/tests/move_check/parser/expr_if_missing_parens.exp move-compiler-v2/tests/more-v1/parser/expr_if_missing_parens.exp +move-compiler/tests/move_check/parser/expr_loop_braces.exp move-compiler-v2/tests/more-v1/parser/expr_loop_braces.exp +move-compiler/tests/move_check/parser/expr_return_braces.exp move-compiler-v2/tests/more-v1/parser/expr_return_braces.exp +move-compiler/tests/move_check/parser/expr_return_missing_value.exp move-compiler-v2/tests/more-v1/parser/expr_return_missing_value.exp +move-compiler/tests/move_check/parser/expr_unary_negation.exp move-compiler-v2/tests/more-v1/parser/expr_unary_negation.exp +move-compiler/tests/move_check/parser/expr_unary_ops.exp move-compiler-v2/tests/more-v1/parser/expr_unary_ops.exp +move-compiler/tests/move_check/parser/expr_while_braces.exp move-compiler-v2/tests/more-v1/parser/expr_while_braces.exp +move-compiler/tests/move_check/parser/expr_while_missing_parens.exp move-compiler-v2/tests/more-v1/parser/expr_while_missing_parens.exp +move-compiler/tests/move_check/parser/extra_text_after_main.exp move-compiler-v2/tests/more-v1/parser/extra_text_after_main.exp +move-compiler/tests/move_check/parser/friend_decl_address_only.exp move-compiler-v2/tests/more-v1/parser/friend_decl_address_only.exp +move-compiler/tests/move_check/parser/friend_decl_inside_function.exp move-compiler-v2/tests/more-v1/parser/friend_decl_inside_function.exp +move-compiler/tests/move_check/parser/friend_decl_missing_semicolon.exp move-compiler-v2/tests/more-v1/parser/friend_decl_missing_semicolon.exp +move-compiler/tests/move_check/parser/friend_decl_more_than_one_module.exp move-compiler-v2/tests/more-v1/parser/friend_decl_more_than_one_module.exp +move-compiler/tests/move_check/parser/friend_decl_qualified_function.exp move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_function.exp +move-compiler/tests/move_check/parser/friend_decl_qualified_struct.exp move-compiler-v2/tests/more-v1/parser/friend_decl_qualified_struct.exp +move-compiler/tests/move_check/parser/friend_decl_valid.exp move-compiler-v2/tests/more-v1/parser/friend_decl_valid.exp +move-compiler/tests/move_check/parser/function_acquires_bad_name.exp move-compiler-v2/tests/more-v1/parser/function_acquires_bad_name.exp +move-compiler/tests/move_check/parser/function_acquires_missing_comma.exp move-compiler-v2/tests/more-v1/parser/function_acquires_missing_comma.exp +move-compiler/tests/move_check/parser/function_acquires_trailing_comma.exp move-compiler-v2/tests/more-v1/parser/function_acquires_trailing_comma.exp +move-compiler/tests/move_check/parser/function_incomplete.exp move-compiler-v2/tests/more-v1/parser/function_incomplete.exp +move-compiler/tests/move_check/parser/function_native_with_body.exp move-compiler-v2/tests/more-v1/parser/function_native_with_body.exp +move-compiler/tests/move_check/parser/function_params_commas.exp move-compiler-v2/tests/more-v1/parser/function_params_commas.exp +move-compiler/tests/move_check/parser/function_params_missing.exp move-compiler-v2/tests/more-v1/parser/function_params_missing.exp +move-compiler/tests/move_check/parser/function_public_native.exp move-compiler-v2/tests/more-v1/parser/function_public_native.exp +move-compiler/tests/move_check/parser/function_return_trailing_comma.exp move-compiler-v2/tests/more-v1/parser/function_return_trailing_comma.exp +move-compiler/tests/move_check/parser/function_return_type.exp move-compiler-v2/tests/more-v1/parser/function_return_type.exp +move-compiler/tests/move_check/parser/function_return_type_missing.exp move-compiler-v2/tests/more-v1/parser/function_return_type_missing.exp +move-compiler/tests/move_check/parser/function_type_empty.exp move-compiler-v2/tests/more-v1/parser/function_type_empty.exp +move-compiler/tests/move_check/parser/function_type_extra_comma.exp move-compiler-v2/tests/more-v1/parser/function_type_extra_comma.exp +move-compiler/tests/move_check/parser/function_type_missing_angle.exp move-compiler-v2/tests/more-v1/parser/function_type_missing_angle.exp +move-compiler/tests/move_check/parser/function_type_nested.exp move-compiler-v2/tests/more-v1/parser/function_type_nested.exp +move-compiler/tests/move_check/parser/function_type_trailing_comma.exp move-compiler-v2/tests/more-v1/parser/function_type_trailing_comma.exp +move-compiler/tests/move_check/parser/function_visibility_empty.exp move-compiler-v2/tests/more-v1/parser/function_visibility_empty.exp +move-compiler/tests/move_check/parser/function_visibility_friend.exp move-compiler-v2/tests/more-v1/parser/function_visibility_friend.exp +move-compiler/tests/move_check/parser/function_visibility_invalid.exp move-compiler-v2/tests/more-v1/parser/function_visibility_invalid.exp +move-compiler/tests/move_check/parser/function_visibility_multiple.exp move-compiler-v2/tests/more-v1/parser/function_visibility_multiple.exp +move-compiler/tests/move_check/parser/function_visibility_script.exp move-compiler-v2/tests/more-v1/parser/function_visibility_script.exp +move-compiler/tests/move_check/parser/function_without_body.exp move-compiler-v2/tests/more-v1/parser/function_without_body.exp +move-compiler/tests/move_check/parser/global_access.exp move-compiler-v2/tests/more-v1/parser/global_access.exp +move-compiler/tests/move_check/parser/global_access_pack.exp move-compiler-v2/tests/more-v1/parser/global_access_pack.exp +move-compiler/tests/move_check/parser/global_access_value.exp move-compiler-v2/tests/more-v1/parser/global_access_value.exp +move-compiler/tests/move_check/parser/hexstring.exp move-compiler-v2/tests/more-v1/parser/hexstring.exp +move-compiler/tests/move_check/parser/hexstring_missing_quote.exp move-compiler-v2/tests/more-v1/parser/hexstring_missing_quote.exp +move-compiler/tests/move_check/parser/hexstring_token_eof1.exp move-compiler-v2/tests/more-v1/parser/hexstring_token_eof1.exp +move-compiler/tests/move_check/parser/hexstring_token_eof2.exp move-compiler-v2/tests/more-v1/parser/hexstring_token_eof2.exp +move-compiler/tests/move_check/parser/invalid_call_lhs_complex_expression.exp move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp +move-compiler/tests/move_check/parser/invalid_call_lhs_parens_around_name.exp move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp +move-compiler/tests/move_check/parser/invalid_call_lhs_return.exp move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp +move-compiler/tests/move_check/parser/invalid_call_lhs_value.exp move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp +move-compiler/tests/move_check/parser/invalid_character.exp move-compiler-v2/tests/more-v1/parser/invalid_character.exp +move-compiler/tests/move_check/parser/invalid_character_comment.exp move-compiler-v2/tests/more-v1/parser/invalid_character_comment.exp +move-compiler/tests/move_check/parser/invalid_character_non_ascii.exp move-compiler-v2/tests/more-v1/parser/invalid_character_non_ascii.exp +move-compiler/tests/move_check/parser/invalid_named_address_assignment.exp move-compiler-v2/tests/more-v1/parser/invalid_named_address_assignment.exp +move-compiler/tests/move_check/parser/invalid_named_address_declaration.exp move-compiler-v2/tests/more-v1/parser/invalid_named_address_declaration.exp +move-compiler/tests/move_check/parser/invalid_pack_mname_non_addr.exp move-compiler-v2/tests/more-v1/parser/invalid_pack_mname_non_addr.exp +move-compiler/tests/move_check/parser/invalid_unpack_assign_lhs_mdot_no_addr.exp move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_lhs_mdot_no_addr.exp +move-compiler/tests/move_check/parser/invalid_unpack_assign_rhs_not_fields.exp move-compiler-v2/tests/more-v1/parser/invalid_unpack_assign_rhs_not_fields.exp +move-compiler/tests/move_check/parser/lambda_no_param.exp move-compiler-v2/tests/more-v1/parser/lambda_no_param.exp +move-compiler/tests/move_check/parser/less_than_space.exp move-compiler-v2/tests/more-v1/parser/less_than_space.exp +move-compiler/tests/move_check/parser/let_binding.exp move-compiler-v2/tests/more-v1/parser/let_binding.exp +move-compiler/tests/move_check/parser/let_binding_bad_name.exp move-compiler-v2/tests/more-v1/parser/let_binding_bad_name.exp +move-compiler/tests/move_check/parser/let_binding_missing_fields.exp move-compiler-v2/tests/more-v1/parser/let_binding_missing_fields.exp +move-compiler/tests/move_check/parser/let_binding_missing_paren.exp move-compiler-v2/tests/more-v1/parser/let_binding_missing_paren.exp +move-compiler/tests/move_check/parser/let_binding_missing_semicolon.exp move-compiler-v2/tests/more-v1/parser/let_binding_missing_semicolon.exp +move-compiler/tests/move_check/parser/let_binding_missing_type.exp move-compiler-v2/tests/more-v1/parser/let_binding_missing_type.exp +move-compiler/tests/move_check/parser/let_binding_trailing_comma.exp move-compiler-v2/tests/more-v1/parser/let_binding_trailing_comma.exp +move-compiler/tests/move_check/parser/missing_angle_brace_close.exp move-compiler-v2/tests/more-v1/parser/missing_angle_brace_close.exp +move-compiler/tests/move_check/parser/module_missing_lbrace.exp move-compiler-v2/tests/more-v1/parser/module_missing_lbrace.exp +move-compiler/tests/move_check/parser/module_missing_rbrace.exp move-compiler-v2/tests/more-v1/parser/module_missing_rbrace.exp +move-compiler/tests/move_check/parser/module_struct_after_func.exp move-compiler-v2/tests/more-v1/parser/module_struct_after_func.exp +move-compiler/tests/move_check/parser/module_use_after_func.exp move-compiler-v2/tests/more-v1/parser/module_use_after_func.exp +move-compiler/tests/move_check/parser/module_use_after_struct.exp move-compiler-v2/tests/more-v1/parser/module_use_after_struct.exp +move-compiler/tests/move_check/parser/named_address.exp move-compiler-v2/tests/more-v1/parser/named_address.exp +move-compiler/tests/move_check/parser/named_address_value.exp move-compiler-v2/tests/more-v1/parser/named_address_value.exp +move-compiler/tests/move_check/parser/native_main.exp move-compiler-v2/tests/more-v1/parser/native_main.exp +move-compiler/tests/move_check/parser/newline_crlf.exp move-compiler-v2/tests/more-v1/parser/newline_crlf.exp +move-compiler/tests/move_check/parser/not_doc_comment.exp move-compiler-v2/tests/more-v1/parser/not_doc_comment.exp +move-compiler/tests/move_check/parser/num_hex_literal_underscore_leading.exp move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading.exp +move-compiler/tests/move_check/parser/num_hex_literal_underscore_leading_no_type_suffix.exp move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_leading_no_type_suffix.exp +move-compiler/tests/move_check/parser/num_hex_literal_underscore_trailing.exp move-compiler-v2/tests/more-v1/parser/num_hex_literal_underscore_trailing.exp +move-compiler/tests/move_check/parser/num_literal_underscore.exp move-compiler-v2/tests/more-v1/parser/num_literal_underscore.exp +move-compiler/tests/move_check/parser/num_literal_underscore_leading.exp move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading.exp +move-compiler/tests/move_check/parser/num_literal_underscore_leading_no_type_suffix.exp move-compiler-v2/tests/more-v1/parser/num_literal_underscore_leading_no_type_suffix.exp +move-compiler/tests/move_check/parser/num_literal_underscore_trailing.exp move-compiler-v2/tests/more-v1/parser/num_literal_underscore_trailing.exp +move-compiler/tests/move_check/parser/phantom_param_invalid_keyword.exp move-compiler-v2/tests/more-v1/parser/phantom_param_invalid_keyword.exp +move-compiler/tests/move_check/parser/phantom_param_missing_type_var.exp move-compiler-v2/tests/more-v1/parser/phantom_param_missing_type_var.exp +move-compiler/tests/move_check/parser/preserve_address_syntax.exp move-compiler-v2/tests/more-v1/parser/preserve_address_syntax.exp +move-compiler/tests/move_check/parser/public_packge_visibility.exp move-compiler-v2/tests/checking-lang-v1/public_packge_visibility.exp +move-compiler/tests/move_check/parser/return_in_binop.exp move-compiler-v2/tests/more-v1/parser/return_in_binop.exp +move-compiler/tests/move_check/parser/spec_parsing_emits_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_emits_fail.exp +move-compiler/tests/move_check/parser/spec_parsing_fun_type_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_fun_type_fail.exp +move-compiler/tests/move_check/parser/spec_parsing_generic_condition_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_generic_condition_fail.exp +move-compiler/tests/move_check/parser/spec_parsing_implies_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_implies_fail.exp +move-compiler/tests/move_check/parser/spec_parsing_index_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_index_fail.exp +move-compiler/tests/move_check/parser/spec_parsing_inside_fun.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_inside_fun.exp +move-compiler/tests/move_check/parser/spec_parsing_ok.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_ok.exp +move-compiler/tests/move_check/parser/spec_parsing_old_fun_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_old_fun_fail.exp +move-compiler/tests/move_check/parser/spec_parsing_quantifier_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_quantifier_fail.exp +move-compiler/tests/move_check/parser/spec_parsing_range_fail.exp move-compiler-v2/tests/more-v1/parser/spec_parsing_range_fail.exp +move-compiler/tests/move_check/parser/struct_field_missing_type.exp move-compiler-v2/tests/more-v1/parser/struct_field_missing_type.exp +move-compiler/tests/move_check/parser/struct_missing_lbrace.exp move-compiler-v2/tests/more-v1/parser/struct_missing_lbrace.exp +move-compiler/tests/move_check/parser/struct_native_missing_semicolon.exp move-compiler-v2/tests/more-v1/parser/struct_native_missing_semicolon.exp +move-compiler/tests/move_check/parser/struct_native_with_fields.exp move-compiler-v2/tests/more-v1/parser/struct_native_with_fields.exp +move-compiler/tests/move_check/parser/struct_public.exp move-compiler-v2/tests/more-v1/parser/struct_public.exp +move-compiler/tests/move_check/parser/struct_trailing_comma.exp move-compiler-v2/tests/more-v1/parser/struct_trailing_comma.exp +move-compiler/tests/move_check/parser/struct_type_empty.exp move-compiler-v2/tests/more-v1/parser/struct_type_empty.exp +move-compiler/tests/move_check/parser/struct_type_extra_comma.exp move-compiler-v2/tests/more-v1/parser/struct_type_extra_comma.exp +move-compiler/tests/move_check/parser/struct_type_missing_angle.exp move-compiler-v2/tests/more-v1/parser/struct_type_missing_angle.exp +move-compiler/tests/move_check/parser/struct_type_misspelled_copy_constraint.exp move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_copy_constraint.exp +move-compiler/tests/move_check/parser/struct_type_misspelled_key_constraint.exp move-compiler-v2/tests/more-v1/parser/struct_type_misspelled_key_constraint.exp +move-compiler/tests/move_check/parser/struct_type_trailing_comma.exp move-compiler-v2/tests/more-v1/parser/struct_type_trailing_comma.exp +move-compiler/tests/move_check/parser/struct_without_fields.exp move-compiler-v2/tests/more-v1/parser/struct_without_fields.exp +move-compiler/tests/move_check/parser/testonly.exp move-compiler-v2/tests/more-v1/parser/testonly.exp +move-compiler/tests/move_check/parser/unexpected_token_after_ability_function_constraint.exp move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp +move-compiler/tests/move_check/parser/unexpected_token_after_ability_modifier.exp move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_modifier.exp +move-compiler/tests/move_check/parser/unknown_ability_name_function_constraint.exp move-compiler-v2/tests/more-v1/parser/unknown_ability_name_function_constraint.exp +move-compiler/tests/move_check/parser/unknown_ability_name_modifier.exp move-compiler-v2/tests/more-v1/parser/unknown_ability_name_modifier.exp +move-compiler/tests/move_check/parser/use_inner_scope.exp move-compiler-v2/tests/more-v1/parser/use_inner_scope.exp +move-compiler/tests/move_check/parser/use_inner_scope_invalid.exp move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid.exp +move-compiler/tests/move_check/parser/use_inner_scope_invalid_inner.exp move-compiler-v2/tests/more-v1/parser/use_inner_scope_invalid_inner.exp +move-compiler/tests/move_check/parser/use_module_member.exp move-compiler-v2/tests/more-v1/parser/use_module_member.exp +move-compiler/tests/move_check/parser/use_module_member_invalid_comma.exp move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_comma.exp +move-compiler/tests/move_check/parser/use_module_member_invalid_missing_close_brace.exp move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_close_brace.exp +move-compiler/tests/move_check/parser/use_module_member_invalid_missing_semicolon.exp move-compiler-v2/tests/more-v1/parser/use_module_member_invalid_missing_semicolon.exp +move-compiler/tests/move_check/parser/use_with_address.exp move-compiler-v2/tests/more-v1/parser/use_with_address.exp +move-compiler/tests/move_check/parser/use_with_main.exp move-compiler-v2/tests/more-v1/parser/use_with_main.exp +move-compiler/tests/move_check/parser/use_with_module.exp move-compiler-v2/tests/more-v1/parser/use_with_module.exp +move-compiler/tests/move_check/parser/vector_literal_unclosed_args.exp move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_args.exp +move-compiler/tests/move_check/parser/vector_literal_unclosed_type_args.exp move-compiler-v2/tests/more-v1/parser/vector_literal_unclosed_type_args.exp +move-compiler/tests/move_check/parser/vector_space_after_less.exp move-compiler-v2/tests/more-v1/parser/vector_space_after_less.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.exp move-compiler-v2/tests/ability-check/v1-signer/address_arg_is_not_signer.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/copy_loc.exp move-compiler-v2/tests/ability-check/v1-signer/copy_loc.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/copy_loc_transitive.exp move-compiler-v2/tests/ability-check/v1-signer/copy_loc_transitive.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/does_not_have_store.exp move-compiler-v2/tests/ability-check/v1-signer/does_not_have_store.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/double_signer.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/invalid_move_to_sender.exp move-compiler-v2/tests/ability-check/v1-signer/invalid_move_to_sender.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/keyword.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/keyword.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/misplaced_signer_arg.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_extra_arg.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_extra_arg.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_missing_resource.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_missing_resource.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_missing_signer.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_missing_signer.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_mutable_signer.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_mutable_signer.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_no_args.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_no_args.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_non_resource.exp move-compiler-v2/tests/ability-check/v1-signer/move_to_non_resource.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_non_signer.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_non_signer.exp @@ -296,10 +645,21 @@ move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_non_struc move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_reference_to_args_flipped.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_reference_to_args_flipped.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_reference_to_resource.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_reference_to_resource.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_reference_to_wrong_resource.exp move-compiler-v2/tests/checking/typing/v1-signer/move_to_reference_to_wrong_resource.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_sender.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_sender.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/move_to_valid.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/move_to_valid.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref.exp move-compiler-v2/tests/ability-check/v1-signer/read_ref.exp move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive.exp move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.exp move-compiler-v2/tests/ability-check/v1-signer/read_ref_transitive2.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/st_loc.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/st_loc_partial.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/st_loc_partial.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/transitive.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/transitive.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/triple_signer.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/unused.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/unused_partial.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/unused_partial.exp +move-compiler/tests/move_check/translated_ir_tests/move/signer/write_ref.exp move-compiler-v2/tests/more-v1/translated_ir_tests/move/signer/write_ref.exp move-compiler/tests/move_check/simplifier/moved_var_not_simplified.exp move-compiler-v2/tests/simplifier/moved_var_not_simplified.exp move-compiler/tests/move_check/simplifier/moved_var_not_simplified2.exp move-compiler-v2/tests/simplifier/moved_var_not_simplified2.exp +move-compiler/tests/move_check/simplifier/moved_var_not_simplified3.exp move-compiler-v2/tests/more-v1/simplifier/moved_var_not_simplified3.exp move-compiler/tests/move_check/skip_attribute_checks/aptos_stdlib_attributes.exp move-compiler-v2/tests/skip_attribute_checks/aptos_stdlib_attributes.exp move-compiler/tests/move_check/skip_attribute_checks/aptos_stdlib_attributes2.exp move-compiler-v2/tests/skip_attribute_checks/aptos_stdlib_attributes2.exp move-compiler/tests/move_check/skip_attribute_checks/attribute_no_closing_bracket.exp move-compiler-v2/tests/skip_attribute_checks/attribute_no_closing_bracket.exp @@ -309,18 +669,22 @@ move-compiler/tests/move_check/skip_attribute_checks/duplicate_attributes.exp move-compiler/tests/move_check/skip_attribute_checks/extra_attributes.exp move-compiler-v2/tests/skip_attribute_checks/extra_attributes.exp move-compiler/tests/move_check/skip_attribute_checks/extra_attributes2.exp move-compiler-v2/tests/skip_attribute_checks/extra_attributes2.exp move-compiler/tests/move_check/skip_attribute_checks/testonly.exp move-compiler-v2/tests/skip_attribute_checks/testonly.exp +move-compiler/tests/move_check/to_bytecode/unassigned_address.exp move-compiler-v2/tests/more-v1/to_bytecode/unassigned_address.exp move-compiler/tests/move_check/typing/ability_constraint_generic_in_field.exp move-compiler-v2/tests/checking/abilities/v1/ability_constraint_generic_in_field.exp move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.exp move-compiler-v2/tests/checking/abilities/v1/ability_constraint_prims_invalid.exp move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.exp move-compiler-v2/tests/checking/abilities/v1/ability_constraint_structs_invalid.exp move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.exp move-compiler-v2/tests/checking/abilities/v1/ability_constraint_tparams_invalid.exp move-compiler/tests/move_check/typing/ability_constraints.exp move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp +move-compiler/tests/move_check/typing/abort_any_type.exp move-compiler-v2/tests/more-v1/typing/abort_any_type.exp +move-compiler/tests/move_check/typing/acquires_error_msg.exp move-compiler-v2/tests/acquires-checker/typing/acquires_error_msg.exp move-compiler/tests/move_check/typing/annotated_types.exp move-compiler-v2/tests/checking/typing/annotated_types.exp move-compiler/tests/move_check/typing/assign_duplicate_assigning.exp move-compiler-v2/tests/checking/typing/assign_duplicate_assigning.exp move-compiler/tests/move_check/typing/assign_nested.exp move-compiler-v2/tests/checking/typing/assign_nested.exp +move-compiler/tests/move_check/typing/assign_nested2.exp move-compiler-v2/tests/checking/typing/assign_nested2.exp move-compiler/tests/move_check/typing/assign_pop_resource.exp move-compiler-v2/tests/ability-check/v1-typing/assign_pop_resource.exp move-compiler/tests/move_check/typing/assign_tuple.exp move-compiler-v2/tests/checking/typing/assign_tuple.exp move-compiler/tests/move_check/typing/assign_tuple_wg.exp move-compiler-v2/tests/checking/typing/assign_tuple_wg.exp -move-compiler/tests/move_check/typing/assign_unpack_references.exp move-compiler-v2/tests/checking/typing/assign_unpack_references.exp +move-compiler/tests/move_check/typing/assign_unpack_references.exp move-compiler-v2/tests/ability-check/typing/assign_unpack_references.exp move-compiler/tests/move_check/typing/assign_unpack_references_invalid.exp move-compiler-v2/tests/checking/typing/assign_unpack_references_invalid.exp move-compiler/tests/move_check/typing/assign_wrong_arity.exp move-compiler-v2/tests/checking/typing/assign_wrong_arity.exp move-compiler/tests/move_check/typing/assign_wrong_type.exp move-compiler-v2/tests/checking/typing/assign_wrong_type.exp @@ -363,7 +727,7 @@ move-compiler/tests/move_check/typing/binary_sub_invalid.exp move-compiler-v2/ move-compiler/tests/move_check/typing/binary_xor.exp move-compiler-v2/tests/checking/typing/binary_xor.exp move-compiler/tests/move_check/typing/bind_duplicate_binding.exp move-compiler-v2/tests/checking/typing/bind_duplicate_binding.exp move-compiler/tests/move_check/typing/bind_pop_resource.exp move-compiler-v2/tests/ability-check/v1-typing/bind_pop_resource.exp -move-compiler/tests/move_check/typing/bind_unpack_references.exp move-compiler-v2/tests/checking/typing/bind_unpack_references.exp +move-compiler/tests/move_check/typing/bind_unpack_references.exp move-compiler-v2/tests/ability-check/typing/bind_unpack_references.exp move-compiler/tests/move_check/typing/bind_unpack_references_invalid.exp move-compiler-v2/tests/checking/typing/bind_unpack_references_invalid.exp move-compiler/tests/move_check/typing/bind_with_type_annot.exp move-compiler-v2/tests/checking/typing/bind_with_type_annot.exp move-compiler/tests/move_check/typing/bind_wrong_arity.exp move-compiler-v2/tests/checking/typing/bind_wrong_arity.exp @@ -374,6 +738,8 @@ move-compiler/tests/move_check/typing/block_single_expr.exp move-compiler-v2/t move-compiler/tests/move_check/typing/block_single_expr_invalid.exp move-compiler-v2/tests/checking/typing/block_single_expr_invalid.exp move-compiler/tests/move_check/typing/block_with_statements.exp move-compiler-v2/tests/checking/typing/block_with_statements.exp move-compiler/tests/move_check/typing/block_with_statements_invalid.exp move-compiler-v2/tests/checking/typing/block_with_statements_invalid.exp +move-compiler/tests/move_check/typing/block_with_statements_invalid2.exp move-compiler-v2/tests/checking/typing/block_with_statements_invalid2.exp +move-compiler/tests/move_check/typing/borrow_divergent.exp move-compiler-v2/tests/more-v1/typing/borrow_divergent.exp move-compiler/tests/move_check/typing/borrow_field.exp move-compiler-v2/tests/checking/typing/borrow_field.exp move-compiler/tests/move_check/typing/borrow_field_chain.exp move-compiler-v2/tests/checking/typing/borrow_field_chain.exp move-compiler/tests/move_check/typing/borrow_field_chain_missing.exp move-compiler-v2/tests/checking/typing/borrow_field_chain_missing.exp @@ -387,7 +753,7 @@ move-compiler/tests/move_check/typing/borrow_local.exp move-compiler-v2/tests/ move-compiler/tests/move_check/typing/borrow_local_invalid.exp move-compiler-v2/tests/checking/typing/borrow_local_invalid.exp move-compiler/tests/move_check/typing/borrow_local_temp.exp move-compiler-v2/tests/checking/typing/borrow_local_temp.exp move-compiler/tests/move_check/typing/borrow_local_temp_invalid.exp move-compiler-v2/tests/checking/typing/borrow_local_temp_invalid.exp -move-compiler/tests/move_check/typing/borrow_local_temp_resource.exp move-compiler-v2/tests/checking/typing/borrow_local_temp_resource.exp +move-compiler/tests/move_check/typing/borrow_local_temp_resource.exp move-compiler-v2/tests/ability-check/typing/borrow_local_temp_resource.exp move-compiler/tests/move_check/typing/break_any_type.exp move-compiler-v2/tests/checking/typing/break_any_type.exp move-compiler/tests/move_check/typing/break_constant.exp move-compiler-v2/tests/checking/typing/break_constant.exp move-compiler/tests/move_check/typing/break_outside_loop.exp move-compiler-v2/tests/checking/typing/break_outside_loop.exp @@ -409,28 +775,34 @@ move-compiler/tests/move_check/typing/constant_unsupported_exps.exp move-compi move-compiler/tests/move_check/typing/constraints_not_satisfied_all_cases.exp move-compiler-v2/tests/ability-check/v1-typing/constraints_not_satisfied_all_cases.exp move-compiler/tests/move_check/typing/constraints_not_satisfied_function_parameter.exp move-compiler-v2/tests/ability-check/v1-typing/constraints_not_satisfied_function_parameter.exp move-compiler/tests/move_check/typing/constraints_not_satisfied_function_return_type.exp move-compiler-v2/tests/ability-check/v1-typing/constraints_not_satisfied_function_return_type.exp +move-compiler/tests/move_check/typing/constraints_not_satisfied_lvalues_bind_type.exp move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_lvalues_bind_type.exp move-compiler/tests/move_check/typing/constraints_not_satisfied_lvalues_decl_type.exp move-compiler-v2/tests/ability-check/v1-typing/constraints_not_satisfied_lvalues_decl_type.exp move-compiler/tests/move_check/typing/constraints_not_satisfied_lvalues_pack_type_args.exp move-compiler-v2/tests/ability-check/v1-typing/constraints_not_satisfied_lvalues_pack_type_args.exp move-compiler/tests/move_check/typing/constraints_not_satisfied_struct_field.exp move-compiler-v2/tests/ability-check/v1-typing/constraints_not_satisfied_struct_field.exp +move-compiler/tests/move_check/typing/constraints_not_satisfied_type_annotation.exp move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_annotation.exp move-compiler/tests/move_check/typing/constraints_not_satisfied_type_arguments_internal_call.exp move-compiler-v2/tests/ability-check/v1-typing/constraints_not_satisfied_type_arguments_internal_call.exp +move-compiler/tests/move_check/typing/constraints_not_satisfied_type_arguments_internal_pack.exp move-compiler-v2/tests/more-v1/typing/constraints_not_satisfied_type_arguments_internal_pack.exp move-compiler/tests/move_check/typing/continue_any_type.exp move-compiler-v2/tests/checking/typing/continue_any_type.exp move-compiler/tests/move_check/typing/continue_outside_loop.exp move-compiler-v2/tests/checking/typing/continue_outside_loop.exp move-compiler/tests/move_check/typing/decl_unpack_references.exp move-compiler-v2/tests/checking/typing/decl_unpack_references.exp move-compiler/tests/move_check/typing/declare_duplicate_binding.exp move-compiler-v2/tests/checking/typing/declare_duplicate_binding.exp +move-compiler/tests/move_check/typing/declare_duplicate_binding2.exp move-compiler-v2/tests/unused-assignment/typing/declare_duplicate_binding2.exp +move-compiler/tests/move_check/typing/declare_pop_resource.exp move-compiler-v2/tests/more-v1/typing/declare_pop_resource.exp move-compiler/tests/move_check/typing/declare_with_type_annot.exp move-compiler-v2/tests/checking/typing/declare_with_type_annot.exp move-compiler/tests/move_check/typing/declare_wrong_arity.exp move-compiler-v2/tests/checking/typing/declare_wrong_arity.exp move-compiler/tests/move_check/typing/declare_wrong_type.exp move-compiler-v2/tests/checking/typing/declare_wrong_type.exp move-compiler/tests/move_check/typing/derefrence.exp move-compiler-v2/tests/checking/typing/derefrence.exp move-compiler/tests/move_check/typing/derefrence_invalid.exp move-compiler-v2/tests/checking/typing/derefrence_invalid.exp -move-compiler/tests/move_check/typing/derefrence_reference.exp move-compiler-v2/tests/checking/typing/derefrence_reference.exp +move-compiler/tests/move_check/typing/derefrence_reference.exp move-compiler-v2/tests/ability-check/typing/derefrence_reference.exp move-compiler/tests/move_check/typing/duplicate_function_parameter_names.exp move-compiler-v2/tests/checking/typing/duplicate_function_parameter_names.exp move-compiler/tests/move_check/typing/entry_on_any_vis.exp move-compiler-v2/tests/checking/typing/entry_on_any_vis.exp move-compiler/tests/move_check/typing/entry_signature_no_warning.exp move-compiler-v2/tests/checking/typing/entry_signature_no_warning.exp move-compiler/tests/move_check/typing/eq.exp move-compiler-v2/tests/checking/typing/eq.exp -move-compiler/tests/move_check/typing/eq_invalid.exp move-compiler-v2/tests/checking/typing/eq_invalid.exp +move-compiler/tests/move_check/typing/eq_invalid.exp move-compiler-v2/tests/ability-check/typing/eq_invalid.exp +move-compiler/tests/move_check/typing/eq_invalid2.exp move-compiler-v2/tests/ability-check/typing/eq_invalid2.exp move-compiler/tests/move_check/typing/exp_list.exp move-compiler-v2/tests/checking/typing/exp_list.exp move-compiler/tests/move_check/typing/exp_list_nested.exp move-compiler-v2/tests/checking/typing/exp_list_nested.exp -move-compiler/tests/move_check/typing/exp_list_resource_drop.exp move-compiler-v2/tests/checking/typing/exp_list_resource_drop.exp +move-compiler/tests/move_check/typing/exp_list_resource_drop.exp move-compiler-v2/tests/ability-check/typing/exp_list_resource_drop.exp move-compiler/tests/move_check/typing/explicit_copy.exp move-compiler-v2/tests/checking/typing/explicit_copy.exp move-compiler/tests/move_check/typing/explicit_move.exp move-compiler-v2/tests/checking/typing/explicit_move.exp move-compiler/tests/move_check/typing/extraneous_acquire.exp move-compiler-v2/tests/acquires-checker/v1-tests/extraneous_acquire.exp @@ -447,7 +819,10 @@ move-compiler/tests/move_check/typing/if_condition_invalid.exp move-compiler-v move-compiler/tests/move_check/typing/if_default_else.exp move-compiler-v2/tests/checking/typing/if_default_else.exp move-compiler/tests/move_check/typing/if_matched_branches.exp move-compiler-v2/tests/checking/typing/if_matched_branches.exp move-compiler/tests/move_check/typing/if_mismatched_branches.exp move-compiler-v2/tests/checking/typing/if_mismatched_branches.exp -move-compiler/tests/move_check/typing/ignore_inferred_resource.exp move-compiler-v2/tests/checking/typing/ignore_inferred_resource.exp +move-compiler/tests/move_check/typing/ignore_inferred_resource.exp move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource.exp +move-compiler/tests/move_check/typing/ignore_inferred_resource2.exp move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource2.exp +move-compiler/tests/move_check/typing/ignore_inferred_resource3.exp move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource3.exp +move-compiler/tests/move_check/typing/ignore_inferred_resource4.exp move-compiler-v2/tests/ability-check/typing/ignore_inferred_resource4.exp move-compiler/tests/move_check/typing/implicit_deref_borrow_field.exp move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field.exp move-compiler/tests/move_check/typing/implicit_deref_borrow_field_chain.exp move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_chain.exp move-compiler/tests/move_check/typing/implicit_deref_borrow_field_chain_missing.exp move-compiler-v2/tests/checking/typing/implicit_deref_borrow_field_chain_missing.exp @@ -461,7 +836,7 @@ move-compiler/tests/move_check/typing/implicit_deref_borrow_field_not_copyable.e move-compiler/tests/move_check/typing/infinite_instantiations_invalid.exp move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_invalid.exp move-compiler/tests/move_check/typing/infinite_instantiations_valid.exp move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp move-compiler/tests/move_check/typing/instantiate_signatures.exp move-compiler-v2/tests/ability-check/v1-typing/instantiate_signatures.exp -move-compiler/tests/move_check/typing/invalid_type_acquire.exp move-compiler-v2/tests/checking-lang-v1/v1-typing/invalid_type_acquire.exp +move-compiler/tests/move_check/typing/invalid_type_acquire.exp move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.exp move-compiler/tests/move_check/typing/lambda.exp move-compiler-v2/tests/checking/typing/lambda.exp move-compiler/tests/move_check/typing/large_binop.exp move-compiler-v2/tests/checking/typing/large_binop.exp move-compiler/tests/move_check/typing/loop_body.exp move-compiler-v2/tests/checking/typing/loop_body.exp @@ -480,7 +855,7 @@ move-compiler/tests/move_check/typing/module_call_complicated_rhs.exp move-com move-compiler/tests/move_check/typing/module_call_constraints_not_satisfied.exp move-compiler-v2/tests/ability-check/v1-typing/module_call_constraints_not_satisfied.exp move-compiler/tests/move_check/typing/module_call_entry_function.exp move-compiler-v2/tests/checking/typing/module_call_entry_function.exp move-compiler/tests/move_check/typing/module_call_entry_function_was_invalid.exp move-compiler-v2/tests/visibility-checker/v1-typing/module_call_entry_function_was_invalid.exp -move-compiler/tests/move_check/typing/module_call_explicit_type_arguments.exp move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments.exp +move-compiler/tests/move_check/typing/module_call_explicit_type_arguments.exp move-compiler-v2/tests/ability-check/typing/module_call_explicit_type_arguments.exp move-compiler/tests/move_check/typing/module_call_explicit_type_arguments_invalid.exp move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments_invalid.exp move-compiler/tests/move_check/typing/module_call_internal.exp move-compiler-v2/tests/visibility-checker/v1-typing/module_call_internal.exp move-compiler/tests/move_check/typing/module_call_missing_function.exp move-compiler-v2/tests/checking/typing/module_call_missing_function.exp @@ -491,6 +866,7 @@ move-compiler/tests/move_check/typing/module_call_wrong_arity.exp move-compile move-compiler/tests/move_check/typing/module_call_wrong_single_argument.exp move-compiler-v2/tests/checking/typing/module_call_wrong_single_argument.exp move-compiler/tests/move_check/typing/move_from_type_argument.exp move-compiler-v2/tests/checking/typing/move_from_type_argument.exp move-compiler/tests/move_check/typing/mutable_borrow_from_immutable.exp move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable.exp +move-compiler/tests/move_check/typing/mutable_borrow_from_immutable2.exp move-compiler-v2/tests/reference-safety/v1-typing/mutable_borrow_from_immutable2.exp move-compiler/tests/move_check/typing/mutable_eq_and_neq.exp move-compiler-v2/tests/checking/typing/mutable_eq_and_neq.exp move-compiler/tests/move_check/typing/mutable_eq_and_neq_invalid.exp move-compiler-v2/tests/reference-safety/v1-typing/mutable_eq_and_neq_invalid.exp move-compiler/tests/move_check/typing/mutate.exp move-compiler-v2/tests/checking/typing/mutate.exp @@ -498,15 +874,18 @@ move-compiler/tests/move_check/typing/mutate_field_internal.exp move-compiler- move-compiler/tests/move_check/typing/mutate_immutable.exp move-compiler-v2/tests/bytecode-generator/v1-typing/mutate_immutable.exp move-compiler/tests/move_check/typing/mutate_invalid.exp move-compiler-v2/tests/checking/typing/mutate_invalid.exp move-compiler/tests/move_check/typing/mutate_non_ref.exp move-compiler-v2/tests/checking/typing/mutate_non_ref.exp -move-compiler/tests/move_check/typing/mutate_resource.exp move-compiler-v2/tests/checking/typing/mutate_resource.exp +move-compiler/tests/move_check/typing/mutate_resource.exp move-compiler-v2/tests/ability-check/typing/mutate_resource.exp move-compiler/tests/move_check/typing/native_structs_pack_unpack.exp move-compiler-v2/tests/checking/typing/native_structs_pack_unpack.exp move-compiler/tests/move_check/typing/neq.exp move-compiler-v2/tests/checking/typing/neq.exp -move-compiler/tests/move_check/typing/neq_invalid.exp move-compiler-v2/tests/checking/typing/neq_invalid.exp +move-compiler/tests/move_check/typing/neq_invalid.exp move-compiler-v2/tests/ability-check/typing/neq_invalid.exp +move-compiler/tests/move_check/typing/neq_invalid2.exp move-compiler-v2/tests/ability-check/typing/neq_invalid2.exp +move-compiler/tests/move_check/typing/non_phantom_in_phantom_pos.exp move-compiler-v2/tests/more-v1/typing/non_phantom_in_phantom_pos.exp move-compiler/tests/move_check/typing/number_literal_too_large.exp move-compiler-v2/tests/checking/typing/number_literal_too_large.exp move-compiler/tests/move_check/typing/other_builtins.exp move-compiler-v2/tests/checking/typing/other_builtins.exp move-compiler/tests/move_check/typing/other_builtins_invalid.exp move-compiler-v2/tests/checking/typing/other_builtins_invalid.exp -move-compiler/tests/move_check/typing/pack.exp move-compiler-v2/tests/checking/typing/pack.exp +move-compiler/tests/move_check/typing/pack.exp move-compiler-v2/tests/ability-check/typing/pack.exp move-compiler/tests/move_check/typing/pack_constraint_not_satisfied.exp move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied.exp +move-compiler/tests/move_check/typing/pack_constraint_not_satisfied2.exp move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.exp move-compiler/tests/move_check/typing/pack_invalid_argument.exp move-compiler-v2/tests/checking/typing/pack_invalid_argument.exp move-compiler/tests/move_check/typing/pack_missing_field.exp move-compiler-v2/tests/checking/typing/pack_missing_field.exp move-compiler/tests/move_check/typing/pack_multiple.exp move-compiler-v2/tests/checking/typing/pack_multiple.exp @@ -517,7 +896,8 @@ move-compiler/tests/move_check/typing/pack_unpack_private.exp move-compiler-v2 move-compiler/tests/move_check/typing/pack_unpack_private_script.exp move-compiler-v2/tests/visibility-checker/v1-typing/pack_unpack_private_script.exp move-compiler/tests/move_check/typing/pay_me_a_river.exp move-compiler-v2/tests/checking/abilities/v1/pay_me_a_river.exp move-compiler/tests/move_check/typing/phantom_param_op_abilities.exp move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp -move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid.exp move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities_invalid.exp +move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid.exp move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid.exp +move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid2.exp move-compiler-v2/tests/ability-check/typing/phantom_param_op_abilities_invalid2.exp move-compiler/tests/move_check/typing/phantom_param_struct_decl.exp move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp move-compiler/tests/move_check/typing/phantom_param_struct_decl_invalid.exp move-compiler-v2/tests/ability-check/v1-typing/phantom_param_struct_decl_invalid.exp move-compiler/tests/move_check/typing/phantom_params_constraint_abilities.exp move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp @@ -559,8 +939,8 @@ move-compiler/tests/move_check/typing/type_variable_join_single_unpack_assign_in move-compiler/tests/move_check/typing/type_variable_join_single_unpack_invalid.exp move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_invalid.exp move-compiler/tests/move_check/typing/type_variable_join_threaded_pack.exp move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp move-compiler/tests/move_check/typing/type_variable_join_threaded_pack_invalid.exp move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack_invalid.exp -move-compiler/tests/move_check/typing/type_variable_join_threaded_unpack.exp move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack.exp -move-compiler/tests/move_check/typing/type_variable_join_threaded_unpack_assign.exp move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign.exp +move-compiler/tests/move_check/typing/type_variable_join_threaded_unpack.exp move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack.exp +move-compiler/tests/move_check/typing/type_variable_join_threaded_unpack_assign.exp move-compiler-v2/tests/ability-check/typing/type_variable_join_threaded_unpack_assign.exp move-compiler/tests/move_check/typing/type_variable_join_threaded_unpack_assign_invalid.exp move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign_invalid.exp move-compiler/tests/move_check/typing/type_variable_join_threaded_unpack_invalid.exp move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_invalid.exp move-compiler/tests/move_check/typing/unary_not.exp move-compiler-v2/tests/checking/typing/unary_not.exp @@ -572,6 +952,7 @@ move-compiler/tests/move_check/typing/uninferred_type_unpack_bind.exp move-com move-compiler/tests/move_check/typing/uninferred_type_unpack_decl.exp move-compiler-v2/tests/checking/typing/uninferred_type_unpack_decl.exp move-compiler/tests/move_check/typing/unit.exp move-compiler-v2/tests/checking/typing/unit.exp move-compiler/tests/move_check/typing/unused_local.exp move-compiler-v2/tests/checking/typing/unused_local.exp +move-compiler/tests/move_check/typing/unused_non_phantom_param.exp move-compiler-v2/tests/more-v1/typing/unused_non_phantom_param.exp move-compiler/tests/move_check/typing/use_local.exp move-compiler-v2/tests/checking/typing/use_local.exp move-compiler/tests/move_check/typing/valid_acquire.exp move-compiler-v2/tests/acquires-checker/v1-tests/valid_acquire.exp move-compiler/tests/move_check/typing/values.exp move-compiler-v2/tests/checking/typing/values.exp @@ -593,6 +974,8 @@ move-compiler/tests/move_check/unit_test/cross_module_members.exp move-compile move-compiler/tests/move_check/unit_test/cross_module_members.unit_test.exp move-compiler-v2/tests/unit_test/test/cross_module_members.exp move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function.exp move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function.exp move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function.unit_test.exp move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function.exp +move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.exp move-compiler-v2/tests/unit_test/notest/cross_module_members_non_test_function2.exp +move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.unit_test.exp move-compiler-v2/tests/unit_test/test/cross_module_members_non_test_function2.exp move-compiler/tests/move_check/unit_test/cross_module_test_only_module.exp move-compiler-v2/tests/unit_test/notest/cross_module_test_only_module.exp move-compiler/tests/move_check/unit_test/cross_module_test_only_module.unit_test.exp move-compiler-v2/tests/unit_test/test/cross_module_test_only_module.exp move-compiler/tests/move_check/unit_test/expected_failure_bad_value.exp move-compiler-v2/tests/unit_test/notest/expected_failure_bad_value.exp @@ -644,7 +1027,9 @@ move-compiler/tests/move_check/unit_test/test_filter_function.exp move-compile move-compiler/tests/move_check/unit_test/test_filter_struct.exp move-compiler-v2/tests/unit_test/notest/test_filter_struct.exp move-compiler/tests/move_check/unit_test/valid_test_module.exp move-compiler-v2/tests/unit_test/notest/valid_test_module.exp move-compiler/tests/move_check/unit_test/valid_test_module.unit_test.exp move-compiler-v2/tests/unit_test/test/valid_test_module.exp +move-compiler/tests/move_check/v2-not-supported/no_receiver_calls.exp move-compiler-v2/tests/more-v1/v2-not-supported/no_receiver_calls.exp move-compiler/tests/move_check/verification/cross_module_invalid.exp move-compiler-v2/tests/verification/noverify/cross_module_invalid.exp +move-compiler/tests/move_check/verification/cross_module_invalid2.exp move-compiler-v2/tests/verification/noverify/cross_module_invalid2.exp move-compiler/tests/move_check/verification/cross_module_valid.exp move-compiler-v2/tests/verification/noverify/cross_module_valid.exp move-compiler/tests/move_check/verification/cross_module_valid.verification.exp move-compiler-v2/tests/verification/verify/cross_module_valid.exp move-compiler/tests/move_check/verification/double_annotation.exp move-compiler-v2/tests/verification/noverify/double_annotation.exp diff --git a/third_party/move/move-compiler-v2/tests/v1.unmatched b/third_party/move/move-compiler-v2/tests/v1.unmatched index bd94619913163..96602ec315b1f 100644 --- a/third_party/move/move-compiler-v2/tests/v1.unmatched +++ b/third_party/move/move-compiler-v2/tests/v1.unmatched @@ -1,263 +1,8 @@ -move-compiler/tests/move_check/borrow_tests/{ - borrow_global_acquires_duplicate_annotation.move, - imm_borrow_global_lossy_acquire_invalid.move, -} -move-compiler/tests/move_check/commands/{ - abort_negative_stack_size.move, - branch_assigns_then_moves.move, - break_unreachable.move, - consume_stack.move, - dead_return.move, - dead_return_local.move, - else_moves_if_doesnt.move, - if_moves_else_doesnt.move, - if_moves_no_else.move, - invalid_fallthrough2.move, - invalid_fallthrough3.move, - join_failure.move, - while_move_local.move, - while_move_local_2.move, -} -move-compiler/tests/move_check/control_flow/{ - for_loop_comment_following.move, - for_loop_lparen_following.move, - infinite_loop_with_dead_exits.move, -} -move-compiler/tests/move_check/deprecated/{ - assert_function.move, - deprecated_placement_basecase.move, -} -move-compiler/tests/move_check/liveness/{ - copy_after_move.move, - dead_refs_branch.move, - dead_refs_branch_both.move, - dead_refs_branch_both_invalid.move, - dead_refs_branch_invalid.move, - dead_refs_loop.move, - dead_refs_loop_invalid.move, - dead_refs_nested.move, - dead_refs_nested_invalid.move, - dead_refs_simple.move, - dead_refs_simple_invalid.move, - explicit_last_copy.move, - loop_weirdness.move, - move_in_infinite_loop_branched.move, - trailing_semi.move, - trailing_semi_loops.move, -} -move-compiler/tests/move_check/locals/{ - dont_warn_unused_self.move, - use_after_move_if.move, - use_after_move_if_else.move, - use_after_move_loop.move, - use_after_move_simple.move, - use_after_move_while.move, -} -move-compiler/tests/move_check/parser/{ - ability_constraint_trailing_plus.move, - ability_modifier_trailing_comma.move, - address_misspelled.move, - address_not_hex.move, - address_too_long.move, - address_too_long_decimal.move, - address_too_long_decimal_exp.move, - address_too_long_exp.move, - anonymous_field_fail.move, - break_with_value.move, - byte_string_invalid_escaped_sequence.move, - byte_string_invalid_hex.move, - byte_string_success.move, - byte_string_token_eof1.move, - byte_string_token_eof2.move, - byte_string_token_eof3.move, - comments_nested_unbalanced.move, - comments_ok.move, - comments_unbalanced.move, - constant_native.move, - constant_public.move, - constant_values.move, - constants_blocks.move, - constants_simple.move, - constants_standalone_let.move, - control_exp_as_term.move, - control_exp_associativity.move, - control_exp_associativity_else_after_if_block.move, - control_exp_associativity_field_access.move, - control_exp_associativity_typing_invalid.move, - control_exp_associativity_unreachable_code.move, - decimal_address.move, - doc_comments_placement.move, - dotdot_not_supported.move, - duplicate_entry_modifier.move, - empty_file.move, - entry_const.move, - entry_function.move, - entry_struct.move, - expr_abort_braces.move, - expr_abort_missing_value.move, - expr_if_braces.move, - expr_if_missing_parens.move, - expr_loop_braces.move, - expr_return_braces.move, - expr_return_missing_value.move, - expr_unary_negation.move, - expr_unary_ops.move, - expr_while_braces.move, - expr_while_missing_parens.move, - extra_text_after_main.move, - friend_decl_address_only.move, - friend_decl_inside_function.move, - friend_decl_missing_semicolon.move, - friend_decl_more_than_one_module.move, - friend_decl_qualified_function.move, - friend_decl_qualified_struct.move, - friend_decl_valid.move, - function_acquires_bad_name.move, - function_acquires_missing_comma.move, - function_acquires_trailing_comma.move, - function_incomplete.move, - function_native_with_body.move, - function_params_commas.move, - function_params_missing.move, - function_public_native.move, - function_return_trailing_comma.move, - function_return_type.move, - function_return_type_missing.move, - function_type_empty.move, - function_type_extra_comma.move, - function_type_missing_angle.move, - function_type_nested.move, - function_type_trailing_comma.move, - function_visibility_empty.move, - function_visibility_friend.move, - function_visibility_invalid.move, - function_visibility_multiple.move, - function_visibility_script.move, - function_without_body.move, - global_access.move, - global_access_pack.move, - global_access_value.move, - hexstring.move, - hexstring_missing_quote.move, - hexstring_token_eof1.move, - hexstring_token_eof2.move, - invalid_call_lhs_complex_expression.move, - invalid_call_lhs_parens_around_name.move, - invalid_call_lhs_return.move, - invalid_call_lhs_value.move, - invalid_character.move, - invalid_character_comment.move, - invalid_character_non_ascii.move, - invalid_named_address_assignment.move, - invalid_named_address_declaration.move, - invalid_pack_mname_non_addr.move, - invalid_unpack_assign_lhs_mdot_no_addr.move, - invalid_unpack_assign_rhs_not_fields.move, - lambda_no_param.move, - less_than_space.move, - let_binding.move, - let_binding_bad_name.move, - let_binding_missing_fields.move, - let_binding_missing_paren.move, - let_binding_missing_semicolon.move, - let_binding_missing_type.move, - let_binding_trailing_comma.move, - missing_angle_brace_close.move, - module_missing_lbrace.move, - module_missing_rbrace.move, - module_struct_after_func.move, - module_use_after_func.move, - module_use_after_struct.move, - named_address.move, - named_address_value.move, - native_main.move, - newline_crlf.move, - not_doc_comment.move, - num_hex_literal_underscore_leading.move, - num_hex_literal_underscore_leading_no_type_suffix.move, - num_hex_literal_underscore_trailing.move, - num_literal_underscore.move, - num_literal_underscore_leading.move, - num_literal_underscore_leading_no_type_suffix.move, - num_literal_underscore_trailing.move, - phantom_param_invalid_keyword.move, - phantom_param_missing_type_var.move, - preserve_address_syntax.move, - public_packge_visibility.move, - return_in_binop.move, - spec_parsing_emits_fail.move, - spec_parsing_fun_type_fail.move, - spec_parsing_generic_condition_fail.move, - spec_parsing_implies_fail.move, - spec_parsing_index_fail.move, - spec_parsing_inside_fun.move, - spec_parsing_ok.move, - spec_parsing_old_fun_fail.move, - spec_parsing_quantifier_fail.move, - spec_parsing_range_fail.move, - struct_field_missing_type.move, - struct_missing_lbrace.move, - struct_native_missing_semicolon.move, - struct_native_with_fields.move, - struct_public.move, - struct_trailing_comma.move, - struct_type_empty.move, - struct_type_extra_comma.move, - struct_type_missing_angle.move, - struct_type_misspelled_copy_constraint.move, - struct_type_misspelled_key_constraint.move, - struct_type_trailing_comma.move, - struct_without_fields.move, - testonly.move, - unexpected_token_after_ability_function_constraint.move, - unexpected_token_after_ability_modifier.move, - unknown_ability_name_function_constraint.move, - unknown_ability_name_modifier.move, - use_inner_scope.move, - use_inner_scope_invalid.move, - use_inner_scope_invalid_inner.move, - use_module_member.move, - use_module_member_invalid_comma.move, - use_module_member_invalid_missing_close_brace.move, - use_module_member_invalid_missing_semicolon.move, - use_with_address.move, - use_with_main.move, - use_with_module.move, - vector_literal_unclosed_args.move, - vector_literal_unclosed_type_args.move, - vector_space_after_less.move, -} -move-compiler/tests/move_check/signer/{ - double_signer.move, - keyword.move, - misplaced_signer_arg.move, - move_to_mutable_signer.move, - move_to_sender.move, - move_to_valid.move, - st_loc.move, - st_loc_partial.move, - transitive.move, - triple_signer.move, - unused.move, - unused_partial.move, - write_ref.move, -} -move-compiler/tests/move_check/simplifier/{ - moved_var_not_simplified3.move, -} -move-compiler/tests/move_check/to_bytecode/{ - unassigned_address.move, -} -move-compiler/tests/move_check/typing/{ - abort_any_type.move, - borrow_divergent.move, - constraints_not_satisfied_lvalues_bind_type.move, - constraints_not_satisfied_type_annotation.move, - constraints_not_satisfied_type_arguments_internal_pack.move, - declare_pop_resource.move, - non_phantom_in_phantom_pos.move, - unused_non_phantom_param.move, -} -move-compiler/tests/move_check/v2-not-supported/{ - no_receiver_calls.move, -} +WARNING: test `move-compiler-v2/tests/live-var/mut_ref.move` and `move-compiler-v2/tests/more-v1/liveness/mut_ref.move` share common key `liveness/mut_ref.move`, discarding former one +WARNING: test `move-compiler-v2/tests/checking-lang-v1/struct_public.move` and `move-compiler-v2/tests/more-v1/parser/struct_public.move` share common key `parser/struct_public.move`, discarding former one +WARNING: test `move-compiler-v2/tests/checking-lang-v1/struct_without_fields.move` and `move-compiler-v2/tests/more-v1/parser/struct_without_fields.move` share common key `parser/struct_without_fields.move`, discarding former one +WARNING: test `move-compiler-v2/tests/checking-lang-v1/v1-typing/invalid_type_acquire.move` and `move-compiler-v2/tests/more-v1/typing/invalid_type_acquire.move` share common key `typing/invalid_type_acquire.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/assign_partial_resource.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/assign_partial_resource.move` share common key `locals/assign_partial_resource.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/assign_resource.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/assign_resource.move` share common key `locals/assign_resource.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/unused_resource.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/unused_resource.move` share common key `locals/unused_resource.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/locals/unused_resource_explicit_return.move` and `move-compiler-v2/tests/unused-assignment/v1-locals/unused_resource_explicit_return.move` share common key `locals/unused_resource_explicit_return.move`, discarding former one diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.exp new file mode 100644 index 0000000000000..39832e3a20b40 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.exp @@ -0,0 +1,80 @@ +============ initial bytecode ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + var $t1: u64 + var $t2: u64 + var $t3: u64 + 0: $t2 := 10 + 1: $t1 := infer($t2) + 2: $t3 := infer($t1) + 3: $t0 := 3 + 4: return $t0 +} + +============ after DeadStoreElimination: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + var $t1: u64 [unused] + var $t2: u64 [unused] + var $t3: u64 [unused] + 0: $t0 := 3 + 1: return $t0 +} + +============ after VariableCoalescingAnnotator: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + var $t1: u64 [unused] + var $t2: u64 [unused] + var $t3: u64 [unused] + # live vars: + # events: b:$t0 + 0: $t0 := 3 + # live vars: $t0 + # events: e:$t0 + 1: return $t0 +} + +============ after VariableCoalescingTransformer: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + var $t1: u64 [unused] + var $t2: u64 [unused] + var $t3: u64 [unused] + 0: $t0 := 3 + 1: return $t0 +} + +============ after DeadStoreElimination: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + var $t1: u64 [unused] + var $t2: u64 [unused] + var $t3: u64 [unused] + 0: $t0 := 3 + 1: return $t0 +} + + +============ disassembled file-format ================== +// Move bytecode v7 +module 42.Test { + + +public test(): u64 /* def_idx: 0 */ { +B0: + 0: LdU64(3) + 1: Ret +} +} +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.move b/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.move new file mode 100644 index 0000000000000..9d529bc3acaab --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.move @@ -0,0 +1,9 @@ +module 0x42::Test { + inline fun foo(f:|u64| u64, x: u64): u64 { + f(x) + } + + public fun test(): u64 { + foo(|_: u64| 3, 10) + } +} diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.opt.exp new file mode 100644 index 0000000000000..fdf29d55e2bf7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/inlining1_typed.opt.exp @@ -0,0 +1,62 @@ +============ initial bytecode ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + 0: $t0 := 3 + 1: return $t0 +} + +============ after DeadStoreElimination: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + 0: $t0 := 3 + 1: return $t0 +} + +============ after VariableCoalescingAnnotator: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + # live vars: + # events: b:$t0 + 0: $t0 := 3 + # live vars: $t0 + # events: e:$t0 + 1: return $t0 +} + +============ after VariableCoalescingTransformer: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + 0: $t0 := 3 + 1: return $t0 +} + +============ after DeadStoreElimination: ================ + +[variant baseline] +public fun Test::test(): u64 { + var $t0: u64 + 0: $t0 := 3 + 1: return $t0 +} + + +============ disassembled file-format ================== +// Move bytecode v7 +module 42.Test { + + +public test(): u64 /* def_idx: 0 */ { +B0: + 0: LdU64(3) + 1: Ret +} +} +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid2.exp b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid2.exp new file mode 100644 index 0000000000000..3a99bb6bcd7b0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid2.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: undeclared `0x1::B::Foo` + ┌─ tests/verification/noverify/cross_module_invalid2.move:24:23 + │ +24 │ public fun bad(): Foo { + │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid2.move b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid2.move new file mode 100644 index 0000000000000..ab87203a407a7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid2.move @@ -0,0 +1,28 @@ +// check that `use`'s are filtered out correctly +address 0x1 { +module A { + struct Foo has drop {} + + public fun build_foo(): Foo { Foo {} } +} + +module B { + use 0x1::A::Self; + + #[verify_only] + use 0x1::A::Foo; + + #[verify_only] + fun x(_: Foo) { } + + #[verify_only] + fun tester() { + x(A::build_foo()) + } + + // this should fail + public fun bad(): Foo { + A::build_foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs b/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs index 717ddf26e62c5..bc201602b28c4 100644 --- a/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs +++ b/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs @@ -57,10 +57,8 @@ const V2_E2E_ROOT: &str = "move-compiler-v2/transactional-tests/tests"; /// Ignored directories in the move_check tree. static IGNORED_UNIT_PATHS: Lazy> = Lazy::new(|| { let mut set = BTreeSet::new(); - set.insert("expansion".to_string()); set.insert("evm".to_string()); set.insert("async".to_string()); - set.insert("dependencies".to_string()); set }); diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam2_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam2_typed.exp new file mode 100644 index 0000000000000..9387f12a2dcb1 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam2_typed.exp @@ -0,0 +1,29 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-10: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:22 +- │ +- 7 │ assert!(foo(|_: u64| 3, |_: u64| 10, 10, 100) == 13, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:34 +- │ +- 7 │ assert!(foo(|_: u64| 3, |_: u64| 10, 10, 100) == 13, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 12-12: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam2_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam2_typed.move new file mode 100644 index 0000000000000..6ef383a7b98a8 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam2_typed.move @@ -0,0 +1,12 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64| u64, g: |u64| u64, x: u64, _: u64): u64 { + f(x) + g(x) + } + + public fun test() { + assert!(foo(|_: u64| 3, |_: u64| 10, 10, 100) == 13, 0); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam_typed.exp new file mode 100644 index 0000000000000..6b250eae787df --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam_typed.exp @@ -0,0 +1,41 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-10: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:22 +- │ +- 7 │ assert!(foo(|_: u64, _: u64| 3, |_: u64, _: u64| 10, 10, 100) == 13, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:30 +- │ +- 7 │ assert!(foo(|_: u64, _: u64| 3, |_: u64, _: u64| 10, 10, 100) == 13, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:42 +- │ +- 7 │ assert!(foo(|_: u64, _: u64| 3, |_: u64, _: u64| 10, 10, 100) == 13, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:50 +- │ +- 7 │ assert!(foo(|_: u64, _: u64| 3, |_: u64, _: u64| 10, 10, 100) == 13, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 12-12: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam_typed.move new file mode 100644 index 0000000000000..72091d0cdfb9c --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam_typed.move @@ -0,0 +1,12 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64, u64| u64, g: |u64, u64| u64, x: u64, _y: u64): u64 { + f(x, _y) + g(x, _y) + } + + public fun test() { + assert!(foo(|_: u64, _: u64| 3, |_: u64, _: u64| 10, 10, 100) == 13, 0); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_typed.exp new file mode 100644 index 0000000000000..f74668967d29c --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_typed.exp @@ -0,0 +1,41 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-10: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:22 +- │ +- 7 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) == 110, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:30 +- │ +- 7 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) == 110, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:42 +- │ +- 7 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) == 110, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:50 +- │ +- 7 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) == 110, 0); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 12-12: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_typed.move new file mode 100644 index 0000000000000..da836f0f58d51 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991_typed.move @@ -0,0 +1,12 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64, u64| u64, g: |u64, u64| u64, x: u64, _y: u64): u64 { + f(x, _y) + g(x, _y) + } + + public fun test() { + assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) == 110, 0); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991a_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991a_typed.exp new file mode 100644 index 0000000000000..7539b24f5e319 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991a_typed.exp @@ -0,0 +1,65 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-14: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:22 +- │ +- 9 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:30 +- │ +- 9 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:42 +- │ +- 9 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:50 +- │ +- 9 │ assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:10:7 +- │ +- 10 │ |a: u64, _b: u64| a, |_c: u64, d: u64| d, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:10:15 +- │ +- 10 │ |a: u64, _b: u64| a, |_c: u64, d: u64| d, +- │ ^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:10:28 +- │ +- 10 │ |a: u64, _b: u64| a, |_c: u64, d: u64| d, +- │ ^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:10:37 +- │ +- 10 │ |a: u64, _b: u64| a, |_c: u64, d: u64| d, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 16-16: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991a_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991a_typed.move new file mode 100644 index 0000000000000..28f6de500dc78 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991a_typed.move @@ -0,0 +1,16 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64, u64| u64, g: |u64, u64| u64, + h:|u64, u64| u64, i: |u64, u64| u64, + x: u64, y: u64): u64 { + f(x, y) + g(x, y) + h(x, y) + i(x, y) + } + + public fun test() { + assert!(foo(|x: u64, _: u64| x, |_: u64, y: u64| y, + |a: u64, _b: u64| a, |_c: u64, d: u64| d, + 10, 100) == 220, 0); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991b_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991b_typed.exp new file mode 100644 index 0000000000000..9c60f12f7e43e --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991b_typed.exp @@ -0,0 +1,29 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-11: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:22 +- │ +- 7 │ assert!(foo(|_: u64, y: u64| y, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:30 +- │ +- 7 │ assert!(foo(|_: u64, y: u64| y, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 13-13: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991b_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991b_typed.move new file mode 100644 index 0000000000000..29521a95ac5c6 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991b_typed.move @@ -0,0 +1,13 @@ +//# publish +module 0x42::Test { + inline fun foo(g: |u64, u64| u64, x: u64, _y: u64): u64 { + g(x, _y) + } + + public fun test() { + assert!(foo(|_: u64, y: u64| y, + 10, 100) == 100, 0); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991c_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991c_typed.exp new file mode 100644 index 0000000000000..49eacd34742fd --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991c_typed.exp @@ -0,0 +1,41 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-11: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:22 +- │ +- 7 │ assert!(foo(|_: u64, y: u64, _: u64, q: u64| y + q, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:30 +- │ +- 7 │ assert!(foo(|_: u64, y: u64, _: u64, q: u64| y + q, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:38 +- │ +- 7 │ assert!(foo(|_: u64, y: u64, _: u64, q: u64| y + q, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:46 +- │ +- 7 │ assert!(foo(|_: u64, y: u64, _: u64, q: u64| y + q, +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 13-13: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991c_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991c_typed.move new file mode 100644 index 0000000000000..71ff4b6e6ebc7 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/bug_10991c_typed.move @@ -0,0 +1,13 @@ +//# publish +module 0x42::Test { + inline fun foo(g: |u64, u64, u64, u64| u64, x: u64, y: u64, z: u64, q:u64): u64 { + g(x, y, z, q) + } + + public fun test() { + assert!(foo(|_: u64, y: u64, _: u64, q: u64| y + q, + 10, 100, 1000, 10000) == 10100, 0); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_some_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_some_typed.exp new file mode 100644 index 0000000000000..11c5e581bd202 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_some_typed.exp @@ -0,0 +1,35 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-13: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:15 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z| x*z, |_, y: u64, _| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:23 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z| x*z, |_, y: u64, _| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:43 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z| x*z, |_, y: u64, _| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 15-15: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_some_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_some_typed.move new file mode 100644 index 0000000000000..ed65160f1f2b6 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_some_typed.move @@ -0,0 +1,15 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64, u64, u64| u64, g: |u64, u64, u64| u64, x: u64, _: u64, y: u64, z: u64): u64 { + let r1 = f({x = x + 1; x}, {y = y + 1; y}, {z = z + 1; z}); + let r2 = g({x = x + 1; x}, {y = y + 1; y}, {z = z + 1 ; z}); + r1 + r2 + 3*x + 5*y + 7*z + } + + public fun test() { + let r = foo(|x: u64, _: u64, z| x*z, |_, y: u64, _| y, 1, 10, 100, 1000); + assert!(r == 9637, r); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_typed.exp new file mode 100644 index 0000000000000..8059ac92a5e46 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_typed.exp @@ -0,0 +1,53 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-13: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:15 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z: u64| x*z, |_: u64, y: u64, _: u64| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:23 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z: u64| x*z, |_: u64, y: u64, _: u64| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:31 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z: u64| x*z, |_: u64, y: u64, _: u64| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:45 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z: u64| x*z, |_: u64, y: u64, _: u64| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:53 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z: u64| x*z, |_: u64, y: u64, _: u64| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:61 +- │ +- 9 │ let r = foo(|x: u64, _: u64, z: u64| x*z, |_: u64, y: u64, _: u64| y, 1, 10, 100, 1000); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 15-15: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_typed.move new file mode 100644 index 0000000000000..d3f74b0d6d903 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/eval_ignored_param_typed.move @@ -0,0 +1,15 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64, u64, u64| u64, g: |u64, u64, u64| u64, x: u64, _: u64, y: u64, z: u64): u64 { + let r1 = f({x = x + 1; x}, {y = y + 1; y}, {z = z + 1; z}); + let r2 = g({x = x + 1; x}, {y = y + 1; y}, {z = z + 1 ; z}); + r1 + r2 + 3*x + 5*y + 7*z + } + + public fun test() { + let r = foo(|x: u64, _: u64, z: u64| x*z, |_: u64, y: u64, _: u64| y, 1, 10, 100, 1000); + assert!(r == 9637, r); + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/generics_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/generics_typed.exp new file mode 100644 index 0000000000000..af1df06d30d62 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/generics_typed.exp @@ -0,0 +1,23 @@ +comparison between v1 and v2 failed: +- processed 2 tasks ++ processed 2 tasks += +- task 0 'publish'. lines 1-20: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:14:27 +- │ +- 14 │ foreach(&v, |e: &u64| sum = sum + *e); +- │ ^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- += task 1 'run'. lines 22-22: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } ++ return values: 6 += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/generics_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/generics_typed.move new file mode 100644 index 0000000000000..15d9a5f191409 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/generics_typed.move @@ -0,0 +1,22 @@ +//# publish +module 0x42::Test { + use std::vector; + + public inline fun foreach(v: &vector, action: |&X|) { + let i = 0; + while (i < vector::length(v)) { + action(vector::borrow(v, i)); + i = i + 1; + } + } + + public fun test(): u64 { + let v = vector[1u64, 2, 3]; + let sum = 0; + foreach(&v, |e: &u64| sum = sum + *e); + sum + } + +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/lambda_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/lambda_typed.exp new file mode 100644 index 0000000000000..b1f5feed168f0 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/lambda_typed.exp @@ -0,0 +1,29 @@ +comparison between v1 and v2 failed: +- processed 2 tasks ++ processed 2 tasks += +- task 0 'publish'. lines 1-11: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:16 +- │ +- 7 │ apply(|x: u64, y: u64| x + y, 1, 2) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:24 +- │ +- 7 │ apply(|x: u64, y: u64| x + y, 1, 2) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- += task 1 'run'. lines 13-13: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } ++ return values: 3 += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/lambda_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/lambda_typed.move new file mode 100644 index 0000000000000..6d28935c398ff --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/lambda_typed.move @@ -0,0 +1,13 @@ +//# publish +module 0x42::Test { + + public inline fun apply(f: |u64, u64|u64, x: u64, y: u64): u64 { + f(x, y) + } + + public fun test(): u64 { + apply(|x: u64, y: u64| x + y, 1, 2) + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/masking_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/masking_typed.exp new file mode 100644 index 0000000000000..0c99da555042f --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/masking_typed.exp @@ -0,0 +1,41 @@ +comparison between v1 and v2 failed: +- processed 2 tasks ++ processed 2 tasks += +- task 0 'publish'. lines 1-10: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:14 +- │ +- 7 │ foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:22 +- │ +- 7 │ foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:34 +- │ +- 7 │ foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:42 +- │ +- 7 │ foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- += task 1 'run'. lines 12-12: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } ++ return values: 110 += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/masking_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/masking_typed.move new file mode 100644 index 0000000000000..5681fa39b26b1 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/masking_typed.move @@ -0,0 +1,12 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64, u64| u64, g: |u64, u64| u64, x: u64, _y: u64): u64 { + f(x, _y) + g(x, _y) + } + + public fun main(): u64 { + foo(|x: u64, _: u64| x, |_: u64, y: u64| y, 10, 100) + } +} + +//# run 0x42::Test::main diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/multi_param_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/multi_param_typed.exp new file mode 100644 index 0000000000000..a4bb458cc6f57 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/multi_param_typed.exp @@ -0,0 +1,44 @@ +comparison between v1 and v2 failed: += processed 2 tasks += += task 0 'publish'. lines 1-29: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:17:30 ++ Error: compilation errors: ++ error: a reference is expected but `_` was provided ++ ┌─ TEMPFILE:24:82 += │ +- 17 │ for_each_ref_mut(v, |elem: &mut Elem| { +- │ ^^^^^^^^^^^^^^^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond ++ 24 │ assert!(elem_for_each_ref(&mut vector[Elem{k:1, v:2}], |x: u64, y: u64| *x + *y) == 3, 0) ++ │ ^ += +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:24:65 ++ error: a reference is expected but `_` was provided ++ ┌─ TEMPFILE:24:87 += │ += 24 │ assert!(elem_for_each_ref(&mut vector[Elem{k:1, v:2}], |x: u64, y: u64| *x + *y) == 3, 0) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond ++ │ ^ += +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:24:73 ++ error: cannot pass `|(u64, u64)|integer` to a function which expects argument of type `|(&integer, &mut integer)|u64` ++ ┌─ TEMPFILE:24:64 += │ += 24 │ assert!(elem_for_each_ref(&mut vector[Elem{k:1, v:2}], |x: u64, y: u64| *x + *y) == 3, 0) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond ++ │ ^^^^^^^^^^^^^^^^^^^^^^^^ += += += += task 1 'run'. lines 31-31: += Error: Function execution failed with VMError: { += major_status: LINKER_ERROR, += sub_status: None, += location: undefined, += indices: redacted, += offsets: redacted, += } += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/multi_param_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/multi_param_typed.move new file mode 100644 index 0000000000000..425abd583731f --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/multi_param_typed.move @@ -0,0 +1,31 @@ +//# publish +module 0x42::Test { + use 0x1::vector as V; + + // Can't use that from V because of precompiled import in transactional tests + // TODO: we need to fix this + public inline fun for_each_ref_mut(v: &mut vector, f: |&mut Element|) { + let i = 0; + while (i < V::length(v)) { + f(V::borrow_mut(v, i)); + i = i + 1 + } + } + struct Elem has drop { k: K, v: V } + + // Checks a multi-mutality scenario. + public inline fun elem_for_each_ref(v: &mut vector>, f: |&K, &mut V|u64): u64 { + let result = 0; + for_each_ref_mut(v, |elem: &mut Elem| { + let elem: &mut Elem = elem; // Checks whether scoping is fine + result = result + f(&elem.k, &mut elem.v); + }); + result + } + + public fun test() { + assert!(elem_for_each_ref(&mut vector[Elem{k:1, v:2}], |x: u64, y: u64| *x + *y) == 3, 0) + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_module_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_module_typed.exp new file mode 100644 index 0000000000000..c32e5f2c5983d --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_module_typed.exp @@ -0,0 +1,41 @@ +comparison between v1 and v2 failed: +- processed 3 tasks ++ processed 3 tasks += +- task 1 'publish'. lines 8-15: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE1:12:23 +- │ +- 12 │ Test1::apply(|x: u64, y: u64| x + y, 1, Test1::apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE1:12:31 +- │ +- 12 │ Test1::apply(|x: u64, y: u64| x + y, 1, Test1::apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE1:12:63 +- │ +- 12 │ Test1::apply(|x: u64, y: u64| x + y, 1, Test1::apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE1:12:71 +- │ +- 12 │ Test1::apply(|x: u64, y: u64| x + y, 1, Test1::apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- += task 2 'run'. lines 17-17: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } ++ return values: 3 += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_module_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_module_typed.move new file mode 100644 index 0000000000000..857dec4843233 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_module_typed.move @@ -0,0 +1,17 @@ +//# publish +module 0x42::Test1 { + public inline fun apply(f: |u64, u64|u64, x: u64, y: u64): u64 { + f(x, y) + } +} + +//# publish +module 0x42::Test { + use 0x42::Test1; + + public fun test(): u64 { + Test1::apply(|x: u64, y: u64| x + y, 1, Test1::apply(|x: u64, y: u64| x * y, 2, 1)) + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_typed.exp new file mode 100644 index 0000000000000..fec36834b3846 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_typed.exp @@ -0,0 +1,41 @@ +comparison between v1 and v2 failed: +- processed 2 tasks ++ processed 2 tasks += +- task 0 'publish'. lines 1-11: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:16 +- │ +- 7 │ apply(|x: u64, y: u64| x + y, 1, apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:24 +- │ +- 7 │ apply(|x: u64, y: u64| x + y, 1, apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:49 +- │ +- 7 │ apply(|x: u64, y: u64| x + y, 1, apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:57 +- │ +- 7 │ apply(|x: u64, y: u64| x + y, 1, apply(|x: u64, y: u64| x * y, 2, 1)) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- += task 1 'run'. lines 13-13: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } ++ return values: 3 += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_typed.move new file mode 100644 index 0000000000000..e31696ac9e662 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/nested_lambda_typed.move @@ -0,0 +1,13 @@ +//# publish +module 0x42::Test { + + public inline fun apply(f: |u64, u64|u64, x: u64, y: u64): u64 { + f(x, y) + } + + public fun test(): u64 { + apply(|x: u64, y: u64| x + y, 1, apply(|x: u64, y: u64| x * y, 2, 1)) + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/options_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/options_typed.exp new file mode 100644 index 0000000000000..73a1637536f2e --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/options_typed.exp @@ -0,0 +1,23 @@ +comparison between v1 and v2 failed: +- processed 3 tasks ++ processed 3 tasks += +- task 1 'publish'. lines 15-25: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE1:21:34 +- │ +- 21 │ let x = map_opt::map(t, |e: u64| e + 1); +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- += task 2 'run'. lines 27-27: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } ++ return values: 2 += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/options_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/options_typed.move new file mode 100644 index 0000000000000..943b85da6dff2 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/options_typed.move @@ -0,0 +1,27 @@ +//# publish +module 0x42::map_opt { + use std::option; + /// Maps the content of an option + public inline fun map(t: option::Option, f: |Element|OtherElement): option::Option { + if (option::is_some(&t)) { + option::some(f(option::extract(&mut t))) + } else { + option::none() + } + } + +} + +//# publish +module 0x42::Test { + use std::option; + use 0x42::map_opt; + + public fun test(): u64 { + let t = option::some(1); + let x = map_opt::map(t, |e: u64| e + 1); + option::extract(&mut x) + } +} + +//# run 0x42::Test::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_param_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_param_typed.exp new file mode 100644 index 0000000000000..d14795838f0db --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_param_typed.exp @@ -0,0 +1,43 @@ +comparison between v1 and v2 failed: += processed 2 tasks += += task 0 'publish'. lines 1-46: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:11:14 ++ warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` ++ ┌─ TEMPFILE:23:17 += │ +- 11 │ foo(|y: u64| { +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond ++ 23 │ let x = q; ++ │ ^ += +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:16:15 +- │ +- 16 │ foo2(|y: u64| { +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond += +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:24:14 +- │ +- 24 │ foo(|y: u64| { +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond += +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:29:15 +- │ +- 29 │ foo2(|y: u64| { +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 48-48: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_param_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_param_typed.move new file mode 100644 index 0000000000000..1ef82d15fcb89 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_param_typed.move @@ -0,0 +1,48 @@ +//# publish +module 0x42::Test { + + public inline fun foo(f:|u64|, x:u64) { + f(x); + } + + public inline fun foo2(f:|u64|, x:u64) { + let x = x; + f(x); + } + + public fun test_shadowing(x: u64) { + foo(|y: u64| { + x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would + // have the value 1. + }, 3); + assert!(x == 3, 0); + + foo2(|y: u64| { + x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would + // have the value 1. + }, 5); + assert!(x == 5, 0) + } + + public fun test_shadowing2(q: u64) { + let x = q; + foo(|y: u64| { + x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would + // have the value 1. + }, 3); + assert!(x == 3, 0); + + foo2(|y: u64| { + x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would + // have the value 1. + }, 5); + assert!(x == 5, 0) + } + + fun test_shadowing_entry() { + test_shadowing(1); + test_shadowing2(1) + } +} + +//# run 0x42::Test::test_shadowing_entry diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_typed.exp new file mode 100644 index 0000000000000..8eeb84f42bddb --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_typed.exp @@ -0,0 +1,25 @@ +comparison between v1 and v2 failed: += processed 2 tasks += += task 0 'publish'. lines 1-19: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:14 ++ warning: Unused assignment to `x`. Consider removing or prefixing with an underscore: `_x` ++ ┌─ TEMPFILE:8:17 += │ +- 9 │ foo(|y: u64| { +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond ++ 8 │ let x = 1; ++ │ ^ += += += +- task 1 'run'. lines 21-21: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_typed.move new file mode 100644 index 0000000000000..37a421b27f40f --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_renamed_typed.move @@ -0,0 +1,21 @@ +//# publish +module 0x42::Test { + + public inline fun foo(f:|u64|) { + let x = 3; + f(x); + } + + public fun test_shadowing() { + let x = 1; + foo(|y: u64| { + x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would + // have the value 1. + }); + assert!(x == 3, 0) + } + + +} + +//# run 0x42::Test::test_shadowing diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_typed.exp new file mode 100644 index 0000000000000..880f900af4c5d --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_typed.exp @@ -0,0 +1,23 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-19: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:9:14 +- │ +- 9 │ foo(|y: u64| { +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 21-21: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_typed.move new file mode 100644 index 0000000000000..4490f8ee8b68b --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/inlining/shadowing_typed.move @@ -0,0 +1,21 @@ +//# publish +module 0x42::Test { + + public inline fun foo(f:|u64|) { + let _x = 3; + f(_x); + } + + public fun test_shadowing() { + let _x = 1; + foo(|y: u64| { + _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would + // have the value 1. + }); + assert!(_x == 3, 0) + } + + +} + +//# run 0x42::Test::test_shadowing diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/misc/simple_map_keys_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/misc/simple_map_keys_typed.exp new file mode 100644 index 0000000000000..4cd3899eb2420 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/misc/simple_map_keys_typed.exp @@ -0,0 +1,37 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-47: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:13:29 +- │ +- 13 │ map_ref(&map.data, |e: &Element| { +- │ ^^^^^^^^^^^^^^^^^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E04010]: cannot infer type +- ┌─ TEMPFILE:14:13 +- │ +- 13 │ map_ref(&map.data, |e: &Element| { +- │ - Could not infer the type before field access. Try annotating here +- 14 │ e.key +- │ ^^^^^ Unbound field 'key' +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:22:26 +- │ +- 22 │ for_each_ref(v, |elem: &Element| vector::push_back(&mut result, f(elem))); +- │ ^^^^^^^^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 49-49: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/misc/simple_map_keys_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/misc/simple_map_keys_typed.move new file mode 100644 index 0000000000000..9c6d4449d6e93 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/misc/simple_map_keys_typed.move @@ -0,0 +1,49 @@ +//# publish +module 0x42::simple_map { + use 0x1::vector; + + struct SimpleMap has copy, drop, store { + data: vector>, + } + + struct Element has copy, drop, store { + key: Key, + value: Value, + } + + + /// Return all keys in the map. This requires keys to be copyable. + public fun keys(map: &SimpleMap): vector { + map_ref(&map.data, |e: &Element| { + e.key + }) + } + + public inline fun map_ref( + v: &vector, + f: |&Element|NewElement + ): vector { + let result = vector[]; + for_each_ref(v, |elem: &Element| vector::push_back(&mut result, f(elem))); + result + } + + public inline fun for_each_ref(v: &vector, f: |&Element|) { + let i = 0; + let len = vector::length(v); + while (i < len) { + f(vector::borrow(v, i)); + i = i + 1 + } + } + + public fun run() { + let entry = Element{key: 1, value: 2}; + let data = vector[entry, entry, entry]; + let map = SimpleMap{data}; + let keys = keys(&map); + assert!(keys == vector[1, 1, 1], 33); + } +} + +//# run 0x42::simple_map::run diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/evaluation_order/short_circuit_boolean.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/evaluation_order/short_circuit_boolean.exp new file mode 100644 index 0000000000000..a6db107b3b9ca --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/evaluation_order/short_circuit_boolean.exp @@ -0,0 +1,3 @@ +processed 2 tasks + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/evaluation_order/short_circuit_boolean.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/evaluation_order/short_circuit_boolean.move new file mode 100644 index 0000000000000..0000f20665d5a --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/evaluation_order/short_circuit_boolean.move @@ -0,0 +1,20 @@ +//# publish +module 0x42::X { + public fun tester(a: bool, b: bool): u64 { + let x = 1; + { x = x * 2; a } && { x = x * 3; true }; + { x = x * 5; b } || { x = x * 7; false }; + x + } +} + +//# run +script { +use 0x42::X; +fun main() { + assert!(X::tester(false, false) == 70, 1); + assert!(X::tester(false, true) == 10, 2); + assert!(X::tester(true, false) == 210, 3); + assert!(X::tester(true, true) == 30, 4); +} +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/generics/global_invalid.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/generics/global_invalid.exp new file mode 100644 index 0000000000000..458a79b88a324 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/generics/global_invalid.exp @@ -0,0 +1,93 @@ +comparison between v1 and v2 failed: += processed 3 tasks += += task 0 'publish'. lines 1-8: +- Error: error[E04009]: expected specific type ++ Error: compilation errors: ++ error: Expected a struct type. Global storage operations are restricted to struct types declared in the current module. Found: 'T' += ┌─ TEMPFILE:4:17 += │ += 4 │ assert!(exists(addr), 0); += │ ^^^^^^^^^^^^^^^ +- │ │ │ +- │ │ Expected a struct type. Global storage operations are restricted to struct types declared in the current module. Found the type parameter: 'T' +- │ Invalid call to exists. ++ │ │ ++ │ Invalid call to exists. += +- error[E04009]: expected specific type ++ error: Expected a struct type. Global storage operations are restricted to struct types declared in the current module. Found: 'T' += ┌─ TEMPFILE:5:17 += │ += 5 │ let _ = borrow_global(addr); += │ ^^^^^^^^^^^^^^^^^^^^^^ +- │ │ │ +- │ │ Expected a struct type. Global storage operations are restricted to struct types declared in the current module. Found the type parameter: 'T' +- │ Invalid call to borrow_global. ++ │ │ ++ │ Invalid call to BorrowGlobal(Immutable). += +- error[E04009]: expected specific type ++ error: Expected a struct type. Global storage operations are restricted to struct types declared in the current module. Found: 'T' += ┌─ TEMPFILE:6:9 += │ += 6 │ move_from(addr); += │ ^^^^^^^^^^^^^^^^^^ +- │ │ │ +- │ │ Expected a struct type. Global storage operations are restricted to struct types declared in the current module. Found the type parameter: 'T' +- │ Invalid call to move_from. ++ │ │ ++ │ Invalid call to MoveFrom. += += += += task 1 'publish'. lines 10-22: +- Error: error[E03009]: unbound variable ++ Error: compilation errors: ++ error: no function named `invalid` found += ┌─ TEMPFILE1:14:9 += │ += 14 │ invalid(@0x41) +- │ ^^^^^^^ Invalid function usage. Unbound variable 'invalid' ++ │ ^^^^^^^^^^^^^^^^^ += +- error[E04005]: expected a single type ++ error: expected a struct with field `f` but found `()` += ┌─ TEMPFILE1:18:9 += │ +- 13 │ public inline fun my_borrow() { +- │ --------- Expected a single type, but found expression list type: '()' +- · += 18 │ my_borrow().f; +- │ ^^^^^^^^^^^ Invalid dot access ++ │ ^^^^^^^^^^^ += +- error[E04009]: expected specific type +- ┌─ TEMPFILE1:18:9 +- │ +- 13 │ public inline fun my_borrow() { +- │ --------- Expected a struct type in the current module but got: '()' +- · +- 18 │ my_borrow().f; +- │ ^^^^^^^^^^^^^ Unbound field 'f' += += +- += task 2 'run'. lines 24-30: +- Error: error[E03002]: unbound module ++ Error: compilation errors: ++ error: unbound module += ┌─ TEMPFILE2:26:9 += │ += 26 │ use 0x42::M; += │ ^^^^^^^ Invalid 'use'. Unbound module: '0x42::M' += +- error[E03002]: unbound module ++ error: unbound module += ┌─ TEMPFILE2:28:9 += │ += 28 │ M::test_resource(&account) += │ ^ Unbound module or type alias 'M' += += += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/generics/global_invalid.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/generics/global_invalid.move new file mode 100644 index 0000000000000..c1db98b1932dc --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/generics/global_invalid.move @@ -0,0 +1,30 @@ +//# publish --print-bytecode +module 0x42::m { + fun invalid(addr: address) { + assert!(exists(addr), 0); + let _ = borrow_global(addr); + move_from(addr); + } +} + +//# publish --print-bytecode +module 0x41::n { + struct R has key, drop { f: u64 } + + public inline fun my_borrow() { + invalid(@0x41) + } + + public fun test_resource(s: &signer) acquires R { + move_to(s, R{f:1}); + my_borrow().f; + } +} + +//# run --signers 0x41 +script { + use 0x42::M; + fun main(account: signer) { + M::test_resource(&account) + } +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/byte_string.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/byte_string.exp new file mode 100644 index 0000000000000..274cdfcf1b008 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/byte_string.exp @@ -0,0 +1,3 @@ +processed 1 task + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/byte_string.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/byte_string.move new file mode 100644 index 0000000000000..06d72a18b3c44 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/byte_string.move @@ -0,0 +1,9 @@ +//# run +script { + +fun main() { + assert!(b"" == x"", 0); + assert!(b"Diem" == x"4469656D", 1); + assert!(b"\x4c\x69\x62\x72\x61" == x"4c69627261", 2); +} +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/control_exp_associativity.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/control_exp_associativity.exp new file mode 100644 index 0000000000000..4950f63b0dc62 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/control_exp_associativity.exp @@ -0,0 +1,6 @@ +processed 2 tasks + +task 1 'run'. lines 24-24: +return values: 42 + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/control_exp_associativity.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/control_exp_associativity.move new file mode 100644 index 0000000000000..de4dfb0616103 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/control_exp_associativity.move @@ -0,0 +1,24 @@ +//# publish +module 0x42::M { + fun t(): u64 { + // 1 + (if (false) 0 else (10 + 10)) + let x = 1 + if (false) 0 else 10 + 10; + assert!(x == 21, 0); + // true && (if (false) false else (10 == 10)) + let x = true && if (false) false else 10 == 10; + assert!(x, 0); + // (if (false) 0 else 10 ) == 10 + let x = if (false) 0 else { 10 } == 10; + assert!(x, 0); + // (if (true) 0 else 10) + 1 + let x = if (true) 0 else { 10 } + 1; + assert!(x == 1, 0); + // if (true) 0 else (10 + 1) + let x = if (true) 0 else ({ 10 }) + 1; + assert!(x == 0, 0); + 42 + } + +} + +//# run 0x42::M::t diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/expr_binary_operators.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/expr_binary_operators.exp new file mode 100644 index 0000000000000..274cdfcf1b008 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/expr_binary_operators.exp @@ -0,0 +1,3 @@ +processed 1 task + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/expr_binary_operators.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/expr_binary_operators.move new file mode 100644 index 0000000000000..cbb2592e61c31 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/expr_binary_operators.move @@ -0,0 +1,23 @@ +//# run +script { + +fun main() { + assert!(1 == 1, 101); + assert!(2 != 3, 102); + assert!((3 < 4) && !(3 < 3), 103); + assert!((4 > 3) && !(4 > 4), 104); + assert!((5 <= 6) && (5 <= 5), 105); + assert!((6 >= 5) && (6 >= 6), 106); + assert!((true || false) && (false || true), 107); + assert!((2 ^ 3) == 1, 108); + assert!((1 | 2) == 3, 109); + assert!((2 & 3) == 2, 110); + assert!((2 << 1) == 4, 111); + assert!((8 >> 2) == 2, 112); + assert!((1 + 2) == 3, 113); + assert!((3 - 2) == 1, 114); + assert!((2 * 3) == 6, 115); + assert!((9 / 3) == 3, 116); + assert!((8 % 3) == 2, 117); +} +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_address.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_address.exp new file mode 100644 index 0000000000000..274cdfcf1b008 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_address.exp @@ -0,0 +1,3 @@ +processed 1 task + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_address.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_address.move new file mode 100644 index 0000000000000..36157b43e6117 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_address.move @@ -0,0 +1,8 @@ +//# run +script { + fun main() { + assert!(@0 == @0x0, 42); + assert!(@0xF == @15, 42); + assert!(@0x42 == @66, 42); + } +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_numbers.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_numbers.exp new file mode 100644 index 0000000000000..274cdfcf1b008 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_numbers.exp @@ -0,0 +1,3 @@ +processed 1 task + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_numbers.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_numbers.move new file mode 100644 index 0000000000000..845ece44158bb --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_numbers.move @@ -0,0 +1,87 @@ +//# run +script { + fun main() { + assert!(15u8 == 0xFu8, 42); + assert!(15u8 == 0x0Fu8, 42); + assert!(255u8 == 0xFFu8, 42); + assert!(255u8 == 0x0FFu8, 42); + + assert!(15u16 == 0xFu16, 42); + assert!(15u16 == 0x0Fu16, 42); + assert!(255u16 == 0xFFu16, 42); + assert!(255u16 == 0x0FFu16, 42); + assert!(4095u16 == 0xFFFu16, 42); + assert!(65535u16 == 0xFFFFu16, 42); + assert!(65535u16 == 0x00FFFFu16, 42); + + + assert!(15u32 == 0xFu32, 42); + assert!(15u32 == 0x0Fu32, 42); + assert!(255u32 == 0xFFu32, 42); + assert!(255u32 == 0x0FFu32, 42); + assert!(4095u32 == 0xFFFu32, 42); + assert!(65535u32 == 0xFFFFu32, 42); + assert!(4294967295u32 == 0xFFFFFFFFu32, 42); + assert!(4294967295u32 == 0x00FFFFFFFFu32, 42); + + assert!(15u64 == 0xFu64, 42); + assert!(15u64 == 0x0Fu64, 42); + assert!(255u64 == 0xFFu64, 42); + assert!(255u64 == 0x0FFu64, 42); + assert!(18446744073709551615u64 == 0xFFFFFFFFFFFFFFFFu64, 42); + assert!(18446744073709551615u64 == 0x0FFFFFFFFFFFFFFFFu64, 42); + + assert!(15u128 == 0xFu128, 42); + assert!(15u128 == 0x0Fu128, 42); + assert!(255u128 == 0xFFu128, 42); + assert!(255u128 == 0x0FFu128, 42); + assert!(18446744073709551615u128 == 0xFFFFFFFFFFFFFFFFu128, 42); + assert!(18446744073709551615u128 == 0x0FFFFFFFFFFFFFFFFu128, 42); + assert!( + 340282366920938463463374607431768211455u128 == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu128, + 42, + ); + assert!( + 340282366920938463463374607431768211455u128 == 0x0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu128, + 42, + ); + + assert!(15u128 == 0xFu128, 42); + assert!(15u128 == 0x0Fu128, 42); + assert!(255u128 == 0xFFu128, 42); + assert!(255u128 == 0x0FFu128, 42); + assert!(18446744073709551615u128 == 0xFFFFFFFFFFFFFFFFu128, 42); + assert!(18446744073709551615u128 == 0x0FFFFFFFFFFFFFFFFu128, 42); + assert!( + 340282366920938463463374607431768211455u128 == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu128, + 42, + ); + assert!( + 340282366920938463463374607431768211455u128 == 0x0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu128, + 42, + ); + + assert!(15u256 == 0xFu256, 42); + assert!(15u256 == 0x0Fu256, 42); + assert!(255u256 == 0xFFu256, 42); + assert!(255u256 == 0x0FFu256, 42); + assert!(18446744073709551615u256 == 0xFFFFFFFFFFFFFFFFu256, 42); + assert!(18446744073709551615u256 == 0x0FFFFFFFFFFFFFFFFu256, 42); + assert!( + 340282366920938463463374607431768211455u256 == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu256, + 42, + ); + assert!( + 115792089237316195423570985008687907853269984665640564039457584007913129639935u256 == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu256, + 42, + ); + assert!( + 115792089237316195423570985008687907853269984665640564039457584007913129639935u256 == 0x0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu256, + 42, + ); + assert!( + 115792089237316195423570985008687907853269984665640564039457584007913129639935u256 == 0x00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFu256, + 42, + ); + } +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hexstring.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hexstring.exp new file mode 100644 index 0000000000000..274cdfcf1b008 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hexstring.exp @@ -0,0 +1,3 @@ +processed 1 task + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hexstring.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hexstring.move new file mode 100644 index 0000000000000..e4ab8f90889e5 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/hexstring.move @@ -0,0 +1,13 @@ +//# run +script { +use std::vector; + +fun main() { + let v = x"01020304"; + let sum: u64 = 0; + while (!vector::is_empty(&v)) { + sum = sum + (vector::pop_back(&mut v) as u64); + }; + assert!(sum == 10, sum); +} +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/num_literal_underscore.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/num_literal_underscore.exp new file mode 100644 index 0000000000000..274cdfcf1b008 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/num_literal_underscore.exp @@ -0,0 +1,3 @@ +processed 1 task + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/num_literal_underscore.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/num_literal_underscore.move new file mode 100644 index 0000000000000..6ec48a75fe43e --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/num_literal_underscore.move @@ -0,0 +1,50 @@ +//# run +script { + fun main() { + assert!(15u8 == 1_5u8, 15); + assert!(15_u8 == 1_5u8, 15); + assert!(1__5u8 == 15___u8, 15); + assert!(1__500u16 == 1500___u16, 150); + assert!(1__5u32 == 15___u32, 15); + assert!(1556u64 == 1_5_56u64, 1556); + assert!(1_556u128 == 1_5_56__u128, 1556); + assert!(015u8 == 1_5u8, 15); + assert!(15_0u8 == 1_50u8, 150); + assert!(00_1__5u8 == 15___u8, 15); + assert!(00_1__5u256 == 15___u256, 15); + + assert!(15u8 == 1_5, 15); + assert!(15_u8 == 1_5, 15); + assert!(1__5u8 == 15___, 15); + assert!(1556u64 == 1_5_56, 1556); + assert!(1_556u128 == 1_5_56__, 1556); + assert!(015u8 == 1_5, 15); + assert!(15_0u8 == 1_50, 150); + assert!(00_1__5u8 == 15___, 15); + assert!(00_1__5u16 == 15___, 15); + assert!(00_1__5u32 == 15___, 15); + + assert!(0x15u8 == 0x1_5u8, 15); + assert!(0x15_u8 == 0x1_5u8, 15); + assert!(0x1__5u8 == 0x15___u8, 15); + assert!(0x1__50u16 == 0x150___u16, 150); + assert!(0x1__5u32 == 0x15___u32, 15); + assert!(0x1556u64 == 0x1_5_56u64, 1556); + assert!(0x1_556u128 == 0x1_5_56__u128, 1556); + assert!(0x015u8 == 0x1_5u8, 15); + assert!(0x15_u8 == 0x1_5u8, 150); + assert!(0x00_1__5u8 == 0x15___u8, 15); + assert!(0x00_1__5u256 == 0x15___u256, 15); + + assert!(0x15u8 == 0x1_5, 15); + assert!(0x15_u8 == 0x1_5, 15); + assert!(0x1__5u8 == 0x15___, 15); + assert!(0x1556u64 == 0x1_5_56, 1556); + assert!(0x1_556u128 == 0x1_5_56__, 1556); + assert!(0x015u8 == 0x1_5, 15); + assert!(0x15_u8 == 0x1_5, 150); + assert!(0x00_1__5u8 == 0x15___, 15); + assert!(0x00_1__5u16 == 0x15___, 15); + assert!(0x00_1__5u32 == 0x15___, 15); + } +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/precedence.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/precedence.exp new file mode 100644 index 0000000000000..274cdfcf1b008 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/precedence.exp @@ -0,0 +1,3 @@ +processed 1 task + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/precedence.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/precedence.move new file mode 100644 index 0000000000000..6cdcbb265c01b --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/precedence.move @@ -0,0 +1,12 @@ +//# run +script { + +fun main() { + assert!(true || true && false, 99); // "&&" has precedence over "||" + assert!(true != false && false != true, 100); // "&&" has precedence over comparisons + assert!(1 | 3 ^ 1 == 3, 101); // binary XOR has precedence over OR + assert!(2 ^ 3 & 1 == 3, 102); // binary AND has precedence over XOR + assert!(3 & 3 + 1 == 0, 103); // addition has precedence over binary AND + assert!(1 + 2 * 3 == 7, 104); // multiplication has precedence over addition +} +} diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/return_not_binary.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/return_not_binary.exp new file mode 100644 index 0000000000000..39b494db4ad59 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/return_not_binary.exp @@ -0,0 +1,9 @@ +processed 3 tasks + +task 1 'run'. lines 18-18: +return values: 0 + +task 2 'run'. lines 20-20: +return values: 0 + +==> Compiler v2 delivered same results! diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/return_not_binary.move b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/return_not_binary.move new file mode 100644 index 0000000000000..0ae400d564674 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/more-v1/parser/return_not_binary.move @@ -0,0 +1,20 @@ +// Test returning expressions, that if parsed differently, could be binary operators, +// where the left argument would be the 'return' + +//# publish +module 0x42::M { + struct S { f: u64} + + fun t1(u: &u64): u64 { + if (true) return * u; + 0 + } + + fun t2(s: &S): &u64 { + if (true) return & s.f else & s.f + } +} + +//# run 0x42::M::t1 --args 0 + +//# run 0x42::M::t2 --args 0 diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.move new file mode 100644 index 0000000000000..d3893ad8b24fc --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.move @@ -0,0 +1,13 @@ +//# publish +module 0xc0ffee::m { + inline fun call(f: |u64|u64): u64 { + f(2) + } + + public fun test(): u64 { + let x = 1; + x + call(|_x: u64| {x = x + 1; x}) + call(|_x: u64| {x = x + 7; x}) + } +} + +//# run 0xc0ffee::m::test diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.operator-eval-lang-1.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.operator-eval-lang-1.exp new file mode 100644 index 0000000000000..4c99c8a28e797 --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.operator-eval-lang-1.exp @@ -0,0 +1,52 @@ +comparison between v1 and v2 failed: += processed 2 tasks += += task 0 'publish'. lines 1-11: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:8:19 ++ Error: compilation errors: ++ error: A sequence within an operand of binary operation `+` can obscure program logic and is not allowed by this compiler. ++ ┌─ TEMPFILE:8:9 += │ += 8 │ x + call(|_x: u64| {x = x + 1; x}) + call(|_x: u64| {x = x + 7; x}) +- │ ^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond ++ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++ │ │ │ ++ │ │ non-empty sequence ++ │ binary operation `+` ++ │ ++ = To compile this code, either: ++ = 1. upgrade to language version 2.0 or later (which uses strict left-to-right evaluation order), ++ = 2. rewrite the code to remove sequences from directly within binary operations, ++ = e.g., save intermediate results providing explicit order. ++ = In either of these cases, please ensure to check the code does what you expect it to, because of changed semantics. += +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:8:52 ++ error: A sequence within an operand of binary operation `+` can obscure program logic and is not allowed by this compiler. ++ ┌─ TEMPFILE:8:9 += │ += 8 │ x + call(|_x: u64| {x = x + 1; x}) + call(|_x: u64| {x = x + 7; x}) +- │ ^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond ++ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++ │ │ │ ++ │ │ non-empty sequence ++ │ binary operation `+` ++ │ ++ = To compile this code, either: ++ = 1. upgrade to language version 2.0 or later (which uses strict left-to-right evaluation order), ++ = 2. rewrite the code to remove sequences from directly within binary operations, ++ = e.g., save intermediate results providing explicit order. ++ = In either of these cases, please ensure to check the code does what you expect it to, because of changed semantics. += += += += task 1 'run'. lines 13-13: += Error: Function execution failed with VMError: { += major_status: LINKER_ERROR, += sub_status: None, += location: undefined, += indices: redacted, += offsets: redacted, += } += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.operator-eval-lang-2.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.operator-eval-lang-2.exp new file mode 100644 index 0000000000000..42fb9148cc13a --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/operator_eval/op_with_side_effect_49_typed.operator-eval-lang-2.exp @@ -0,0 +1,29 @@ +comparison between v1 and v2 failed: +- processed 2 tasks ++ processed 2 tasks += +- task 0 'publish'. lines 1-11: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:8:19 +- │ +- 8 │ x + call(|_x: u64| {x = x + 1; x}) + call(|_x: u64| {x = x + 7; x}) +- │ ^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- error[E01013]: unsupported language construct +- ┌─ TEMPFILE:8:52 +- │ +- 8 │ x + call(|_x: u64| {x = x + 1; x}) + call(|_x: u64| {x = x + 7; x}) +- │ ^^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- += task 1 'run'. lines 13-13: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } ++ return values: 12 += diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/optimization/inlining1_typed.exp b/third_party/move/move-compiler-v2/transactional-tests/tests/optimization/inlining1_typed.exp new file mode 100644 index 0000000000000..c9058684fa8ba --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/optimization/inlining1_typed.exp @@ -0,0 +1,23 @@ +comparison between v1 and v2 failed: +- processed 2 tasks +- +- task 0 'publish'. lines 1-14: +- Error: error[E01013]: unsupported language construct +- ┌─ TEMPFILE:7:14 +- │ +- 7 │ foo(|_: u64| 3, 10) +- │ ^^^^^^ Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond +- +- +- +- task 1 'run'. lines 16-16: +- Error: Function execution failed with VMError: { +- major_status: LINKER_ERROR, +- sub_status: None, +- location: undefined, +- indices: redacted, +- offsets: redacted, +- } +- ++ processed 2 tasks ++ diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/optimization/inlining1_typed.move b/third_party/move/move-compiler-v2/transactional-tests/tests/optimization/inlining1_typed.move new file mode 100644 index 0000000000000..e22c531b09c4f --- /dev/null +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/optimization/inlining1_typed.move @@ -0,0 +1,16 @@ +//# publish +module 0x42::Test { + inline fun foo(f:|u64| u64, x: u64): u64 { + f(x) + } + + public fun test(): u64 { + foo(|_: u64| 3, 10) + } + + public fun main() { + assert!(test() == 3, 5); + } +} + +//# run 0x42::Test::main diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched b/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched index db793a356d40e..42fe326080349 100644 --- a/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched @@ -77,6 +77,7 @@ move-compiler/transactional-tests/tests/evaluation_order/lazy_assert.exp move- move-compiler/transactional-tests/tests/evaluation_order/short_circuiting.exp move-compiler-v2/transactional-tests/tests/evaluation_order/short_circuiting.exp move-compiler/transactional-tests/tests/evaluation_order/short_circuiting_invalid.exp move-compiler-v2/transactional-tests/tests/evaluation_order/short_circuiting_invalid.exp move-compiler/transactional-tests/tests/evaluation_order/struct_arguments.exp move-compiler-v2/transactional-tests/tests/evaluation_order/struct_arguments.exp +move-compiler/transactional-tests/tests/generics/global_invalid.exp move-compiler-v2/transactional-tests/tests/more-v1/generics/global_invalid.exp move-compiler/transactional-tests/tests/inlining/bug_10991.exp move-compiler-v2/transactional-tests/tests/inlining/bug_10991.exp move-compiler/transactional-tests/tests/inlining/bug_10991_noparam.exp move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam.exp move-compiler/transactional-tests/tests/inlining/bug_10991_noparam2.exp move-compiler-v2/transactional-tests/tests/inlining/bug_10991_noparam2.exp @@ -119,5 +120,14 @@ move-compiler/transactional-tests/tests/operators/casting_operators.exp move-c move-compiler/transactional-tests/tests/operators/comparison_operators.exp move-compiler-v2/transactional-tests/tests/operators/comparison_operators.exp move-compiler/transactional-tests/tests/operators/precedence.exp move-compiler-v2/transactional-tests/tests/operators/precedence.exp move-compiler/transactional-tests/tests/operators/shift_operators.exp move-compiler-v2/transactional-tests/tests/operators/shift_operators.exp +move-compiler/transactional-tests/tests/parser/byte_string.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/byte_string.exp +move-compiler/transactional-tests/tests/parser/control_exp_associativity.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/control_exp_associativity.exp +move-compiler/transactional-tests/tests/parser/expr_binary_operators.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/expr_binary_operators.exp +move-compiler/transactional-tests/tests/parser/hex_and_decimal_address.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_address.exp +move-compiler/transactional-tests/tests/parser/hex_and_decimal_numbers.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/hex_and_decimal_numbers.exp +move-compiler/transactional-tests/tests/parser/hexstring.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/hexstring.exp +move-compiler/transactional-tests/tests/parser/num_literal_underscore.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/num_literal_underscore.exp +move-compiler/transactional-tests/tests/parser/precedence.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/precedence.exp +move-compiler/transactional-tests/tests/parser/return_not_binary.exp move-compiler-v2/transactional-tests/tests/more-v1/parser/return_not_binary.exp move-compiler/transactional-tests/tests/simplifier/conditional_borrow.exp move-compiler-v2/transactional-tests/tests/simplifier/conditional_borrow.exp move-compiler/transactional-tests/tests/simplifier/constant_folding_ristretto.exp move-compiler-v2/transactional-tests/tests/simplifier/constant_folding_ristretto.exp diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/v1.unmatched b/third_party/move/move-compiler-v2/transactional-tests/tests/v1.unmatched index f5a88eab7ccc3..e69de29bb2d1d 100644 --- a/third_party/move/move-compiler-v2/transactional-tests/tests/v1.unmatched +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/v1.unmatched @@ -1,14 +0,0 @@ -move-compiler/transactional-tests/tests/generics/{ - global_invalid.move, -} -move-compiler/transactional-tests/tests/parser/{ - byte_string.move, - control_exp_associativity.move, - expr_binary_operators.move, - hex_and_decimal_address.move, - hex_and_decimal_numbers.move, - hexstring.move, - num_literal_underscore.move, - precedence.move, - return_not_binary.move, -} diff --git a/third_party/move/move-compiler/src/expansion/ast.rs b/third_party/move/move-compiler/src/expansion/ast.rs index 257306fbd608b..50cf0b63da498 100644 --- a/third_party/move/move-compiler/src/expansion/ast.rs +++ b/third_party/move/move-compiler/src/expansion/ast.rs @@ -426,6 +426,13 @@ pub type LValue = Spanned; pub type LValueList_ = Vec; pub type LValueList = Spanned; +/// These represent LValues with user-specified explicit types. +#[derive(Debug, Clone, PartialEq)] +pub struct TypedLValue_(pub LValue, pub Option); +pub type TypedLValue = Spanned; +pub type TypedLValueList_ = Vec; +pub type TypedLValueList = Spanned; + pub fn wild_card(loc: Loc) -> LValue { let wildcard = sp(loc, Symbol::from("_")); let lvalue_ = LValue_::Var(sp(loc, ModuleAccess_::Name(wildcard)), None); @@ -500,7 +507,7 @@ pub enum Exp_ { While(Box, Box), Loop(Box), Block(Sequence), - Lambda(LValueList, Box), + Lambda(TypedLValueList, Box), Quant( QuantKind, LValueWithRangeList, @@ -1800,6 +1807,23 @@ impl AstDebug for ExpDotted_ { } } +impl AstDebug for Vec { + fn ast_debug(&self, w: &mut AstWriter) { + w.comma(self, |w, b| b.ast_debug(w)); + } +} + +impl AstDebug for TypedLValue_ { + fn ast_debug(&self, w: &mut AstWriter) { + let TypedLValue_(lv, opt_ty) = self; + lv.ast_debug(w); + if let Some(ty) = opt_ty { + w.write(":"); + ty.ast_debug(w); + } + } +} + impl AstDebug for Vec { fn ast_debug(&self, w: &mut AstWriter) { let parens = self.len() != 1; diff --git a/third_party/move/move-compiler/src/expansion/dependency_ordering.rs b/third_party/move/move-compiler/src/expansion/dependency_ordering.rs index 92cb3ed239168..9912bd62634ff 100644 --- a/third_party/move/move-compiler/src/expansion/dependency_ordering.rs +++ b/third_party/move/move-compiler/src/expansion/dependency_ordering.rs @@ -513,7 +513,9 @@ fn exp(context: &mut Context, sp!(_loc, e_): &E::Exp) { }, E::Lambda(ll, e) => { - lvalues(context, &ll.value); + use crate::expansion::ast::TypedLValue_; + let mapped = ll.value.iter().map(|sp!(_, TypedLValue_(lv, _opt_ty))| lv); + lvalues(context, mapped); exp(context, e) }, E::Quant(_, binds, es_vec, eopt, e) => { diff --git a/third_party/move/move-compiler/src/expansion/translate.rs b/third_party/move/move-compiler/src/expansion/translate.rs index c7ea02c5e7f6a..4fec7ef662b1f 100644 --- a/third_party/move/move-compiler/src/expansion/translate.rs +++ b/third_party/move/move-compiler/src/expansion/translate.rs @@ -2615,10 +2615,10 @@ fn exp_(context: &mut Context, sp!(loc, pe_): P::Exp) -> E::Exp { PE::Loop(ploop) => EE::Loop(exp(context, *ploop)), PE::Block(seq) => EE::Block(sequence(context, loc, seq)), PE::Lambda(pbs, pe) => { - let bs_opt = bind_list(context, pbs); + let tbs_opt = typed_bind_list(context, pbs); let e = exp_(context, *pe); - match bs_opt { - Some(bs) => EE::Lambda(bs, Box::new(e)), + match tbs_opt { + Some(tbs) => EE::Lambda(tbs, Box::new(e)), None => { assert!(context.env.has_errors()); EE::UnresolvedError @@ -2886,6 +2886,24 @@ fn fields( // LValues //************************************************************************************************** +fn typed_bind_list( + context: &mut Context, + sp!(loc, pbs_): P::TypedBindList, +) -> Option { + let bs_: Option> = pbs_ + .into_iter() + .map(|tpb| typed_bind(context, tpb)) + .collect(); + Some(sp(loc, bs_?)) +} + +fn typed_bind(context: &mut Context, sp!(loc, tpb_): P::TypedBind) -> Option { + let P::TypedBind_(pb, opt_type) = tpb_; + let b = bind(context, pb)?; + let ot = opt_type.map(|ty| type_(context, ty)); + Some(sp(loc, E::TypedLValue_(b, ot))) +} + fn bind_list(context: &mut Context, sp!(loc, pbs_): P::BindList) -> Option { let bs_: Option> = pbs_.into_iter().map(|pb| bind(context, pb)).collect(); Some(sp(loc, bs_?)) @@ -3234,7 +3252,7 @@ fn unbound_names_exp(unbound: &mut UnboundNames, sp!(_, e_): &E::Exp) { EE::Lambda(ls, er) => { unbound_names_exp(unbound, er); // remove anything in `ls` - unbound_names_binds(unbound, ls); + unbound_names_typed_binds(unbound, ls); }, EE::Quant(_, rs, trs, cr_opt, er) => { unbound_names_exp(unbound, er); @@ -3311,6 +3329,12 @@ fn unbound_names_binds(unbound: &mut UnboundNames, sp!(_, ls_): &E::LValueList) .for_each(|l| unbound_names_bind(unbound, l)) } +fn unbound_names_typed_binds(unbound: &mut UnboundNames, sp!(_, ls_): &E::TypedLValueList) { + ls_.iter() + .rev() + .for_each(|sp!(_loc, E::TypedLValue_(l, _opt_ty))| unbound_names_bind(unbound, l)) +} + fn unbound_names_binds_with_range( unbound: &mut UnboundNames, sp!(_, rs_): &E::LValueWithRangeList, diff --git a/third_party/move/move-compiler/src/naming/translate.rs b/third_party/move/move-compiler/src/naming/translate.rs index 9080f025707f5..640e235b3605d 100644 --- a/third_party/move/move-compiler/src/naming/translate.rs +++ b/third_party/move/move-compiler/src/naming/translate.rs @@ -942,7 +942,7 @@ fn exp_(context: &mut Context, e: E::Exp) -> N::Exp { EE::Loop(el) => NE::Loop(exp(context, *el)), EE::Block(seq) => NE::Block(sequence(context, seq)), EE::Lambda(args, body) => { - let bind_opt = bind_list(context, args); + let bind_opt = bind_typed_list(context, args); match bind_opt { None => { assert!(context.env.has_errors()); @@ -1201,6 +1201,10 @@ fn bind_list(context: &mut Context, ls: E::LValueList) -> Option lvalue_list(context, LValueCase::Bind, ls) } +fn bind_typed_list(context: &mut Context, ls: E::TypedLValueList) -> Option { + typed_lvalue_list(context, ls) +} + fn assign_list(context: &mut Context, ls: E::LValueList) -> Option { lvalue_list(context, LValueCase::Assign, ls) } @@ -1218,6 +1222,30 @@ fn lvalue_list( )) } +fn typed_lvalue_list( + context: &mut Context, + sp!(loc, b_): E::TypedLValueList, +) -> Option { + let case = LValueCase::Bind; + Some(sp( + loc, + b_.into_iter() + .map(|sp!(loc, E::TypedLValue_(inner, opt_ty))| { + if opt_ty.is_some() { + context.env.add_diag(diag!( + Syntax::UnsupportedLanguageItem, + ( + loc, + "Explicit type annotations for lambda parameters are only allowed in Move 2 and beyond" + ) + )) + } + lvalue(context, case, inner) + }) + .collect::>()?, + )) +} + fn resolve_builtin_function( context: &mut Context, loc: Loc, diff --git a/third_party/move/move-compiler/src/parser/ast.rs b/third_party/move/move-compiler/src/parser/ast.rs index 1bc388c914eb5..bd22eca723c27 100644 --- a/third_party/move/move-compiler/src/parser/ast.rs +++ b/third_party/move/move-compiler/src/parser/ast.rs @@ -523,6 +523,13 @@ pub type Bind = Spanned; // b1, ..., bn pub type BindList = Spanned>; +#[derive(Debug, Clone, PartialEq)] +pub struct TypedBind_(pub Bind, pub Option); +pub type TypedBind = Spanned; + +// b1 [":" ], ..., bn [":" ] +pub type TypedBindList = Spanned>; + #[derive(Debug, Clone, PartialEq)] pub enum BindFieldOrDotDot_ { // f : b @@ -680,8 +687,8 @@ pub enum Exp_ { // { seq } Block(Sequence), - // |x1, ..., xn| e - Lambda(BindList, Box), // spec only + // | x1 [: t1], ..., xn [: tn] | e + Lambda(TypedBindList, Box), // forall/exists x1 : e1, ..., xn [{ t1, .., tk } *] [where cond]: en. Quant( QuantKind, @@ -1780,6 +1787,7 @@ impl AstDebug for SequenceItem_ { w.write("let "); bs.ast_debug(w); if let Some(ty) = ty_opt { + w.write(":"); ty.ast_debug(w) } }, @@ -1787,6 +1795,7 @@ impl AstDebug for SequenceItem_ { w.write("let "); bs.ast_debug(w); if let Some(ty) = ty_opt { + w.write(":"); ty.ast_debug(w) } w.write(" = "); @@ -1884,9 +1893,9 @@ impl AstDebug for Exp_ { e.ast_debug(w); }, E::Block(seq) => w.block(|w| seq.ast_debug(w)), - E::Lambda(sp!(_, bs), e) => { + E::Lambda(sp!(_, tbs), e) => { w.write("|"); - bs.ast_debug(w); + tbs.ast_debug(w); w.write("|"); e.ast_debug(w); }, @@ -2127,3 +2136,20 @@ impl AstDebug for Bind_ { } } } + +impl AstDebug for Vec { + fn ast_debug(&self, w: &mut AstWriter) { + w.comma(self, |w, b| b.ast_debug(w)); + } +} + +impl AstDebug for TypedBind_ { + fn ast_debug(&self, w: &mut AstWriter) { + let TypedBind_(b, ty_opt) = self; + b.ast_debug(w); + if let Some(ty) = ty_opt { + w.write(":"); + ty.ast_debug(w) + } + } +} diff --git a/third_party/move/move-compiler/src/parser/lexer.rs b/third_party/move/move-compiler/src/parser/lexer.rs index 71bfd10c28daa..b2a3439ff182e 100644 --- a/third_party/move/move-compiler/src/parser/lexer.rs +++ b/third_party/move/move-compiler/src/parser/lexer.rs @@ -478,6 +478,25 @@ fn find_token( (get_name_token(&text[..len]), len) } }, + '"' => { + let line = &text.lines().next().unwrap()[1..]; + match get_string_len(line) { + Some(_last_quote) => { + let loc = make_loc(file_hash, start_offset, start_offset); + return Err(Box::new(diag!( + Syntax::InvalidByteString, + (loc, "String literal must begin with b\" (for a byte string) or x\" (for a hex string)") + ))); + }, + None => { + let loc = make_loc(file_hash, start_offset, start_offset); + return Err(Box::new(diag!( + Syntax::InvalidCharacter, + (loc, format!("Invalid character: '{}'; string literal must begin with `b\"` and closing quote `\"` must appear on same line", c)) + ))); + }, + } + }, '&' => { if text.starts_with("&mut ") { (Tok::AmpMut, 5) diff --git a/third_party/move/move-compiler/src/parser/syntax.rs b/third_party/move/move-compiler/src/parser/syntax.rs index e969ac5268a74..1c4aee7141204 100644 --- a/third_party/move/move-compiler/src/parser/syntax.rs +++ b/third_party/move/move-compiler/src/parser/syntax.rs @@ -781,6 +781,26 @@ fn parse_bind_field(context: &mut Context) -> Result<(Field, Bind), Box )? +fn parse_typed_bind(context: &mut Context) -> Result> { + let start_loc = context.tokens.start_loc(); + let bind = parse_bind(context)?; + let ty_opt = if match_token(context.tokens, Tok::Colon)? { + Some(parse_type(context)?) + } else { + None + }; + let end_loc = context.tokens.previous_end_loc(); + let typed_bind_ = TypedBind_(bind, ty_opt); + Ok(spanned( + context.tokens.file_hash(), + start_loc, + end_loc, + typed_bind_, + )) +} + // Parse a binding: // Bind = // @@ -895,14 +915,14 @@ fn parse_bind_or_dotdot(context: &mut Context) -> Result "|" -fn parse_lambda_bind_list(context: &mut Context) -> Result> { +// "|" Comma "|" +fn parse_lambda_bind_list(context: &mut Context) -> Result> { let start_loc = context.tokens.start_loc(); let b = parse_comma_list( context, Tok::Pipe, Tok::Pipe, - parse_bind, + parse_typed_bind, "a variable or structure binding", )?; let end_loc = context.tokens.previous_end_loc(); diff --git a/third_party/move/move-compiler/tests/move_check/borrows/unused_ref.exp b/third_party/move/move-compiler/tests/move_check/borrows/unused_ref.exp deleted file mode 100644 index eab735f329766..0000000000000 --- a/third_party/move/move-compiler/tests/move_check/borrows/unused_ref.exp +++ /dev/null @@ -1,9 +0,0 @@ -error[E04017]: too many arguments - ┌─ tests/move_check/borrows/unused_ref.move:28:5 - │ -28 │ borrow(&mut x, 0, 0); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ Found 3 argument(s) here - │ Invalid call of '0x42::m::borrow'. The call expected 2 argument(s) but got 3 - diff --git a/third_party/move/move-compiler/tests/move_check/borrows/unused_ref.move b/third_party/move/move-compiler/tests/move_check/borrows/unused_ref.move index 9301e29a7f2e5..bc0404abc121f 100644 --- a/third_party/move/move-compiler/tests/move_check/borrows/unused_ref.move +++ b/third_party/move/move-compiler/tests/move_check/borrows/unused_ref.move @@ -25,7 +25,7 @@ fun borrow_wrong_type() { let scenario = begin(sender); let x = new(&mut scenario); add(&mut x, 0, 0); - borrow(&mut x, 0, 0); + borrow(&mut x, 0); abort 42 } diff --git a/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.exp b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.exp new file mode 100644 index 0000000000000..92ffcfe4fc696 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.exp @@ -0,0 +1,12 @@ +warning[W09001]: unused alias + ┌─ tests/move_check/expansion/use_nested_self_as_invalid2.move:8:26 + │ +8 │ use 0x2::X::{Self as B, foo, S}; + │ ^ Unused 'use' of alias 'B'. Consider removing it + +error[E03002]: unbound module + ┌─ tests/move_check/expansion/use_nested_self_as_invalid2.move:10:19 + │ +10 │ struct X { f: X::S, f2: S } + │ ^ Unbound module or type alias 'X' + diff --git a/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.move b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.move new file mode 100644 index 0000000000000..58bb11f6ca5c1 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.move @@ -0,0 +1,16 @@ +address 0x2 { +module X { + struct S {} + public fun foo() {} +} + +module M { + use 0x2::X::{Self as B, foo, S}; + + struct X { f: X::S, f2: S } + fun bar() { + // X::foo(); + foo() + } +} +} diff --git a/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg_inline.exp b/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg_inline.exp new file mode 100644 index 0000000000000..974af7c614967 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg_inline.exp @@ -0,0 +1,6 @@ +error[E04020]: missing acquires annotation + ┌─ tests/move_check/inlining/acquires_error_msg_inline.move:11:9 + │ +11 │ borrow_global_mut(@0xcafe).value = 2; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The call acquires '0x42::test::Test', but the 'acquires' list for the current function 'call_modify_without_acquire` does not contain this type. It must be present in the calling context's acquires list + diff --git a/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg_inline.move b/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg_inline.move new file mode 100644 index 0000000000000..0db2a23937458 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg_inline.move @@ -0,0 +1,13 @@ +module 0x42::test { + struct Test has key { + value: u64 + } + + public fun call_modify_without_acquire() { + modify(); // expect error message here + } + + public inline fun modify() acquires Test { + borrow_global_mut(@0xcafe).value = 2; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.exp b/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.exp index 3f5913f49b2af..092be903a7ac4 100644 --- a/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.exp +++ b/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.exp @@ -1,9 +1,3 @@ -error[E04020]: missing acquires annotation - ┌─ tests/move_check/inlining/resources_invalid.move:8:9 - │ -8 │ borrow_global(ref.addr) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ The call acquires '0x42::token::Token', but the 'acquires' list for the current function 'get_value` does not contain this type. It must be present in the calling context's acquires list - error[E14002]: Inlined code invalid in this context ┌─ tests/move_check/inlining/resources_invalid.move:8:26 │ diff --git a/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.move b/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.move index 3445aa71d15d9..0ed28eded5c71 100644 --- a/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.move +++ b/third_party/move/move-compiler/tests/move_check/inlining/resources_invalid.move @@ -14,7 +14,7 @@ module 0x42::token { struct Token has key { val: u64 } - public fun get_value(ref: &obj::ReaderRef): u64 { + public fun get_value(ref: &obj::ReaderRef): u64 acquires Token { obj::reader(ref).val } } diff --git a/third_party/move/move-compiler/tests/move_check/inlining/resources_valid.move b/third_party/move/move-compiler/tests/move_check/inlining/resources_valid.move new file mode 100644 index 0000000000000..37f2720a95b55 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/inlining/resources_valid.move @@ -0,0 +1,24 @@ +module 0x42::objects { + + struct ReaderRef has store { + addr: address + } + + public fun get_addr(ref: &ReaderRef): address { + ref.addr + } + + public inline fun reader(ref: &ReaderRef): &T { + borrow_global(get_addr(ref)) + } +} + +module 0x42::token { + use 0x42::objects as obj; + + struct Token has key { val: u64 } + + public fun get_value(ref: &obj::ReaderRef): u64 acquires Token { + obj::reader(ref).val + } +} diff --git a/third_party/move/move-compiler/tests/move_check/inlining/resources_valid_noacquires.exp b/third_party/move/move-compiler/tests/move_check/inlining/resources_valid_noacquires.exp new file mode 100644 index 0000000000000..3829891a72e2b --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/inlining/resources_valid_noacquires.exp @@ -0,0 +1,6 @@ +error[E04020]: missing acquires annotation + ┌─ tests/move_check/inlining/resources_valid_noacquires.move:12:9 + │ +12 │ borrow_global(get_addr(ref)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The call acquires '0x42::token::Token', but the 'acquires' list for the current function 'get_value` does not contain this type. It must be present in the calling context's acquires list + diff --git a/third_party/move/move-compiler/tests/move_check/inlining/resources_valid_noacquires.move b/third_party/move/move-compiler/tests/move_check/inlining/resources_valid_noacquires.move new file mode 100644 index 0000000000000..895bc3ec90889 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/inlining/resources_valid_noacquires.move @@ -0,0 +1,24 @@ +module 0x42::objects { + + struct ReaderRef has store { + addr: address + } + + public fun get_addr(ref: &ReaderRef): address { + ref.addr + } + + public inline fun reader(ref: &ReaderRef): &T { + borrow_global(get_addr(ref)) + } +} + +module 0x42::token { + use 0x42::objects as obj; + + struct Token has key { val: u64 } + + public fun get_value(ref: &obj::ReaderRef): u64 { + obj::reader(ref).val + } +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long.move b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long.move new file mode 100644 index 0000000000000..bae137078f679 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long.move @@ -0,0 +1,4 @@ +// Addresses are at most 32 bytes long. +address 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF { + +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal.move b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal.move new file mode 100644 index 0000000000000..3d4beb78ce5bc --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal.move @@ -0,0 +1,3 @@ +address 115792089237316195423570985008687907853269984665640564039457584007913129639935 { + +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal_exp.exp b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal_exp.exp new file mode 100644 index 0000000000000..c507378cfd5e6 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal_exp.exp @@ -0,0 +1,6 @@ +warning[W09003]: unused assignment + ┌─ tests/move_check/parser/address_almost_too_long_decimal_exp.move:4:13 + │ +4 │ let x = @115792089237316195423570985008687907853269984665640564039457584007913129639935; + │ ^ Unused assignment or binding for local 'x'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_x') + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal_exp.move b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal_exp.move new file mode 100644 index 0000000000000..0e8a1f6a6f493 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_decimal_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @115792089237316195423570985008687907853269984665640564039457584007913129639935; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_exp.exp b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_exp.exp new file mode 100644 index 0000000000000..3e02bbaf0de4a --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_exp.exp @@ -0,0 +1,6 @@ +warning[W09003]: unused assignment + ┌─ tests/move_check/parser/address_almost_too_long_exp.move:4:13 + │ +4 │ let x = @0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + │ ^ Unused assignment or binding for local 'x'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_x') + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_exp.move b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_exp.move new file mode 100644 index 0000000000000..39d883afdb267 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_almost_too_long_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long.exp b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long.exp new file mode 100644 index 0000000000000..e0c37cf09907b --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long.exp @@ -0,0 +1,6 @@ +error[E01005]: invalid address + ┌─ tests/move_check/parser/address_just_too_long.move:2:9 + │ +2 │ address 0x10000000000000000000000000000000000000000000000000000000000000000 { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long.move b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long.move new file mode 100644 index 0000000000000..ce9f217c553ff --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long.move @@ -0,0 +1,4 @@ +// Addresses are at most 32 bytes long. +address 0x10000000000000000000000000000000000000000000000000000000000000000 { + +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal.exp b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal.exp new file mode 100644 index 0000000000000..90a240c059305 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal.exp @@ -0,0 +1,6 @@ +error[E01005]: invalid address + ┌─ tests/move_check/parser/address_just_too_long_decimal.move:1:9 + │ +1 │ address 115792089237316195423570985008687907853269984665640564039457584007913129639936 { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal.move b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal.move new file mode 100644 index 0000000000000..79f930637ae0a --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal.move @@ -0,0 +1,3 @@ +address 115792089237316195423570985008687907853269984665640564039457584007913129639936 { + +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal_exp.exp b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal_exp.exp new file mode 100644 index 0000000000000..ca115eafc7696 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal_exp.exp @@ -0,0 +1,12 @@ +warning[W09003]: unused assignment + ┌─ tests/move_check/parser/address_just_too_long_decimal_exp.move:4:13 + │ +4 │ let x = @115792089237316195423570985008687907853269984665640564039457584007913129639936; + │ ^ Unused assignment or binding for local 'x'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_x') + +error[E01005]: invalid address + ┌─ tests/move_check/parser/address_just_too_long_decimal_exp.move:4:18 + │ +4 │ let x = @115792089237316195423570985008687907853269984665640564039457584007913129639936; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal_exp.move b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal_exp.move new file mode 100644 index 0000000000000..7279fd444c282 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_decimal_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @115792089237316195423570985008687907853269984665640564039457584007913129639936; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_exp.exp b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_exp.exp new file mode 100644 index 0000000000000..fcb5a3c79f6bb --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_exp.exp @@ -0,0 +1,12 @@ +warning[W09003]: unused assignment + ┌─ tests/move_check/parser/address_just_too_long_exp.move:4:13 + │ +4 │ let x = @0x10000000000000000000000000000000000000000000000000000000000000000; + │ ^ Unused assignment or binding for local 'x'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_x') + +error[E01005]: invalid address + ┌─ tests/move_check/parser/address_just_too_long_exp.move:4:18 + │ +4 │ let x = @0x10000000000000000000000000000000000000000000000000000000000000000; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_exp.move b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_exp.move new file mode 100644 index 0000000000000..169636f02c202 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_just_too_long_exp.move @@ -0,0 +1,6 @@ +// Addresses are at most 32 bytes long. +script { + fun main() { + let x = @0x10000000000000000000000000000000000000000000000000000000000000000; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_too_long.move b/third_party/move/move-compiler/tests/move_check/parser/address_too_long.move index 22ee75579a0d9..a87cadca53176 100644 --- a/third_party/move/move-compiler/tests/move_check/parser/address_too_long.move +++ b/third_party/move/move-compiler/tests/move_check/parser/address_too_long.move @@ -1,4 +1,4 @@ -// Addresses are at most 16 bytes long. +// Addresses are at most 32 bytes long. address 0x112233445566778899101122334455667788992011223344556677889930112233 { } diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal.exp b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal.exp new file mode 100644 index 0000000000000..726ee3998bb87 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal.exp @@ -0,0 +1,6 @@ +error[E01005]: invalid address + ┌─ tests/move_check/parser/address_too_long_decimal.move:1:9 + │ +1 │ address 1983934734707648152487488126467385770325287564619460388105773776639483347804723 { + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal.move b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal.move index e0d0903ab7eba..723c0e14c9db6 100644 --- a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal.move +++ b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal.move @@ -1,3 +1,3 @@ -address 340282366920938463463374607431768211456282366920938463463374607431768211456 { +address 1983934734707648152487488126467385770325287564619460388105773776639483347804723 { } diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.exp b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.exp index 272389f979bfd..0f7743d0bc40e 100644 --- a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.exp +++ b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.exp @@ -1,6 +1,12 @@ warning[W09003]: unused assignment ┌─ tests/move_check/parser/address_too_long_decimal_exp.move:4:13 │ -4 │ let x = @3402823669209384634633746074317682114560282366920938463463374607431768211456; +4 │ let x = @1983934734707648152487488126467385770325287564619460388105773776639483347804723; │ ^ Unused assignment or binding for local 'x'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_x') +error[E01005]: invalid address + ┌─ tests/move_check/parser/address_too_long_decimal_exp.move:4:18 + │ +4 │ let x = @1983934734707648152487488126467385770325287564619460388105773776639483347804723; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid address literal. The numeric value is too large. The maximum size is 32 bytes + diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.move b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.move index 738372a1c9bef..075c04280e5f0 100644 --- a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.move +++ b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_decimal_exp.move @@ -1,6 +1,6 @@ // Addresses are at most 32 bytes long. script { fun main() { - let x = @3402823669209384634633746074317682114560282366920938463463374607431768211456; + let x = @1983934734707648152487488126467385770325287564619460388105773776639483347804723; } } diff --git a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_exp.move b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_exp.move index b3d65b794b32e..7f34521c783bc 100644 --- a/third_party/move/move-compiler/tests/move_check/parser/address_too_long_exp.move +++ b/third_party/move/move-compiler/tests/move_check/parser/address_too_long_exp.move @@ -1,4 +1,4 @@ -// Addresses are at most 16 bytes long. +// Addresses are at most 32 bytes long. script { fun main() { let x = @0x112233445566778899101122334455667788992011223344556677889930112233; diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_hexstring.exp b/third_party/move/move-compiler/tests/move_check/parser/constants_hexstring.exp new file mode 100644 index 0000000000000..0fa9678e51c46 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_hexstring.exp @@ -0,0 +1,24 @@ +error[E01008]: invalid hex string + ┌─ tests/move_check/parser/constants_hexstring.move:6:29 + │ +6 │ const C12: vector = x"hello"; + │ ^^^^^^^^ Odd number of characters in hex string. Expected 2 hexadecimal digits for each byte + +error[E08001]: cannot compute constant value + ┌─ tests/move_check/parser/constants_hexstring.move:6:29 + │ +6 │ const C12: vector = x"hello"; + │ ^^^^^^^^ Invalid expression in 'const'. This expression could not be evaluated to a value + +error[E08001]: cannot compute constant value + ┌─ tests/move_check/parser/constants_hexstring.move:7:29 + │ +7 │ const C13: vector = x"hello!"; + │ ^^^^^^^^^ Invalid expression in 'const'. This expression could not be evaluated to a value + +error[E01008]: invalid hex string + ┌─ tests/move_check/parser/constants_hexstring.move:7:31 + │ +7 │ const C13: vector = x"hello!"; + │ ^ Invalid hexadecimal character: 'h' + diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_hexstring.move b/third_party/move/move-compiler/tests/move_check/parser/constants_hexstring.move new file mode 100644 index 0000000000000..db5e628e6bac1 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_hexstring.move @@ -0,0 +1,9 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C11: vector = x"deadbeef"; + const C12: vector = x"hello"; + const C13: vector = x"hello!"; +} +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_quoted_string.exp b/third_party/move/move-compiler/tests/move_check/parser/constants_quoted_string.exp new file mode 100644 index 0000000000000..4aefbcb208d9b --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_quoted_string.exp @@ -0,0 +1,6 @@ +error[E01007]: invalid byte string + ┌─ tests/move_check/parser/constants_quoted_string.move:5:29 + │ +5 │ const C12: vector = ""; + │ ^ String literal must begin with b" (for a byte string) or x" (for a hex string) + diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_quoted_string.move b/third_party/move/move-compiler/tests/move_check/parser/constants_quoted_string.move new file mode 100644 index 0000000000000..a51de933b4e29 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_quoted_string.move @@ -0,0 +1,8 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C12: vector = ""; + const C13: vector = "foo; +} +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_simple.move b/third_party/move/move-compiler/tests/move_check/parser/constants_simple.move index dc5e980cf6a65..36ea3929b3d70 100644 --- a/third_party/move/move-compiler/tests/move_check/parser/constants_simple.move +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_simple.move @@ -11,6 +11,9 @@ module M { const C7: u256 = 4 / 3 + 4 - 1 << 143; const C8: u16 = 123; const C9: u32 = (453 as u32); - + const C10: vector = b""; + const C11: vector = x"deadbeef"; + const C12: vector = b"\"foo\""; + const C13: vector = b"\"\x48"; } } diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_single_quote.exp b/third_party/move/move-compiler/tests/move_check/parser/constants_single_quote.exp new file mode 100644 index 0000000000000..4cd777b63242f --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_single_quote.exp @@ -0,0 +1,6 @@ +error[E01001]: invalid character + ┌─ tests/move_check/parser/constants_single_quote.move:4:29 + │ +4 │ const C13: vector = "foo + │ ^ Invalid character: '"'; string literal must begin with `b"` and closing quote `"` must appear on same line + diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_single_quote.move b/third_party/move/move-compiler/tests/move_check/parser/constants_single_quote.move new file mode 100644 index 0000000000000..5ac99045bd143 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_single_quote.move @@ -0,0 +1,10 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + const C13: vector = "foo + "; + const C14: vector = "bar"; + const C15: vector = b"baz"; + const C16: vector = x"quux"; +} +} diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_string_non_utf8.exp b/third_party/move/move-compiler/tests/move_check/parser/constants_string_non_utf8.exp new file mode 100644 index 0000000000000..05b90d2d3704e --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_string_non_utf8.exp @@ -0,0 +1,6 @@ +error[E01001]: invalid character + ┌─ tests/move_check/parser/constants_string_non_utf8.move:5:31 + │ +5 │ const C12: vector = b"ÿ"; + │ ^ Invalid character 'ÿ' found when reading file. Only ASCII printable characters, tabs (\t), lf (\n) and crlf (\r\n) are permitted. + diff --git a/third_party/move/move-compiler/tests/move_check/parser/constants_string_non_utf8.move b/third_party/move/move-compiler/tests/move_check/parser/constants_string_non_utf8.move new file mode 100644 index 0000000000000..b1ff20f608048 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/parser/constants_string_non_utf8.move @@ -0,0 +1,7 @@ +address 0x42 { +module M { + fun u(): u64 { 0 } + + const C12: vector = b"ÿ"; +} +} diff --git a/third_party/move/move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.exp b/third_party/move/move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.exp new file mode 100644 index 0000000000000..4cca3cd0e608c --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.exp @@ -0,0 +1,11 @@ +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.move:5:9 + │ +4 │ let x = S { s }; + │ --------------- + │ │ │ + │ │ The type '0x8675309::M::S' can have the ability 'copy' but the type argument 'signer' does not have the required ability 'copy' + │ The type '0x8675309::M::S' does not have the ability 'copy' +5 │ *&x + │ ^^^ Invalid dereference. Dereference requires the 'copy' ability + diff --git a/third_party/move/move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.move b/third_party/move/move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.move new file mode 100644 index 0000000000000..50598545bb58e --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/translated_ir_tests/move/signer/read_ref_transitive2.move @@ -0,0 +1,8 @@ +module 0x8675309::M { + struct S has copy, drop { s: T } + fun t(s: signer): S { + let x = S { s }; + *&x + } +} +// check: READREF_RESOURCE_ERROR diff --git a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.exp b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.exp index 152e2bda505e0..d18806ffbf5ca 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.exp @@ -161,35 +161,35 @@ error[E05001]: ability constraint not satisfied │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:30:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:35:13 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -30 │ let Sc {} = Sc {}; +35 │ let Sc {} = Sc {}; │ ^^^^^ ------ The type 'signer' does not have the ability 'copy' │ │ │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:30:21 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:35:21 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -30 │ let Sc {} = Sc {}; +35 │ let Sc {} = Sc {}; │ ^^^^^^^^^^^^^ │ │ │ │ │ The type 'signer' does not have the ability 'copy' │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:31:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:36:13 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -31 │ let Sc {} = Sc> {}; +36 │ let Sc {} = Sc> {}; │ ^^^^^ -------------- │ │ │ │ │ │ │ The type 'vector' can have the ability 'copy' but the type argument 'signer' does not have the required ability 'copy' @@ -197,12 +197,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:31:21 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:36:21 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -31 │ let Sc {} = Sc> {}; +36 │ let Sc {} = Sc> {}; │ ^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type 'vector' can have the ability 'copy' but the type argument 'signer' does not have the required ability 'copy' @@ -210,12 +210,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:32:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:37:13 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -32 │ let Sc {} = Sc> {}; +37 │ let Sc {} = Sc> {}; │ ^^^^^ ----------- │ │ │ │ │ │ │ The type 'vector<0x42::M::NoC>' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' @@ -223,12 +223,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:32:21 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:37:21 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -32 │ let Sc {} = Sc> {}; +37 │ let Sc {} = Sc> {}; │ ^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type 'vector<0x42::M::NoC>' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' @@ -236,150 +236,150 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:33:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:38:13 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -33 │ let Sk {} = Sk {}; +38 │ let Sk {} = Sk {}; │ ^^^^^ --- The type 'u64' does not have the ability 'key' │ │ │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:33:21 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:38:21 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -33 │ let Sk {} = Sk {}; +38 │ let Sk {} = Sk {}; │ ^^^^^^^^^^ │ │ │ │ │ The type 'u64' does not have the ability 'key' │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:34:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:13 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -34 │ let Sk {} = Sk {}; +39 │ let Sk {} = Sk {}; │ ^^^^^ ------ The type 'signer' does not have the ability 'key' │ │ │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:34:21 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:21 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -34 │ let Sk {} = Sk {}; +39 │ let Sk {} = Sk {}; │ ^^^^^^^^^^^^^ │ │ │ │ │ The type 'signer' does not have the ability 'key' │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:35:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:40:13 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -35 │ let Sk {} = Sk> {}; +40 │ let Sk {} = Sk> {}; │ ^^^^^ ----------- The type 'vector<0x42::M::NoC>' does not have the ability 'key' │ │ │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:35:21 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:40:21 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -35 │ let Sk {} = Sk> {}; +40 │ let Sk {} = Sk> {}; │ ^^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type 'vector<0x42::M::NoC>' does not have the ability 'key' │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:36:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:41:13 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -36 │ let Sk {} = Sk> {}; +41 │ let Sk {} = Sk> {}; │ ^^^^^ ----------- The type 'vector<0x42::M::NoK>' does not have the ability 'key' │ │ │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:36:21 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:41:21 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -36 │ let Sk {} = Sk> {}; +41 │ let Sk {} = Sk> {}; │ ^^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type 'vector<0x42::M::NoK>' does not have the ability 'key' │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:37:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:42:13 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -37 │ let Scds {} = Scds {}; +42 │ let Scds {} = Scds {}; │ ^^^^^^^ ------ The type 'signer' does not have the ability 'copy' │ │ │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:37:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:42:13 │ 15 │ struct Scds {} │ ----- 'store' constraint declared here · -37 │ let Scds {} = Scds {}; +42 │ let Scds {} = Scds {}; │ ^^^^^^^ ------ The type 'signer' does not have the ability 'store' │ │ │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:37:23 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:42:23 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -37 │ let Scds {} = Scds {}; +42 │ let Scds {} = Scds {}; │ ^^^^^^^^^^^^^^^ │ │ │ │ │ The type 'signer' does not have the ability 'copy' │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:37:23 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:42:23 │ 15 │ struct Scds {} │ ----- 'store' constraint declared here · -37 │ let Scds {} = Scds {}; +42 │ let Scds {} = Scds {}; │ ^^^^^^^^^^^^^^^ │ │ │ │ │ The type 'signer' does not have the ability 'store' │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:38:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:43:13 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -38 │ let Scds {} = Scds> {}; +43 │ let Scds {} = Scds> {}; │ ^^^^^^^ ----------- │ │ │ │ │ │ │ The type 'vector<0x42::M::NoC>' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' @@ -387,12 +387,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:38:23 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:43:23 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -38 │ let Scds {} = Scds> {}; +43 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type 'vector<0x42::M::NoC>' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' @@ -400,12 +400,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:44:13 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -39 │ let Scds {} = Scds>> {}; +44 │ let Scds {} = Scds>> {}; │ ^^^^^^^ --------------- │ │ │ │ │ │ │ The type 'vector<0x42::M::Cup>' can have the ability 'copy' but the type argument '0x42::M::Cup' does not have the required ability 'copy' @@ -413,12 +413,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:44:13 │ 15 │ struct Scds {} │ ---- 'drop' constraint declared here · -39 │ let Scds {} = Scds>> {}; +44 │ let Scds {} = Scds>> {}; │ ^^^^^^^ --------------- │ │ │ │ │ │ │ The type 'vector<0x42::M::Cup>' can have the ability 'drop' but the type argument '0x42::M::Cup' does not have the required ability 'drop' @@ -426,12 +426,12 @@ error[E05001]: ability constraint not satisfied │ 'drop' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:13 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:44:13 │ 15 │ struct Scds {} │ ----- 'store' constraint declared here · -39 │ let Scds {} = Scds>> {}; +44 │ let Scds {} = Scds>> {}; │ ^^^^^^^ --------------- │ │ │ │ │ │ │ The type 'vector<0x42::M::Cup>' can have the ability 'store' but the type argument '0x42::M::Cup' does not have the required ability 'store' @@ -439,12 +439,12 @@ error[E05001]: ability constraint not satisfied │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:23 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:44:23 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -39 │ let Scds {} = Scds>> {}; +44 │ let Scds {} = Scds>> {}; │ ^^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type 'vector<0x42::M::Cup>' can have the ability 'copy' but the type argument '0x42::M::Cup' does not have the required ability 'copy' @@ -452,12 +452,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:23 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:44:23 │ 15 │ struct Scds {} │ ---- 'drop' constraint declared here · -39 │ let Scds {} = Scds>> {}; +44 │ let Scds {} = Scds>> {}; │ ^^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type 'vector<0x42::M::Cup>' can have the ability 'drop' but the type argument '0x42::M::Cup' does not have the required ability 'drop' @@ -465,12 +465,12 @@ error[E05001]: ability constraint not satisfied │ 'drop' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:39:23 + ┌─ tests/move_check/typing/ability_constraint_prims_invalid.move:44:23 │ 15 │ struct Scds {} │ ----- 'store' constraint declared here · -39 │ let Scds {} = Scds>> {}; +44 │ let Scds {} = Scds>> {}; │ ^^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type 'vector<0x42::M::Cup>' can have the ability 'store' but the type argument '0x42::M::Cup' does not have the required ability 'store' diff --git a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.move b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.move index f37a75c987fa4..edca6d17a365d 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.move +++ b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_prims_invalid.move @@ -27,6 +27,11 @@ module M { cds(); cds>(); cds>>(); + } + + /// Not all above errors are shown because of duplicate removal, + /// so some moved here. + fun t2() { let Sc {} = Sc {}; let Sc {} = Sc> {}; let Sc {} = Sc> {}; @@ -38,7 +43,5 @@ module M { let Scds {} = Scds> {}; let Scds {} = Scds>> {}; } - - } } diff --git a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.exp b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.exp index 7d71e664c68b4..240f655ff1846 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.exp @@ -203,7 +203,7 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:29:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:34:13 │ 3 │ struct NoC has drop, store, key {} │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -211,13 +211,13 @@ error[E05001]: ability constraint not satisfied 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -29 │ let Sc {} = Sc {}; +34 │ let Sc {} = Sc {}; │ ^^^^^ --- The type '0x42::M::NoC' does not have the ability 'copy' │ │ │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:29:21 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:34:21 │ 3 │ struct NoC has drop, store, key {} │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -225,14 +225,14 @@ error[E05001]: ability constraint not satisfied 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -29 │ let Sc {} = Sc {}; +34 │ let Sc {} = Sc {}; │ ^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::NoC' does not have the ability 'copy' │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:30:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:35:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -240,13 +240,13 @@ error[E05001]: ability constraint not satisfied 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -30 │ let Sc {} = Sc> {}; +35 │ let Sc {} = Sc> {}; │ ^^^^^ -------- The type '0x42::M::Cup' does not have the ability 'copy' │ │ │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:30:21 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:35:21 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -254,19 +254,19 @@ error[E05001]: ability constraint not satisfied 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -30 │ let Sc {} = Sc> {}; +35 │ let Sc {} = Sc> {}; │ ^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup' does not have the ability 'copy' │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:31:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:13 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -31 │ let Sc {} = Sc> {}; +36 │ let Sc {} = Sc> {}; │ ^^^^^ -------- │ │ │ │ │ │ │ The type '0x42::M::Box<0x42::M::NoC>' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' @@ -274,12 +274,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:31:21 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:21 │ 13 │ struct Sc {} │ ---- 'copy' constraint declared here · -31 │ let Sc {} = Sc> {}; +36 │ let Sc {} = Sc> {}; │ ^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type '0x42::M::Box<0x42::M::NoC>' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' @@ -287,7 +287,7 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:32:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:13 │ 4 │ struct NoK has copy, drop, store {} │ --- To satisfy the constraint, the 'key' ability would need to be added here @@ -295,13 +295,13 @@ error[E05001]: ability constraint not satisfied 14 │ struct Sk {} │ --- 'key' constraint declared here · -32 │ let Sk {} = Sk {}; +37 │ let Sk {} = Sk {}; │ ^^^^^ --- The type '0x42::M::NoK' does not have the ability 'key' │ │ │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:32:21 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:21 │ 4 │ struct NoK has copy, drop, store {} │ --- To satisfy the constraint, the 'key' ability would need to be added here @@ -309,14 +309,14 @@ error[E05001]: ability constraint not satisfied 14 │ struct Sk {} │ --- 'key' constraint declared here · -32 │ let Sk {} = Sk {}; +37 │ let Sk {} = Sk {}; │ ^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::NoK' does not have the ability 'key' │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:33:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:38:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'key' ability would need to be added here @@ -324,13 +324,13 @@ error[E05001]: ability constraint not satisfied 14 │ struct Sk {} │ --- 'key' constraint declared here · -33 │ let Sk {} = Sk> {}; +38 │ let Sk {} = Sk> {}; │ ^^^^^ -------- The type '0x42::M::Cup' does not have the ability 'key' │ │ │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:33:21 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:38:21 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'key' ability would need to be added here @@ -338,19 +338,19 @@ error[E05001]: ability constraint not satisfied 14 │ struct Sk {} │ --- 'key' constraint declared here · -33 │ let Sk {} = Sk> {}; +38 │ let Sk {} = Sk> {}; │ ^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup' does not have the ability 'key' │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:34:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:39:13 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -34 │ let Sk {} = Sk>> {}; +39 │ let Sk {} = Sk>> {}; │ ^^^^^ ------------- │ │ │ │ │ │ │ The type '0x42::M::Box<0x42::M::Cup>' can have the ability 'key' but the type argument '0x42::M::Cup' does not have the required ability 'store' @@ -358,12 +358,12 @@ error[E05001]: ability constraint not satisfied │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:34:21 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:39:21 │ 14 │ struct Sk {} │ --- 'key' constraint declared here · -34 │ let Sk {} = Sk>> {}; +39 │ let Sk {} = Sk>> {}; │ ^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type '0x42::M::Box<0x42::M::Cup>' can have the ability 'key' but the type argument '0x42::M::Cup' does not have the required ability 'store' @@ -371,7 +371,7 @@ error[E05001]: ability constraint not satisfied │ 'key' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:35:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:40:13 │ 3 │ struct NoC has drop, store, key {} │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -379,13 +379,13 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -35 │ let Scds {} = Scds {}; +40 │ let Scds {} = Scds {}; │ ^^^^^^^ --- The type '0x42::M::NoC' does not have the ability 'copy' │ │ │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:35:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:40:23 │ 3 │ struct NoC has drop, store, key {} │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -393,14 +393,14 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -35 │ let Scds {} = Scds {}; +40 │ let Scds {} = Scds {}; │ ^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::NoC' does not have the ability 'copy' │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:41:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -408,13 +408,13 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -36 │ let Scds {} = Scds> {}; +41 │ let Scds {} = Scds> {}; │ ^^^^^^^ -------- The type '0x42::M::Cup' does not have the ability 'copy' │ │ │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:41:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'drop' ability would need to be added here @@ -422,13 +422,13 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'drop' constraint declared here · -36 │ let Scds {} = Scds> {}; +41 │ let Scds {} = Scds> {}; │ ^^^^^^^ -------- The type '0x42::M::Cup' does not have the ability 'drop' │ │ │ 'drop' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:41:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'store' ability would need to be added here @@ -436,13 +436,13 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ----- 'store' constraint declared here · -36 │ let Scds {} = Scds> {}; +41 │ let Scds {} = Scds> {}; │ ^^^^^^^ -------- The type '0x42::M::Cup' does not have the ability 'store' │ │ │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:41:23 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -450,14 +450,14 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -36 │ let Scds {} = Scds> {}; +41 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup' does not have the ability 'copy' │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:41:23 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'drop' ability would need to be added here @@ -465,14 +465,14 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'drop' constraint declared here · -36 │ let Scds {} = Scds> {}; +41 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup' does not have the ability 'drop' │ 'drop' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:36:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:41:23 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'store' ability would need to be added here @@ -480,14 +480,14 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ----- 'store' constraint declared here · -36 │ let Scds {} = Scds> {}; +41 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup' does not have the ability 'store' │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:42:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -495,13 +495,13 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -37 │ let Scds {} = Scds> {}; +42 │ let Scds {} = Scds> {}; │ ^^^^^^^ -------- The type '0x42::M::Cup<0x42::M::NoC>' does not have the ability 'copy' │ │ │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:42:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'drop' ability would need to be added here @@ -509,13 +509,13 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'drop' constraint declared here · -37 │ let Scds {} = Scds> {}; +42 │ let Scds {} = Scds> {}; │ ^^^^^^^ -------- The type '0x42::M::Cup<0x42::M::NoC>' does not have the ability 'drop' │ │ │ 'drop' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:42:13 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'store' ability would need to be added here @@ -523,13 +523,13 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ----- 'store' constraint declared here · -37 │ let Scds {} = Scds> {}; +42 │ let Scds {} = Scds> {}; │ ^^^^^^^ -------- The type '0x42::M::Cup<0x42::M::NoC>' does not have the ability 'store' │ │ │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:42:23 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'copy' ability would need to be added here @@ -537,14 +537,14 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -37 │ let Scds {} = Scds> {}; +42 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup<0x42::M::NoC>' does not have the ability 'copy' │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:42:23 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'drop' ability would need to be added here @@ -552,14 +552,14 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ---- 'drop' constraint declared here · -37 │ let Scds {} = Scds> {}; +42 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup<0x42::M::NoC>' does not have the ability 'drop' │ 'drop' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:37:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:42:23 │ 5 │ struct Cup { f: T } │ --- To satisfy the constraint, the 'store' ability would need to be added here @@ -567,19 +567,19 @@ error[E05001]: ability constraint not satisfied 15 │ struct Scds {} │ ----- 'store' constraint declared here · -37 │ let Scds {} = Scds> {}; +42 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::Cup<0x42::M::NoC>' does not have the ability 'store' │ 'store' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:38:13 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:43:13 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -38 │ let Scds {} = Scds> {}; +43 │ let Scds {} = Scds> {}; │ ^^^^^^^ -------------- │ │ │ │ │ │ │ The type '0x42::M::Pair' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' @@ -587,12 +587,12 @@ error[E05001]: ability constraint not satisfied │ 'copy' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:38:23 + ┌─ tests/move_check/typing/ability_constraint_structs_invalid.move:43:23 │ 15 │ struct Scds {} │ ---- 'copy' constraint declared here · -38 │ let Scds {} = Scds> {}; +43 │ let Scds {} = Scds> {}; │ ^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type '0x42::M::Pair' can have the ability 'copy' but the type argument '0x42::M::NoC' does not have the required ability 'copy' diff --git a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.move b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.move index f51edb3803c13..8359049cb4724 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.move +++ b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_structs_invalid.move @@ -26,6 +26,11 @@ module M { cds>(); cds>(); cds>(); + } + + /// Not all above errors are shown because of duplicate removal, + /// so some moved here. + fun t2() { let Sc {} = Sc {}; let Sc {} = Sc> {}; let Sc {} = Sc> {}; @@ -37,7 +42,5 @@ module M { let Scds {} = Scds> {}; let Scds {} = Scds> {}; } - - } } diff --git a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.exp b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.exp index 3060f5e037ece..278477f978df6 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.exp @@ -202,400 +202,12 @@ error[E05001]: ability constraint not satisfied │ │ The type '0x42::M::Pair' does not have the ability 'copy' │ 'copy' constraint not satisifed -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:31:13 - │ -11 │ struct Sc {} - │ ---- 'copy' constraint declared here - · -17 │ TnoC: drop + store + key, - │ ---- To satisfy the constraint, the 'copy' ability would need to be added here - · -31 │ let Sc {} = Sc {}; - │ ^^^^^ ---- The type 'TnoC' does not have the ability 'copy' - │ │ - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:31:21 - │ -11 │ struct Sc {} - │ ---- 'copy' constraint declared here - · -17 │ TnoC: drop + store + key, - │ ---- To satisfy the constraint, the 'copy' ability would need to be added here - · -31 │ let Sc {} = Sc {}; - │ ^^^^^^^^^^^ - │ │ │ - │ │ The type 'TnoC' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:32:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'copy' ability would need to be added here - · -11 │ struct Sc {} - │ ---- 'copy' constraint declared here - · -32 │ let Sc {} = Sc> {}; - │ ^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'copy' - │ │ - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:32:21 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'copy' ability would need to be added here - · -11 │ struct Sc {} - │ ---- 'copy' constraint declared here - · -32 │ let Sc {} = Sc> {}; - │ ^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:33:13 - │ -11 │ struct Sc {} - │ ---- 'copy' constraint declared here - · -33 │ let Sc {} = Sc> {}; - │ ^^^^^ --------- - │ │ │ │ - │ │ │ The type '0x42::M::Box' can have the ability 'copy' but the type argument 'TnoC' does not have the required ability 'copy' - │ │ The type '0x42::M::Box' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:33:21 - │ -11 │ struct Sc {} - │ ---- 'copy' constraint declared here - · -33 │ let Sc {} = Sc> {}; - │ ^^^^^^^^^^^^^^^^ - │ │ │ │ - │ │ │ The type '0x42::M::Box' can have the ability 'copy' but the type argument 'TnoC' does not have the required ability 'copy' - │ │ The type '0x42::M::Box' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:34:13 - │ -12 │ struct Sk {} - │ --- 'key' constraint declared here - · -18 │ TnoK: copy + drop + store, - │ ---- To satisfy the constraint, the 'key' ability would need to be added here - · -34 │ let Sk {} = Sk {}; - │ ^^^^^ ---- The type 'TnoK' does not have the ability 'key' - │ │ - │ 'key' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:34:21 - │ -12 │ struct Sk {} - │ --- 'key' constraint declared here - · -18 │ TnoK: copy + drop + store, - │ ---- To satisfy the constraint, the 'key' ability would need to be added here - · -34 │ let Sk {} = Sk {}; - │ ^^^^^^^^^^^ - │ │ │ - │ │ The type 'TnoK' does not have the ability 'key' - │ 'key' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:35:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'key' ability would need to be added here - · -12 │ struct Sk {} - │ --- 'key' constraint declared here - · -35 │ let Sk {} = Sk> {}; - │ ^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'key' - │ │ - │ 'key' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:35:21 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'key' ability would need to be added here - · -12 │ struct Sk {} - │ --- 'key' constraint declared here - · -35 │ let Sk {} = Sk> {}; - │ ^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'key' - │ 'key' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:36:13 - │ -12 │ struct Sk {} - │ --- 'key' constraint declared here - · -36 │ let Sk {} = Sk>> {}; - │ ^^^^^ -------------- - │ │ │ │ - │ │ │ The type '0x42::M::Box<0x42::M::Cup>' can have the ability 'key' but the type argument '0x42::M::Cup' does not have the required ability 'store' - │ │ The type '0x42::M::Box<0x42::M::Cup>' does not have the ability 'key' - │ 'key' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:36:21 - │ -12 │ struct Sk {} - │ --- 'key' constraint declared here - · -36 │ let Sk {} = Sk>> {}; - │ ^^^^^^^^^^^^^^^^^^^^^ - │ │ │ │ - │ │ │ The type '0x42::M::Box<0x42::M::Cup>' can have the ability 'key' but the type argument '0x42::M::Cup' does not have the required ability 'store' - │ │ The type '0x42::M::Box<0x42::M::Cup>' does not have the ability 'key' - │ 'key' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:37:13 - │ -13 │ struct Scds {} - │ ---- 'copy' constraint declared here - · -17 │ TnoC: drop + store + key, - │ ---- To satisfy the constraint, the 'copy' ability would need to be added here - · -37 │ let Scds {} = Scds {}; - │ ^^^^^^^ ---- The type 'TnoC' does not have the ability 'copy' - │ │ - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:37:23 - │ -13 │ struct Scds {} - │ ---- 'copy' constraint declared here - · -17 │ TnoC: drop + store + key, - │ ---- To satisfy the constraint, the 'copy' ability would need to be added here - · -37 │ let Scds {} = Scds {}; - │ ^^^^^^^^^^^^^ - │ │ │ - │ │ The type 'TnoC' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:38:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'copy' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'copy' constraint declared here - · -38 │ let Scds {} = Scds> {}; - │ ^^^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'copy' - │ │ - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:38:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'drop' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'drop' constraint declared here - · -38 │ let Scds {} = Scds> {}; - │ ^^^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'drop' - │ │ - │ 'drop' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:38:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'store' ability would need to be added here - · -13 │ struct Scds {} - │ ----- 'store' constraint declared here - · -38 │ let Scds {} = Scds> {}; - │ ^^^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'store' - │ │ - │ 'store' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:38:23 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'copy' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'copy' constraint declared here - · -38 │ let Scds {} = Scds> {}; - │ ^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:38:23 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'drop' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'drop' constraint declared here - · -38 │ let Scds {} = Scds> {}; - │ ^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'drop' - │ 'drop' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:38:23 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'store' ability would need to be added here - · -13 │ struct Scds {} - │ ----- 'store' constraint declared here - · -38 │ let Scds {} = Scds> {}; - │ ^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'store' - │ 'store' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:39:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'copy' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'copy' constraint declared here - · -39 │ let Scds {} = Scds> {}; - │ ^^^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'copy' - │ │ - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:39:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'drop' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'drop' constraint declared here - · -39 │ let Scds {} = Scds> {}; - │ ^^^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'drop' - │ │ - │ 'drop' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:39:13 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'store' ability would need to be added here - · -13 │ struct Scds {} - │ ----- 'store' constraint declared here - · -39 │ let Scds {} = Scds> {}; - │ ^^^^^^^ --------- The type '0x42::M::Cup' does not have the ability 'store' - │ │ - │ 'store' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:39:23 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'copy' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'copy' constraint declared here - · -39 │ let Scds {} = Scds> {}; - │ ^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:39:23 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'drop' ability would need to be added here - · -13 │ struct Scds {} - │ ---- 'drop' constraint declared here - · -39 │ let Scds {} = Scds> {}; - │ ^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'drop' - │ 'drop' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:39:23 - │ - 3 │ struct Cup { f: T } - │ --- To satisfy the constraint, the 'store' ability would need to be added here - · -13 │ struct Scds {} - │ ----- 'store' constraint declared here - · -39 │ let Scds {} = Scds> {}; - │ ^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ The type '0x42::M::Cup' does not have the ability 'store' - │ 'store' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:40:13 - │ -13 │ struct Scds {} - │ ---- 'copy' constraint declared here - · -40 │ let Scds {} = Scds> {}; - │ ^^^^^^^ --------------- - │ │ │ │ - │ │ │ The type '0x42::M::Pair' can have the ability 'copy' but the type argument 'TnoC' does not have the required ability 'copy' - │ │ The type '0x42::M::Pair' does not have the ability 'copy' - │ 'copy' constraint not satisifed - -error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:40:23 +error[E02001]: duplicate declaration, item, or annotation + ┌─ tests/move_check/typing/ability_constraint_tparams_invalid.move:35:9 │ -13 │ struct Scds {} - │ ---- 'copy' constraint declared here +16 │ fun t< + │ - Alias previously defined here · -40 │ let Scds {} = Scds> {}; - │ ^^^^^^^^^^^^^^^^^^^^^^^^ - │ │ │ │ - │ │ │ The type '0x42::M::Pair' can have the ability 'copy' but the type argument 'TnoC' does not have the required ability 'copy' - │ │ The type '0x42::M::Pair' does not have the ability 'copy' - │ 'copy' constraint not satisifed +35 │ fun t< + │ ^ Duplicate module member or alias 't'. Top level names in a namespace must be unique diff --git a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.move b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.move index 366e1cddadbf9..0aa8814a6fc66 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.move +++ b/third_party/move/move-compiler/tests/move_check/typing/ability_constraint_tparams_invalid.move @@ -28,6 +28,15 @@ module M { cds>(); cds>(); cds>(); + } + + /// Not all above errors are shown because of duplicate removal, + /// so some moved here. + fun t< + TnoC: drop + store + key, + TnoK: copy + drop + store, + T, + >() { let Sc {} = Sc {}; let Sc {} = Sc> {}; let Sc {} = Sc> {}; diff --git a/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg.exp b/third_party/move/move-compiler/tests/move_check/typing/acquires_error_msg.exp similarity index 83% rename from third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg.exp rename to third_party/move/move-compiler/tests/move_check/typing/acquires_error_msg.exp index f28c1ba4e27e3..6156694b71179 100644 --- a/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/acquires_error_msg.exp @@ -1,5 +1,5 @@ error[E04020]: missing acquires annotation - ┌─ tests/move_check/inlining/acquires_error_msg.move:7:9 + ┌─ tests/move_check/typing/acquires_error_msg.move:7:9 │ 7 │ modify(); // expect error message here │ ^^^^^^^^ The call acquires '0x42::test::Test', but the 'acquires' list for the current function 'call_modify_without_acquire` does not contain this type. It must be present in the calling context's acquires list diff --git a/third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg.move b/third_party/move/move-compiler/tests/move_check/typing/acquires_error_msg.move similarity index 100% rename from third_party/move/move-compiler/tests/move_check/inlining/acquires_error_msg.move rename to third_party/move/move-compiler/tests/move_check/typing/acquires_error_msg.move diff --git a/third_party/move/move-compiler/tests/move_check/typing/assign_nested2.exp b/third_party/move/move-compiler/tests/move_check/typing/assign_nested2.exp new file mode 100644 index 0000000000000..b63491b749fde --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/assign_nested2.exp @@ -0,0 +1,18 @@ +warning[W09003]: unused assignment + ┌─ tests/move_check/typing/assign_nested2.move:12:13 + │ +12 │ let r_ref = &mut r; + │ ^^^^^ Unused assignment or binding for local 'r_ref'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_r_ref') + +warning[W09003]: unused assignment + ┌─ tests/move_check/typing/assign_nested2.move:13:13 + │ +13 │ let s = S { f: 0 }; + │ ^ Unused assignment or binding for local 's'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_s') + +warning[W09003]: unused assignment + ┌─ tests/move_check/typing/assign_nested2.move:14:13 + │ +14 │ (_, x, _, _) = four(); + │ ^ Unused assignment or binding for local 'x'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_x') + diff --git a/third_party/move/move-compiler/tests/move_check/typing/assign_nested2.move b/third_party/move/move-compiler/tests/move_check/typing/assign_nested2.move new file mode 100644 index 0000000000000..17445eec24783 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/assign_nested2.move @@ -0,0 +1,17 @@ +module 0x8675309::A { + + struct S has drop { f: u64 } + + fun four(): (u64, u64, u64, u64) { + (0, 1, 2, 3) + } + + public fun mixed() { + let x: u64; + let r = 0; + let r_ref = &mut r; + let s = S { f: 0 }; + (_, x, _, _) = four(); + } + +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/block_with_statements_invalid2.exp b/third_party/move/move-compiler/tests/move_check/typing/block_with_statements_invalid2.exp new file mode 100644 index 0000000000000..36f604c72065c --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/block_with_statements_invalid2.exp @@ -0,0 +1,40 @@ +error[E04007]: incompatible types + ┌─ tests/move_check/typing/block_with_statements_invalid2.move:4:29 + │ +4 │ ({ let x = 0; x } : bool); + │ - ^^^^ + │ │ │ + │ │ Invalid type annotation + │ │ Expected: 'bool' + │ Given: integer + +error[E04007]: incompatible types + ┌─ tests/move_check/typing/block_with_statements_invalid2.move:5:30 + │ +5 │ ({ let x = 0; &x } : u64); + │ -- ^^^ + │ │ │ + │ │ Invalid type annotation + │ │ Expected: 'u64' + │ Given: '&{integer}' + +error[E04007]: incompatible types + ┌─ tests/move_check/typing/block_with_statements_invalid2.move:6:40 + │ +6 │ ({ let y = 0; &mut (y + 1) } : ()); + │ ------------ ^^ + │ │ │ + │ │ Invalid type annotation + │ │ Expected: '()' + │ Given: '&mut {integer}' + +error[E04007]: incompatible types + ┌─ tests/move_check/typing/block_with_statements_invalid2.move:8:45 + │ +8 │ ({ let x = 0; (x, false, false) } : (u64, bool)); + │ ----------------- ^^^^^^^^^^^ + │ │ │ + │ │ Invalid type annotation + │ │ Expected expression list of length 2: '(u64, bool)' + │ Given expression list of length 3: '({integer}, bool, bool)' + diff --git a/third_party/move/move-compiler/tests/move_check/typing/block_with_statements_invalid2.move b/third_party/move/move-compiler/tests/move_check/typing/block_with_statements_invalid2.move new file mode 100644 index 0000000000000..eb5ab484dcbb7 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/block_with_statements_invalid2.move @@ -0,0 +1,10 @@ +module 0x8675309::M { + struct R has drop {} + fun t0() { + ({ let x = 0; x } : bool); + ({ let x = 0; &x } : u64); + ({ let y = 0; &mut (y + 1) } : ()); + ({ let r = { let r = R {}; r }; r } : R); + ({ let x = 0; (x, false, false) } : (u64, bool)); + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/declare_duplicate_binding2.exp b/third_party/move/move-compiler/tests/move_check/typing/declare_duplicate_binding2.exp new file mode 100644 index 0000000000000..3d10ead182b53 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/declare_duplicate_binding2.exp @@ -0,0 +1,18 @@ +warning[W09003]: unused assignment + ┌─ tests/move_check/typing/declare_duplicate_binding2.move:7:9 + │ +7 │ x = 0; + │ ^ Unused assignment or binding for local 'x'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_x') + +warning[W09003]: unused assignment + ┌─ tests/move_check/typing/declare_duplicate_binding2.move:8:9 + │ +8 │ f = 0; + │ ^ Unused assignment or binding for local 'f'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_f') + +warning[W09003]: unused assignment + ┌─ tests/move_check/typing/declare_duplicate_binding2.move:9:9 + │ +9 │ g = 0; + │ ^ Unused assignment or binding for local 'g'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_g') + diff --git a/third_party/move/move-compiler/tests/move_check/typing/declare_duplicate_binding2.move b/third_party/move/move-compiler/tests/move_check/typing/declare_duplicate_binding2.move new file mode 100644 index 0000000000000..9620607e1e8cb --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/declare_duplicate_binding2.move @@ -0,0 +1,11 @@ +module 0x8675309::M { + struct R {f: u64} + + fun t0() { + let (x); + let (f, R{f: g}); + x = 0; + f = 0; + g = 0; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/eq_invalid2.exp b/third_party/move/move-compiler/tests/move_check/typing/eq_invalid2.exp new file mode 100644 index 0000000000000..593f1c61ce5f4 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/eq_invalid2.exp @@ -0,0 +1,55 @@ +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/eq_invalid2.move:11:9 + │ + 3 │ struct R has key { + │ - To satisfy the constraint, the 'drop' ability would need to be added here + · +10 │ fun t1(r: R) { + │ - The type '0x8675309::M::R' does not have the ability 'drop' +11 │ r == r; + │ ^ '==' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/eq_invalid2.move:11:14 + │ + 3 │ struct R has key { + │ - To satisfy the constraint, the 'drop' ability would need to be added here + · +10 │ fun t1(r: R) { + │ - The type '0x8675309::M::R' does not have the ability 'drop' +11 │ r == r; + │ ^ '==' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + +error[E06002]: use of unassigned variable + ┌─ tests/move_check/typing/eq_invalid2.move:11:14 + │ +11 │ r == r; + │ - ^ Invalid usage of previously moved variable 'r'. + │ │ + │ The value of 'r' was previously moved here. + │ Suggestion: use 'copy r' to avoid the move. + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/eq_invalid2.move:15:9 + │ + 7 │ struct G1 { f: T } + │ -- To satisfy the constraint, the 'drop' ability would need to be added here + · +15 │ G1{ f: t } == G1{ f: t }; + │ ^^^^^^^^^^ + │ │ + │ '==' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + │ The type '0x8675309::M::G1' does not have the ability 'drop' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/eq_invalid2.move:15:23 + │ + 7 │ struct G1 { f: T } + │ -- To satisfy the constraint, the 'drop' ability would need to be added here + · +15 │ G1{ f: t } == G1{ f: t }; + │ ^^^^^^^^^^ + │ │ + │ '==' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + │ The type '0x8675309::M::G1' does not have the ability 'drop' + diff --git a/third_party/move/move-compiler/tests/move_check/typing/eq_invalid2.move b/third_party/move/move-compiler/tests/move_check/typing/eq_invalid2.move new file mode 100644 index 0000000000000..6e35450a894d1 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/eq_invalid2.move @@ -0,0 +1,17 @@ +module 0x8675309::M { + struct S { u: u64 } + struct R has key { + f: u64 + } + struct G0 has drop { f: T } + struct G1 { f: T } + struct G2 has drop {} + + fun t1(r: R) { + r == r; + } + + fun t3(t: T) { + G1{ f: t } == G1{ f: t }; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource2.exp b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource2.exp new file mode 100644 index 0000000000000..2bf95b6667645 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource2.exp @@ -0,0 +1,6 @@ +error[E04010]: cannot infer type + ┌─ tests/move_check/typing/ignore_inferred_resource2.move:4:9 + │ +4 │ S{}; + │ ^^^ Cannot infer the type parameter `T` for generic struct `0x8675309::M::S`. Try providing a type parameter. + diff --git a/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource2.move b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource2.move new file mode 100644 index 0000000000000..7c271d25b02b1 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource2.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + struct S has drop {} + fun no() { + S{}; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource3.move b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource3.move new file mode 100644 index 0000000000000..4cede30b50822 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource3.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + struct S has drop {} + fun no() { + S{}; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource4.move b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource4.move new file mode 100644 index 0000000000000..fa29aa768979d --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/ignore_inferred_resource4.move @@ -0,0 +1,6 @@ +module 0x8675309::M { + struct S has drop {} + fun no() { + S{}; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.exp b/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.exp index dbddfb2ed0772..a39688a480a04 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.exp @@ -90,91 +90,91 @@ error[E04004]: expected a single non-reference type │ Invalid type argument error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/instantiate_signatures.move:23:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:28:9 │ 3 │ struct S has drop { f: T } │ ---- 'drop' constraint declared here 4 │ struct R {} │ - To satisfy the constraint, the 'drop' ability would need to be added here · -23 │ S, +28 │ S, │ ^^^^ │ │ │ │ │ The type '0x42::M::R' does not have the ability 'drop' │ 'drop' constraint not satisifed error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:24:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:29:9 │ -24 │ S<&u64>, +29 │ S<&u64>, │ ^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '&u64' │ Invalid type argument error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:25:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:30:9 │ -25 │ &(&u64), +30 │ &(&u64), │ ^^^^^^^ │ ││ │ │Expected a single non-reference type, but found: '&u64' │ Invalid reference type error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:26:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:31:9 │ -26 │ S<(u64, u64)>, +31 │ S<(u64, u64)>, │ ^^^^^^^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '(u64, u64)' │ Invalid type argument error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/instantiate_signatures.move:32:17 + ┌─ tests/move_check/typing/instantiate_signatures.move:37:17 │ 3 │ struct S has drop { f: T } │ ---- 'drop' constraint declared here 4 │ struct R {} │ - To satisfy the constraint, the 'drop' ability would need to be added here · -32 │ let f1: S = abort 0; +37 │ let f1: S = abort 0; │ ^^^^ │ │ │ │ │ The type '0x42::M::R' does not have the ability 'drop' │ 'drop' constraint not satisifed error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:33:17 + ┌─ tests/move_check/typing/instantiate_signatures.move:38:17 │ -33 │ let f2: S<&u64> = abort 0; +38 │ let f2: S<&u64> = abort 0; │ ^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '&u64' │ Invalid type argument error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:34:17 + ┌─ tests/move_check/typing/instantiate_signatures.move:39:17 │ -34 │ let f3: &(&u64) = abort 0; +39 │ let f3: &(&u64) = abort 0; │ ^^^^^^^ │ ││ │ │Expected a single non-reference type, but found: '&u64' │ Invalid reference type error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:35:17 + ┌─ tests/move_check/typing/instantiate_signatures.move:40:17 │ -35 │ let f4: S<(u64, u64)> = abort 0; +40 │ let f4: S<(u64, u64)> = abort 0; │ ^^^^^^^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '(u64, u64)' │ Invalid type argument error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/instantiate_signatures.move:37:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:42:9 │ -37 │ id>(abort 0); +42 │ id>(abort 0); │ ^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type '0x42::M::S<0x42::M::R>' can have the ability 'drop' but the type argument '0x42::M::R' does not have the required ability 'drop' @@ -182,62 +182,62 @@ error[E05001]: ability constraint not satisfied │ Cannot ignore values without the 'drop' ability. The value must be used error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/instantiate_signatures.move:37:12 + ┌─ tests/move_check/typing/instantiate_signatures.move:42:12 │ 3 │ struct S has drop { f: T } │ ---- 'drop' constraint declared here 4 │ struct R {} │ - To satisfy the constraint, the 'drop' ability would need to be added here · -37 │ id>(abort 0); +42 │ id>(abort 0); │ ^^^^ │ │ │ │ │ The type '0x42::M::R' does not have the ability 'drop' │ 'drop' constraint not satisifed error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:38:12 + ┌─ tests/move_check/typing/instantiate_signatures.move:43:12 │ -38 │ id>(abort 0); +43 │ id>(abort 0); │ ^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '&u64' │ Invalid type argument error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:39:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:44:9 │ -39 │ id<&(&u64)>(abort 0); +44 │ id<&(&u64)>(abort 0); │ ^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '&&u64' │ Invalid type argument error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:39:12 + ┌─ tests/move_check/typing/instantiate_signatures.move:44:12 │ -39 │ id<&(&u64)>(abort 0); +44 │ id<&(&u64)>(abort 0); │ ^^^^^^^ │ ││ │ │Expected a single non-reference type, but found: '&u64' │ Invalid reference type error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:40:12 + ┌─ tests/move_check/typing/instantiate_signatures.move:45:12 │ -40 │ id>(abort 0); +45 │ id>(abort 0); │ ^^^^^^^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '(u64, u64)' │ Invalid type argument error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/instantiate_signatures.move:42:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:47:9 │ 3 │ struct S has drop { f: T } │ ---- 'drop' constraint declared here · -42 │ S> { f: abort 0 }; +47 │ S> { f: abort 0 }; │ ^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ │ │ The type '0x42::M::S<0x42::M::R>' can have the ability 'drop' but the type argument '0x42::M::R' does not have the required ability 'drop' @@ -245,9 +245,9 @@ error[E05001]: ability constraint not satisfied │ 'drop' constraint not satisifed error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/instantiate_signatures.move:42:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:47:9 │ -42 │ S> { f: abort 0 }; +47 │ S> { f: abort 0 }; │ ^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ The type '0x42::M::S<0x42::M::S<0x42::M::R>>' can have the ability 'drop' but the type argument '0x42::M::S<0x42::M::R>' does not have the required ability 'drop' @@ -255,50 +255,50 @@ error[E05001]: ability constraint not satisfied │ The type '0x42::M::S<0x42::M::S<0x42::M::R>>' does not have the ability 'drop' error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/typing/instantiate_signatures.move:42:11 + ┌─ tests/move_check/typing/instantiate_signatures.move:47:11 │ 3 │ struct S has drop { f: T } │ ---- 'drop' constraint declared here 4 │ struct R {} │ - To satisfy the constraint, the 'drop' ability would need to be added here · -42 │ S> { f: abort 0 }; +47 │ S> { f: abort 0 }; │ ^^^^ │ │ │ │ │ The type '0x42::M::R' does not have the ability 'drop' │ 'drop' constraint not satisifed error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:43:11 + ┌─ tests/move_check/typing/instantiate_signatures.move:48:11 │ -43 │ S> { f: abort 0 }; +48 │ S> { f: abort 0 }; │ ^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '&u64' │ Invalid type argument error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:44:9 + ┌─ tests/move_check/typing/instantiate_signatures.move:49:9 │ -44 │ S<&(&u64)> { f: abort 0 }; +49 │ S<&(&u64)> { f: abort 0 }; │ ^^^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '&&u64' │ Invalid type argument error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:44:11 + ┌─ tests/move_check/typing/instantiate_signatures.move:49:11 │ -44 │ S<&(&u64)> { f: abort 0 }; +49 │ S<&(&u64)> { f: abort 0 }; │ ^^^^^^^ │ ││ │ │Expected a single non-reference type, but found: '&u64' │ Invalid reference type error[E04004]: expected a single non-reference type - ┌─ tests/move_check/typing/instantiate_signatures.move:45:11 + ┌─ tests/move_check/typing/instantiate_signatures.move:50:11 │ -45 │ S> { f: abort 0 }; +50 │ S> { f: abort 0 }; │ ^^^^^^^^^^^^^ │ │ │ │ │ Expected a single non-reference type, but found: '(u64, u64)' diff --git a/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.move b/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.move index 33f84f31b4ae2..60b7cf1aa0beb 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.move +++ b/third_party/move/move-compiler/tests/move_check/typing/instantiate_signatures.move @@ -14,11 +14,16 @@ module M { f4: S<(u64, u64)>, } - fun f1( + fun f1a( _f1: S, _f2: S<&u64>, _f3: &(&u64), _f4: S<(u64, u64)>, + ) { + abort 0 + } + + fun f1b( ): ( S, S<&u64>, diff --git a/third_party/move/move-compiler/tests/move_check/typing/lambda.exp b/third_party/move/move-compiler/tests/move_check/typing/lambda.exp index fe323295ea9ec..e59ad1ba145cf 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/lambda.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/lambda.exp @@ -40,7 +40,7 @@ error[E04007]: incompatible types error[E04007]: incompatible types ┌─ tests/move_check/typing/lambda.move:61:9 │ -61 │ x(1) +61 │ x(1) // expected to be not a function │ ^ Expected a function type but found 'u64' error[E04007]: incompatible types diff --git a/third_party/move/move-compiler/tests/move_check/typing/lambda.move b/third_party/move/move-compiler/tests/move_check/typing/lambda.move index 8679dacf0ef02..c5e29275c3d28 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/lambda.move +++ b/third_party/move/move-compiler/tests/move_check/typing/lambda.move @@ -58,7 +58,7 @@ module 0x8675309::M { } public fun wrong_local_call_no_fun(x: u64) { - x(1) + x(1) // expected to be not a function } public fun wrong_lambda_inferred_type() { diff --git a/third_party/move/move-compiler/tests/move_check/typing/lambda2.exp b/third_party/move/move-compiler/tests/move_check/typing/lambda2.exp new file mode 100644 index 0000000000000..073ed797528e3 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/lambda2.exp @@ -0,0 +1,30 @@ +error[E04024]: invalid usage of function type + ┌─ tests/move_check/typing/lambda2.move:77:18 + │ +77 │ let _x = |i| i + 1; // expected lambda not allowed + │ ^^^^^^^^^ function type only allowed for inline function arguments + +error[E04024]: invalid usage of function type + ┌─ tests/move_check/typing/lambda2.move:81:12 + │ +81 │ f: |u64|u64, // expected lambda not allowed + │ ^^^^^^^^ function type only allowed for inline function arguments + +error[E04024]: invalid usage of function type + ┌─ tests/move_check/typing/lambda2.move:84:46 + │ +84 │ public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed + │ ^^^^^ function type only allowed for inline function arguments + +error[E04024]: invalid usage of function type + ┌─ tests/move_check/typing/lambda2.move:86:58 + │ +86 │ public inline fun macro_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + │ ^^^^^ function type only allowed for inline function arguments + +error[E04024]: invalid usage of function type + ┌─ tests/move_check/typing/lambda2.move:89:49 + │ +89 │ public fun fun_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + │ ^^^^^ function type only allowed for inline function arguments + diff --git a/third_party/move/move-compiler/tests/move_check/typing/lambda2.move b/third_party/move/move-compiler/tests/move_check/typing/lambda2.move new file mode 100644 index 0000000000000..50bdd1270ce25 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/lambda2.move @@ -0,0 +1,100 @@ +module 0x8675309::M { + // use 0x1::XVector; + + // public inline fun foreach(v: &vector, action: |&T|) { // expected to be not implemented + // let i = 0; + // while (i < XVector::length(v)) { + // action(XVector::borrow(v, i)); + // i = i + 1; + // } + // } + + // public inline fun reduce(v: vector, accu: R, reducer: |T, R|R): R { + // while (!XVector::is_empty(&v)) { + // accu = reducer(XVector::pop_back(&mut v), accu); + // }; + // accu + // } + + + // public fun correct_foreach() { + // let v = vector[1, 2, 3]; + // let sum = 0; + // foreach(&v, |e| sum = sum + *e) // expected to be not implemented + // } + + // public fun correct_reduce(): u64 { + // let v = vector[1, 2, 3]; + // reduce(v, 0, |t, r| t + r) + // } + + // public fun corrected_nested() { + // let v = vector[vector[1,2], vector[3]]; + // let sum = 0; + // foreach(&v, |e| sum = sum + reduce!(*e, 0, |t, r| t + r)); + // } + + // public inline fun wrong_local_call_arg_count(v: &vector, action: |&T|) { + // let i = 0; + // while (i < XVector::length(v)) { + // action(XVector::borrow(v, i), i); // expected to have wrong argument count + // i = i + 1; + // } + // } + + // public inline fun wrong_local_call_arg_type(v: &vector, action: |&T|) { + // let i = 0; + // while (i < XVector::length(v)) { + // action(i); // expected to have wrong argument type + // i = i + 1; + // } + // } + + // public inline fun wrong_local_call_result_type(v: &vector, action: |&T|) { + // let i = 0; + // while (i < XVector::length(v)) { + // i = i + action(XVector::borrow(v, i)); // expected to have wrong result type + // } + // } + + // public fun wrong_local_call_no_fun(x: u64) { + // x(1) // expected to be not a function + // } + + // public fun wrong_lambda_inferred_type() { + // let v = vector[1, 2, 3]; + // let sum = 0; + // foreach(&v, |e| sum = sum + e) // expected to cannot infer type + // } + + // public fun wrong_lambda_result_type() { + // let v = vector[1, 2, 3]; + // let sum = 0; + // foreach(&v, |e| { sum = sum + *e; *e }) // expected to have wrong result type of lambda + // } + + public fun lambda_not_allowed() { + let _x = |i| i + 1; // expected lambda not allowed + } + + struct FieldFunNotAllowed { + f: |u64|u64, // expected lambda not allowed + } + + public fun fun_arg_lambda_not_allowed(x: |u64|) {} // expected lambda not allowed + + public inline fun macro_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + abort (1) + } + public fun fun_result_lambda_not_allowed(): |u64| { // expected lambda not allowed + abort (1) + } + +} + +// module 0x1::XVector { +// public fun length(v: &vector): u64 { abort(1) } +// public fun is_empty(v: &vector): bool { abort(1) } +// public fun borrow(v: &vector, i: u64): &T { abort(1) } +// public fun pop_back(v: &mut vector): T { abort(1) } +// } diff --git a/third_party/move/move-compiler/tests/move_check/typing/mutable_borrow_from_immutable2.exp b/third_party/move/move-compiler/tests/move_check/typing/mutable_borrow_from_immutable2.exp new file mode 100644 index 0000000000000..500988d3a132b --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/mutable_borrow_from_immutable2.exp @@ -0,0 +1,51 @@ +error[E07001]: referential transparency violated + ┌─ tests/move_check/typing/mutable_borrow_from_immutable2.move:6:9 + │ +6 │ &mut (&s).v; + │ ^^^^^^^^^^^ + │ │ │ + │ │ Immutable because of this position + │ Invalid mutable borrow from an immutable reference + +error[E07001]: referential transparency violated + ┌─ tests/move_check/typing/mutable_borrow_from_immutable2.move:10:9 + │ +10 │ &mut (&s.x).f; + │ ^^^^^^^^^^^^^ + │ │ │ + │ │ Immutable because of this position + │ Invalid mutable borrow from an immutable reference + +error[E07001]: referential transparency violated + ┌─ tests/move_check/typing/mutable_borrow_from_immutable2.move:15:9 + │ +14 │ let sref = &s; + │ -- Immutable because of this position +15 │ &mut sref.v; + │ ^^^^^^^^^^^ Invalid mutable borrow from an immutable reference + +error[E07001]: referential transparency violated + ┌─ tests/move_check/typing/mutable_borrow_from_immutable2.move:20:9 + │ +19 │ let xref = &s.x; + │ ---- Immutable because of this position +20 │ &mut xref.f; + │ ^^^^^^^^^^^ Invalid mutable borrow from an immutable reference + +error[E07001]: referential transparency violated + ┌─ tests/move_check/typing/mutable_borrow_from_immutable2.move:24:9 + │ +23 │ fun t2(s: &S, x: &X) { + │ -- Immutable because of this position +24 │ x.f = x.f + 1; + │ ^^^ Invalid mutable borrow from an immutable reference + +error[E07001]: referential transparency violated + ┌─ tests/move_check/typing/mutable_borrow_from_immutable2.move:25:9 + │ +23 │ fun t2(s: &S, x: &X) { + │ -- Immutable because of this position +24 │ x.f = x.f + 1; +25 │ s.x.f = s.x.f + 1 + │ ^^^^^ Invalid mutable borrow from an immutable reference + diff --git a/third_party/move/move-compiler/tests/move_check/typing/mutable_borrow_from_immutable2.move b/third_party/move/move-compiler/tests/move_check/typing/mutable_borrow_from_immutable2.move new file mode 100644 index 0000000000000..335087ed41dc0 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/mutable_borrow_from_immutable2.move @@ -0,0 +1,27 @@ +module 0x8675309::M { + struct X { f: u64 } + struct S { v: u64, x: X } + fun t() { + let s = S { v: 0, x: X { f: 0 }}; + &mut (&s).v; + } + fun t1a() { + let s = S { v: 0, x: X { f: 0 }}; + &mut (&s.x).f; + } + fun t1b() { + let s = S { v: 0, x: X { f: 0 }}; + let sref = &s; + &mut sref.v; + } + fun t1c() { + let s = S { v: 0, x: X { f: 0 }}; + let xref = &s.x; + &mut xref.f; + } + + fun t2(s: &S, x: &X) { + x.f = x.f + 1; + s.x.f = s.x.f + 1 + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/neq_invalid2.exp b/third_party/move/move-compiler/tests/move_check/typing/neq_invalid2.exp new file mode 100644 index 0000000000000..d04996b2e2aa7 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/neq_invalid2.exp @@ -0,0 +1,94 @@ +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:17:9 + │ + 2 │ struct S { u: u64 } + │ - To satisfy the constraint, the 'drop' ability would need to be added here + · +12 │ fun t0(s: S, s2: S) { + │ - The type '0x8675309::M::S' does not have the ability 'drop' + · +17 │ s != s2; + │ ^ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:17:14 + │ + 2 │ struct S { u: u64 } + │ - To satisfy the constraint, the 'drop' ability would need to be added here + · +12 │ fun t0(s: S, s2: S) { + │ - The type '0x8675309::M::S' does not have the ability 'drop' + · +17 │ s != s2; + │ ^^ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:22:9 + │ + 3 │ struct R { + │ - To satisfy the constraint, the 'drop' ability would need to be added here + · +21 │ fun t1(r1: R, r2: R) { + │ - The type '0x8675309::M::R' does not have the ability 'drop' +22 │ r1 != r2; + │ ^^ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:22:15 + │ + 3 │ struct R { + │ - To satisfy the constraint, the 'drop' ability would need to be added here + · +21 │ fun t1(r1: R, r2: R) { + │ - The type '0x8675309::M::R' does not have the ability 'drop' +22 │ r1 != r2; + │ ^^ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:27:9 + │ + 7 │ struct G1 {} + │ -- To satisfy the constraint, the 'drop' ability would need to be added here + · +27 │ G1{} != G1{}; + │ ^^^^^^^^^ + │ │ + │ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + │ The type '0x8675309::M::G1<0x8675309::M::Key>' does not have the ability 'drop' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:27:22 + │ + 7 │ struct G1 {} + │ -- To satisfy the constraint, the 'drop' ability would need to be added here + · +27 │ G1{} != G1{}; + │ ^^^^^^^^^ + │ │ + │ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + │ The type '0x8675309::M::G1<0x8675309::M::Key>' does not have the ability 'drop' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:28:9 + │ + 8 │ struct G2 {} + │ -- To satisfy the constraint, the 'drop' ability would need to be added here + · +28 │ G2{} != G2{}; + │ ^^^^^^^^^ + │ │ + │ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + │ The type '0x8675309::M::G2<0x8675309::M::Key>' does not have the ability 'drop' + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/neq_invalid2.move:28:22 + │ + 8 │ struct G2 {} + │ -- To satisfy the constraint, the 'drop' ability would need to be added here + · +28 │ G2{} != G2{}; + │ ^^^^^^^^^ + │ │ + │ '!=' requires the 'drop' ability as the value is consumed. Try borrowing the values with '&' first.' + │ The type '0x8675309::M::G2<0x8675309::M::Key>' does not have the ability 'drop' + diff --git a/third_party/move/move-compiler/tests/move_check/typing/neq_invalid2.move b/third_party/move/move-compiler/tests/move_check/typing/neq_invalid2.move new file mode 100644 index 0000000000000..e8bfbd6af0a36 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/neq_invalid2.move @@ -0,0 +1,30 @@ +module 0x8675309::M { + struct S { u: u64 } + struct R { + f: u64 + } + struct G0 has drop {} + struct G1 {} + struct G2 {} + struct Key has key {} + + // Leave out test cases and edit code to avoid shadowing drop errors here. + fun t0(s: S, s2: S) { + // (0: u8) != (1: u128); + // 0 != false; + // &0 != 1; + // 1 != &0; + s != s2; + // s_mut != s; + } + + fun t1(r1: R, r2: R) { + r1 != r2; + } + + fun t3() { + G0{} != G0{}; + G1{} != G1{}; + G2{} != G2{}; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/pack_constraint_not_satisfied2.exp b/third_party/move/move-compiler/tests/move_check/typing/pack_constraint_not_satisfied2.exp new file mode 100644 index 0000000000000..1930b2fc3f415 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/pack_constraint_not_satisfied2.exp @@ -0,0 +1,23 @@ +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/pack_constraint_not_satisfied2.move:7:9 + │ +3 │ struct R { r: T } + │ --- 'key' constraint declared here + · +7 │ R {r:_ } = R { r: 0 }; + │ ^^^^^^^^ - The type 'u64' does not have the ability 'key' + │ │ + │ 'key' constraint not satisifed + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/pack_constraint_not_satisfied2.move:7:20 + │ +3 │ struct R { r: T } + │ --- 'key' constraint declared here + · +7 │ R {r:_ } = R { r: 0 }; + │ ^^^^^^^^^^ + │ │ │ + │ │ The type 'u64' does not have the ability 'key' + │ 'key' constraint not satisifed + diff --git a/third_party/move/move-compiler/tests/move_check/typing/pack_constraint_not_satisfied2.move b/third_party/move/move-compiler/tests/move_check/typing/pack_constraint_not_satisfied2.move new file mode 100644 index 0000000000000..c508612afb679 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/pack_constraint_not_satisfied2.move @@ -0,0 +1,10 @@ +module 0x8675309::M { + struct Coin {} + struct R { r: T } + struct S has drop { c: T } + + fun t0() { + R {r:_ } = R { r: 0 }; + // S { c: Coin {} }; + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid2.exp b/third_party/move/move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid2.exp new file mode 100644 index 0000000000000..9192bb3f31d92 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid2.exp @@ -0,0 +1,45 @@ +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/phantom_param_op_abilities_invalid2.move:11:10 + │ +10 │ fun f1(ref: &mut HasDrop) { + │ --------------------------------- + │ │ │ + │ │ The type '0x42::M::HasDrop<0x42::M::NoAbilities, 0x42::M::NoAbilities>' can have the ability 'drop' but the type argument '0x42::M::NoAbilities' does not have the required ability 'drop' + │ The type '0x42::M::HasDrop<0x42::M::NoAbilities, 0x42::M::NoAbilities>' does not have the ability 'drop' +11 │ *ref = HasDrop { a: NoAbilities { } }; + │ ^^^ Invalid mutation. Mutation requires the 'drop' ability as the old value is destroyed + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/phantom_param_op_abilities_invalid2.move:16:9 + │ +16 │ _ = HasDrop { a: NoAbilities { } }; + │ ^ -------------------------------------------------------- + │ │ │ │ + │ │ │ The type '0x42::M::HasDrop<0x42::M::NoAbilities, 0x42::M::NoAbilities>' can have the ability 'drop' but the type argument '0x42::M::NoAbilities' does not have the required ability 'drop' + │ │ The type '0x42::M::HasDrop<0x42::M::NoAbilities, 0x42::M::NoAbilities>' does not have the ability 'drop' + │ Cannot ignore values without the 'drop' ability. The value must be used + +error[E06001]: unused value without 'drop' + ┌─ tests/move_check/typing/phantom_param_op_abilities_invalid2.move:20:51 + │ +20 │ fun f3(_x: HasDrop) { + │ -- --------------------------------- + │ │ │ │ + │ │ │ The type '0x42::M::HasDrop<0x42::M::NoAbilities, 0x42::M::NoAbilities>' can have the ability 'drop' but the type argument '0x42::M::NoAbilities' does not have the required ability 'drop' + │ │ The type '0x42::M::HasDrop<0x42::M::NoAbilities, 0x42::M::NoAbilities>' does not have the ability 'drop' + │ The parameter '_x' still contains a value. The value does not have the 'drop' ability and must be consumed before the function returns + │ ╭───────────────────────────────────────────────────^ +21 │ │ } + │ ╰─────^ Invalid return + +error[E05001]: ability constraint not satisfied + ┌─ tests/move_check/typing/phantom_param_op_abilities_invalid2.move:25:10 + │ +24 │ fun f4(x: HasCopy): (HasCopy, HasCopy) { + │ --------------------------------- + │ │ │ + │ │ The type '0x42::M::HasCopy<0x42::M::NoAbilities, 0x42::M::NoAbilities>' can have the ability 'copy' but the type argument '0x42::M::NoAbilities' does not have the required ability 'copy' + │ The type '0x42::M::HasCopy<0x42::M::NoAbilities, 0x42::M::NoAbilities>' does not have the ability 'copy' +25 │ (copy x, x) + │ ^^^^^^ Invalid 'copy' of owned value without the 'copy' ability + diff --git a/third_party/move/move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid2.move b/third_party/move/move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid2.move new file mode 100644 index 0000000000000..e903ea8103fd6 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/phantom_param_op_abilities_invalid2.move @@ -0,0 +1,27 @@ +module 0x42::M { + struct NoAbilities { } + struct HasDrop has drop { a: T2 } + struct HasCopy has copy { a: T2 } + struct HasStore has store { a: T2} + struct HasKey has key { a : T2 } + struct RequireStore { a: T } + + // Writing to a references requires drop + fun f1(ref: &mut HasDrop) { + *ref = HasDrop { a: NoAbilities { } }; + } + + // Ignoring values requires drop + fun f2() { + _ = HasDrop { a: NoAbilities { } }; + } + + // Leaving value in local requires drop + fun f3(_x: HasDrop) { + } + + // `copy` requires copy + fun f4(x: HasCopy): (HasCopy, HasCopy) { + (copy x, x) + } +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.exp b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.exp new file mode 100644 index 0000000000000..058f17f7e76d1 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.exp @@ -0,0 +1,12 @@ +error[E04013]: invalid statement or expression in constant + ┌─ tests/move_check/typing/recursive_constant.move:3:20 + │ +3 │ const X: u64 = Y; + │ ^ Other constants are not supported in constants + +error[E04013]: invalid statement or expression in constant + ┌─ tests/move_check/typing/recursive_constant.move:4:20 + │ +4 │ const Y: u64 = X; + │ ^ Other constants are not supported in constants + diff --git a/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.move b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.move new file mode 100644 index 0000000000000..bf342fcfa6282 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.move @@ -0,0 +1,15 @@ +address 0x42 { +module M { + const X: u64 = Y; + const Y: u64 = X; + const Z: u64 = 0; + + public fun get_x(): u64 { + X + } + + public fun get_y(): u64 { + Y + } +} +} diff --git a/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.exp b/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.exp new file mode 100644 index 0000000000000..599adc18c6143 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.exp @@ -0,0 +1,6 @@ +error[E03004]: unbound type + ┌─ tests/move_check/unit_test/cross_module_members_non_test_function2.move:25:23 + │ +25 │ public fun bad(): Foo { + │ ^^^ Unbound type 'Foo' in current scope + diff --git a/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.move b/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.move new file mode 100644 index 0000000000000..d182b6e683f9a --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.move @@ -0,0 +1,29 @@ +// check that `use`'s are filtered out correctly in non-test mode +address 0x1 { +module A { + struct Foo has drop {} + + public fun build_foo(): Foo { Foo {} } +} + +module B { + use 0x1::A; + + #[test_only] + use 0x1::A::Foo; + + #[test_only] + fun x(_: Foo) { } + + #[test] + fun tester() { + x(A::build_foo()) + } + + // this should fail find the Foo result type as the use statement + // is test_only. + public fun bad(): Foo { + A::build_foo() + } +} +} diff --git a/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.unit_test b/third_party/move/move-compiler/tests/move_check/unit_test/cross_module_members_non_test_function2.unit_test new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/third_party/move/move-compiler/tests/move_check/v2-not-supported/no_receiver_calls.move b/third_party/move/move-compiler/tests/move_check/v2-not-supported/no_receiver_calls.move index ea0592b41721b..f442a7c6e5ddf 100644 --- a/third_party/move/move-compiler/tests/move_check/v2-not-supported/no_receiver_calls.move +++ b/third_party/move/move-compiler/tests/move_check/v2-not-supported/no_receiver_calls.move @@ -1,7 +1,7 @@ module 0x42::m { - struct T {} + struct T has drop {} - fun receiver(self: &T, x: u64) { abort 1 } + fun receiver(self: &T, _x: u64) { abort 1 } fun call_receiver(t: T) { t.receiver(1); diff --git a/third_party/move/move-compiler/tests/move_check/verification/cross_module_invalid2.exp b/third_party/move/move-compiler/tests/move_check/verification/cross_module_invalid2.exp new file mode 100644 index 0000000000000..5f684d41353de --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/verification/cross_module_invalid2.exp @@ -0,0 +1,6 @@ +error[E03004]: unbound type + ┌─ tests/move_check/verification/cross_module_invalid2.move:24:23 + │ +24 │ public fun bad(): Foo { + │ ^^^ Unbound type 'Foo' in current scope + diff --git a/third_party/move/move-compiler/tests/move_check/verification/cross_module_invalid2.move b/third_party/move/move-compiler/tests/move_check/verification/cross_module_invalid2.move new file mode 100644 index 0000000000000..ab87203a407a7 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/verification/cross_module_invalid2.move @@ -0,0 +1,28 @@ +// check that `use`'s are filtered out correctly +address 0x1 { +module A { + struct Foo has drop {} + + public fun build_foo(): Foo { Foo {} } +} + +module B { + use 0x1::A::Self; + + #[verify_only] + use 0x1::A::Foo; + + #[verify_only] + fun x(_: Foo) { } + + #[verify_only] + fun tester() { + x(A::build_foo()) + } + + // this should fail + public fun bad(): Foo { + A::build_foo() + } +} +} diff --git a/third_party/move/move-model/src/builder/exp_builder.rs b/third_party/move/move-model/src/builder/exp_builder.rs index adf8c6c828fbd..21e7e4369562c 100644 --- a/third_party/move/move-model/src/builder/exp_builder.rs +++ b/third_party/move/move-model/src/builder/exp_builder.rs @@ -2262,6 +2262,61 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo ExpData::Match(id, discr_exp.into_exp(), translate_arms) } + fn translate_typed_lvalue_list( + &mut self, + list: &EA::TypedLValueList, + expected_type: &Type, + expected_order: WideningOrder, + match_locals: bool, + context: &ErrorMessageContext, + ) -> Pattern { + // Shortcut for single element case + if list.value.len() == 1 { + return self.translate_typed_lvalue( + list.value.first().unwrap(), + expected_type, + expected_order, + match_locals, + context, + ); + } + let loc = self.to_loc(&list.loc); + // Ensure to maximize precision of expected type for elements + let expected_type = self.subs.specialize(expected_type); + let elem_expected_types = if let Type::Tuple(tys) = expected_type { + tys + } else { + let vars = self.fresh_type_vars(list.value.len()); + // Just bind the variables + self.check_type_with_order( + expected_order, + &loc, + &Type::Tuple(vars.clone()), + &expected_type, + context, + ); + vars + }; + if elem_expected_types.len() != list.value.len() { + self.error( + &loc, + &context.arity_mismatch(false, elem_expected_types.len(), list.value.len()), + ); + return self.new_error_pat(&loc); + } + let mut args = vec![]; + let mut elem_types = vec![]; + for (lv, expected) in list.value.iter().zip(elem_expected_types.iter()) { + let value = + self.translate_typed_lvalue(lv, expected, expected_order, match_locals, context); + elem_types.push(self.get_node_type(value.node_id())); + args.push(value) + } + let ty = Type::Tuple(elem_types); + let id = self.new_node_id_with_type_loc(&ty, &loc); + Pattern::Tuple(id, args) + } + fn translate_lvalue_list( &mut self, list: &EA::LValueList, @@ -2332,6 +2387,33 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo } } + fn translate_typed_lvalue( + &mut self, + tlv: &EA::TypedLValue, + expected_type: &Type, + expected_order: WideningOrder, + match_locals: bool, + context: &ErrorMessageContext, + ) -> Pattern { + use move_ir_types::sp; + let sp!(loc, EA::TypedLValue_(lv, opt_ty)) = tlv; + match opt_ty { + Some(ty) => { + let loc = self.to_loc(loc); + let bound_type = self.translate_type(ty); + self.check_type_with_order( + expected_order, + &loc, + &bound_type, // is this arg ordering right? + expected_type, + context, + ); + self.translate_lvalue(lv, &bound_type, expected_order, match_locals, context) + }, + None => self.translate_lvalue(lv, expected_type, expected_order, match_locals, context), + } + } + fn translate_lvalue( &mut self, lv: &EA::LValue, @@ -4946,14 +5028,14 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo fn translate_lambda( &mut self, loc: &Loc, - args: &EA::LValueList, + args: &EA::TypedLValueList, body: &EA::Exp, expected_type: &Type, context: &ErrorMessageContext, ) -> ExpData { // Translate the argument list let arg_type = self.fresh_type_var(); - let pat = self.translate_lvalue_list( + let pat = self.translate_typed_lvalue_list( args, &arg_type, WideningOrder::LeftToRight, diff --git a/third_party/move/move-model/src/builder/model_builder.rs b/third_party/move/move-model/src/builder/model_builder.rs index 2be015a56a8dd..91d8a77e39d93 100644 --- a/third_party/move/move-model/src/builder/model_builder.rs +++ b/third_party/move/move-model/src/builder/model_builder.rs @@ -151,8 +151,9 @@ pub(crate) struct StructVariant { /// A declaration of a function. #[derive(Debug, Clone)] pub(crate) struct FunEntry { - pub loc: Loc, // location of the entire function span - pub name_loc: Loc, // location of just the function name + pub loc: Loc, // location of the entire function span + pub name_loc: Loc, // location of just the function name + pub result_type_loc: Loc, // location of the result type declaration pub module_id: ModuleId, pub fun_id: FunId, pub visibility: Visibility, diff --git a/third_party/move/move-model/src/builder/module_builder.rs b/third_party/move/move-model/src/builder/module_builder.rs index 7cf73ae32f664..95d45397af623 100644 --- a/third_party/move/move-model/src/builder/module_builder.rs +++ b/third_party/move/move-model/src/builder/module_builder.rs @@ -568,9 +568,11 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> { let is_native = matches!(def.body.value, EA::FunctionBody_::Native); let def_loc = et.to_loc(&def.loc); let name_loc = et.to_loc(&name.loc()); + let result_type_loc = et.to_loc(&def.signature.return_type.loc); et.parent.parent.define_fun(qsym.clone(), FunEntry { loc: def_loc.clone(), name_loc, + result_type_loc, module_id: et.parent.module_id, fun_id, visibility, @@ -3552,6 +3554,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> { name: name.symbol, loc: entry.loc.clone(), id_loc: entry.name_loc.clone(), + result_type_loc: entry.result_type_loc.clone(), def_idx: None, handle_idx: None, visibility: entry.visibility, diff --git a/third_party/move/move-model/src/model.rs b/third_party/move/move-model/src/model.rs index a03fc714e1674..71f4059e609b9 100644 --- a/third_party/move/move-model/src/model.rs +++ b/third_party/move/move-model/src/model.rs @@ -1870,7 +1870,8 @@ impl GlobalEnv { let data = FunctionData { name, loc: loc.clone(), - id_loc: loc, + id_loc: loc.clone(), + result_type_loc: loc, def_idx: None, handle_idx: None, visibility, @@ -2368,7 +2369,6 @@ impl GlobalEnv { pub fn internal_dump_env(&self, all: bool) -> String { let spool = self.symbol_pool(); - let tctx = &self.get_type_display_ctx(); let writer = CodeWriter::new(self.internal_loc()); for module in self.get_modules() { if !all && !module.is_target() { @@ -2422,6 +2422,7 @@ impl GlobalEnv { emitln!(writer, "{}", self.display(&*module_spec)); } for str in module.get_structs() { + let tctx = str.get_type_display_ctx(); if str.has_variants() { emitln!(writer, "enum {} {{", str.get_name().display(spool)); writer.indent(); @@ -2432,7 +2433,7 @@ impl GlobalEnv { emitln!(writer, " {"); writer.indent(); for fld in fields { - emitln!(writer, "{},", self.dump_field(tctx, &fld)) + emitln!(writer, "{},", self.dump_field(&tctx, &fld)) } writer.unindent(); emitln!(writer, "}") @@ -2444,7 +2445,7 @@ impl GlobalEnv { emitln!(writer, "struct {} {{", str.get_name().display(spool)); writer.indent(); for fld in str.get_fields() { - emitln!(writer, "{},", self.dump_field(tctx, &fld)) + emitln!(writer, "{},", self.dump_field(&tctx, &fld)) } } writer.unindent(); @@ -2455,7 +2456,8 @@ impl GlobalEnv { } } for fun in module.get_functions() { - self.dump_fun_internal(&writer, tctx, &fun); + let tctx = fun.get_type_display_ctx(); + self.dump_fun_internal(&writer, &tctx, &fun); } for (_, fun) in module.get_spec_funs() { emit!( @@ -3977,6 +3979,9 @@ pub struct FunctionData { /// Location of the function identifier, suitable for error messages alluding to the function. pub(crate) id_loc: Loc, + /// Location of the function result type, suitable for error messages alluding to the result type. + pub(crate) result_type_loc: Loc, + /// The definition index of this function in its bytecode module, if a bytecode module /// is attached to the parent module data. pub(crate) def_idx: Option, @@ -4119,6 +4124,11 @@ impl<'env> FunctionEnv<'env> { self.data.id_loc.clone() } + /// Returns the location of the function identifier. + pub fn get_result_type_loc(&self) -> Loc { + self.data.result_type_loc.clone() + } + /// Returns the attributes of this function. pub fn get_attributes(&self) -> &[Attribute] { &self.data.attributes diff --git a/third_party/move/move-model/src/ty.rs b/third_party/move/move-model/src/ty.rs index 449be66bad45f..985a75766055d 100644 --- a/third_party/move/move-model/src/ty.rs +++ b/third_party/move/move-model/src/ty.rs @@ -155,6 +155,9 @@ pub enum Constraint { /// a pseudo constraint which never fails, but used to generate a default for /// inference. WithDefault(Type), + /// The type must not be function because it is used as the type of some field or + /// as a type argument. + NoFunction, } /// A type to describe the context from where a constraint stems. Used for @@ -384,7 +387,10 @@ impl Constraint { /// for internal constraints which would be mostly confusing to users. pub fn hidden(&self) -> bool { use Constraint::*; - matches!(self, NoPhantom | NoReference | NoTuple | WithDefault(..)) + matches!( + self, + NoPhantom | NoReference | NoTuple | NoFunction | WithDefault(..) + ) } /// Returns true if this context is accumulating. When adding a new constraint @@ -402,6 +408,7 @@ impl Constraint { | Constraint::NoPhantom | Constraint::NoTuple | Constraint::NoReference + | Constraint::NoFunction ) } @@ -420,7 +427,10 @@ impl Constraint { /// the same type. pub fn report_only_once(&self) -> bool { use Constraint::*; - matches!(self, HasAbilities(..) | NoReference | NoPhantom | NoTuple) + matches!( + self, + HasAbilities(..) | NoReference | NoFunction | NoPhantom | NoTuple + ) } /// Joins the two constraints. If they are incompatible, produces a type unification error. @@ -505,6 +515,7 @@ impl Constraint { )) } }, + (Constraint::NoFunction, Constraint::NoFunction) => Ok(true), (Constraint::NoReference, Constraint::NoReference) => Ok(true), (Constraint::NoTuple, Constraint::NoTuple) => Ok(true), (Constraint::NoPhantom, Constraint::NoPhantom) => Ok(true), @@ -528,7 +539,11 @@ impl Constraint { /// type parameter. This creates NoReference, NoTuple, NoPhantom unless the type parameter is /// phantom, and HasAbilities if any abilities need to be met. pub fn for_type_parameter(param: &TypeParameter) -> Vec { - let mut result = vec![Constraint::NoReference, Constraint::NoTuple]; + let mut result = vec![ + Constraint::NoReference, + Constraint::NoTuple, + Constraint::NoFunction, + ]; let TypeParameter( _, TypeParameterKind { @@ -552,6 +567,7 @@ impl Constraint { Constraint::NoPhantom, Constraint::NoReference, Constraint::NoTuple, + Constraint::NoFunction, ] } @@ -562,6 +578,7 @@ impl Constraint { Constraint::NoPhantom, Constraint::NoTuple, Constraint::NoReference, + Constraint::NoFunction, ]; let abilities = if !field_ty.depends_from_type_parameter() { if struct_abilities.has_ability(Ability::Key) { @@ -632,6 +649,7 @@ impl Constraint { ) }, Constraint::NoReference => "no-ref".to_string(), + Constraint::NoFunction => "no-func".to_string(), Constraint::NoTuple => "no-tuple".to_string(), Constraint::NoPhantom => "no-phantom".to_string(), Constraint::HasAbilities(required_abilities) => { @@ -806,6 +824,11 @@ impl Type { matches!(self, Type::Reference(_, _)) } + /// Determines whether this is a function. + pub fn is_function(&self) -> bool { + matches!(self, Type::Fun(..)) + } + /// If this is a reference, return the kind of the reference, otherwise None. pub fn ref_kind(&self) -> Option { if let Type::Reference(kind, _) = self { @@ -1774,6 +1797,13 @@ impl Substitution { Ok(()) } }, + (Constraint::NoFunction, ty) => { + if ty.is_function() { + constraint_unsatisfied_error() + } else { + Ok(()) + } + }, (Constraint::NoTuple, ty) => { if ty.is_tuple() { constraint_unsatisfied_error() @@ -2944,6 +2974,13 @@ impl TypeUnificationError { item_name() ) }, + Constraint::NoFunction => { + format!( + "function type `{}` is not allowed {}", + ty.display(display_context), + item_name() + ) + }, Constraint::NoPhantom => { format!( "phantom type `{}` can only be used as an argument for another phantom type parameter", diff --git a/types/src/on_chain_config/execution_config.rs b/types/src/on_chain_config/execution_config.rs index 97ce9773022af..3b1c753edcefa 100644 --- a/types/src/on_chain_config/execution_config.rs +++ b/types/src/on_chain_config/execution_config.rs @@ -168,6 +168,19 @@ impl TransactionShufflerType { user_use_case_spread_factor: 4, } } + + pub fn user_use_case_spread_factor(&self) -> Option { + match self { + TransactionShufflerType::NoShuffling + | TransactionShufflerType::DeprecatedSenderAwareV1(_) + | TransactionShufflerType::SenderAwareV2(_) + | TransactionShufflerType::DeprecatedFairness { .. } => None, + TransactionShufflerType::UseCaseAware { + user_use_case_spread_factor, + .. + } => Some(*user_use_case_spread_factor), + } + } } #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] diff --git a/types/src/state_store/state_key/registry.rs b/types/src/state_store/state_key/registry.rs index 1fad8c4d90a15..c56577eda6653 100644 --- a/types/src/state_store/state_key/registry.rs +++ b/types/src/state_store/state_key/registry.rs @@ -152,13 +152,13 @@ where let mut locked = self.inner.write(); if let Some(map2) = locked.get_mut(key1) { if let Some(entry) = map2.get(key2) { - if entry.upgrade().is_none() { + if entry.strong_count() == 0 { map2.remove(key2); + if map2.is_empty() { + locked.remove(key1); + } } } - if map2.is_empty() { - locked.remove(key1); - } } }