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
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ impl LogicalAndChain {
/// `LogicalAndChainOrdering` by comparing their `token_text_trimmed` for
/// every `JsAnyExpression` node.
fn cmp_chain(&self, other: &Self) -> SyntaxResult<LogicalAndChainOrdering> {
if other.buf.is_empty() {
return Ok(LogicalAndChainOrdering::Different);
}
let chain_ordering = match self.buf.len().cmp(&other.buf.len()) {
Ordering::Less => return Ok(LogicalAndChainOrdering::Different),
Ordering::Equal => LogicalAndChainOrdering::Equal,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* should not generate diagnostics */

// Unrelated identifiers with negation prefix (#9428)
hasMore && !isLoading && inView;
a && !b && c;
foo && !bar && baz.qux;

// Unrelated identifiers without member access
a && b && c;

// Negation at different positions
!a && b && c;
a && b && !c;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
source: crates/biome_js_analyze/tests/spec_tests.rs
expression: validLogicalAndUnrelatedOperands.js
---
# Input
```js
/* should not generate diagnostics */

// Unrelated identifiers with negation prefix (#9428)
hasMore && !isLoading && inView;
a && !b && c;
foo && !bar && baz.qux;

// Unrelated identifiers without member access
a && b && c;

// Negation at different positions
!a && b && c;
a && b && !c;

```
Loading