From 7cf9c675c1177ba412fa404c36129749f56b1db4 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Tue, 10 Oct 2023 21:22:47 -0400 Subject: [PATCH] chore(compiler): update rust and wasi toolchain (#4458) This was a difficult update. A newer version of rust exposed/caused an issue with our UnsafeRefs in some cases, causing memory corruption. I tried to highlight semi-functional changes ~Looks like the wasm size has increased by almost 2x. Not ideal, but not sure why or what to do. Based on benchmarks it looks like the perf is unchanged at least.~ Ok it turns out the new version of rust also somehow broke cargo-wasi and it no longer ran wasm-opt anymore. So now this PR also removes cargo-wasi and instead runs wasm-opt directly from the binaryen toolchain. On the bright side, the install for this is much faster. The only other useful special thing that cargo-wasi did was run https://github.com/rustwasm/walrus to demangle names. Since we always do release builds, I'm not sure how valuable that is. Updates: - wasi-sdk: 19 -> 20 - rust: 1.67.1 -> 1.73.0 - cargo-wasi: Removed. Now using the `wasm32-wasi` target and wasm-opt directly - tree-sitter: 0.20.7 -> 0.20.8 - All crates were updated - All crates were set to use similar pinning as `^`, where patches are automatically installed *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*. --- .cargo/.gitignore | 1 + .cargo/config.toml | 7 +- .github/workflows/build.yml | 19 ++--- .gitignore | 1 + Cargo.lock | 77 ++++++++----------- Cargo.toml | 1 + libs/tree-sitter-wing/Cargo.toml | 14 ++-- libs/wingc/.gitignore | 1 + libs/wingc/Cargo.toml | 38 ++++----- libs/wingc/package.json | 2 +- libs/wingc/src/ast.rs | 20 +++-- libs/wingc/src/comp_ctx.rs | 18 ++--- libs/wingc/src/diagnostic.rs | 28 ++++--- libs/wingc/src/docs.rs | 4 +- libs/wingc/src/jsify.rs | 2 +- libs/wingc/src/lib.rs | 16 ++-- libs/wingc/src/lsp/completions.rs | 2 +- libs/wingc/src/lsp/sync.rs | 9 ++- libs/wingc/src/parser.rs | 11 ++- libs/wingc/src/test_utils.rs | 4 +- libs/wingc/src/type_check.rs | 46 ++++++----- libs/wingc/src/type_check/jsii_importer.rs | 6 +- .../type_check/type_reference_transform.rs | 31 ++++++++ libs/wingc/turbo.json | 3 +- libs/wingcompiler/package.json | 2 +- libs/wingcompiler/turbo.json | 1 + libs/wingii/Cargo.toml | 16 ++-- libs/wingii/package.json | 2 +- libs/wingii/turbo.json | 1 + rust-toolchain.toml | 3 +- scripts/setup_wasi.sh | 67 +++++++++++----- tools/generate-workspace/src/cli.ts | 2 + tools/hangar/README.md | 4 - tools/hangar/__snapshots__/invalid.ts.snap | 4 +- 34 files changed, 266 insertions(+), 197 deletions(-) create mode 100644 libs/wingc/src/type_check/type_reference_transform.rs diff --git a/.cargo/.gitignore b/.cargo/.gitignore index 4c7cbb9191e..8735a43759c 100644 --- a/.cargo/.gitignore +++ b/.cargo/.gitignore @@ -1 +1,2 @@ /wasi-sdk-*/ +/binaryen-*/ diff --git a/.cargo/config.toml b/.cargo/config.toml index 99e455d785d..4e6f4107a70 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,5 @@ [env] -WASI_SDK = { value = ".cargo/wasi-sdk-19.0", relative = true } -CC_wasm32_wasi = { value = ".cargo/wasi-sdk-19.0/bin/clang", relative = true } -AR_wasm32_wasi = { value = ".cargo/wasi-sdk-19.0/bin/ar", relative = true } +WASI_SDK = { value = ".cargo/wasi-sdk-20.0", relative = true } +# tree-sitter build fails with newer version of clang unless implicit-function-declaration is ignored +CC_wasm32_wasi = { value = ".cargo/wasi-sdk-20.0/bin/clang -Wno-error=implicit-function-declaration", relative = true } +AR_wasm32_wasi = { value = ".cargo/wasi-sdk-20.0/bin/ar", relative = true } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a12e6f6761a..05e9f4a4a32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,6 @@ concurrency: cancel-in-progress: true env: - RUST_VERSION: "1.67.1" NODE_VERSION: "18.16.0" PNPM_VERSION: "8.6.3" CARGO_TERM_COLOR: always @@ -58,13 +57,10 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Install Rust - uses: dtolnay/rust-toolchain@master + uses: moonrepo/setup-rust@v1 with: - toolchain: ${{ env.RUST_VERSION }} - targets: | - x86_64-unknown-linux-gnu - wasm32-wasi - components: rustfmt,clippy,rust-std + inherit-toolchain: true + cache: false - name: Setup Cargo Cache uses: Swatinem/rust-cache@v2 @@ -120,13 +116,10 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Install Rust - uses: dtolnay/rust-toolchain@master + uses: moonrepo/setup-rust@v1 with: - toolchain: ${{ env.RUST_VERSION }} - targets: | - x86_64-unknown-linux-gnu - wasm32-wasi - components: rustfmt,clippy,rust-std + inherit-toolchain: true + cache: false - name: Setup Cargo Cache uses: Swatinem/rust-cache@v2 diff --git a/.gitignore b/.gitignore index c41313fee1d..b5c5dd29f51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules/ .pnpm-store/ diff --git a/Cargo.lock b/Cargo.lock index 3a7cc736d47..89a16ce8e05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,18 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - -[[package]] -name = "aho-corasick" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -90,16 +81,15 @@ checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" [[package]] name = "blake3" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", - "digest", ] [[package]] @@ -141,9 +131,9 @@ checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" [[package]] name = "cc" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -309,7 +299,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", - "subtle", ] [[package]] @@ -389,13 +378,13 @@ checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] @@ -407,9 +396,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", @@ -463,7 +452,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aca8bbd8e0707c1887a8bbb7e6b40e228f251ff5d62c8220a4a7a53c73aff006" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "bstr", "fnv", "log", @@ -565,9 +554,9 @@ checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4" [[package]] name = "insta" -version = "1.31.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0770b0a3d4c70567f0d58331f3088b0e4c4f56c9b8d764efe654b4a5d46de3a" +checksum = "1aa511b2e298cd49b1856746f6bb73e17036bcd66b25f5e92cdcdbec9bd75686" dependencies = [ "console", "lazy_static", @@ -592,9 +581,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -965,7 +954,7 @@ version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-automata", "regex-syntax 0.7.4", @@ -977,7 +966,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-syntax 0.7.4", ] @@ -1141,32 +1130,26 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "strum" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.28", ] -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - [[package]] name = "syn" version = "1.0.109" @@ -1191,9 +1174,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.7.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", @@ -1378,7 +1361,7 @@ dependencies = [ [[package]] name = "tree-sitter-wing" -version = "0.0.1" +version = "0.0.0" dependencies = [ "cc", "tree-sitter", @@ -1743,16 +1726,16 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "wingc" -version = "0.1.0" +version = "0.0.0" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "camino", "colored", "const_format", "derivative", "duplicate", "globset", - "indexmap 1.9.3", + "indexmap 2.0.0", "indoc", "insta", "itertools", @@ -1773,7 +1756,7 @@ dependencies = [ [[package]] name = "wingii" -version = "0.1.0" +version = "0.0.0" dependencies = [ "blake3", "camino", diff --git a/Cargo.toml b/Cargo.toml index 879efa7645f..22981b3a6b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "libs/wingc", "libs/wingii", ] +resolver = "2" # For use with `cargo flamegraph --profile flamegraph` [profile.flamegraph] diff --git a/libs/tree-sitter-wing/Cargo.toml b/libs/tree-sitter-wing/Cargo.toml index 4e83ebf664d..48d45c0adf4 100644 --- a/libs/tree-sitter-wing/Cargo.toml +++ b/libs/tree-sitter-wing/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "tree-sitter-wing" description = "winglang grammar for the tree-sitter parsing library" -version = "0.0.1" +version = "0.0.0" keywords = ["incremental", "parsing", "wing"] categories = ["parsing", "text-editors"] repository = "https://github.com/winglang/wing/tree/main/libs/tree-sitter-wing" -edition = "2018" +edition = "2021" license = "MIT" build = "bindings/rust/build.rs" @@ -20,12 +20,12 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.20.7" +tree-sitter = "0.20.10" [dev-dependencies] -tree-sitter-cli = "0.20.7" +tree-sitter-cli = "0.20.8" [build-dependencies] -cc = "1.0.79" -tree-sitter-cli = "0.20.7" -tree-sitter = "0.20.7" +cc = "1.0" +tree-sitter-cli = "0.20.8" +tree-sitter = "0.20.10" diff --git a/libs/wingc/.gitignore b/libs/wingc/.gitignore index b83d22266ac..8eb8070aae2 100644 --- a/libs/wingc/.gitignore +++ b/libs/wingc/.gitignore @@ -1 +1,2 @@ /target/ +wingc.wasm diff --git a/libs/wingc/Cargo.toml b/libs/wingc/Cargo.toml index 00c0f4a7d12..4c1c90e17e8 100644 --- a/libs/wingc/Cargo.toml +++ b/libs/wingc/Cargo.toml @@ -1,35 +1,35 @@ [package] name = "wingc" -version = "0.1.0" +version = "0.0.0" edition = "2021" [dependencies] -tree-sitter = "0.20.9" -tree-sitter-traversal = "0.1.2" -derivative = "2.2.0" +tree-sitter = "0.20.10" +tree-sitter-traversal = "0.1" +derivative = "2.2" tree-sitter-wing = { path = "../tree-sitter-wing" } wingii = { path = "../wingii" } serde = "1.0" serde_json = "1.0" colored = "2.0" -lazy_static = "1.4.0" -globset = "0.4.9" -itertools = "0.10" +lazy_static = "1.4" +globset = "0.4" +itertools = "0.11" phf = { version = "0.11", features = ["macros"] } -indexmap = "1.9.1" -aho-corasick = "0.7.20" -lsp-types = "0.94.0" -indoc = "2.0.0" -const_format = "0.2.30" -duplicate = "1.0.0" -strum = { version = "0.24", features = ["derive"] } -petgraph = "0.6.3" -camino = "1.1.6" +indexmap = "2.0" +aho-corasick = "1.1" +lsp-types = "0.94" +indoc = "2.0" +const_format = "0.2" +duplicate = "1.0" +strum = { version = "0.25", features = ["derive"] } +petgraph = "0.6" +camino = "1.1" [lib] crate-type = ["rlib", "cdylib"] [dev-dependencies] -insta = { version = "1.29.0", features = ["yaml", "redactions"] } -uuid = { version = "1.3.2", features = ["fast-rng", "v4"] } -tempfile = "3.6.0" +insta = { version = "1.33", features = ["yaml", "redactions"] } +uuid = { version = "1.4", features = ["fast-rng", "v4"] } +tempfile = "3.8" diff --git a/libs/wingc/package.json b/libs/wingc/package.json index 1c6448b9a0d..cad6ae5e78a 100644 --- a/libs/wingc/package.json +++ b/libs/wingc/package.json @@ -2,7 +2,7 @@ "name": "@winglang/wingc", "private": true, "scripts": { - "compile": "cargo wasi build --release", + "compile": "cargo build --target wasm32-wasi --release && ../../.cargo/binaryen-version_116/bin/wasm-opt --enable-bulk-memory --strip-debug --strip-producers -O3 -o wingc.wasm ../../target/wasm32-wasi/release/wingc.wasm", "dev": "cargo run --example compile --release", "test": "cargo test", "lint": "cargo fmt && cargo clippy --fix --no-deps --allow-dirty --target wasm32-wasi --release" diff --git a/libs/wingc/src/ast.rs b/libs/wingc/src/ast.rs index 37cdbcf81b6..8a8f7b873b1 100644 --- a/libs/wingc/src/ast.rs +++ b/libs/wingc/src/ast.rs @@ -49,12 +49,7 @@ impl Ord for Symbol { impl PartialOrd for Symbol { fn partial_cmp(&self, other: &Self) -> Option { - let string_ord = self.name.partial_cmp(&other.name); - if string_ord == Some(std::cmp::Ordering::Equal) { - self.span.partial_cmp(&other.span) - } else { - string_ord - } + Some(self.cmp(other)) } } @@ -766,6 +761,19 @@ pub enum Reference { }, } +impl Clone for Reference { + fn clone(&self) -> Reference { + match self { + Reference::Identifier(i) => Reference::Identifier(i.clone()), + Reference::InstanceMember { .. } => panic!("Unable to clone reference to instance member"), + Reference::TypeMember { type_name, property } => Reference::TypeMember { + type_name: type_name.clone(), + property: property.clone(), + }, + } + } +} + impl Spanned for Reference { fn span(&self) -> WingSpan { match self { diff --git a/libs/wingc/src/comp_ctx.rs b/libs/wingc/src/comp_ctx.rs index d883181f0b6..84b74231ae3 100644 --- a/libs/wingc/src/comp_ctx.rs +++ b/libs/wingc/src/comp_ctx.rs @@ -12,9 +12,10 @@ use crate::diagnostic::{report_diagnostic, Diagnostic, WingSpan}; /// Try to make these end with 'ing' (building, parsing, etc.) so they'll fit in /// in the context of a diagnostic message. /// See `CompilationContext::set` for more information. -#[derive(EnumString, Display, PartialEq, Clone, Copy)] +#[derive(EnumString, Display, PartialEq, Clone, Copy, Debug, Default)] #[strum(serialize_all = "kebab-case")] pub enum CompilationPhase { + #[default] Compiling, Parsing, TypeChecking, @@ -22,12 +23,6 @@ pub enum CompilationPhase { Jsifying, } -impl Default for CompilationPhase { - fn default() -> Self { - CompilationPhase::Compiling - } -} - pub struct CompilationContext { /// Description of current compilation phase pub phase: CompilationPhase, @@ -78,7 +73,9 @@ macro_rules! dbg_panic { () => {{ || -> () { // Get environment variable to see if we should panic or not - let Ok(dbg_panic) = std::env::var("WINGC_DEBUG_PANIC") else { return; }; + let Ok(dbg_panic) = std::env::var("WINGC_DEBUG_PANIC") else { + return; + }; if dbg_panic == "1" || dbg_panic == "true" @@ -105,8 +102,9 @@ pub fn set_custom_panic_hook() { report_diagnostic(Diagnostic { message: format!( - "Compiler bug ({}) during {}, please report at https://www.winglang.io/contributing/start-here/bugs", - pi, + "Compiler bug ('{}' at {}) during {}, please report at https://www.winglang.io/contributing/start-here/bugs", + pi.payload().downcast_ref::<&str>().unwrap_or(&""), + pi.location().unwrap_or(&std::panic::Location::caller()), CompilationContext::get_phase() ), span: Some(CompilationContext::get_span()), diff --git a/libs/wingc/src/diagnostic.rs b/libs/wingc/src/diagnostic.rs index 1825ecaee57..37a9e766d1a 100644 --- a/libs/wingc/src/diagnostic.rs +++ b/libs/wingc/src/diagnostic.rs @@ -223,16 +223,7 @@ impl Ord for WingSpan { impl PartialOrd for WingSpan { fn partial_cmp(&self, other: &Self) -> Option { - if self.file_id == other.file_id { - let start_ord = self.start.partial_cmp(&other.start); - if start_ord == Some(std::cmp::Ordering::Equal) { - self.end.partial_cmp(&other.end) - } else { - start_ord - } - } else { - self.file_id.partial_cmp(&other.file_id) - } + Some(self.cmp(other)) } } @@ -267,7 +258,7 @@ impl Ord for Diagnostic { impl PartialOrd for Diagnostic { fn partial_cmp(&self, other: &Self) -> Option { - self.span.partial_cmp(&other.span) + Some(self.cmp(other)) } } @@ -285,10 +276,17 @@ pub fn report_diagnostic(diagnostic: Diagnostic) { // If we're running in wasm32 then send the diagnostic to the client #[cfg(target_arch = "wasm32")] { - let json = serde_json::to_string(&diagnostic).unwrap(); - let bytes = json.as_bytes(); - unsafe { - send_diagnostic(bytes.as_ptr(), bytes.len() as u32); + match serde_json::to_string(&diagnostic) { + Ok(json) => { + let bytes = json.as_bytes(); + unsafe { + send_diagnostic(bytes.as_ptr(), bytes.len() as u32); + } + } + Err(err) => { + eprintln!("Error serializing diagnostic: {}", err); + // avoiding a panic here because we don't want to crash the panic handler + } } } } diff --git a/libs/wingc/src/docs.rs b/libs/wingc/src/docs.rs index 0a6381a3b47..01b5f9d9c43 100644 --- a/libs/wingc/src/docs.rs +++ b/libs/wingc/src/docs.rs @@ -262,7 +262,9 @@ fn render_struct(s: &Struct) -> String { } for field in s.env.iter(true) { - let Some(variable) = field.1.as_variable() else { continue }; + let Some(variable) = field.1.as_variable() else { + continue; + }; let optional = if variable.type_.is_option() { "?" } else { "" }; markdown.line(&format!( "- `{}{optional}` — {}\n", diff --git a/libs/wingc/src/jsify.rs b/libs/wingc/src/jsify.rs index afe867ddbee..b3ebf552623 100644 --- a/libs/wingc/src/jsify.rs +++ b/libs/wingc/src/jsify.rs @@ -576,7 +576,7 @@ impl<'a> JSifier<'a> { }; let patterns = &[MACRO_REPLACE_SELF, MACRO_REPLACE_ARGS, MACRO_REPLACE_ARGS_TEXT]; let replace_with = &[self_string, args_string, args_text_string]; - let ac = AhoCorasick::new(patterns); + let ac = AhoCorasick::new(patterns).expect("Failed to create macro pattern"); return ac.replace_all(js_override, replace_with); } } diff --git a/libs/wingc/src/lib.rs b/libs/wingc/src/lib.rs index 951042835f9..187a64cafd8 100644 --- a/libs/wingc/src/lib.rs +++ b/libs/wingc/src/lib.rs @@ -23,6 +23,7 @@ use parser::parse_wing_project; use struct_schema::StructSchemaVisitor; use type_check::jsii_importer::JsiiImportSpec; use type_check::symbol_env::{StatementIdx, SymbolEnvKind}; +use type_check::type_reference_transform::TypeReferenceTransformer; use type_check::{FunctionSignature, SymbolKind, Type}; use type_check_assert::TypeCheckAssert; use valid_json_visitor::ValidJsonVisitor; @@ -186,7 +187,7 @@ pub unsafe extern "C" fn wingc_compile(ptr: u32, len: u32) -> u64 { if results.is_err() { WASM_RETURN_ERROR } else { - string_to_combined_ptr("winged it!".to_string()) + string_to_combined_ptr("".to_string()) } } @@ -198,7 +199,7 @@ pub fn type_check( jsii_types: &mut TypeSystem, jsii_imports: &mut Vec, ) { - let env = types.add_symbol_env(SymbolEnv::new(None, SymbolEnvKind::Scope, Phase::Preflight, 0)); + let mut env = types.add_symbol_env(SymbolEnv::new(None, SymbolEnvKind::Scope, Phase::Preflight, 0)); types.set_scope_env(scope, env); // note: Globals are emitted here and wrapped in "{ ... }" blocks. Wrapping makes these emissions, actual @@ -260,10 +261,9 @@ pub fn type_check( types, ); - let mut scope_env = types.get_scope_env(&scope); let mut tc = TypeChecker::new(types, file_path, file_graph, jsii_types, jsii_imports); tc.add_jsii_module_to_env( - &mut scope_env, + &mut env, WINGSDK_ASSEMBLY_NAME.to_string(), vec![WINGSDK_STD_MODULE.to_string()], &Symbol::global(WINGSDK_STD_MODULE), @@ -332,7 +332,7 @@ pub fn compile( // Type check all files in topological order (start with files that don't bring any other // Wing files, then move on to files that depend on those, and repeat) for file in &topo_sorted_files { - let mut scope = asts.get_mut(file).expect("matching AST not found"); + let mut scope = asts.remove(file).expect("matching AST not found"); type_check( &mut scope, &mut types, @@ -342,6 +342,10 @@ pub fn compile( &mut jsii_imports, ); + // Make sure all type reference are no longer considered references + let mut tr_transformer = TypeReferenceTransformer { types: &mut types }; + let scope = tr_transformer.fold_scope(scope); + // Validate the type checker didn't miss anything - see `TypeCheckAssert` for details let mut tc_assert = TypeCheckAssert::new(&types, found_errors()); tc_assert.check(&scope); @@ -349,6 +353,8 @@ pub fn compile( // Validate all Json literals to make sure their values are legal let mut json_checker = ValidJsonVisitor::new(&types); json_checker.check(&scope); + + asts.insert(file.clone(), scope); } let project_dir = absolute_project_root; diff --git a/libs/wingc/src/lsp/completions.rs b/libs/wingc/src/lsp/completions.rs index 15f797c8749..fd794167b36 100644 --- a/libs/wingc/src/lsp/completions.rs +++ b/libs/wingc/src/lsp/completions.rs @@ -814,7 +814,7 @@ fn get_completions_from_namespace( .iter() .flat_map(|env| env.symbol_map.iter()) .flat_map(|(name, symbol)| format_symbol_kind_as_completion(name, &symbol.2)) - .chain(util_completions.into_iter()) + .chain(util_completions) .collect() } diff --git a/libs/wingc/src/lsp/sync.rs b/libs/wingc/src/lsp/sync.rs index 02ba16d49be..cebf551b7ee 100644 --- a/libs/wingc/src/lsp/sync.rs +++ b/libs/wingc/src/lsp/sync.rs @@ -17,6 +17,7 @@ use crate::lifting::LiftVisitor; use crate::parser::{normalize_path, parse_wing_project}; use crate::type_check; use crate::type_check::jsii_importer::JsiiImportSpec; +use crate::type_check::type_reference_transform::TypeReferenceTransformer; use crate::type_check_assert::TypeCheckAssert; use crate::valid_json_visitor::ValidJsonVisitor; use crate::visit::Visit; @@ -167,7 +168,7 @@ fn partial_compile( // Type check all files in topological order (start with files that don't require any other // Wing files, then move on to files that depend on those, etc.) for file in &topo_sorted_files { - let mut scope = project_data.asts.get_mut(file).expect("matching AST not found"); + let mut scope = project_data.asts.remove(file).expect("matching AST not found"); type_check( &mut scope, &mut types, @@ -177,6 +178,10 @@ fn partial_compile( &mut jsii_imports, ); + // Make sure all type reference are no longer considered references + let mut tr_transformer = TypeReferenceTransformer { types: &mut types }; + let scope = tr_transformer.fold_scope(scope); + // Validate the type checker didn't miss anything - see `TypeCheckAssert` for details let mut tc_assert = TypeCheckAssert::new(&types, found_errors()); tc_assert.check(&scope); @@ -184,6 +189,8 @@ fn partial_compile( // Validate all Json literals to make sure their values are legal let mut json_checker = ValidJsonVisitor::new(&types); json_checker.check(&scope); + + project_data.asts.insert(file.clone(), scope); } // -- LIFTING PHASE -- diff --git a/libs/wingc/src/parser.rs b/libs/wingc/src/parser.rs index 3588760fbda..f4de29a965f 100644 --- a/libs/wingc/src/parser.rs +++ b/libs/wingc/src/parser.rs @@ -792,7 +792,12 @@ impl<'s> Parser<'s> { fn build_bring_statement(&self, statement_node: &Node) -> DiagnosticResult { let Some(module_name_node) = statement_node.child_by_field_name("module_name") else { - return self.with_error("Expected module specification (see https://www.winglang.io/docs/libraries)", &statement_node.child(statement_node.child_count() - 1).unwrap_or(*statement_node)); + return self.with_error( + "Expected module specification (see https://www.winglang.io/docs/libraries)", + &statement_node + .child(statement_node.child_count() - 1) + .unwrap_or(*statement_node), + ); }; let module_name = self.node_symbol(&module_name_node)?; @@ -1029,7 +1034,9 @@ impl<'s> Parser<'s> { continue; }; - let Ok(func_def) = self.build_function_definition(Some(method_name.clone()), &class_element, phase, is_static) else { + let Ok(func_def) = + self.build_function_definition(Some(method_name.clone()), &class_element, phase, is_static) + else { continue; }; diff --git a/libs/wingc/src/test_utils.rs b/libs/wingc/src/test_utils.rs index 381576c07de..4e55895e0d5 100644 --- a/libs/wingc/src/test_utils.rs +++ b/libs/wingc/src/test_utils.rs @@ -69,8 +69,8 @@ fn compile_code(code: &str) -> String { match result { Ok(_) => { let Ok(files) = read_dir(outdir.path()) else { - panic!("failed to read dir"); - }; + panic!("failed to read dir"); + }; snap.push("## Code".to_string()); snap.push("".into()); diff --git a/libs/wingc/src/type_check.rs b/libs/wingc/src/type_check.rs index 8cbe66f94b3..a3f198a25f9 100644 --- a/libs/wingc/src/type_check.rs +++ b/libs/wingc/src/type_check.rs @@ -3,6 +3,7 @@ mod inference_visitor; pub(crate) mod jsii_importer; pub mod lifts; pub mod symbol_env; +pub(crate) mod type_reference_transform; use crate::ast::{ self, AccessModifier, AssignmentKind, BringSource, CalleeKind, ClassField, ExprId, FunctionDefinition, IfLet, New, @@ -48,7 +49,7 @@ use self::symbol_env::{LookupResult, LookupResultMut, SymbolEnvIter, SymbolEnvRe pub struct UnsafeRef(*const T); impl Clone for UnsafeRef { fn clone(&self) -> Self { - Self(self.0) + *self } } @@ -1312,6 +1313,9 @@ pub struct Types { json_literal_casts: IndexMap, /// Lookup table from a Scope's `id` to its symbol environment scope_envs: Vec>, + /// Expressions used in references that actually refer to a type. + /// Key is the ExprId of the object of a InstanceMember, and the value is a TypeMember representing the whole reference. + type_expressions: IndexMap, } impl Types { @@ -1360,6 +1364,7 @@ impl Types { json_literal_casts: IndexMap::new(), scope_envs: Vec::new(), inferences: Vec::new(), + type_expressions: IndexMap::new(), } } @@ -3015,6 +3020,7 @@ impl<'a> TypeChecker<'a> { fn type_check_scope(&mut self, scope: &Scope) { assert!(self.inner_scopes.is_empty()); let mut env = self.types.get_scope_env(scope); + for statement in scope.statements.iter() { self.type_check_statement(statement, &mut env); } @@ -3737,8 +3743,8 @@ impl<'a> TypeChecker<'a> { }; let cur_func_env = *self.ctx.current_function_env().expect("a function env"); - let SymbolEnvKind::Function{sig: cur_func_type, ..} = cur_func_env.kind else { - panic!("Expected function env"); + let SymbolEnvKind::Function { sig: cur_func_type, .. } = cur_func_env.kind else { + panic!("Expected function env"); }; let mut function_ret_type = cur_func_type.as_function_sig().expect("a function_type").return_type; @@ -4212,7 +4218,10 @@ impl<'a> TypeChecker<'a> { // Verify the class has a parent class let Some(parent_class) = &class_type.as_class().expect("class type to be a class").parent else { - self.spanned_error(super_constructor_call, format!("Class \"{class_type}\" does not have a parent class")); + self.spanned_error( + super_constructor_call, + format!("Class \"{class_type}\" does not have a parent class"), + ); return; }; @@ -4603,7 +4612,8 @@ impl<'a> TypeChecker<'a> { // Update the class's env to point to the new env new_type_class.env = new_env; - let SymbolEnvKind::Type(new_type) = new_type_class.env.kind else { // TODO: Ugly hack to get non mut ref of new_type so we can use it + let SymbolEnvKind::Type(new_type) = new_type_class.env.kind else { + // TODO: Ugly hack to get non mut ref of new_type so we can use it panic!("Expected class env to be a type"); }; @@ -4911,18 +4921,14 @@ impl<'a> TypeChecker<'a> { // We can't get here twice, we can safely assume that if we're here the `object` part of the reference doesn't have and evaluated type yet. // Create a type reference out of this nested reference and call ourselves again let new_ref = Reference::TypeMember { - type_name: user_type_annotation, + type_name: user_type_annotation.clone(), property: property.clone(), }; - // Replace the reference with the new one, this is unsafe because `reference` isn't mutable and theoretically someone may - // hold another reference to it. But our AST doesn't hold up/cross references so this is safe as long as we return right. - let const_ptr = reference as *const Reference; - let mut_ptr = const_ptr as *mut Reference; - unsafe { - // We don't use the return value but need to call replace so it'll drop the old value - _ = std::mem::replace(&mut *mut_ptr, new_ref); - } - return self.resolve_reference(reference, env); + + // Store this reference for later when we can modify the final AST and replace the original reference with the new one + self.types.type_expressions.insert(object.id, new_ref.clone()); + + return self.resolve_reference(&new_ref, env); } // Special case: if the object expression is a simple reference to `this` and we're inside the init function then @@ -5257,7 +5263,7 @@ impl<'a> TypeChecker<'a> { name: &Symbol, env: &mut SymbolEnv, ) -> (Option, Option) { - let Some(parent) = parent else { + let Some(parent) = parent else { if phase == Phase::Preflight { // if this is a preflight and we don't have a parent, then we implicitly set it to `std.Resource` let t = self.types.resource_base_type(); @@ -5734,6 +5740,7 @@ mod tests { let void = UnsafeRef::(&Type::Void as *const Type); let num = UnsafeRef::(&Type::Number as *const Type); let string = UnsafeRef::(&Type::String as *const Type); + let returns_num = make_function(vec![], num, Phase::Inflight); let returns_str = make_function(vec![], string, Phase::Inflight); let returns_void = make_function(vec![], void, Phase::Inflight); @@ -5749,9 +5756,10 @@ mod tests { #[test] fn function_subtyping_parameter_contravariance() { - let void = UnsafeRef::(&Type::Void as *const Type); - let string = UnsafeRef::(&Type::String as *const Type); - let opt_string = UnsafeRef::(&Type::Optional(string) as *const Type); + let void = UnsafeRef::(&Type::Void); + let string = UnsafeRef::(&Type::String); + let opt_string_type = Type::Optional(string); + let opt_string = UnsafeRef::(&opt_string_type); let str_fn = make_function( vec![FunctionParameter { typeref: string, diff --git a/libs/wingc/src/type_check/jsii_importer.rs b/libs/wingc/src/type_check/jsii_importer.rs index 7e73a2f1d05..dbbb0a058c8 100644 --- a/libs/wingc/src/type_check/jsii_importer.rs +++ b/libs/wingc/src/type_check/jsii_importer.rs @@ -593,7 +593,7 @@ impl<'a> JsiiImporter<'a> { line: (jsii_source_location.line - 1.0) as u32, col: 0, }, - file_id: (&jsii_source_location.filename).into(), + file_id: jsii_source_location.filename.clone(), } } else { Default::default() @@ -1069,9 +1069,7 @@ pub fn is_construct_base(fqn: &str) -> bool { impl From<&Option> for Docs { fn from(value: &Option) -> Self { - let Some(docs) = value else { - return Docs::default() - }; + let Some(docs) = value else { return Docs::default() }; Docs { custom: docs.custom.as_ref().unwrap_or(&BTreeMap::default()).clone(), diff --git a/libs/wingc/src/type_check/type_reference_transform.rs b/libs/wingc/src/type_check/type_reference_transform.rs new file mode 100644 index 00000000000..7e6adb064c4 --- /dev/null +++ b/libs/wingc/src/type_check/type_reference_transform.rs @@ -0,0 +1,31 @@ +use crate::{ + ast::{Reference, Scope}, + fold::{self, Fold}, +}; + +/// Replaces InstanceMembers pointing to a type a proper TypeMember. +pub struct TypeReferenceTransformer<'a> { + pub types: &'a mut crate::type_check::Types, +} + +impl<'a> Fold for TypeReferenceTransformer<'a> { + fn fold_scope(&mut self, node: Scope) -> Scope { + if self.types.type_expressions.is_empty() { + return node; + } else { + fold::fold_scope(self, node) + } + } + fn fold_reference(&mut self, node: Reference) -> Reference { + match node { + Reference::InstanceMember { ref object, .. } => { + if let Some(new_ref) = self.types.type_expressions.remove(&object.id) { + new_ref + } else { + fold::fold_reference(self, node) + } + } + Reference::Identifier(..) | Reference::TypeMember { .. } => node, + } + } +} diff --git a/libs/wingc/turbo.json b/libs/wingc/turbo.json index 37f630ba201..c36f0446d23 100644 --- a/libs/wingc/turbo.json +++ b/libs/wingc/turbo.json @@ -6,7 +6,8 @@ "dependsOn": ["@winglang/wingii#compile", "@winglang/tree-sitter-wing#compile"], "outputs": [ "../../target/wasm32-wasi/release/wingc.wasm", - "../../target/wasm32-wasi/release/libwingc.*" + "../../target/wasm32-wasi/release/libwingc.*", + "wingc.wasm" ] }, "test": { diff --git a/libs/wingcompiler/package.json b/libs/wingcompiler/package.json index b1e1059251a..c3935a3d1ca 100644 --- a/libs/wingcompiler/package.json +++ b/libs/wingcompiler/package.json @@ -17,7 +17,7 @@ "url": "git+https://github.com/winglang/wing.git" }, "scripts": { - "compile:copy-wingc-wasm": "cp ../../target/wasm32-wasi/release/wingc.wasm . && mkdir -p ../../dist && cp wingc.wasm ../../dist/wingc.wasm", + "compile:copy-wingc-wasm": "cp ../wingc/wingc.wasm . && mkdir -p ../../dist && cp wingc.wasm ../../dist/wingc.wasm", "compile": "tsup-node", "watch": "tsup-node --watch", "test": "vitest run --passWithNoTests", diff --git a/libs/wingcompiler/turbo.json b/libs/wingcompiler/turbo.json index 12f565675f4..f2b5aef90f9 100644 --- a/libs/wingcompiler/turbo.json +++ b/libs/wingcompiler/turbo.json @@ -4,6 +4,7 @@ "pipeline": { "compile:copy-wingc-wasm": { "dependsOn": ["^compile"], + "inputs": ["../wingc/wingc.wasm"], "outputs": ["wingc.wasm", "../../dist/wingc.wasm"] }, "compile": { diff --git a/libs/wingii/Cargo.toml b/libs/wingii/Cargo.toml index afac2f4c645..289ae852a7f 100644 --- a/libs/wingii/Cargo.toml +++ b/libs/wingii/Cargo.toml @@ -1,18 +1,16 @@ [package] name = "wingii" -version = "0.1.0" +version = "0.0.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -flate2 = "1.0.25" -blake3 = "1.4.1" -speedy = "0.8.6" -camino = "1.1.6" +flate2 = "1.0" +blake3 = "1.5" +speedy = "0.8" +camino = "1.1" [dev-dependencies] -rand = "0.8.5" -filetime = "0.2.21" +rand = "0.8" +filetime = "0.2" diff --git a/libs/wingii/package.json b/libs/wingii/package.json index d5ef43c59dd..11bd43933c2 100644 --- a/libs/wingii/package.json +++ b/libs/wingii/package.json @@ -2,7 +2,7 @@ "name": "@winglang/wingii", "private": true, "scripts": { - "compile": "cargo wasi build --release", + "compile": "cargo build --target wasm32-wasi --release", "dev": "cargo run --example compile --release", "test": "cargo test", "lint": "cargo fmt && cargo clippy --fix --no-deps --allow-dirty --target wasm32-wasi --release" diff --git a/libs/wingii/turbo.json b/libs/wingii/turbo.json index 6131083750b..87c7d5d0c4e 100644 --- a/libs/wingii/turbo.json +++ b/libs/wingii/turbo.json @@ -3,6 +3,7 @@ "extends": ["//"], "pipeline": { "compile": { + "dependsOn": ["@winglang/tree-sitter-wing#compile"], "outputs": ["../../target/wasm32-wasi/release/libwingii.*"] } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6dd863b35de..6f845e2f98f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,4 @@ [toolchain] profile = "default" -channel = "1.67.1" +channel = "1.73.0" +targets = ["wasm32-wasi"] \ No newline at end of file diff --git a/scripts/setup_wasi.sh b/scripts/setup_wasi.sh index 1c2d0a3f436..35bdd241b4c 100755 --- a/scripts/setup_wasi.sh +++ b/scripts/setup_wasi.sh @@ -1,38 +1,63 @@ #!/usr/bin/env bash set -eo pipefail -WASI_VERSION="19" -WASI_VERSION_FULL="$WASI_VERSION.0" -WASI_INSTALL_PARENT_DIR="./.cargo" -WASI_INSTALL_DIR="$WASI_INSTALL_PARENT_DIR/wasi-sdk-$WASI_VERSION_FULL" +TOOL_INSTALL_DIR="./.cargo" + +BINARYEN_VERSION="version_116" +WASI_SDK_VERSION="20" +WASI_SDK_VERSION_FULL="$WASI_SDK_VERSION.0" + +SYS_OS=$OSTYPE +SYS_ARCH=$(uname -m) # Check if mac or linux -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - WASI_OS="linux" -elif [[ "$OSTYPE" == "darwin"* ]]; then - WASI_OS="macos" +if [[ "$SYS_OS" == "linux-gnu"* ]]; then + SYS_OS="linux" +elif [[ "$SYS_OS" == "darwin"* ]]; then + SYS_OS="macos" else echo "Unsupported OS" exit 1 fi -if ! command -v cargo-wasi &> /dev/null; then - echo "Installing cargo-wasi..." - cargo install cargo-wasi +# Check if x86_64 or arm64 +if [[ "$SYS_ARCH" != "x86_64" && "$SYS_ARCH" != "arm64" ]]; then + echo "Unsupported architecture" + exit 1 fi -if [ ! -d $WASI_INSTALL_DIR ]; then - WASI_TARBALL="wasi-sdk-$WASI_VERSION_FULL-$WASI_OS.tar.gz" - WASI_INSTALL_URL="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_VERSION/$WASI_TARBALL" - OUTFILE="/tmp/$WASI_TARBALL" +# Download binaryen tools +BINARYEN_INSTALL_DIR="$TOOL_INSTALL_DIR/binaryen-$BINARYEN_VERSION" +if [ ! -d $BINARYEN_INSTALL_DIR ]; then + TARBALL="binaryen-$BINARYEN_VERSION-$SYS_ARCH-$SYS_OS.tar.gz" + INSTALL_URL="https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/$TARBALL" + OUTFILE="/tmp/$TARBALL" - echo "Installing WASI SDK $WASI_VERSION_FULL to $WASI_INSTALL_DIR..." + echo "Installing Binaryen $BINARYEN_VERSION to $BINARYEN_INSTALL_DIR..." if [ ! -f $OUTFILE ]; then - echo "Downloading WASI SDK $WASI_VERSION_FULL to $OUTFILE..." - curl --retry 2 -L $WASI_INSTALL_URL -o $OUTFILE + echo "Downloading Binaryen $BINARYEN_VERSION to $OUTFILE..." + curl --retry 2 -L $INSTALL_URL -o $OUTFILE fi - - echo "Extracting to $WASI_INSTALL_PARENT_DIR..." - tar zxf $OUTFILE -C $WASI_INSTALL_PARENT_DIR + + echo "Extracting to $BINARYEN_INSTALL_DIR..." + tar zxf $OUTFILE -C $TOOL_INSTALL_DIR +fi + +# Download wasi-sdk +WASI_SDK_INSTALL_DIR="$TOOL_INSTALL_DIR/wasi-sdk-$WASI_SDK_VERSION_FULL" +if [ ! -d $WASI_SDK_INSTALL_DIR ]; then + WASI_SDK_TARBALL="wasi-sdk-$WASI_SDK_VERSION_FULL-$SYS_OS.tar.gz" + WASI_SDK_INSTALL_URL="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/$WASI_SDK_TARBALL" + OUTFILE="/tmp/$WASI_SDK_TARBALL" + + echo "Installing WASI SDK $WASI_SDK_VERSION_FULL to $WASI_SDK_INSTALL_DIR..." + + if [ ! -f $OUTFILE ]; then + echo "Downloading WASI SDK $WASI_SDK_VERSION_FULL to $OUTFILE..." + curl --retry 2 -L $WASI_SDK_INSTALL_URL -o $OUTFILE + fi + + echo "Extracting to $WASI_SDK_INSTALL_DIR..." + tar zxf $OUTFILE -C $TOOL_INSTALL_DIR fi diff --git a/tools/generate-workspace/src/cli.ts b/tools/generate-workspace/src/cli.ts index d58937b4ef8..9c272a0bff6 100644 --- a/tools/generate-workspace/src/cli.ts +++ b/tools/generate-workspace/src/cli.ts @@ -17,6 +17,8 @@ const ignoreList = [ "@wingconsole/tsconfig", "hangar", "@wingconsole/design-system", + "@wingconsole/use-persistent-state", + "wing-fixture", ]; const nameMapping: Record = { diff --git a/tools/hangar/README.md b/tools/hangar/README.md index 848440bf96d..48011a216da 100644 --- a/tools/hangar/README.md +++ b/tools/hangar/README.md @@ -1,7 +1,3 @@ # Hangar - Wing Toolchain Test Suite [How to run E2E tests?](https://www.winglang.io/contributing/start-here/development#-how-do-i-run-tests) - -### Ideas for later - - - "Flight Plan": schema for defining test scenario in markdown diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index 5b38d79acc6..ed19ecf15b2 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -2282,11 +2282,11 @@ Duration " `; exports[`panic.test.w 1`] = ` -"error: Compiler bug (panicked at 'User invoked panic', libs/wingc/src/type_check.rs:LINE:COL) during type-checking, please report at https://www.winglang.io/contributing/start-here/bugs +"error: Compiler bug ('User invoked panic' at libs/wingc/src/type_check.rs:LINE:COL) during type-checking, please report at https://www.winglang.io/contributing/start-here/bugs --> ../../../examples/tests/invalid/panic.test.w:6:1 | 6 | 😱; - | ^^ Compiler bug (panicked at 'User invoked panic', libs/wingc/src/type_check.rs:LINE:COL) during type-checking, please report at https://www.winglang.io/contributing/start-here/bugs + | ^^ Compiler bug ('User invoked panic' at libs/wingc/src/type_check.rs:LINE:COL) during type-checking, please report at https://www.winglang.io/contributing/start-here/bugs