Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.5.1218 — bson 3.x/mongodb crate type mismatch broke the default build (#5830 follow-up)

`deps(deps): bump bson from 2.15.0 to 3.1.0` (#5830) merged clean through CI but broke `cargo build`/`cargo check -p perry-stdlib` (and `perry-ext-mongodb`) under default features: two regressions stacked. (1) bson 3.x made serde support opt-in (`bson::Document` no longer implements `serde::{Serialize,Deserialize}` without the `serde` feature) — our direct `bson = "3.1"` dep in `perry-stdlib`/`perry-ext-mongodb` didn't request it, so every `serde_json::from_str::<Document>` call failed to typecheck. (2) The `mongodb` crate's `compat-3-0-0` feature (which we had carried over unchanged from the pre-bump Cargo.toml) actually selects the crate's **bson-2** internals (`mongodb::bson` re-exported bson 2.15.0), not bson 3 — so `Collection<bson::Document>` methods (`find_one`, `update_one`, etc.) expected the *other* bson major version than the one our own code passed in, and `Cargo.lock` carried both bson 2.15.0 and 3.1.0 simultaneously. Fix: add `features = ["serde"]` to both crates' `bson` dependency, and swap the `mongodb` dependency's `compat-3-0-0` feature for `bson-3` (plus the now-required `compat-3-3-0` marker) so `mongodb`'s internal bson matches our direct dependency — collapses back to a single resolved `bson` version. Caught by `cargo check -p perry-stdlib -p perry-ext-mongodb` with default features; CI's `cargo-test` job apparently didn't exercise this combination for #5830, which is worth follow-up (tracked informally, no issue filed yet).

## v0.5.1217 — switch inside async/generator state machines miscompiled (#5885, fixes #5868)

Two state-machine defects, one shared fix. (1) A `yield`/`await` inside a switch case was silently lowered to `0`: the linearizer had no `Stmt::Switch` arm, so the switch fell to the catch-all, was emitted unsplit inside one state, and codegen's fallback lowered the residual `Expr::Yield` to `0.0` — `async f(x){ switch(x){ case 1: return await g() } }` resolved to `0` without suspending, and a generator `yield` inside a case vanished. (2) A loop-level `continue` inside a yield-free switch in a CPS'd loop survived as a raw `Stmt::Continue` the dispatch loop ignored, silently running the rest of the iteration. Both live in production paths since #5854 put async class methods through CPS; minifiers turn if-chains into switches routinely. New `desugar_switch_to_ifs` (generator/break_continue.rs): discriminant temp + match-index + guarded-`if` chain preserving JS switch semantics (single-eval discriminant, in-order first-match-wins tests, fallthrough, default-in-the-middle, `break` — incl. from nested if/try — via done-flag with remainder guarding; `continue`/`return`/`throw` pass through). Wired into a new yielding-switch `linearize_body` arm, a splice in `rewrite_break_continue_in_stmts` for continue-bearing yield-free switches (`next_local_id` threaded through), and the labeled arm (`break label` → plain break in a labeled switch). e2e: `crates/perry/tests/issue_5868_switch_state_machine.rs` (9 scenarios vs node). Note: this PR's labeled run showed parity/smokes/doc-tests failing to BUILD with the pre-existing #5466 E0308 feature-combo breakage (#5872) — zero parity tests executed; compiler-output-regression and the full cargo-test suite are green.
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

Perry is a native TypeScript compiler written in Rust that compiles TypeScript source code directly to native executables. It uses SWC for TypeScript parsing and LLVM for code generation.

**Current Version:** 0.5.1217
**Current Version:** 0.5.1218


## TypeScript Parity Status
Expand Down
33 changes: 5 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ strip = false
codegen-units = 16

[workspace.package]
version = "0.5.1217"
version = "0.5.1218"
edition = "2021"
license = "MIT"
repository = "https://github.com/PerryTS/perry"
Expand Down
4 changes: 2 additions & 2 deletions crates/perry-ext-mongodb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ crate-type = ["staticlib", "rlib"]

[dependencies]
perry-ffi.workspace = true
mongodb = { version = "3.7", default-features = false, features = ["compat-3-0-0", "rustls-tls", "dns-resolver"] }
bson = "3.1"
mongodb = { version = "3.7", default-features = false, features = ["bson-3", "compat-3-3-0", "rustls-tls", "dns-resolver"] }
bson = { version = "3.1", features = ["serde"] }
tokio = { workspace = true }
futures-util = "0.3"
serde_json = "1"
Expand Down
4 changes: 2 additions & 2 deletions crates/perry-stdlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ rustls-pemfile = { version = "2", optional = true }
# Database
sqlx = { version = "0.9.0", default-features = false, features = ["runtime-tokio", "mysql", "postgres", "chrono"], optional = true }
redis = { version = "1.2", features = ["tokio-comp", "connection-manager"], optional = true }
mongodb = { version = "3.7", default-features = false, features = ["compat-3-0-0", "rustls-tls", "dns-resolver"], optional = true }
bson = { version = "3.1", optional = true }
mongodb = { version = "3.7", default-features = false, features = ["bson-3", "compat-3-3-0", "rustls-tls", "dns-resolver"], optional = true }
bson = { version = "3.1", optional = true, features = ["serde"] }
rusqlite = { version = "0.37", features = ["bundled", "column_decltype", "limits", "session"], optional = true }

# Crypto
Expand Down
Loading