{"record":{"id":"5802af23a664df6f","repo":"swc-project/swc","slug":"unknown-binary-operator","errorCode":null,"errorMessage":"unknown binary operator: {:?}","messagePattern":"unknown binary operator: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs","lineNumber":1580,"sourceCode":"                let result: f64 = js_lv.pow(js_rv).into();\n                return try_replace(lv, rv, result);\n            }\n\n            return Unknown;\n        }\n        _ => {}\n    }\n    let (lv, rv) = match (lv, rv) {\n        (Known(lv), Known(rv)) => (lv, rv),\n        _ => return Unknown,\n    };\n\n    match op {\n        op!(\"&\") => try_replace_i32(lv, rv, to_int32(lv) & to_int32(rv)),\n        op!(\"|\") => try_replace_i32(lv, rv, to_int32(lv) | to_int32(rv)),\n        op!(\"^\") => try_replace_i32(lv, rv, to_int32(lv) ^ to_int32(rv)),\n        op!(\"%\") => try_replace(lv, rv, lv % rv),\n        _ => unreachable!(\"unknown binary operator: {:?}\", op),\n    }\n}\n\n/// This actually performs `<`.\n///\n/// https://tc39.github.io/ecma262/#sec-abstract-relational-comparison\nfn perform_abstract_rel_cmp(\n    expr_ctx: ExprCtx,\n    left: &Expr,\n    right: &Expr,\n    will_negate: bool,\n) -> Value<bool> {\n    match (left, right) {\n        // Special case: `x < x` is always false.\n        (\n            &Expr::Ident(\n                Ident {\n                    sym: ref li,","sourceCodeStart":1562,"sourceCodeEnd":1598,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_transforms_optimization/src/simplify/expr/mod.rs#L1562-L1598","documentation":"perform_arithmetic_op in the simplifier constant-folds bitwise/modulo arithmetic once both sides are Known values. It matches exactly `&`, `|`, `^`, `%`; any other operator reaching the final match trips this unreachable!. Like its shift sibling, the guard upstream is supposed to only route those four operators here.","triggerScenarios":"An swc internal bug where the simplifier routes an unsupported binary operator into perform_arithmetic_op, or a fork calling this internal function with an arbitrary op.","commonSituations":"Forked/patched simplifiers; version skew inside swc crates; not reachable through public config on released versions.","solutions":["Align swc crates on one swc_core version and update — the routing guards and matches are versioned together.","In forks, keep the caller's operator filter consistent with this match.","File an swc issue with the expression if stock swc reproduces it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn is_arithmetic_fold_op(op: BinaryOp) -> bool {\n    matches!(op, op!(\"&\") | op!(\"|\") | op!(\"^\") | op!(\"%\"))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Route only &, |, ^, % into arithmetic folding in patched forks.","Reproduce simplifier panics on the latest swc_core before investigating locally.","Treat unreachable! in the optimizer as an upstream bug report, not a config problem."],"tags":["swc","optimizer","simplifier","constant-folding","bitwise-operators","ast-invariant","panic"],"backgroundTag":"compiler-internal-panic","analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}