# biome complexity/useSimplifiedLogicExpression: fixed output does not parse

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: biome 2.5.15
- Rule: complexity/useSimplifiedLogicExpression (tool labels the fix: safe, this fix reported as safe)
- Oracle: fix-breaks-syntax
- Judge (Nemotron 3 Ultra, advisory): real, severity high. The rule rewrites 'true && function() { return 1; }()' to 'function() { return 1; }()', but a function expression in statement position is a syntax error because function statements require a name. The original code was valid because the function expression was an operand of &&, making it an expression statement; the fix changes the parse context and breaks syntax.
- Program: minimized from 6 to 4 lines

## Reproducer

```js
try {
  true && function() { return 1; }();
} catch (e) {
}
```

## Commands

```sh
node prog.js
bunx @biomejs/biome lint --only=complexity/useSimplifiedLogicExpression --write prog.js
node prog.js
```

## Observed

```
/home/sun/dev/diaghunt/runs/2026-10-17T20-15-13-121Z-vjcv-biome-complexity_useSimplifiedLogicExpression/r2-p001/min/r2-p001-reuse/fixed.js:2
  function() { return 1; }();
  ^^^^^^^^

SyntaxError: Function statements require a function name
    at checkSyntax (node:internal/main/check_syntax:84:5)

Node.js v26.8.1
```

## Diff applied by the fix

```diff
--- orig.js	2026-10-22 13:26:40.370213262 -0400
+++ fixed.js	2026-10-22 13:26:42.425247346 -0400
@@ -1,4 +1,4 @@
 try {
-  true && function() { return 1; }();
+  function() { return 1; }();
 } catch (e) {
 }
```

## Why the rewrite is not equivalent (model draft, verify before use)

The original expression `true && function(){return 1;}()` evaluates to either false or 1 depending on truthiness of left operand but always executes the IIFE due to grouping parentheses after function definition. After rewriting as just `function(){return 1;}();`, it becomes a bare function declaration followed by a call expression which JavaScript parses as invalid syntax—function declarations require an identifier—and thus throws before any execution occurs, changing behavior from potentially returning a value to unconditionally throwing a SyntaxError. This alters both control flow and outcome.

## Upstream search

Queries: "useSimplifiedLogicExpression fix", "complexity useSimplifiedLogicExpression logical AND", "Biome rule simplify truthy expressions", "remove redundant true && in try block"

- duplicate: https://github.com/biomejs/biome/issues/11351
  same rule useSimplifiedLogicExpression removing a leading literal in a logical expression and breaking syntax
- related: https://github.com/biomejs/biome/issues/7984
  same rule useSimplifiedLogicExpression but different construct multiline conditions with comments
- related: https://github.com/biomejs/biome/issues/8577
  same rule useSimplifiedLogicExpression but different construct redundant terms in logical expression
- related: https://github.com/biomejs/biome/issues/279
  same rule useSimplifiedLogicExpression but different construct type narrowing with logical negation

<details><summary>All hits</summary>

- [github, closed] 💅 `useSimplifiedLogicExpression` "safe" fix breaks code — https://github.com/biomejs/biome/issues/11351
- [github, open] 💅 `noUnnecessaryConditions`: false positive on an overloaded call with `undefined` as the default argument (Vue `inject`) — https://github.com/biomejs/biome/issues/12040
- [github, open] Extension chokes on large files — https://github.com/biomejs/biome/issues/3860
- [github, closed] 💅 `useExplicitLengthCheck` false positive and broken fix — https://github.com/biomejs/biome/issues/11558
- [github, closed] useExplicitLengthCheck ruins multi-line conditions that have single-line comments — https://github.com/biomejs/biome/issues/7984
- [github, closed] 💅 `useExplicitLengthCheck` false positive — https://github.com/biomejs/biome/issues/11352
- [github, closed] 💅 Corrupted CLI safe fix for `useConsistentArrowReturn` — https://github.com/biomejs/biome/issues/8347
- [github, closed] 💅 lint/nursery/noUselessUndefined fix is unsafe for functions with union return types — https://github.com/biomejs/biome/issues/6906
- [github, closed] 💅 `correctness/noUnusedVariables` shows class as unused, when `namespace` with the same name is present — https://github.com/biomejs/biome/issues/4928
- [github, closed] 💅 useImportExtensions doesn't respect tsconfig paths from referenced project configs — https://github.com/biomejs/biome/issues/7644
- [tavily] 💅 noNoninteractiveElementInteractions marks `dialog` as non-interactive · Issue #7783 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7783
- [tavily] 💅 Incorrectly suggest to discard redundant terms (useSimplifiedLogicExpression) · Issue #8577 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8577
- [tavily] One does not simply enable just one lint rule · Issue #1768 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/1768
- [tavily] 💅 useShorthandArrayType fix produces invalid syntax in `class extends` clause · Issue #3247 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/3247
- [tavily] 📝 CSS formatter messes up Tailwind theme(...) arguments · Issue #3863 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/3863
- [tavily] 🐛 OOM when using certain rules after 2.1.x · Issue #7179 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7179
- [tavily] 📝 Sorting tailwind class with a calc is broken · Issue #5496 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/5496
- [tavily] 🐛 Typescript narrowing problem with `useSimplifiedLogicExpression` · Issue #279 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/279
- [tavily] ☂️ Tailwind class sorting lint rule · Issue #1274 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/1274
- [github, closed] 🐛 `noUnusedVariables` not looking at inner functions against a declared variable for a match — https://github.com/biomejs/biome/issues/105
- [github, closed] 🐛 `noUnusedVariables` misreporting imports used for type definitions — https://github.com/biomejs/biome/issues/104
- [tavily] 💅 lint/correctness/noUnusedVariables for `catch` clause should suggest removing variable definition as unsafe fix · Issue #6476 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/6476
- [tavily] 🐛panic when trying to fix 'Redundant use strict directive' - `crates\biome_js_formatter\src\utils\string_utils.rs:164:33` - `byte index 1 is out of bounds of` · Issue #9180 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/9180
- [tavily] 💅 Linter: `lint --write` is not idempotent on Astro frontmatter, while `lint` reports no issues · Issue #7912 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7912
- [tavily] 💅 `useImportType` fixes `import React from 'react'` into `import type React from 'react'` · Issue #2004 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/2004

</details>
