Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nullish coalescing negation inference (#1045)
This PR does 2 things: - It removes special casing for nullish coalescing (??) in negation - This fixes #1003 - We also made sure optional chaining (?.) is ok - This cements #1007 as fixed
- Loading branch information
Robin Ricard
committed
Aug 22, 2021
1 parent
9101e63
commit 622654c
Showing
3 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
nullish_coalescing_boolean_expr: { | ||
options = { | ||
booleans: true, | ||
ecma: true, | ||
} | ||
input: { | ||
(function(a, b) { | ||
if(!(a ?? b)) throw new Error("Some error"); | ||
})() | ||
} | ||
expect: { | ||
(function(a, b) { | ||
if(!(a ?? b)) throw new Error("Some error"); | ||
})() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
optional_chaining_boolean_expr: { | ||
options = { | ||
booleans: true, | ||
ecma: true, | ||
} | ||
input: { | ||
(function(option) { | ||
if (!(option.container?.tagName === "DIV")) | ||
throw new Error("Invalid `container` and/or `viewer` option."); | ||
})() | ||
} | ||
expect: { | ||
(function(option) { | ||
if ("DIV" !== option.container?.tagName) | ||
throw new Error("Invalid `container` and/or `viewer` option."); | ||
})() | ||
} | ||
} |