diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c3d14f4cf6..8458229d7f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -243,6 +243,14 @@ jobs: - uses: actions/checkout@v4 - run: cargo doc --all + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0 + - run: rustup component add clippy + - run: cargo clippy --workspace --exclude dl --exclude component + verify-publish: if: github.repository_owner == 'bytecodealliance' runs-on: ubuntu-latest @@ -274,6 +282,7 @@ jobs: - test_capi - test_extra_features - test-no-hash-maps + - clippy if: always() steps: diff --git a/Cargo.toml b/Cargo.toml index b40482b014..3eae6c35a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "1.214.0" authors = ["The Wasmtime Project Developers"] edition.workspace = true description = "CLI tools for interoperating with WebAssembly files" -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true documentation = "https://github.com/bytecodealliance/wasm-tools" categories = ["wasm"] keywords = ["webassembly", "wasm"] @@ -48,10 +48,18 @@ members = [ unsafe_code = "deny" [workspace.lints.clippy] -all = "allow" +# The default set of lints in Clippy is viewed as "too noisy" right now so +# they're all turned off by default. Selective lints are then enabled below as +# necessary. +all = { level = 'allow', priority = -1 } +clone_on_copy = 'warn' +map_clone = 'warn' +unnecessary_to_owned = 'warn' +manual_strip = 'warn' [workspace.package] edition = '2021' +license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" version = "0.214.0" # Current policy for wasm-tools is the same as Wasmtime which is that this # number can be no larger than the current stable release of Rust minus 2. diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000000..16fe87b06e --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/LICENSE b/LICENSE-Apache-2.0_WITH_LLVM-exception similarity index 100% rename from LICENSE rename to LICENSE-Apache-2.0_WITH_LLVM-exception diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000000..31aa79387f --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index aef7c70d5e..4be959841d 100644 --- a/README.md +++ b/README.md @@ -251,11 +251,18 @@ to this repository. # License -This project is licensed under the Apache 2.0 license with the LLVM exception. -See [LICENSE](LICENSE) for more details. +This project is triple licenced under the Apache 2/ Apache 2 with LLVM exceptions/ MIT licences. The reasoning for this is: +- Apache 2/ MIT is common in the rust ecosystem. +- Apache 2/ MIT is used in the rust compiler, and some of this code may be migrated there. +- Some of this code may be used in compiler output, and the Apache 2 with LLVM exceptions licence is useful for this. + +For more details see +- [Apache 2 Licence](LICENSE-APACHE) +- [Apache 2 Licence with LLVM exceptions](LICENSE-Apache-2.0_WITH_LLVM-exception) +- [MIT Licence](LICENSE-MIT) ### Contribution Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in this project by you, as defined in the Apache-2.0 license, +for inclusion in this project by you, as defined in the Apache 2/ Apache 2 with LLVM exceptions/ MIT licenses, shall be licensed as above, without any additional terms or conditions. diff --git a/ci/build-tarballs.sh b/ci/build-tarballs.sh index 6e7eee790d..b3e1eb8226 100755 --- a/ci/build-tarballs.sh +++ b/ci/build-tarballs.sh @@ -13,7 +13,7 @@ tag=$(./ci/print-current-version.sh) bin_pkgname=wasm-tools-$tag-$platform mkdir tmp/$bin_pkgname -cp LICENSE README.md tmp/$bin_pkgname +cp LICENSE-* README.md tmp/$bin_pkgname fmt=tar if [ "$platform" = "x86_64-windows" ]; then diff --git a/crates/c-api/Cargo.toml b/crates/c-api/Cargo.toml index 93e04c56dc..5b9e2d00e6 100644 --- a/crates/c-api/Cargo.toml +++ b/crates/c-api/Cargo.toml @@ -4,6 +4,8 @@ authors = ["Addison Hart "] categories = ["development-tools", "development-tools::testing", "wasm"] description = "C API to expose wasm-tools" edition.workspace = true +# Note that this is intentionally not the workspace's license. For more +# information see #1637. license = "Apache-2.0 WITH LLVM-exception" readme = "./README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/c-api" diff --git a/crates/c-api/LICENSE b/crates/c-api/LICENSE index 30cff7403d..f9d81955f4 100644 --- a/crates/c-api/LICENSE +++ b/crates/c-api/LICENSE @@ -1 +1,220 @@ -../../LICENSE \ No newline at end of file + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +--- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + diff --git a/crates/wasm-compose/Cargo.toml b/crates/wasm-compose/Cargo.toml index 92d2889b64..b155fca9a7 100644 --- a/crates/wasm-compose/Cargo.toml +++ b/crates/wasm-compose/Cargo.toml @@ -3,7 +3,7 @@ name = "wasm-compose" version.workspace = true edition.workspace = true authors = ["Peter Huene "] -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-compose" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-compose" diff --git a/crates/wasm-encoder/Cargo.toml b/crates/wasm-encoder/Cargo.toml index 7472bd7b13..a7d06808a1 100644 --- a/crates/wasm-encoder/Cargo.toml +++ b/crates/wasm-encoder/Cargo.toml @@ -3,7 +3,7 @@ name = "wasm-encoder" version.workspace = true authors = ["Nick Fitzgerald "] edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-encoder" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-encoder" diff --git a/crates/wasm-encoder/LICENSE b/crates/wasm-encoder/LICENSE deleted file mode 120000 index 30cff7403d..0000000000 --- a/crates/wasm-encoder/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../LICENSE \ No newline at end of file diff --git a/crates/wasm-encoder/src/reencode.rs b/crates/wasm-encoder/src/reencode.rs index 40b9562921..228c9836a5 100644 --- a/crates/wasm-encoder/src/reencode.rs +++ b/crates/wasm-encoder/src/reencode.rs @@ -583,7 +583,7 @@ pub mod utils { last_section: &mut Option, next_section: Option, ) -> Result<(), Error> { - let after = std::mem::replace(last_section, next_section.clone()); + let after = std::mem::replace(last_section, next_section); let before = next_section; reencoder.intersperse_section_hook(module, after, before) } @@ -1206,7 +1206,7 @@ pub mod utils { fields: struct_ty .fields .iter() - .map(|field_ty| reencoder.field_type(field_ty.clone())) + .map(|field_ty| reencoder.field_type(*field_ty)) .collect::>()?, }) } diff --git a/crates/wasm-metadata/Cargo.toml b/crates/wasm-metadata/Cargo.toml index 354d6e481b..8809575ad0 100644 --- a/crates/wasm-metadata/Cargo.toml +++ b/crates/wasm-metadata/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-metadata" version.workspace = true edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-metadata" description = "Read and manipulate WebAssembly metadata" rust-version.workspace = true diff --git a/crates/wasm-metadata/src/lib.rs b/crates/wasm-metadata/src/lib.rs index f4eeec8bb3..4d6b7f2abe 100644 --- a/crates/wasm-metadata/src/lib.rs +++ b/crates/wasm-metadata/src/lib.rs @@ -864,9 +864,9 @@ impl RegistryMetadata { let license_id = req.req.to_string(); - if license_id.starts_with(LICENSE_REF) { - // Strip "LicenseRef-", convert to lowercase and then append - licenses.push(license_id[LICENSE_REF.len()..].to_lowercase()); + // Strip "LicenseRef-", convert to lowercase and then append + if let Some(id) = license_id.strip_prefix(LICENSE_REF) { + licenses.push(id.to_lowercase()); } } } diff --git a/crates/wasm-mutate-stats/src/bin/wasm-mutate-stats.rs b/crates/wasm-mutate-stats/src/bin/wasm-mutate-stats.rs index 800d213885..4fd56881aa 100644 --- a/crates/wasm-mutate-stats/src/bin/wasm-mutate-stats.rs +++ b/crates/wasm-mutate-stats/src/bin/wasm-mutate-stats.rs @@ -120,15 +120,16 @@ fn main() -> anyhow::Result<()> { .map(|configs| { configs .iter() + .copied() .map(|optlevel| { let mut config = Config::default(); - config.cranelift_opt_level(optlevel.clone()); + config.cranelift_opt_level(optlevel); if let Some(triple) = triple { config.target(triple).context("Invalid target")?; } Ok(( Engine::new(&config).context("Engine could not be initialized")?, - optlevel.clone(), + optlevel, )) }) .collect::>>() diff --git a/crates/wasm-mutate/Cargo.toml b/crates/wasm-mutate/Cargo.toml index 3a9385cdd1..df82b2f4b0 100644 --- a/crates/wasm-mutate/Cargo.toml +++ b/crates/wasm-mutate/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-mutate" version.workspace = true edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-mutate" description = "A WebAssembly test case mutator" rust-version.workspace = true diff --git a/crates/wasm-mutate/src/mutators/peephole.rs b/crates/wasm-mutate/src/mutators/peephole.rs index 82a5f5254f..dd10d94e32 100644 --- a/crates/wasm-mutate/src/mutators/peephole.rs +++ b/crates/wasm-mutate/src/mutators/peephole.rs @@ -85,13 +85,13 @@ impl PeepholeMutator { let mut all_locals = Vec::new(); for primitive in &tpe.params { - all_locals.push(primitive.clone()) + all_locals.push(*primitive) } for _ in 0..localsreader.get_count() { let (count, ty) = localsreader.read()?; let tymapped = PrimitiveTypeInfo::from(ty); for _ in 0..count { - all_locals.push(tymapped.clone()); + all_locals.push(tymapped); } } diff --git a/crates/wasm-mutate/src/mutators/peephole/dfg.rs b/crates/wasm-mutate/src/mutators/peephole/dfg.rs index a5e1ca2a51..427652683d 100644 --- a/crates/wasm-mutate/src/mutators/peephole/dfg.rs +++ b/crates/wasm-mutate/src/mutators/peephole/dfg.rs @@ -137,7 +137,7 @@ impl MiniDFG { builder: &mut String, ) { let entry = &minidfg.entries[entryidx]; - builder.push_str(&(&preffix).to_string()); + builder.push_str(preffix); let color = get_ansi_term_color(entry.color); builder.push_str( format!( diff --git a/crates/wasm-mutate/src/mutators/peephole/eggsy/analysis.rs b/crates/wasm-mutate/src/mutators/peephole/eggsy/analysis.rs index e1e4437332..a5e5a9ca16 100644 --- a/crates/wasm-mutate/src/mutators/peephole/eggsy/analysis.rs +++ b/crates/wasm-mutate/src/mutators/peephole/eggsy/analysis.rs @@ -96,7 +96,7 @@ impl PeepholeMutationAnalysis { Lang::I64GeS(_) => Ok(PrimitiveTypeInfo::I32), Lang::I32GeU(_) => Ok(PrimitiveTypeInfo::I32), Lang::I64GeU(_) => Ok(PrimitiveTypeInfo::I32), - Lang::LocalTee(idx, _) => Ok(self.locals[*idx as usize].clone()), + Lang::LocalTee(idx, _) => Ok(self.locals[*idx as usize]), Lang::Wrap(_) => Ok(PrimitiveTypeInfo::I32), Lang::Call(idx, _) => { let type_idx = self.function_map[*idx as usize]; @@ -110,7 +110,7 @@ impl PeepholeMutationAnalysis { return Err(Error::no_mutations_applicable()); } - Ok(ty.returns[0].clone()) + Ok(ty.returns[0]) } } } @@ -138,8 +138,8 @@ impl PeepholeMutationAnalysis { Lang::I64ExtendI32U(_) => Ok(PrimitiveTypeInfo::I64), Lang::LocalSet(_, _) => Ok(PrimitiveTypeInfo::Empty), Lang::GlobalSet(_, _) => Ok(PrimitiveTypeInfo::Empty), - Lang::LocalGet(idx) => Ok(self.locals[*idx as usize].clone()), - Lang::GlobalGet(v) => Ok(self.global_types[*v as usize].clone()), + Lang::LocalGet(idx) => Ok(self.locals[*idx as usize]), + Lang::GlobalGet(v) => Ok(self.global_types[*v as usize]), Lang::I32Store { .. } => Ok(PrimitiveTypeInfo::Empty), Lang::I64Store { .. } => Ok(PrimitiveTypeInfo::Empty), Lang::F32(_) => Ok(PrimitiveTypeInfo::F32), @@ -289,7 +289,7 @@ impl PeepholeMutationAnalysis { Lang::TableFill { .. } => Ok(PrimitiveTypeInfo::Empty), Lang::TableSet(..) => Ok(PrimitiveTypeInfo::Empty), Lang::TableGet(idx, _) => { - let ty = self.table_types[*idx as usize].clone(); + let ty = self.table_types[*idx as usize]; Ok(ty.element_type.into()) } Lang::I32UseGlobal(_) => Ok(PrimitiveTypeInfo::I32), diff --git a/crates/wasm-shrink/Cargo.toml b/crates/wasm-shrink/Cargo.toml index fbf9283fb0..e6647d5781 100644 --- a/crates/wasm-shrink/Cargo.toml +++ b/crates/wasm-shrink/Cargo.toml @@ -4,7 +4,7 @@ categories = ["command-line-utilities", "development-tools", "development-tools: description = "A WebAssembly test case shrinker" edition.workspace = true keywords = ["reducer", "reduce", "bug", "crash"] -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "./README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-shrink" name = "wasm-shrink" diff --git a/crates/wasm-smith/Cargo.toml b/crates/wasm-smith/Cargo.toml index 49d9379365..c35ed4904c 100644 --- a/crates/wasm-smith/Cargo.toml +++ b/crates/wasm-smith/Cargo.toml @@ -4,7 +4,7 @@ categories = ["command-line-utilities", "development-tools", "development-tools: description = "A WebAssembly test case generator" documentation = "https://docs.rs/wasm-smith" edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true name = "wasm-smith" readme = "./README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasm-smith" diff --git a/crates/wasm-smith/LICENSE b/crates/wasm-smith/LICENSE deleted file mode 120000 index 30cff7403d..0000000000 --- a/crates/wasm-smith/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../LICENSE \ No newline at end of file diff --git a/crates/wasm-smith/src/core.rs b/crates/wasm-smith/src/core.rs index 2f8b552982..bdde0db39d 100644 --- a/crates/wasm-smith/src/core.rs +++ b/crates/wasm-smith/src/core.rs @@ -303,7 +303,7 @@ impl CompositeType { impl From<&CompositeType> for wasm_encoder::CompositeType { fn from(ty: &CompositeType) -> Self { let inner = match &ty.inner { - CompositeInnerType::Array(a) => wasm_encoder::CompositeInnerType::Array(a.clone()), + CompositeInnerType::Array(a) => wasm_encoder::CompositeInnerType::Array(*a), CompositeInnerType::Func(f) => wasm_encoder::CompositeInnerType::Func( wasm_encoder::FuncType::new(f.params.iter().cloned(), f.results.iter().cloned()), ), diff --git a/crates/wasm-wave/Cargo.toml b/crates/wasm-wave/Cargo.toml index fbf0efc2fd..9291ab0c8f 100644 --- a/crates/wasm-wave/Cargo.toml +++ b/crates/wasm-wave/Cargo.toml @@ -2,7 +2,7 @@ name = "wasm-wave" version.workspace = true edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true rust-version.workspace = true authors = ["lann.martin@fermyon.com"] description = "WebAssembly Value Encoding" diff --git a/crates/wasmparser/Cargo.toml b/crates/wasmparser/Cargo.toml index 117681d72e..c5f68ae738 100644 --- a/crates/wasmparser/Cargo.toml +++ b/crates/wasmparser/Cargo.toml @@ -2,7 +2,7 @@ name = "wasmparser" version.workspace = true authors = ["Yury Delendik "] -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmparser" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmparser" keywords = ["parser", "WebAssembly", "wasm"] diff --git a/crates/wasmparser/src/validator/operators.rs b/crates/wasmparser/src/validator/operators.rs index 7cc309df95..2c38db8bc7 100644 --- a/crates/wasmparser/src/validator/operators.rs +++ b/crates/wasmparser/src/validator/operators.rs @@ -3960,7 +3960,7 @@ where .params() .iter() .skip(src_cont.params().len() - dst_cont.params().len()) - .map(|i| *i) + .copied() .collect(); // TODO(dhil): `is_func_subtype` is a kind of convenience hack // that implements the subtyping relation for function diff --git a/crates/wasmparser/src/validator/types.rs b/crates/wasmparser/src/validator/types.rs index 43173ab8b7..076f46fed0 100644 --- a/crates/wasmparser/src/validator/types.rs +++ b/crates/wasmparser/src/validator/types.rs @@ -3842,7 +3842,7 @@ impl<'a> SubtypeCx<'a> { let b_imports = self.b[b] .imports .iter() - .map(|(name, ty)| (name.clone(), ty.clone())) + .map(|(name, ty)| (name.clone(), *ty)) .collect(); self.swap(); let mut import_mapping = @@ -3852,7 +3852,7 @@ impl<'a> SubtypeCx<'a> { let mut a_exports = this.a[a] .exports .iter() - .map(|(name, ty)| (name.clone(), ty.clone())) + .map(|(name, ty)| (name.clone(), *ty)) .collect::>(); for ty in a_exports.values_mut() { this.a.remap_component_entity(ty, &mut import_mapping); @@ -4196,7 +4196,7 @@ impl<'a> SubtypeCx<'a> { let mut to_typecheck = Vec::new(); for (name, expected) in entities.iter() { match a.get(name) { - Some(arg) => to_typecheck.push((arg.clone(), expected.clone())), + Some(arg) => to_typecheck.push((*arg, *expected)), None => bail!(offset, "missing {} named `{name}`", kind.desc()), } } diff --git a/crates/wasmprinter/Cargo.toml b/crates/wasmprinter/Cargo.toml index 8f9845bec1..d26149cbdd 100644 --- a/crates/wasmprinter/Cargo.toml +++ b/crates/wasmprinter/Cargo.toml @@ -3,7 +3,7 @@ name = "wasmprinter" version.workspace = true authors = ["Alex Crichton "] edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmprinter" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmprinter" diff --git a/crates/wasmprinter/LICENSE b/crates/wasmprinter/LICENSE deleted file mode 120000 index 30cff7403d..0000000000 --- a/crates/wasmprinter/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../LICENSE \ No newline at end of file diff --git a/crates/wast/Cargo.toml b/crates/wast/Cargo.toml index e01cbd65b0..40ebb90c17 100644 --- a/crates/wast/Cargo.toml +++ b/crates/wast/Cargo.toml @@ -3,7 +3,7 @@ name = "wast" version = "214.0.0" authors = ["Alex Crichton "] edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wast" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wast" diff --git a/crates/wast/LICENSE b/crates/wast/LICENSE deleted file mode 120000 index 30cff7403d..0000000000 --- a/crates/wast/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../LICENSE \ No newline at end of file diff --git a/crates/wast/src/core/resolve/names.rs b/crates/wast/src/core/resolve/names.rs index 053dbf6d3d..0361bfff62 100644 --- a/crates/wast/src/core/resolve/names.rs +++ b/crates/wast/src/core/resolve/names.rs @@ -779,8 +779,8 @@ impl<'a> TypeReference<'a> for FunctionType<'a> { // opportunistically here to see if the values are equal. let types_not_equal = |a: &ValType, b: &ValType| { - let mut a = a.clone(); - let mut b = b.clone(); + let mut a = *a; + let mut b = *b; drop(cx.resolve_valtype(&mut a)); drop(cx.resolve_valtype(&mut b)); a != b diff --git a/crates/wat/Cargo.toml b/crates/wat/Cargo.toml index 537c92344c..bd9693addc 100644 --- a/crates/wat/Cargo.toml +++ b/crates/wat/Cargo.toml @@ -3,7 +3,7 @@ name = "wat" version = "1.214.0" authors = ["Alex Crichton "] edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wat" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wat" diff --git a/crates/wat/LICENSE b/crates/wat/LICENSE deleted file mode 120000 index 30cff7403d..0000000000 --- a/crates/wat/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../LICENSE \ No newline at end of file diff --git a/crates/wit-component/Cargo.toml b/crates/wit-component/Cargo.toml index c05f13e652..04f85f2d01 100644 --- a/crates/wit-component/Cargo.toml +++ b/crates/wit-component/Cargo.toml @@ -3,7 +3,7 @@ name = "wit-component" authors = ["Peter Huene "] version.workspace = true edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-component" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-component" diff --git a/crates/wit-component/src/gc.rs b/crates/wit-component/src/gc.rs index 76697927f3..3393a967cc 100644 --- a/crates/wit-component/src/gc.rs +++ b/crates/wit-component/src/gc.rs @@ -582,7 +582,7 @@ impl<'a> Module<'a> { for (i, table) in self.live_tables() { map.tables.push(i); - let ty = map.table_type(table.ty.clone())?; + let ty = map.table_type(table.ty)?; match &table.def { Definition::Import(m, n) => { imports.import(m, n, ty); @@ -595,7 +595,7 @@ impl<'a> Module<'a> { for (i, global) in self.live_globals() { map.globals.push(i); - let ty = map.global_type(global.ty.clone())?; + let ty = map.global_type(global.ty)?; match &global.def { Definition::Import(m, n) => { imports.import(m, n, ty); diff --git a/crates/wit-component/src/printing.rs b/crates/wit-component/src/printing.rs index 3af41a94cf..0bd41c8a3b 100644 --- a/crates/wit-component/src/printing.rs +++ b/crates/wit-component/src/printing.rs @@ -63,7 +63,7 @@ impl WitPrinter { self.output.push_str("\n\n"); } - let pkg = &resolve.packages[pkg_id.clone()]; + let pkg = &resolve.packages[*pkg_id]; self.print_docs(&pkg.docs); self.output.push_str("package "); self.print_name(&pkg.name.namespace); diff --git a/crates/wit-component/tests/merge/success/from/a.wit b/crates/wit-component/tests/merge/success/from/a.wit index d181c7f53e..0680ab711b 100644 --- a/crates/wit-component/tests/merge/success/from/a.wit +++ b/crates/wit-component/tests/merge/success/from/a.wit @@ -1,7 +1,7 @@ package foo:%from; interface a { - use foo:foo/only-from.{r}; + use foo:foo/only-from@1.0.0.{r}; foo: func(); } diff --git a/crates/wit-component/tests/merge/success/from/deps/foo/shared.wit b/crates/wit-component/tests/merge/success/from/deps/foo/shared.wit index 272c592880..c2df6de713 100644 --- a/crates/wit-component/tests/merge/success/from/deps/foo/shared.wit +++ b/crates/wit-component/tests/merge/success/from/deps/foo/shared.wit @@ -1,4 +1,4 @@ -package foo:foo; +package foo:foo@1.0.0; interface shared-only-from { variant v { diff --git a/crates/wit-component/tests/merge/success/into/b.wit b/crates/wit-component/tests/merge/success/into/b.wit index ae3681207b..d636b6fa75 100644 --- a/crates/wit-component/tests/merge/success/into/b.wit +++ b/crates/wit-component/tests/merge/success/into/b.wit @@ -1,7 +1,7 @@ package foo:into; interface b { - use foo:foo/only-into.{r}; + use foo:foo/only-into@1.0.0.{r}; foo: func(); } diff --git a/crates/wit-component/tests/merge/success/into/deps/foo/shared.wit b/crates/wit-component/tests/merge/success/into/deps/foo/shared.wit index 0adea4f0fc..5a97ef93d9 100644 --- a/crates/wit-component/tests/merge/success/into/deps/foo/shared.wit +++ b/crates/wit-component/tests/merge/success/into/deps/foo/shared.wit @@ -1,4 +1,4 @@ -package foo:foo; +package foo:foo@1.0.0; interface shared-only-into { variant v { diff --git a/crates/wit-component/tests/merge/success/merge/foo.wit b/crates/wit-component/tests/merge/success/merge/foo.wit index f209dac2a5..c8b446a981 100644 --- a/crates/wit-component/tests/merge/success/merge/foo.wit +++ b/crates/wit-component/tests/merge/success/merge/foo.wit @@ -1,4 +1,4 @@ -package foo:foo; +package foo:foo@1.0.0; interface only-into { record r { diff --git a/crates/wit-component/tests/merge/success/merge/from.wit b/crates/wit-component/tests/merge/success/merge/from.wit index a57ad14152..b080c2fc7b 100644 --- a/crates/wit-component/tests/merge/success/merge/from.wit +++ b/crates/wit-component/tests/merge/success/merge/from.wit @@ -1,7 +1,7 @@ package foo:%from; interface a { - use foo:foo/only-from.{r}; + use foo:foo/only-from@1.0.0.{r}; foo: func(); } diff --git a/crates/wit-component/tests/merge/success/merge/into.wit b/crates/wit-component/tests/merge/success/merge/into.wit index 7448a6a228..ae40b42753 100644 --- a/crates/wit-component/tests/merge/success/merge/into.wit +++ b/crates/wit-component/tests/merge/success/merge/into.wit @@ -1,7 +1,7 @@ package foo:into; interface b { - use foo:foo/only-into.{r}; + use foo:foo/only-into@1.0.0.{r}; foo: func(); } diff --git a/crates/wit-encoder/Cargo.toml b/crates/wit-encoder/Cargo.toml index cc72b4c766..626959e60c 100644 --- a/crates/wit-encoder/Cargo.toml +++ b/crates/wit-encoder/Cargo.toml @@ -2,7 +2,7 @@ description = "A WIT encoder for Rust" documentation = "https://docs.rs/wit-encoder" edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true name = "wit-encoder" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-encoder" version.workspace = true diff --git a/crates/wit-parser/Cargo.toml b/crates/wit-parser/Cargo.toml index 386be96951..577ec4a4aa 100644 --- a/crates/wit-parser/Cargo.toml +++ b/crates/wit-parser/Cargo.toml @@ -3,7 +3,7 @@ name = "wit-parser" authors = ["Alex Crichton "] version.workspace = true edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true readme = "README.md" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-parser" homepage = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-parser" diff --git a/crates/wit-parser/fuzz/Cargo.toml b/crates/wit-parser/fuzz/Cargo.toml index f3a20af241..f6fd02cb9c 100644 --- a/crates/wit-parser/fuzz/Cargo.toml +++ b/crates/wit-parser/fuzz/Cargo.toml @@ -7,6 +7,9 @@ rust-version.workspace = true [package.metadata] cargo-fuzz = true +[lints] +workspace = true + [dependencies] arbitrary = { workspace = true, features = ['derive'] } env_logger = { workspace = true } diff --git a/crates/wit-parser/fuzz/fuzz_targets/parse.rs b/crates/wit-parser/fuzz/fuzz_targets/parse.rs index b9d21dc4f5..f3bb800a59 100644 --- a/crates/wit-parser/fuzz/fuzz_targets/parse.rs +++ b/crates/wit-parser/fuzz/fuzz_targets/parse.rs @@ -10,8 +10,5 @@ fuzz_target!(|data: &[u8]| { Err(_) => return, }; - drop(wit_parser::UnresolvedPackageGroup::parse( - "foo".as_ref(), - &data, - )); + drop(wit_parser::UnresolvedPackageGroup::parse("foo", &data)); }); diff --git a/crates/wit-parser/src/decoding.rs b/crates/wit-parser/src/decoding.rs index 1c61ecfd48..9574cdc248 100644 --- a/crates/wit-parser/src/decoding.rs +++ b/crates/wit-parser/src/decoding.rs @@ -66,7 +66,7 @@ impl ComponentInfo { // // Note that the buffer management here is not ideal, // but it's compact enough to fit in an example! - let len = buffer.len().clone(); + let len = buffer.len(); buffer.extend((0..hint).map(|_| 0u8)); let n = reader.read(&mut buffer[len..])?; buffer.truncate(len + n); diff --git a/crates/wit-parser/src/resolve.rs b/crates/wit-parser/src/resolve.rs index 9a69eba45d..5471a54c18 100644 --- a/crates/wit-parser/src/resolve.rs +++ b/crates/wit-parser/src/resolve.rs @@ -1,3 +1,13 @@ +use std::collections::{BTreeMap, HashMap, HashSet}; +use std::mem; +use std::path::{Path, PathBuf}; + +use anyhow::{anyhow, bail, ensure, Context, Result}; +use id_arena::{Arena, Id}; +use indexmap::{IndexMap, IndexSet}; +#[cfg(feature = "serde")] +use serde_derive::Serialize; + use crate::ast::lex::Span; use crate::ast::{parse_use_path, ParsedUsePath}; #[cfg(feature = "serde")] @@ -8,14 +18,6 @@ use crate::{ TypeOwner, UnresolvedPackage, UnresolvedPackageGroup, World, WorldId, WorldItem, WorldKey, WorldSpan, }; -use anyhow::{anyhow, bail, Context, Result}; -use id_arena::{Arena, Id}; -use indexmap::{IndexMap, IndexSet}; -#[cfg(feature = "serde")] -use serde_derive::Serialize; -use std::collections::{BTreeMap, HashMap, HashSet}; -use std::mem; -use std::path::{Path, PathBuf}; /// Representation of a fully resolved set of WIT packages. /// @@ -1408,13 +1410,37 @@ impl Resolve { } } - fn include_stability(&self, stability: &Stability) -> bool { - match stability { - Stability::Stable { .. } | Stability::Unknown => true, + fn include_stability(&self, stability: &Stability, pkg_id: &PackageId) -> Result { + Ok(match stability { + Stability::Unknown => true, + // NOTE: deprecations are intentionally omitted -- an existing `@since` takes precedence over `@deprecated` + Stability::Stable { since, .. } => { + let Some(p) = self.packages.get(*pkg_id) else { + // We can't check much without a package (possibly dealing with an item in an `UnresolvedPackage`), + // @since version & deprecations can't be checked because there's no package version to compare to. + // + // Feature requirements on stabilized features are ignored in resolved packages, so we do the same here. + return Ok(true); + }; + + // Use of feature gating with version specifiers inside a package that is not versioned is not allowed + let package_version = p.name.version.as_ref().with_context(|| format!("package [{}] contains a feature gate with a version specifier, so it must have a version", p.name))?; + + // If the version on the feature gate is: + // - released, then we can include it + // - unreleased, then we must check the feature (if present) + ensure!( + since <= package_version, + "feature gate cannot reference unreleased version {since} of package [{}] (current version {package_version})", + p.name + ); + + true + } Stability::Unstable { feature, .. } => { self.features.contains(feature) || self.all_features } - } + }) } } @@ -1503,7 +1529,16 @@ impl Remap { .zip(&unresolved.type_spans) .skip(foreign_types) { - if !resolve.include_stability(&ty.stability) { + if !resolve + .include_stability(&ty.stability, &pkgid) + .with_context(|| { + format!( + "failed to process feature gate for type [{}] in package [{}]", + ty.name.as_ref().map(String::as_str).unwrap_or(""), + resolve.packages[pkgid].name, + ) + })? + { self.types.push(None); continue; } @@ -1544,13 +1579,26 @@ impl Remap { .zip(&unresolved.interface_spans) .skip(foreign_interfaces) { - if !resolve.include_stability(&iface.stability) { + if !resolve + .include_stability(&iface.stability, &pkgid) + .with_context(|| { + format!( + "failed to process feature gate for interface [{}] in package [{}]", + iface + .name + .as_ref() + .map(String::as_str) + .unwrap_or(""), + resolve.packages[pkgid].name, + ) + })? + { self.interfaces.push(None); continue; } - self.update_interface(resolve, &mut iface, Some(span))?; assert!(iface.package.is_none()); iface.package = Some(pkgid); + self.update_interface(resolve, &mut iface, Some(span))?; let new_id = resolve.interfaces.alloc(iface); assert_eq!(self.interfaces.len(), id.index()); self.interfaces.push(Some(new_id)); @@ -1589,11 +1637,19 @@ impl Remap { .zip(unresolved.world_spans) .skip(foreign_worlds) { - if !resolve.include_stability(&world.stability) { + if !resolve + .include_stability(&world.stability, &pkgid) + .with_context(|| { + format!( + "failed to process feature gate for world [{}] in package [{}]", + world.name, resolve.packages[pkgid].name, + ) + })? + { self.worlds.push(None); continue; } - self.update_world(&mut world, resolve, &span)?; + self.update_world(&mut world, resolve, &pkgid, &span)?; let new_id = resolve.worlds.alloc(world); assert_eq!(self.worlds.len(), id.index()); @@ -1945,6 +2001,16 @@ impl Remap { spans: Option<&InterfaceSpan>, ) -> Result<()> { iface.types.retain(|_, ty| self.types[ty.index()].is_some()); + let iface_pkg_id = iface.package.as_ref().unwrap_or_else(|| { + panic!( + "unexpectedly missing package on interface [{}]", + iface + .name + .as_ref() + .map(String::as_str) + .unwrap_or(""), + ) + }); // NB: note that `iface.doc` is not updated here since interfaces // haven't been mapped yet and that's done in a separate step. @@ -1954,17 +2020,31 @@ impl Remap { if let Some(spans) = spans { assert_eq!(iface.functions.len(), spans.funcs.len()); } - for (i, (_, func)) in iface.functions.iter_mut().enumerate() { - if !resolve.include_stability(&func.stability) { + for (i, (func_name, func)) in iface.functions.iter_mut().enumerate() { + if !resolve + .include_stability(&func.stability, iface_pkg_id) + .with_context(|| { + format!( + "failed to process feature gate for function [{func_name}] in package [{}]", + resolve.packages[*iface_pkg_id].name, + ) + })? + { continue; } let span = spans.map(|s| s.funcs[i]); self.update_function(resolve, func, span) .with_context(|| format!("failed to update function `{}`", func.name))?; } - iface - .functions - .retain(|_, f| resolve.include_stability(&f.stability)); + + // Filter out all of the existing functions in interface which fail the + // `include_stability()` check, as they shouldn't be available. + for (name, func) in mem::take(&mut iface.functions) { + if resolve.include_stability(&func.stability, iface_pkg_id)? { + iface.functions.insert(name, func); + } + } + Ok(()) } @@ -2017,6 +2097,7 @@ impl Remap { &mut self, world: &mut World, resolve: &mut Resolve, + pkg_id: &PackageId, spans: &WorldSpan, ) -> Result<()> { // NB: this function is more more complicated than the prior versions @@ -2047,7 +2128,16 @@ impl Remap { *id = self.map_type(*id, Some(*span))?; } let stability = item.stability(resolve); - if !resolve.include_stability(stability) { + if !resolve + .include_stability(stability, pkg_id) + .with_context(|| { + format!( + "failed to process imported world item type [{}] in package [{}]", + resolve.name_world_key(&name), + resolve.packages[*pkg_id].name, + ) + })? + { continue; } self.update_world_key(&mut name, Some(*span))?; @@ -2088,7 +2178,16 @@ impl Remap { .zip(&spans.exports) { let stability = item.stability(resolve); - if !resolve.include_stability(stability) { + if !resolve + .include_stability(stability, pkg_id) + .with_context(|| { + format!( + "failed to process feature gate for exported item [{}] in package [{}]", + resolve.name_world_key(&name), + resolve.packages[*pkg_id].name, + ) + })? + { continue; } self.update_world_key(&mut name, Some(*span))?; @@ -2121,7 +2220,16 @@ impl Remap { .zip(&spans.includes) .zip(&include_names) { - if !resolve.include_stability(&stability) { + if !resolve + .include_stability(&stability, pkg_id) + .with_context(|| { + format!( + "failed to process feature gate for included world [{}] in package [{}]", + resolve.worlds[include_world].name.as_str(), + resolve.packages[*pkg_id].name + ) + })? + { continue; } self.resolve_include(world, include_world, names, *span, resolve)?; diff --git a/crates/wit-smith/Cargo.toml b/crates/wit-smith/Cargo.toml index 3956466dc5..09d8e9c699 100644 --- a/crates/wit-smith/Cargo.toml +++ b/crates/wit-smith/Cargo.toml @@ -2,7 +2,7 @@ description = "A WIT test case generator" documentation = "https://docs.rs/wit-smith" edition.workspace = true -license = "Apache-2.0 WITH LLVM-exception" +license.workspace = true name = "wit-smith" repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-smith" version.workspace = true diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index c85c29c7d2..9c5830aee7 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -7,6 +7,9 @@ rust-version.workspace = true [package.metadata] cargo-fuzz = true +[lints] +workspace = true + [dependencies] anyhow = { workspace = true } arbitrary = { workspace = true } diff --git a/tests/cli/since-on-future-package.wit b/tests/cli/since-on-future-package.wit new file mode 100644 index 0000000000..1c9a8eb6db --- /dev/null +++ b/tests/cli/since-on-future-package.wit @@ -0,0 +1,18 @@ +// FAIL: component embed --dummy % + +package test:invalid@0.1.0; + +interface foo { + a: func(s: string) -> string; + + @since(version = 0.1.1) + b: func(s: string) -> string; + + @since(version = 0.1.1, feature = c-please) + c: func(s: string) -> string; +} + +world test { + import foo; + export foo; +} \ No newline at end of file diff --git a/tests/cli/since-on-future-package.wit.stderr b/tests/cli/since-on-future-package.wit.stderr new file mode 100644 index 0000000000..b1c0e6e14f --- /dev/null +++ b/tests/cli/since-on-future-package.wit.stderr @@ -0,0 +1,4 @@ +error: failed to process feature gate for function [b] in package [test:invalid@0.1.0] + +Caused by: + 0: feature gate cannot reference unreleased version 0.1.1 of package [test:invalid@0.1.0] (current version 0.1.0) diff --git a/tests/cli/wit-stability-in-binary-format.wit b/tests/cli/wit-stability-in-binary-format.wit index fb56e018ff..8ab7149729 100644 --- a/tests/cli/wit-stability-in-binary-format.wit +++ b/tests/cli/wit-stability-in-binary-format.wit @@ -1,6 +1,6 @@ // RUN: component wit % --wasm | component wit -package a:b; +package a:b@1.0.0; @since(version = 1.0.0) interface foo { diff --git a/tests/cli/wit-stability-in-binary-format.wit.stdout b/tests/cli/wit-stability-in-binary-format.wit.stdout index ce05750ad4..f6dd5adc68 100644 --- a/tests/cli/wit-stability-in-binary-format.wit.stdout +++ b/tests/cli/wit-stability-in-binary-format.wit.stdout @@ -1,5 +1,5 @@ /// RUN: component wit % --wasm | component wit -package a:b; +package a:b@1.0.0; @since(version = 1.0.0) interface foo { diff --git a/tests/cli/wit-stability-inherited.wit b/tests/cli/wit-stability-inherited.wit index 572e1c2579..6dd7249f3b 100644 --- a/tests/cli/wit-stability-inherited.wit +++ b/tests/cli/wit-stability-inherited.wit @@ -1,6 +1,6 @@ // RUN: component wit % -package a:b; +package a:b@1.0.0; interface foo { type t = u32; diff --git a/tests/cli/wit-stability-inherited.wit.stdout b/tests/cli/wit-stability-inherited.wit.stdout index 651b90e2f8..19b3df4505 100644 --- a/tests/cli/wit-stability-inherited.wit.stdout +++ b/tests/cli/wit-stability-inherited.wit.stdout @@ -1,5 +1,5 @@ /// RUN: component wit % -package a:b; +package a:b@1.0.0; interface foo { type t = u32; diff --git a/tests/local/component-model/adapt.wast b/tests/local/component-model/adapt.wast index 7c5cb9ebda..9070cf0f98 100644 --- a/tests/local/component-model/adapt.wast +++ b/tests/local/component-model/adapt.wast @@ -245,12 +245,10 @@ ) (assert_invalid - (component - (core module $m - (func (export "")) - ) - (core instance $i (instantiate $m)) - (core func (canon lower (func $i ""))) + (component quote + "(core module $m (func (export \"\")))" + "(core instance $i (instantiate $m))" + "(core func (canon lower (func $i \"\")))" ) "unknown instance: failed to find name `$i`") @@ -280,8 +278,8 @@ "not a function type") (assert_invalid - (component - (import "a" (func $f)) - (func (export "foo") (canon lift (core func $f))) + (component quote + "(import \"a\" (func $f))" + "(func (export \"foo\") (canon lift (core func $f)))" ) "unknown core func: failed to find name `$f`") diff --git a/tests/local/component-model/definedtypes.wast b/tests/local/component-model/definedtypes.wast index aa47a2c9a4..6124a07ff4 100644 --- a/tests/local/component-model/definedtypes.wast +++ b/tests/local/component-model/definedtypes.wast @@ -43,23 +43,23 @@ ) (assert_invalid - (component - (type $t (variant (case $x "x" string (refines $x)))) + (component quote + "(type $t (variant (case $x \"x\" string (refines $x))))" ) "variant case cannot refine itself" ) (assert_invalid - (component - (type $t (variant (case "x" (refines $y)) (case $y "y" string))) + (component quote + "(type $t (variant (case \"x\" (refines $y)) (case $y \"y\" string)))" ) "unknown variant case" ) (assert_invalid - (component - (type $t string) - (type $v (variant (case "x" $t (refines $z)))) + (component quote + "(type $t string)" + "(type $v (variant (case \"x\" $t (refines $z))))" ) "unknown variant case" ) @@ -82,9 +82,9 @@ ) (assert_invalid - (component - (type $t string) - (type $v (variant (case $x "x" $t) (case $x "y" $t))) + (component quote + "(type $t string)" + "(type $v (variant (case $x \"x\" $t) (case $x \"y\" $t)))" ) "duplicate variant case identifier" ) diff --git a/tests/local/component-model/export-introduces-alias.wast b/tests/local/component-model/export-introduces-alias.wast index 4a0f602153..5f7074c7f5 100644 --- a/tests/local/component-model/export-introduces-alias.wast +++ b/tests/local/component-model/export-introduces-alias.wast @@ -27,11 +27,11 @@ ) (assert_invalid - (component - (type (instance - (type $t u8) - (export $t "t" (type (eq $t))) - )) + (component quote + "(type (instance" + "(type $t u8)" + "(export $t \"t\" (type (eq $t)))" + "))" ) "duplicate type identifier") diff --git a/tests/local/component-model/instance-type.wast b/tests/local/component-model/instance-type.wast index 5cdfbbf6ce..3aaaf82faf 100644 --- a/tests/local/component-model/instance-type.wast +++ b/tests/local/component-model/instance-type.wast @@ -199,11 +199,10 @@ "core type index 0 is not a module type") (assert_invalid - (component - (type $t (func)) - (type (instance - (export "a" (core module (type $t))) - ))) + (component quote + "(type $t (func))" + "(type (instance (export \"a\" (core module (type $t)))))" + ) "unknown core type") (assert_invalid diff --git a/tests/local/component-model/types.wast b/tests/local/component-model/types.wast index 88fbd2d376..34115c942f 100644 --- a/tests/local/component-model/types.wast +++ b/tests/local/component-model/types.wast @@ -119,10 +119,8 @@ "import name `a` conflicts with previous name `A`") (assert_invalid - (component $c - (core type $t (module - (alias outer $c $t (type)) - )) + (component quote + "(component $c (core type $t (module (alias outer $c $t (type)))))" ) "unknown core type") @@ -142,10 +140,8 @@ ) (assert_invalid - (component $c - (type $t (component - (alias outer $c $t (type)) - )) + (component quote + "(component $c (type $t (component (alias outer $c $t (type)))))" ) "unknown type") @@ -196,10 +192,8 @@ "export name `FOO-bar-BAZ` conflicts with previous name `foo-BAR-baz`") (assert_invalid - (component $c - (type $t (instance - (alias outer $c $t (type)) - )) + (component quote + "(component $c (type $t (instance (alias outer $c $t (type)))))" ) "unknown type") diff --git a/tests/roundtrip.rs b/tests/roundtrip.rs index 4fae706cc0..58b3598316 100644 --- a/tests/roundtrip.rs +++ b/tests/roundtrip.rs @@ -536,11 +536,6 @@ impl TestState { } fn test_json_from_wast(&self, path: &Path) -> Result<()> { - // component model tests aren't tested through json-from-wast at this time. - if path.iter().any(|p| p == "component-model") { - return Ok(()); - } - // This has an `assert_invalid` which should be `assert_malformed`, so // skip it. if path.ends_with("gc-subtypes-invalid.wast") { diff --git a/tests/snapshots/local/component-model/a.wast.json b/tests/snapshots/local/component-model/a.wast.json new file mode 100644 index 0000000000..657a7dbb93 --- /dev/null +++ b/tests/snapshots/local/component-model/a.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/a.wast", + "commands": [ + { + "type": "module", + "line": 4, + "filename": "a.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/adapt.wast.json b/tests/snapshots/local/component-model/adapt.wast.json new file mode 100644 index 0000000000..efa9eae4de --- /dev/null +++ b/tests/snapshots/local/component-model/adapt.wast.json @@ -0,0 +1,134 @@ +{ + "source_filename": "tests/local/component-model/adapt.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "adapt.0.wasm" + }, + { + "type": "assert_invalid", + "line": 75, + "filename": "adapt.1.wasm", + "text": "canonical encoding option `utf8` conflicts with option `utf16`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 82, + "filename": "adapt.2.wasm", + "text": "canonical encoding option `utf8` conflicts with option `latin1-utf16`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 89, + "filename": "adapt.3.wasm", + "text": "canonical encoding option `utf16` conflicts with option `latin1-utf16`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 96, + "filename": "adapt.4.wasm", + "text": "memory index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 103, + "filename": "adapt.5.wasm", + "text": "`memory` is specified more than once", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 112, + "filename": "adapt.6.wasm", + "text": "canonical option `memory` is required", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 122, + "filename": "adapt.7.wasm", + "text": "canonical option `realloc` is required", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 137, + "filename": "adapt.8.wasm", + "text": "canonical option `realloc` is specified more than once", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 155, + "filename": "adapt.9.wasm", + "text": "canonical option `realloc` uses a core function with an incorrect signature", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 172, + "filename": "adapt.10.wasm", + "text": "canonical option `post-return` uses a core function with an incorrect signature", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 191, + "filename": "adapt.11.wasm", + "text": "canonical option `post-return` is specified more than once", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 211, + "filename": "adapt.12.wasm", + "text": "canonical option `post-return` cannot be specified for lowerings", + "module_type": "binary" + }, + { + "type": "module", + "line": 230, + "filename": "adapt.13.wasm" + }, + { + "type": "assert_invalid", + "line": 248, + "filename": "adapt.14.wat", + "text": "unknown instance: failed to find name `$i`", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 256, + "filename": "adapt.15.wasm", + "text": "lowered parameter types `[]` do not match parameter types `[I32]`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 264, + "filename": "adapt.16.wasm", + "text": "lowered result types `[]` do not match result types `[I32]`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 272, + "filename": "adapt.17.wasm", + "text": "not a function type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 281, + "filename": "adapt.18.wat", + "text": "unknown core func: failed to find name `$f`", + "module_type": "text" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/alias.wast.json b/tests/snapshots/local/component-model/alias.wast.json new file mode 100644 index 0000000000..73c32f1f79 --- /dev/null +++ b/tests/snapshots/local/component-model/alias.wast.json @@ -0,0 +1,179 @@ +{ + "source_filename": "tests/local/component-model/alias.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "alias.0.wasm" + }, + { + "type": "module", + "line": 9, + "filename": "alias.1.wasm" + }, + { + "type": "module", + "line": 18, + "filename": "alias.2.wasm" + }, + { + "type": "module", + "line": 30, + "filename": "alias.3.wasm" + }, + { + "type": "module", + "line": 62, + "filename": "alias.4.wasm" + }, + { + "type": "module", + "line": 73, + "filename": "alias.5.wasm" + }, + { + "type": "assert_invalid", + "line": 101, + "filename": "alias.6.wasm", + "text": "export `a` for instance 0 is not a module", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 108, + "filename": "alias.7.wasm", + "text": "export `a` for instance 0 is not a module", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 118, + "filename": "alias.8.wasm", + "text": "core instance 0 has no export named `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 126, + "filename": "alias.9.wasm", + "text": "core instance 0 has no export named `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 134, + "filename": "alias.10.wasm", + "text": "instance 0 has no export named `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 142, + "filename": "alias.11.wasm", + "text": "type mismatch", + "module_type": "binary" + }, + { + "type": "module", + "line": 153, + "name": "PARENT", + "filename": "alias.12.wasm" + }, + { + "type": "module", + "line": 165, + "filename": "alias.13.wasm" + }, + { + "type": "module", + "line": 194, + "name": "a", + "filename": "alias.14.wasm" + }, + { + "type": "module", + "line": 213, + "filename": "alias.15.wasm" + }, + { + "type": "module", + "line": 218, + "filename": "alias.16.wasm" + }, + { + "type": "module", + "line": 223, + "filename": "alias.17.wasm" + }, + { + "type": "module", + "line": 228, + "name": "C", + "filename": "alias.18.wasm" + }, + { + "type": "module", + "line": 239, + "name": "C", + "filename": "alias.19.wasm" + }, + { + "type": "module", + "line": 245, + "name": "C", + "filename": "alias.20.wasm" + }, + { + "type": "assert_invalid", + "line": 252, + "filename": "alias.21.wasm", + "text": "invalid outer alias count of 100", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 256, + "filename": "alias.22.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 260, + "filename": "alias.23.wasm", + "text": "invalid outer alias count of 100", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 264, + "filename": "alias.24.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 268, + "filename": "alias.25.wasm", + "text": "invalid outer alias count of 100", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 272, + "filename": "alias.26.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "module", + "line": 275, + "filename": "alias.27.wasm" + }, + { + "type": "module", + "line": 283, + "filename": "alias.28.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/big.wast.json b/tests/snapshots/local/component-model/big.wast.json new file mode 100644 index 0000000000..f17480563d --- /dev/null +++ b/tests/snapshots/local/component-model/big.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/big.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "big.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/definedtypes.wast.json b/tests/snapshots/local/component-model/definedtypes.wast.json new file mode 100644 index 0000000000..5dcaa60a4c --- /dev/null +++ b/tests/snapshots/local/component-model/definedtypes.wast.json @@ -0,0 +1,179 @@ +{ + "source_filename": "tests/local/component-model/definedtypes.wast", + "commands": [ + { + "type": "module", + "line": 1, + "name": "C", + "filename": "definedtypes.0.wasm" + }, + { + "type": "assert_invalid", + "line": 46, + "filename": "definedtypes.1.wat", + "text": "variant case cannot refine itself", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 53, + "filename": "definedtypes.2.wat", + "text": "unknown variant case", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 60, + "filename": "definedtypes.3.wat", + "text": "unknown variant case", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 69, + "filename": "definedtypes.4.wasm", + "text": "variant case can only refine a previously defined case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 77, + "filename": "definedtypes.5.wasm", + "text": "variant case can only refine a previously defined case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 85, + "filename": "definedtypes.6.wat", + "text": "duplicate variant case identifier", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 93, + "filename": "definedtypes.7.wasm", + "text": "type index 0 is not a defined type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 100, + "filename": "definedtypes.8.wasm", + "text": "type index 0 is not a defined type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 107, + "filename": "definedtypes.9.wasm", + "text": "type index 0 is not a defined type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 114, + "filename": "definedtypes.10.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 117, + "filename": "definedtypes.11.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 120, + "filename": "definedtypes.12.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 123, + "filename": "definedtypes.13.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 126, + "filename": "definedtypes.14.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 129, + "filename": "definedtypes.15.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 133, + "filename": "definedtypes.16.wasm", + "text": "record field name `A-b-C-d` conflicts with previous field name `a-B-c-D`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 136, + "filename": "definedtypes.17.wasm", + "text": "variant case name `x` conflicts with previous case name `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 139, + "filename": "definedtypes.18.wasm", + "text": "flag name `X` conflicts with previous flag name `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 142, + "filename": "definedtypes.19.wasm", + "text": "enum tag name `X` conflicts with previous tag name `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 146, + "filename": "definedtypes.20.wasm", + "text": "name cannot be empty", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 149, + "filename": "definedtypes.21.wasm", + "text": "name cannot be empty", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 152, + "filename": "definedtypes.22.wasm", + "text": "name cannot be empty", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 155, + "filename": "definedtypes.23.wasm", + "text": "name cannot be empty", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 159, + "filename": "definedtypes.24.wasm", + "text": "variant type must have at least one case", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/empty.wast.json b/tests/snapshots/local/component-model/empty.wast.json new file mode 100644 index 0000000000..e13914cbb9 --- /dev/null +++ b/tests/snapshots/local/component-model/empty.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/empty.wast", + "commands": [ + { + "type": "module", + "line": 2, + "filename": "empty.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/example.wast.json b/tests/snapshots/local/component-model/example.wast.json new file mode 100644 index 0000000000..a0b716586b --- /dev/null +++ b/tests/snapshots/local/component-model/example.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/example.wast", + "commands": [ + { + "type": "module", + "line": 3, + "filename": "example.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/export-ascription.wast.json b/tests/snapshots/local/component-model/export-ascription.wast.json new file mode 100644 index 0000000000..00505406b6 --- /dev/null +++ b/tests/snapshots/local/component-model/export-ascription.wast.json @@ -0,0 +1,29 @@ +{ + "source_filename": "tests/local/component-model/export-ascription.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "export-ascription.0.wasm" + }, + { + "type": "module", + "line": 7, + "filename": "export-ascription.1.wasm" + }, + { + "type": "assert_invalid", + "line": 14, + "filename": "export-ascription.2.wasm", + "text": "ascribed type of export is not compatible", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 22, + "filename": "export-ascription.3.wasm", + "text": "missing expected export `f`", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/export-introduces-alias.wast.json b/tests/snapshots/local/component-model/export-introduces-alias.wast.json new file mode 100644 index 0000000000..74b0dcd3d7 --- /dev/null +++ b/tests/snapshots/local/component-model/export-introduces-alias.wast.json @@ -0,0 +1,32 @@ +{ + "source_filename": "tests/local/component-model/export-introduces-alias.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "export-introduces-alias.0.wasm" + }, + { + "type": "module", + "line": 8, + "filename": "export-introduces-alias.1.wasm" + }, + { + "type": "module", + "line": 16, + "filename": "export-introduces-alias.2.wasm" + }, + { + "type": "assert_invalid", + "line": 30, + "filename": "export-introduces-alias.3.wat", + "text": "duplicate type identifier", + "module_type": "text" + }, + { + "type": "module", + "line": 38, + "filename": "export-introduces-alias.4.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/export.wast.json b/tests/snapshots/local/component-model/export.wast.json new file mode 100644 index 0000000000..0fe9caa23f --- /dev/null +++ b/tests/snapshots/local/component-model/export.wast.json @@ -0,0 +1,97 @@ +{ + "source_filename": "tests/local/component-model/export.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "export.0.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 6, + "filename": "export.1.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 10, + "filename": "export.2.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 14, + "filename": "export.3.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 18, + "filename": "export.4.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "module", + "line": 21, + "filename": "export.5.wasm" + }, + { + "type": "assert_invalid", + "line": 36, + "filename": "export.6.wasm", + "text": "cannot be used more than once", + "module_type": "binary" + }, + { + "type": "module", + "line": 44, + "filename": "export.7.wasm" + }, + { + "type": "module", + "line": 50, + "filename": "export.8.wasm" + }, + { + "type": "assert_invalid", + "line": 57, + "filename": "export.9.wasm", + "text": "not a valid export name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 60, + "filename": "export.10.wasm", + "text": "not a valid export name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 63, + "filename": "export.11.wasm", + "text": "not a valid extern name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 66, + "filename": "export.12.wasm", + "text": "not a valid export name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 69, + "filename": "export.13.wasm", + "text": "not a valid export name", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/func.wast.json b/tests/snapshots/local/component-model/func.wast.json new file mode 100644 index 0000000000..ce97c9fdb4 --- /dev/null +++ b/tests/snapshots/local/component-model/func.wast.json @@ -0,0 +1,72 @@ +{ + "source_filename": "tests/local/component-model/func.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "func.0.wasm" + }, + { + "type": "assert_invalid", + "line": 8, + "filename": "func.1.wasm", + "text": "multiple returns on a function is now a gated feature", + "module_type": "binary" + }, + { + "type": "module", + "line": 13, + "filename": "func.2.wasm" + }, + { + "type": "assert_invalid", + "line": 22, + "filename": "func.3.wasm", + "text": "function parameter name `FOO` conflicts with previous parameter name `foo`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 30, + "filename": "func.4.wasm", + "text": "canonical option `memory` is required", + "module_type": "binary" + }, + { + "type": "module", + "line": 44, + "filename": "func.5.wasm" + }, + { + "type": "module", + "line": 53, + "filename": "func.6.wasm" + }, + { + "type": "module", + "line": 65, + "filename": "func.7.wasm" + }, + { + "type": "assert_invalid", + "line": 82, + "filename": "func.8.wasm", + "text": "canonical option `realloc` is required", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 105, + "filename": "func.9.wasm", + "text": "canonical option `realloc` is required", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 117, + "filename": "func.10.wasm", + "text": "canonical option `realloc` is required", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/import-extended.wast.json b/tests/snapshots/local/component-model/import-extended.wast.json new file mode 100644 index 0000000000..a2e59865ed --- /dev/null +++ b/tests/snapshots/local/component-model/import-extended.wast.json @@ -0,0 +1,20 @@ +{ + "source_filename": "tests/local/component-model/import-extended.wast", + "commands": [ + { + "type": "module", + "line": 4, + "filename": "import-extended.0.wasm" + }, + { + "type": "module", + "line": 9, + "filename": "import-extended.1.wasm" + }, + { + "type": "module", + "line": 20, + "filename": "import-extended.2.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/import.wast.json b/tests/snapshots/local/component-model/import.wast.json new file mode 100644 index 0000000000..ad84643248 --- /dev/null +++ b/tests/snapshots/local/component-model/import.wast.json @@ -0,0 +1,514 @@ +{ + "source_filename": "tests/local/component-model/import.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "import.0.wasm" + }, + { + "type": "assert_invalid", + "line": 16, + "filename": "import.1.wasm", + "text": "type index 0 is not an instance type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 23, + "filename": "import.2.wasm", + "text": "core type index 0 is not a module type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 30, + "filename": "import.3.wasm", + "text": "type index 0 is not a function type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 38, + "filename": "import.4.wasm", + "text": "duplicate import name `:`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 46, + "filename": "import.5.wasm", + "text": "duplicate import name `:`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 54, + "filename": "import.6.wasm", + "text": "duplicate import name `:a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 62, + "filename": "import.7.wasm", + "text": "duplicate import name `:a`", + "module_type": "binary" + }, + { + "type": "assert_malformed", + "line": 71, + "filename": "import.8.wat", + "text": "import name `a` conflicts with previous name `a`", + "module_type": "text" + }, + { + "type": "assert_malformed", + "line": 78, + "filename": "import.9.wat", + "text": "import name `a` conflicts with previous name `a`", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 87, + "filename": "import.10.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 93, + "filename": "import.11.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 101, + "filename": "import.12.wasm", + "text": "value index 0 was not used as part of an instantiation, start function, or export", + "module_type": "binary" + }, + { + "type": "module", + "line": 106, + "filename": "import.13.wasm" + }, + { + "type": "module", + "line": 111, + "filename": "import.14.wasm" + }, + { + "type": "assert_invalid", + "line": 125, + "filename": "import.15.wasm", + "text": "conflicts with previous name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 132, + "filename": "import.16.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 135, + "filename": "import.17.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 138, + "filename": "import.18.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 141, + "filename": "import.19.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 144, + "filename": "import.20.wasm", + "text": "`wasi/http` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 147, + "filename": "import.21.wasm", + "text": "`TyPeS` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 150, + "filename": "import.22.wasm", + "text": "`WaSi` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 153, + "filename": "import.23.wasm", + "text": "`HtTp` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 156, + "filename": "import.24.wasm", + "text": "empty string", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 159, + "filename": "import.25.wasm", + "text": "unexpected character '.'", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 162, + "filename": "import.26.wasm", + "text": "unexpected end of input", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 165, + "filename": "import.27.wasm", + "text": "unexpected character 'a'", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 168, + "filename": "import.28.wasm", + "text": "unexpected character 'b'", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 171, + "filename": "import.29.wasm", + "text": "unexpected character 'x'", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 174, + "filename": "import.30.wasm", + "text": "empty identifier segment", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 177, + "filename": "import.31.wasm", + "text": "empty identifier segment", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 180, + "filename": "import.32.wasm", + "text": "expected `/` after package name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 183, + "filename": "import.33.wasm", + "text": "trailing characters found: `/qux`", + "module_type": "binary" + }, + { + "type": "module", + "line": 186, + "filename": "import.34.wasm" + }, + { + "type": "module", + "line": 191, + "filename": "import.35.wasm" + }, + { + "type": "assert_invalid", + "line": 203, + "filename": "import.36.wasm", + "text": "expected `<` at ``", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 206, + "filename": "import.37.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 209, + "filename": "import.38.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 212, + "filename": "import.39.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 215, + "filename": "import.40.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 218, + "filename": "import.41.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 221, + "filename": "import.42.wasm", + "text": "expected `{` at `>`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 224, + "filename": "import.43.wasm", + "text": "expected `>=` or `<` at start of version range", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 227, + "filename": "import.44.wasm", + "text": "`xyz` is not a valid semver", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 230, + "filename": "import.45.wasm", + "text": "`1.2.3 >=2.3.4` is not a valid semver", + "module_type": "binary" + }, + { + "type": "module", + "line": 233, + "filename": "import.46.wasm" + }, + { + "type": "assert_invalid", + "line": 241, + "filename": "import.47.wasm", + "text": "expected `<` at ``", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 244, + "filename": "import.48.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 247, + "filename": "import.49.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 250, + "filename": "import.50.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 253, + "filename": "import.51.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 256, + "filename": "import.52.wasm", + "text": "`` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 259, + "filename": "import.53.wasm", + "text": "expected `>` at ``", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 262, + "filename": "import.54.wasm", + "text": "is not a valid semver", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 265, + "filename": "import.55.wasm", + "text": "expected `>` at ``", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 268, + "filename": "import.56.wasm", + "text": "expected `integrity=<`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 271, + "filename": "import.57.wasm", + "text": "trailing characters found: `x`", + "module_type": "binary" + }, + { + "type": "module", + "line": 274, + "filename": "import.58.wasm" + }, + { + "type": "assert_invalid", + "line": 281, + "filename": "import.59.wasm", + "text": "expected `<` at ``", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 284, + "filename": "import.60.wasm", + "text": "failed to find `>`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 287, + "filename": "import.61.wasm", + "text": "url cannot contain `<`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 291, + "filename": "import.62.wasm", + "text": "not a valid extern name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 299, + "filename": "import.63.wasm", + "text": "not a valid extern name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 302, + "filename": "import.64.wasm", + "text": "not a valid extern name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 305, + "filename": "import.65.wasm", + "text": "not a valid extern name", + "module_type": "binary" + }, + { + "type": "module", + "line": 308, + "filename": "import.66.wasm" + }, + { + "type": "assert_invalid", + "line": 321, + "filename": "import.67.wasm", + "text": "integrity hash cannot be empty", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 324, + "filename": "import.68.wasm", + "text": "expected `-` after hash algorithm", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 327, + "filename": "import.69.wasm", + "text": "not valid base64", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 330, + "filename": "import.70.wasm", + "text": "not valid base64", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 333, + "filename": "import.71.wasm", + "text": "not valid base64", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 336, + "filename": "import.72.wasm", + "text": "not valid base64", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 339, + "filename": "import.73.wasm", + "text": "not valid base64", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 342, + "filename": "import.74.wasm", + "text": "unrecognized hash algorithm", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/imports-exports.wast.json b/tests/snapshots/local/component-model/imports-exports.wast.json new file mode 100644 index 0000000000..87af5e7acf --- /dev/null +++ b/tests/snapshots/local/component-model/imports-exports.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/imports-exports.wast", + "commands": [ + { + "type": "module", + "line": 3, + "filename": "imports-exports.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/inline-exports.wast.json b/tests/snapshots/local/component-model/inline-exports.wast.json new file mode 100644 index 0000000000..ee1ac7c69f --- /dev/null +++ b/tests/snapshots/local/component-model/inline-exports.wast.json @@ -0,0 +1,17 @@ +{ + "source_filename": "tests/local/component-model/inline-exports.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "inline-exports.0.wasm" + }, + { + "type": "assert_malformed", + "line": 6, + "filename": "inline-exports.1.wat", + "text": "unexpected token", + "module_type": "text" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/instance-type.wast.json b/tests/snapshots/local/component-model/instance-type.wast.json new file mode 100644 index 0000000000..684e3725a7 --- /dev/null +++ b/tests/snapshots/local/component-model/instance-type.wast.json @@ -0,0 +1,79 @@ +{ + "source_filename": "tests/local/component-model/instance-type.wast", + "commands": [ + { + "type": "module", + "line": 2, + "filename": "instance-type.0.wasm" + }, + { + "type": "module", + "line": 68, + "filename": "instance-type.1.wasm" + }, + { + "type": "module", + "line": 73, + "filename": "instance-type.2.wasm" + }, + { + "type": "module", + "line": 83, + "filename": "instance-type.3.wasm" + }, + { + "type": "module", + "line": 107, + "filename": "instance-type.4.wasm" + }, + { + "type": "assert_invalid", + "line": 179, + "filename": "instance-type.5.wasm", + "text": "export name `a` conflicts with previous name `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 186, + "filename": "instance-type.6.wasm", + "text": "type index 0 is not an instance type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 194, + "filename": "instance-type.7.wasm", + "text": "core type index 0 is not a module type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 202, + "filename": "instance-type.8.wat", + "text": "unknown core type", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 209, + "filename": "instance-type.9.wasm", + "text": "type index 0 is not a function type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 217, + "filename": "instance-type.10.wasm", + "text": "type index 0 is not a function type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 225, + "filename": "instance-type.11.wasm", + "text": "type index 0 is not a function type", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/instantiate.wast.json b/tests/snapshots/local/component-model/instantiate.wast.json new file mode 100644 index 0000000000..3808ba5a5b --- /dev/null +++ b/tests/snapshots/local/component-model/instantiate.wast.json @@ -0,0 +1,628 @@ +{ + "source_filename": "tests/local/component-model/instantiate.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "instantiate.0.wasm" + }, + { + "type": "module", + "line": 6, + "filename": "instantiate.1.wasm" + }, + { + "type": "module", + "line": 12, + "filename": "instantiate.2.wasm" + }, + { + "type": "module", + "line": 18, + "filename": "instantiate.3.wasm" + }, + { + "type": "module", + "line": 24, + "filename": "instantiate.4.wasm" + }, + { + "type": "module", + "line": 30, + "filename": "instantiate.5.wasm" + }, + { + "type": "module", + "line": 36, + "filename": "instantiate.6.wasm" + }, + { + "type": "module", + "line": 53, + "filename": "instantiate.7.wasm" + }, + { + "type": "module", + "line": 76, + "filename": "instantiate.8.wasm" + }, + { + "type": "module", + "line": 83, + "filename": "instantiate.9.wasm" + }, + { + "type": "module", + "line": 99, + "filename": "instantiate.10.wasm" + }, + { + "type": "assert_invalid", + "line": 136, + "filename": "instantiate.11.wasm", + "text": "unknown module", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 141, + "filename": "instantiate.12.wasm", + "text": "unknown component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 146, + "filename": "instantiate.13.wasm", + "text": "unknown module", + "module_type": "binary" + }, + { + "type": "module", + "line": 152, + "filename": "instantiate.14.wasm" + }, + { + "type": "assert_invalid", + "line": 158, + "filename": "instantiate.15.wasm", + "text": "missing module instantiation argument", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 164, + "filename": "instantiate.16.wasm", + "text": "missing import named `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 171, + "filename": "instantiate.17.wasm", + "text": "expected func, found component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 181, + "filename": "instantiate.18.wasm", + "text": "expected 0 results, found 1", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 191, + "filename": "instantiate.19.wasm", + "text": "expected 0 parameters, found 1", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 201, + "filename": "instantiate.20.wasm", + "text": "type mismatch in import `::`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 215, + "filename": "instantiate.21.wasm", + "text": "missing expected import `::foobar`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 226, + "filename": "instantiate.22.wasm", + "text": "missing expected export `x`", + "module_type": "binary" + }, + { + "type": "module", + "line": 236, + "filename": "instantiate.23.wasm" + }, + { + "type": "module", + "line": 250, + "filename": "instantiate.24.wasm" + }, + { + "type": "module", + "line": 262, + "filename": "instantiate.25.wasm" + }, + { + "type": "assert_invalid", + "line": 280, + "filename": "instantiate.26.wasm", + "text": "expected: [] -> []", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 288, + "filename": "instantiate.27.wasm", + "text": "expected: [] -> []", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 296, + "filename": "instantiate.28.wasm", + "text": "expected global type i32, found i64", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 304, + "filename": "instantiate.29.wasm", + "text": "expected table element type funcref, found externref", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 312, + "filename": "instantiate.30.wasm", + "text": "mismatch in table limits", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 320, + "filename": "instantiate.31.wasm", + "text": "mismatch in table limits", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 328, + "filename": "instantiate.32.wasm", + "text": "mismatch in table limits", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 336, + "filename": "instantiate.33.wasm", + "text": "mismatch in the shared flag for memories", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 344, + "filename": "instantiate.34.wasm", + "text": "mismatch in memory limits", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 352, + "filename": "instantiate.35.wasm", + "text": "type mismatch in export `g`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 362, + "filename": "instantiate.36.wasm", + "text": "unknown module", + "module_type": "binary" + }, + { + "type": "module", + "line": 367, + "filename": "instantiate.37.wasm" + }, + { + "type": "assert_invalid", + "line": 386, + "filename": "instantiate.38.wasm", + "text": "function index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 390, + "filename": "instantiate.39.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 394, + "filename": "instantiate.40.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 398, + "filename": "instantiate.41.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 402, + "filename": "instantiate.42.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 406, + "filename": "instantiate.43.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 410, + "filename": "instantiate.44.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 414, + "filename": "instantiate.45.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 418, + "filename": "instantiate.46.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 422, + "filename": "instantiate.47.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 426, + "filename": "instantiate.48.wasm", + "text": "duplicate module instantiation argument named ``", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 438, + "filename": "instantiate.49.wasm", + "text": "duplicate module instantiation argument named ``", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 449, + "filename": "instantiate.50.wasm", + "text": "expected global, found func", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 460, + "filename": "instantiate.51.wasm", + "text": "instantiation argument `a` conflicts with previous argument `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 471, + "filename": "instantiate.52.wasm", + "text": "expected func, found component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 480, + "filename": "instantiate.53.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 489, + "filename": "instantiate.54.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 498, + "filename": "instantiate.55.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 507, + "filename": "instantiate.56.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 516, + "filename": "instantiate.57.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 525, + "filename": "instantiate.58.wasm", + "text": "export name `a` conflicts with previous name `a`", + "module_type": "binary" + }, + { + "type": "module", + "line": 534, + "filename": "instantiate.59.wasm" + }, + { + "type": "module", + "line": 549, + "filename": "instantiate.60.wasm" + }, + { + "type": "assert_invalid", + "line": 566, + "filename": "instantiate.61.wasm", + "text": "export name `` already defined", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 577, + "filename": "instantiate.62.wasm", + "text": "no export named `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 585, + "filename": "instantiate.63.wasm", + "text": "index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 591, + "filename": "instantiate.64.wasm", + "text": "module instantiation argument `` does not export an item named `table`", + "module_type": "binary" + }, + { + "type": "module", + "line": 623, + "filename": "instantiate.65.wasm" + }, + { + "type": "assert_invalid", + "line": 637, + "filename": "instantiate.66.wasm", + "text": "expected primitive `u32` found primitive `string`", + "module_type": "binary" + }, + { + "type": "module", + "line": 661, + "filename": "instantiate.67.wasm" + }, + { + "type": "module", + "line": 676, + "filename": "instantiate.68.wasm" + }, + { + "type": "assert_invalid", + "line": 690, + "filename": "instantiate.69.wasm", + "text": "expected parameter named `y`, found `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 700, + "filename": "instantiate.70.wasm", + "text": "type mismatch in function parameter `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 710, + "filename": "instantiate.71.wasm", + "text": "mismatched result names", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 720, + "filename": "instantiate.72.wasm", + "text": "type mismatch with result type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 731, + "filename": "instantiate.73.wasm", + "text": "type mismatch in instance export `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 742, + "filename": "instantiate.74.wasm", + "text": "expected primitive, found record", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 754, + "filename": "instantiate.75.wasm", + "text": "expected record, found u32", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 766, + "filename": "instantiate.76.wasm", + "text": "expected u32, found tuple", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 779, + "filename": "instantiate.77.wasm", + "text": "type mismatch in record field `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 792, + "filename": "instantiate.78.wasm", + "text": "expected 1 fields, found 2", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 804, + "filename": "instantiate.79.wasm", + "text": "expected field name `a`, found `b`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 816, + "filename": "instantiate.80.wasm", + "text": "expected 1 cases, found 2", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 828, + "filename": "instantiate.81.wasm", + "text": "expected case named `x`, found `y`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 840, + "filename": "instantiate.82.wasm", + "text": "expected case `x` to have a type, found none", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 852, + "filename": "instantiate.83.wasm", + "text": "expected case `x` to have no type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 864, + "filename": "instantiate.84.wasm", + "text": "type mismatch in variant case `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 876, + "filename": "instantiate.85.wasm", + "text": "expected 1 types, found 2", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 888, + "filename": "instantiate.86.wasm", + "text": "type mismatch in tuple field 0", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 900, + "filename": "instantiate.87.wasm", + "text": "mismatch in flags elements", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 912, + "filename": "instantiate.88.wasm", + "text": "mismatch in enum elements", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 924, + "filename": "instantiate.89.wasm", + "text": "type mismatch in ok variant", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 936, + "filename": "instantiate.90.wasm", + "text": "type mismatch in err variant", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 948, + "filename": "instantiate.91.wasm", + "text": "expected ok type to not be present", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 960, + "filename": "instantiate.92.wasm", + "text": "expected ok type, but found none", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 972, + "filename": "instantiate.93.wasm", + "text": "expected err type to not be present", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 984, + "filename": "instantiate.94.wasm", + "text": "expected err type, but found none", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/invalid.wast.json b/tests/snapshots/local/component-model/invalid.wast.json new file mode 100644 index 0000000000..97dd44610b --- /dev/null +++ b/tests/snapshots/local/component-model/invalid.wast.json @@ -0,0 +1,33 @@ +{ + "source_filename": "tests/local/component-model/invalid.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "invalid.0.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_malformed", + "line": 11, + "filename": "invalid.1.wat", + "text": "unknown func", + "module_type": "text" + }, + { + "type": "assert_malformed", + "line": 17, + "filename": "invalid.2.wat", + "text": "outer count of `100` is too large", + "module_type": "text" + }, + { + "type": "assert_malformed", + "line": 23, + "filename": "invalid.3.wat", + "text": "outer component `nonexistent` not found", + "module_type": "text" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/link.wast.json b/tests/snapshots/local/component-model/link.wast.json new file mode 100644 index 0000000000..ecbdbb27bf --- /dev/null +++ b/tests/snapshots/local/component-model/link.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/link.wast", + "commands": [ + { + "type": "module", + "line": 3, + "filename": "link.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/lots-of-aliases.wast.json b/tests/snapshots/local/component-model/lots-of-aliases.wast.json new file mode 100644 index 0000000000..93abf4253b --- /dev/null +++ b/tests/snapshots/local/component-model/lots-of-aliases.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/lots-of-aliases.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "lots-of-aliases.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/lower.wast.json b/tests/snapshots/local/component-model/lower.wast.json new file mode 100644 index 0000000000..98a20cdec2 --- /dev/null +++ b/tests/snapshots/local/component-model/lower.wast.json @@ -0,0 +1,19 @@ +{ + "source_filename": "tests/local/component-model/lower.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "lower.0.wasm", + "text": "canonical option `memory` is required", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 10, + "filename": "lower.1.wasm", + "text": "canonical option `memory` is required", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/memory64.wast.json b/tests/snapshots/local/component-model/memory64.wast.json new file mode 100644 index 0000000000..318a8ee356 --- /dev/null +++ b/tests/snapshots/local/component-model/memory64.wast.json @@ -0,0 +1,19 @@ +{ + "source_filename": "tests/local/component-model/memory64.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "memory64.0.wasm", + "text": "mismatch in index type used for memories", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 13, + "filename": "memory64.1.wasm", + "text": "mismatch in index type used for memories", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/module-link.wast.json b/tests/snapshots/local/component-model/module-link.wast.json new file mode 100644 index 0000000000..9a8e829206 --- /dev/null +++ b/tests/snapshots/local/component-model/module-link.wast.json @@ -0,0 +1,15 @@ +{ + "source_filename": "tests/local/component-model/module-link.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "module-link.0.wasm" + }, + { + "type": "module", + "line": 10, + "filename": "module-link.1.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/more-flags.wast.json b/tests/snapshots/local/component-model/more-flags.wast.json new file mode 100644 index 0000000000..5ec6cfc05c --- /dev/null +++ b/tests/snapshots/local/component-model/more-flags.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/more-flags.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "more-flags.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/multiple-returns.wast.json b/tests/snapshots/local/component-model/multiple-returns.wast.json new file mode 100644 index 0000000000..0f8bda5d29 --- /dev/null +++ b/tests/snapshots/local/component-model/multiple-returns.wast.json @@ -0,0 +1,36 @@ +{ + "source_filename": "tests/local/component-model/multiple-returns.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "multiple-returns.0.wasm" + }, + { + "type": "module", + "line": 5, + "filename": "multiple-returns.1.wasm" + }, + { + "type": "assert_invalid", + "line": 15, + "filename": "multiple-returns.2.wasm", + "text": "component start function has a result count of 1 but the function type has a result count of 2", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 26, + "filename": "multiple-returns.3.wasm", + "text": "function result name cannot be empty", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 33, + "filename": "multiple-returns.4.wasm", + "text": "function result name `foo` conflicts with previous result name `FOO`", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/naming.wast.json b/tests/snapshots/local/component-model/naming.wast.json new file mode 100644 index 0000000000..4065be146c --- /dev/null +++ b/tests/snapshots/local/component-model/naming.wast.json @@ -0,0 +1,120 @@ +{ + "source_filename": "tests/local/component-model/naming.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "naming.0.wasm" + }, + { + "type": "assert_invalid", + "line": 8, + "filename": "naming.1.wasm", + "text": "`1` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 16, + "filename": "naming.2.wasm", + "text": "instance 0 has no export named `Xml`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 24, + "filename": "naming.3.wasm", + "text": "flag name `a-1-c` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 31, + "filename": "naming.4.wasm", + "text": "enum tag name `NevEr` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 38, + "filename": "naming.5.wasm", + "text": "record field name `GoNnA` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 45, + "filename": "naming.6.wasm", + "text": "variant case name `GIVe` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 53, + "filename": "naming.7.wasm", + "text": "function parameter name `yOu` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 60, + "filename": "naming.8.wasm", + "text": "name `uP` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 67, + "filename": "naming.9.wasm", + "text": "`NevEr` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 74, + "filename": "naming.10.wasm", + "text": "`GonnA` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 81, + "filename": "naming.11.wasm", + "text": "`lET` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 88, + "filename": "naming.12.wasm", + "text": "`YoU` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 95, + "filename": "naming.13.wasm", + "text": "`DOWn` is not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 102, + "filename": "naming.14.wasm", + "text": "character `A` is not lowercase in package name/namespace", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 108, + "filename": "naming.15.wasm", + "text": "character `B` is not lowercase in package name/namespace", + "module_type": "binary" + }, + { + "type": "module", + "line": 113, + "filename": "naming.16.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/nested-modules.wast.json b/tests/snapshots/local/component-model/nested-modules.wast.json new file mode 100644 index 0000000000..222b719ac8 --- /dev/null +++ b/tests/snapshots/local/component-model/nested-modules.wast.json @@ -0,0 +1,27 @@ +{ + "source_filename": "tests/local/component-model/nested-modules.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "nested-modules.0.wasm" + }, + { + "type": "module", + "line": 21, + "filename": "nested-modules.1.wasm" + }, + { + "type": "assert_invalid", + "line": 28, + "filename": "nested-modules.2.wasm", + "text": "type mismatch", + "module_type": "binary" + }, + { + "type": "module", + "line": 38, + "filename": "nested-modules.3.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/resources.wast.json b/tests/snapshots/local/component-model/resources.wast.json new file mode 100644 index 0000000000..f216f365d7 --- /dev/null +++ b/tests/snapshots/local/component-model/resources.wast.json @@ -0,0 +1,713 @@ +{ + "source_filename": "tests/local/component-model/resources.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "resources.0.wasm" + }, + { + "type": "module", + "line": 5, + "filename": "resources.1.wasm" + }, + { + "type": "module", + "line": 13, + "filename": "resources.2.wasm" + }, + { + "type": "module", + "line": 19, + "filename": "resources.3.wasm" + }, + { + "type": "module", + "line": 28, + "filename": "resources.4.wasm" + }, + { + "type": "assert_invalid", + "line": 50, + "filename": "resources.5.wasm", + "text": "resources can only be represented by `i32`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 56, + "filename": "resources.6.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 62, + "filename": "resources.7.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 68, + "filename": "resources.8.wasm", + "text": "not a resource type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 75, + "filename": "resources.9.wasm", + "text": "not a resource type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 82, + "filename": "resources.10.wasm", + "text": "not a local resource", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 89, + "filename": "resources.11.wasm", + "text": "not a local resource", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 96, + "filename": "resources.12.wasm", + "text": "not a resource type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 103, + "filename": "resources.13.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 109, + "filename": "resources.14.wasm", + "text": "not a resource type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 116, + "filename": "resources.15.wasm", + "text": "not a resource type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 123, + "filename": "resources.16.wasm", + "text": "wrong signature for a destructor", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 134, + "filename": "resources.17.wasm", + "text": "function index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 140, + "filename": "resources.18.wasm", + "text": "resource types are not the same", + "module_type": "binary" + }, + { + "type": "module", + "line": 154, + "filename": "resources.19.wasm" + }, + { + "type": "assert_invalid", + "line": 163, + "filename": "resources.20.wasm", + "text": "resources can only be defined within a concrete component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 171, + "filename": "resources.21.wasm", + "text": "resources can only be defined within a concrete component", + "module_type": "binary" + }, + { + "type": "module", + "line": 178, + "filename": "resources.22.wasm" + }, + { + "type": "module", + "line": 189, + "filename": "resources.23.wasm" + }, + { + "type": "module", + "line": 199, + "name": "C", + "filename": "resources.24.wasm" + }, + { + "type": "module", + "line": 218, + "filename": "resources.25.wasm" + }, + { + "type": "module", + "line": 223, + "name": "C", + "filename": "resources.26.wasm" + }, + { + "type": "module", + "line": 232, + "filename": "resources.27.wasm" + }, + { + "type": "module", + "line": 249, + "filename": "resources.28.wasm" + }, + { + "type": "module", + "line": 261, + "filename": "resources.29.wasm" + }, + { + "type": "module", + "line": 274, + "filename": "resources.30.wasm" + }, + { + "type": "module", + "line": 280, + "filename": "resources.31.wasm" + }, + { + "type": "module", + "line": 287, + "filename": "resources.32.wasm" + }, + { + "type": "module", + "line": 293, + "filename": "resources.33.wasm" + }, + { + "type": "module", + "line": 300, + "name": "P", + "filename": "resources.34.wasm" + }, + { + "type": "module", + "line": 317, + "filename": "resources.35.wasm" + }, + { + "type": "assert_invalid", + "line": 339, + "filename": "resources.36.wasm", + "text": "not a local resource", + "module_type": "binary" + }, + { + "type": "module", + "line": 350, + "filename": "resources.37.wasm" + }, + { + "type": "module", + "line": 360, + "filename": "resources.38.wasm" + }, + { + "type": "module", + "line": 372, + "filename": "resources.39.wasm" + }, + { + "type": "module", + "line": 388, + "filename": "resources.40.wasm" + }, + { + "type": "assert_invalid", + "line": 409, + "filename": "resources.41.wasm", + "text": "resource types are not the same", + "module_type": "binary" + }, + { + "type": "module", + "line": 431, + "filename": "resources.42.wasm" + }, + { + "type": "module", + "line": 457, + "filename": "resources.43.wasm" + }, + { + "type": "assert_invalid", + "line": 484, + "filename": "resources.44.wasm", + "text": "expected resource, found defined type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 494, + "filename": "resources.45.wasm", + "text": "expected defined type, found resource", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 505, + "filename": "resources.46.wasm", + "text": "resource types are not the same", + "module_type": "binary" + }, + { + "type": "module", + "line": 519, + "filename": "resources.47.wasm" + }, + { + "type": "assert_invalid", + "line": 533, + "filename": "resources.48.wasm", + "text": "func not valid to be used as import", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 540, + "filename": "resources.49.wasm", + "text": "func not valid to be used as import", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 549, + "filename": "resources.50.wasm", + "text": "func not valid to be used as export", + "module_type": "binary" + }, + { + "type": "module", + "line": 559, + "filename": "resources.51.wasm" + }, + { + "type": "module", + "line": 569, + "filename": "resources.52.wasm" + }, + { + "type": "module", + "line": 583, + "filename": "resources.53.wasm" + }, + { + "type": "module", + "line": 601, + "filename": "resources.54.wasm" + }, + { + "type": "module", + "line": 617, + "filename": "resources.55.wasm" + }, + { + "type": "module", + "line": 649, + "filename": "resources.56.wasm" + }, + { + "type": "module", + "line": 669, + "filename": "resources.57.wasm" + }, + { + "type": "assert_invalid", + "line": 693, + "filename": "resources.58.wasm", + "text": "resource types are not the same", + "module_type": "binary" + }, + { + "type": "module", + "line": 713, + "filename": "resources.59.wasm" + }, + { + "type": "assert_invalid", + "line": 736, + "filename": "resources.60.wasm", + "text": "missing import named `x`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 744, + "filename": "resources.61.wasm", + "text": "missing import named `y`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 756, + "filename": "resources.62.wasm", + "text": "resource types are not the same", + "module_type": "binary" + }, + { + "type": "module", + "line": 771, + "name": "A", + "filename": "resources.63.wasm" + }, + { + "type": "assert_invalid", + "line": 795, + "filename": "resources.64.wasm", + "text": "refers to resources not defined in the current component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 801, + "filename": "resources.65.wasm", + "text": "refers to resources not defined in the current component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 808, + "filename": "resources.66.wasm", + "text": "refers to resources not defined in the current component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 815, + "filename": "resources.67.wasm", + "text": "refers to resources not defined in the current component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 822, + "filename": "resources.68.wasm", + "text": "refers to resources not defined in the current component", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 830, + "filename": "resources.69.wasm", + "text": "expected component, found instance", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 846, + "filename": "resources.70.wasm", + "text": "type mismatch for import `y`", + "module_type": "binary" + }, + { + "type": "module", + "line": 866, + "filename": "resources.71.wasm" + }, + { + "type": "assert_invalid", + "line": 890, + "filename": "resources.72.wasm", + "text": "failed to find `.` character", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 895, + "filename": "resources.73.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 898, + "filename": "resources.74.wasm", + "text": "should return one value", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 901, + "filename": "resources.75.wasm", + "text": "should return `(own $T)`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 904, + "filename": "resources.76.wasm", + "text": "import name `[constructor]a` is not valid", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 909, + "filename": "resources.77.wasm", + "text": "function does not match expected resource name `b`", + "module_type": "binary" + }, + { + "type": "module", + "line": 913, + "filename": "resources.78.wasm" + }, + { + "type": "module", + "line": 916, + "filename": "resources.79.wasm" + }, + { + "type": "assert_invalid", + "line": 922, + "filename": "resources.80.wasm", + "text": "failed to find `.` character", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 925, + "filename": "resources.81.wasm", + "text": "failed to find `.` character", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 928, + "filename": "resources.82.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 931, + "filename": "resources.83.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 934, + "filename": "resources.84.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 937, + "filename": "resources.85.wasm", + "text": "is not a func", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 940, + "filename": "resources.86.wasm", + "text": "should have at least one argument", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 943, + "filename": "resources.87.wasm", + "text": "should have a first argument called `self`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 946, + "filename": "resources.88.wasm", + "text": "should take a first argument of `(borrow $T)`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 949, + "filename": "resources.89.wasm", + "text": "does not match expected resource name", + "module_type": "binary" + }, + { + "type": "module", + "line": 953, + "filename": "resources.90.wasm" + }, + { + "type": "assert_invalid", + "line": 959, + "filename": "resources.91.wasm", + "text": "failed to find `.` character", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 962, + "filename": "resources.92.wasm", + "text": "failed to find `.` character", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 965, + "filename": "resources.93.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 968, + "filename": "resources.94.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 971, + "filename": "resources.95.wasm", + "text": "not in kebab case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 974, + "filename": "resources.96.wasm", + "text": "is not a func", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 977, + "filename": "resources.97.wasm", + "text": "static resource name is not known in this context", + "module_type": "binary" + }, + { + "type": "module", + "line": 980, + "filename": "resources.98.wasm" + }, + { + "type": "assert_invalid", + "line": 986, + "filename": "resources.99.wasm", + "text": "resource used in function does not have a name in this context", + "module_type": "binary" + }, + { + "type": "module", + "line": 993, + "filename": "resources.100.wasm" + }, + { + "type": "assert_invalid", + "line": 1002, + "filename": "resources.101.wasm", + "text": "resource used in function does not have a name in this context", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1013, + "filename": "resources.102.wasm", + "text": "function does not match expected resource name `b`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1023, + "filename": "resources.103.wasm", + "text": "resource used in function does not have a name in this context", + "module_type": "binary" + }, + { + "type": "module", + "line": 1035, + "filename": "resources.104.wasm" + }, + { + "type": "module", + "line": 1043, + "filename": "resources.105.wasm" + }, + { + "type": "module", + "line": 1049, + "filename": "resources.106.wasm" + }, + { + "type": "assert_invalid", + "line": 1084, + "filename": "resources.107.wasm", + "text": "resource types are not the same", + "module_type": "binary" + }, + { + "type": "module", + "line": 1104, + "filename": "resources.108.wasm" + }, + { + "type": "module", + "line": 1119, + "filename": "resources.109.wasm" + }, + { + "type": "assert_invalid", + "line": 1130, + "filename": "resources.110.wasm", + "text": "function result cannot contain a `borrow` type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1136, + "filename": "resources.111.wasm", + "text": "function result cannot contain a `borrow` type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1142, + "filename": "resources.112.wasm", + "text": "function result cannot contain a `borrow` type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1148, + "filename": "resources.113.wasm", + "text": "function result cannot contain a `borrow` type", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/start.wast.json b/tests/snapshots/local/component-model/start.wast.json new file mode 100644 index 0000000000..f5a520472f --- /dev/null +++ b/tests/snapshots/local/component-model/start.wast.json @@ -0,0 +1,64 @@ +{ + "source_filename": "tests/local/component-model/start.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 3, + "filename": "start.0.wasm", + "text": "start function requires 1 arguments", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 10, + "filename": "start.1.wasm", + "text": "start function requires 1 arguments", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 18, + "filename": "start.2.wasm", + "text": "cannot be used more than once", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 26, + "filename": "start.3.wasm", + "text": "type mismatch for component start function argument 1", + "module_type": "binary" + }, + { + "type": "module", + "line": 34, + "filename": "start.4.wasm" + }, + { + "type": "module", + "line": 41, + "filename": "start.5.wasm" + }, + { + "type": "assert_invalid", + "line": 48, + "filename": "start.6.wasm", + "text": "cannot have more than one start", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 56, + "filename": "start.7.wasm", + "text": "start function results size is out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 78, + "filename": "start.8.wasm", + "text": "unexpected content in the component start section", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/string.wast.json b/tests/snapshots/local/component-model/string.wast.json new file mode 100644 index 0000000000..2cb1044493 --- /dev/null +++ b/tests/snapshots/local/component-model/string.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/string.wast", + "commands": [ + { + "type": "module", + "line": 3, + "filename": "string.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/type-export-restrictions.wast.json b/tests/snapshots/local/component-model/type-export-restrictions.wast.json new file mode 100644 index 0000000000..eb30bf3a24 --- /dev/null +++ b/tests/snapshots/local/component-model/type-export-restrictions.wast.json @@ -0,0 +1,299 @@ +{ + "source_filename": "tests/local/component-model/type-export-restrictions.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 4, + "filename": "type-export-restrictions.0.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 12, + "filename": "type-export-restrictions.1.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 20, + "filename": "type-export-restrictions.2.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 28, + "filename": "type-export-restrictions.3.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 36, + "filename": "type-export-restrictions.4.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 44, + "filename": "type-export-restrictions.5.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 54, + "filename": "type-export-restrictions.6.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 62, + "filename": "type-export-restrictions.7.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 70, + "filename": "type-export-restrictions.8.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 78, + "filename": "type-export-restrictions.9.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 86, + "filename": "type-export-restrictions.10.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "module", + "line": 94, + "filename": "type-export-restrictions.11.wasm" + }, + { + "type": "module", + "line": 105, + "filename": "type-export-restrictions.12.wasm" + }, + { + "type": "assert_invalid", + "line": 114, + "filename": "type-export-restrictions.13.wasm", + "text": "type not valid to be used as import", + "module_type": "binary" + }, + { + "type": "module", + "line": 120, + "filename": "type-export-restrictions.14.wasm" + }, + { + "type": "assert_invalid", + "line": 127, + "filename": "type-export-restrictions.15.wasm", + "text": "func not valid to be used as import", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 135, + "filename": "type-export-restrictions.16.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 145, + "filename": "type-export-restrictions.17.wasm", + "text": "func not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 153, + "filename": "type-export-restrictions.18.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "module", + "line": 163, + "filename": "type-export-restrictions.19.wasm" + }, + { + "type": "assert_invalid", + "line": 172, + "filename": "type-export-restrictions.20.wasm", + "text": "instance not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 184, + "filename": "type-export-restrictions.21.wasm", + "text": "func not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 197, + "filename": "type-export-restrictions.22.wasm", + "text": "func not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 213, + "filename": "type-export-restrictions.23.wasm", + "text": "func not valid to be used as export", + "module_type": "binary" + }, + { + "type": "module", + "line": 229, + "filename": "type-export-restrictions.24.wasm" + }, + { + "type": "module", + "line": 242, + "filename": "type-export-restrictions.25.wasm" + }, + { + "type": "module", + "line": 258, + "filename": "type-export-restrictions.26.wasm" + }, + { + "type": "assert_invalid", + "line": 271, + "filename": "type-export-restrictions.27.wasm", + "text": "func not valid to be used as import", + "module_type": "binary" + }, + { + "type": "module", + "line": 279, + "filename": "type-export-restrictions.28.wasm" + }, + { + "type": "module", + "line": 284, + "filename": "type-export-restrictions.29.wasm" + }, + { + "type": "assert_invalid", + "line": 294, + "filename": "type-export-restrictions.30.wasm", + "text": "func not valid to be used as import", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 303, + "filename": "type-export-restrictions.31.wasm", + "text": "func not valid to be used as export", + "module_type": "binary" + }, + { + "type": "module", + "line": 315, + "filename": "type-export-restrictions.32.wasm" + }, + { + "type": "module", + "line": 335, + "filename": "type-export-restrictions.33.wasm" + }, + { + "type": "module", + "line": 339, + "filename": "type-export-restrictions.34.wasm" + }, + { + "type": "module", + "line": 344, + "filename": "type-export-restrictions.35.wasm" + }, + { + "type": "module", + "line": 348, + "filename": "type-export-restrictions.36.wasm" + }, + { + "type": "assert_invalid", + "line": 356, + "filename": "type-export-restrictions.37.wasm", + "text": "instance not valid to be used as export", + "module_type": "binary" + }, + { + "type": "module", + "line": 378, + "filename": "type-export-restrictions.38.wasm" + }, + { + "type": "assert_invalid", + "line": 385, + "filename": "type-export-restrictions.39.wasm", + "text": "instance not valid to be used as import", + "module_type": "binary" + }, + { + "type": "module", + "line": 396, + "name": "C", + "filename": "type-export-restrictions.40.wasm" + }, + { + "type": "module", + "line": 412, + "filename": "type-export-restrictions.41.wasm" + }, + { + "type": "assert_invalid", + "line": 427, + "filename": "type-export-restrictions.42.wasm", + "text": "type not valid to be used as import", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 437, + "filename": "type-export-restrictions.43.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 448, + "filename": "type-export-restrictions.44.wasm", + "text": "type not valid to be used as import", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 455, + "filename": "type-export-restrictions.45.wasm", + "text": "type not valid to be used as export", + "module_type": "binary" + }, + { + "type": "module", + "line": 462, + "filename": "type-export-restrictions.46.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/types.wast.json b/tests/snapshots/local/component-model/types.wast.json new file mode 100644 index 0000000000..8279f094ca --- /dev/null +++ b/tests/snapshots/local/component-model/types.wast.json @@ -0,0 +1,288 @@ +{ + "source_filename": "tests/local/component-model/types.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "types.0.wasm", + "text": "type index 0 is not a function type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 9, + "filename": "types.1.wasm", + "text": "core type index 0 is not a module type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 16, + "filename": "types.2.wasm", + "text": "type index 0 is not an instance type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 23, + "filename": "types.3.wasm", + "text": "type index 0 is not an instance type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 32, + "filename": "types.4.wasm", + "text": "core type index 0 is not a module type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 41, + "filename": "types.5.wasm", + "text": "type index 0 is not a function type", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 50, + "filename": "types.6.wasm", + "text": "module index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 56, + "filename": "types.7.wasm", + "text": "instance index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 62, + "filename": "types.8.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 70, + "filename": "types.9.wasm", + "text": "export name `a` already defined", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 79, + "filename": "types.10.wasm", + "text": "duplicate import name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 88, + "filename": "types.11.wasm", + "text": "memory size must be at most", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 96, + "filename": "types.12.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 104, + "filename": "types.13.wasm", + "text": "export name `A` conflicts with previous name `a`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 113, + "filename": "types.14.wasm", + "text": "import name `a` conflicts with previous name `A`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 122, + "filename": "types.15.wat", + "text": "unknown core type", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 128, + "filename": "types.16.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "module", + "line": 135, + "name": "c", + "filename": "types.17.wasm" + }, + { + "type": "assert_invalid", + "line": 143, + "filename": "types.18.wat", + "text": "unknown type", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 149, + "filename": "types.19.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 157, + "filename": "types.20.wasm", + "text": "invalid outer alias count of 100", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 166, + "filename": "types.21.wasm", + "text": "name `` already defined", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 178, + "filename": "types.22.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 186, + "filename": "types.23.wasm", + "text": "export name `FOO-bar-BAZ` conflicts with previous name `foo-BAR-baz`", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 195, + "filename": "types.24.wat", + "text": "unknown type", + "module_type": "text" + }, + { + "type": "assert_invalid", + "line": 201, + "filename": "types.25.wasm", + "text": "type index out of bounds", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 209, + "filename": "types.26.wasm", + "text": "invalid outer alias count of 100", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 218, + "filename": "types.27.wasm", + "text": "name `` already defined", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 230, + "filename": "types.28.wasm", + "text": "function parameter name cannot be empty", + "module_type": "binary" + }, + { + "type": "module", + "line": 235, + "filename": "types.29.wasm" + }, + { + "type": "module", + "line": 239, + "name": "C", + "filename": "types.30.wasm" + }, + { + "type": "module", + "line": 247, + "name": "C", + "filename": "types.31.wasm" + }, + { + "type": "module", + "line": 257, + "name": "C", + "filename": "types.32.wasm" + }, + { + "type": "module", + "line": 267, + "filename": "types.33.wasm" + }, + { + "type": "module", + "line": 274, + "filename": "types.34.wasm" + }, + { + "type": "assert_invalid", + "line": 283, + "filename": "types.35.wasm", + "text": "variant type must have at least one case", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 289, + "filename": "types.36.wasm", + "text": "enum type must have at least one variant", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 295, + "filename": "types.37.wasm", + "text": "record type must have at least one field", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 301, + "filename": "types.38.wasm", + "text": "flags must have at least one entry", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 307, + "filename": "types.39.wasm", + "text": "tuple type must have at least one type", + "module_type": "binary" + }, + { + "type": "module", + "line": 312, + "name": "c", + "filename": "types.40.wasm" + }, + { + "type": "assert_invalid", + "line": 322, + "filename": "types.41.wasm", + "text": "cannot have more than 32 flags", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/very-nested.wast.json b/tests/snapshots/local/component-model/very-nested.wast.json new file mode 100644 index 0000000000..92996f3824 --- /dev/null +++ b/tests/snapshots/local/component-model/very-nested.wast.json @@ -0,0 +1,40 @@ +{ + "source_filename": "tests/local/component-model/very-nested.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "very-nested.0.wasm", + "text": "conflicts with previous name", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1568, + "filename": "very-nested.1.wasm", + "text": "effective type size exceeds the limit", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1689, + "filename": "very-nested.2.wasm", + "text": "effective type size exceeds the limit", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 1779, + "filename": "very-nested.3.wasm", + "text": "effective type size exceeds the limit", + "module_type": "binary" + }, + { + "type": "assert_malformed", + "line": 1869, + "filename": "very-nested.4.wat", + "text": "nesting too deep", + "module_type": "text" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/virtualize.wast.json b/tests/snapshots/local/component-model/virtualize.wast.json new file mode 100644 index 0000000000..ebe8848505 --- /dev/null +++ b/tests/snapshots/local/component-model/virtualize.wast.json @@ -0,0 +1,10 @@ +{ + "source_filename": "tests/local/component-model/virtualize.wast", + "commands": [ + { + "type": "module", + "line": 1, + "filename": "virtualize.0.wasm" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/component-model/wrong-order.wast.json b/tests/snapshots/local/component-model/wrong-order.wast.json new file mode 100644 index 0000000000..2763f066db --- /dev/null +++ b/tests/snapshots/local/component-model/wrong-order.wast.json @@ -0,0 +1,12 @@ +{ + "source_filename": "tests/local/component-model/wrong-order.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "wrong-order.0.wasm", + "text": "section out of order", + "module_type": "binary" + } + ] +} \ No newline at end of file diff --git a/tests/snapshots/local/missing-features/component-model/value-not-enabled.wast.json b/tests/snapshots/local/missing-features/component-model/value-not-enabled.wast.json new file mode 100644 index 0000000000..d26d16859c --- /dev/null +++ b/tests/snapshots/local/missing-features/component-model/value-not-enabled.wast.json @@ -0,0 +1,54 @@ +{ + "source_filename": "tests/local/missing-features/component-model/value-not-enabled.wast", + "commands": [ + { + "type": "assert_invalid", + "line": 2, + "filename": "value-not-enabled.0.wasm", + "text": "support for component model `value`s is not enabled", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 9, + "filename": "value-not-enabled.1.wasm", + "text": "support for component model `value`s is not enabled", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 15, + "filename": "value-not-enabled.2.wasm", + "text": "support for component model `value`s is not enabled", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 21, + "filename": "value-not-enabled.3.wasm", + "text": "support for component model `value`s is not enabled", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 26, + "filename": "value-not-enabled.4.wasm", + "text": "support for component model `value`s is not enabled", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 32, + "filename": "value-not-enabled.5.wasm", + "text": "support for component model `value`s is not enabled", + "module_type": "binary" + }, + { + "type": "assert_invalid", + "line": 38, + "filename": "value-not-enabled.6.wasm", + "text": "support for component model `value`s is not enabled", + "module_type": "binary" + } + ] +} \ No newline at end of file