mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
fix(parser): fix conditional expressions with arrow-function alternates in TS (#20356)
fixes https://github.com/rolldown/rolldown/issues/8676
This commit is contained in:
1 parent
bf442f8399
commit
78c264a783
7 files changed
+32
-11
No files matched your search
@@ -22,7 +22,7 @@ impl<'a, C: Config> ParserImpl<'a, C> {
|
||||
match self.is_parenthesized_arrow_function_expression() {
|
||||
Tristate::False => None,
|
||||
Tristate::True => Some(self.parse_parenthesized_arrow_function_expression(
|
||||
/* allow_return_type_in_arrow_function */ true,
|
||||
allow_return_type_in_arrow_function,
|
||||
)),
|
||||
Tristate::Maybe => self.parse_possible_parenthesized_arrow_function_expression(
|
||||
allow_return_type_in_arrow_function,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const formErrors = { foo: 'bar' };
|
||||
|
||||
type Form = { id: number; errors: Record<string, boolean> };
|
||||
|
||||
type Errors<T extends Form> = Pick<T, 'errors'>;
|
||||
|
||||
type FooBarForm = Form & { tag: 'foobarform' };
|
||||
|
||||
const getFormError =
|
||||
typeof formErrors !== 'object'
|
||||
? () => ({})
|
||||
: (index: number): Errors<FooBarForm> => {
|
||||
return {
|
||||
errors: { a: true, b: false },
|
||||
};
|
||||
};
|
||||
@@ -1,3 +1,3 @@
|
||||
codegen_misc Summary:
|
||||
AST Parsed : 64/64 (100.00%)
|
||||
Positive Passed: 64/64 (100.00%)
|
||||
AST Parsed : 65/65 (100.00%)
|
||||
Positive Passed: 65/65 (100.00%)
|
||||
@@ -1,3 +1,3 @@
|
||||
formatter_misc Summary:
|
||||
AST Parsed : 64/64 (100.00%)
|
||||
Positive Passed: 64/64 (100.00%)
|
||||
AST Parsed : 65/65 (100.00%)
|
||||
Positive Passed: 65/65 (100.00%)
|
||||
@@ -1,6 +1,6 @@
|
||||
parser_misc Summary:
|
||||
AST Parsed : 64/64 (100.00%)
|
||||
Positive Passed: 64/64 (100.00%)
|
||||
AST Parsed : 65/65 (100.00%)
|
||||
Positive Passed: 65/65 (100.00%)
|
||||
Negative Passed: 134/134 (100.00%)
|
||||
|
||||
× Cannot assign to 'arguments' in strict mode
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
semantic_misc Summary:
|
||||
AST Parsed : 64/64 (100.00%)
|
||||
Positive Passed: 51/64 (79.69%)
|
||||
AST Parsed : 65/65 (100.00%)
|
||||
Positive Passed: 51/65 (78.46%)
|
||||
semantic Error: tasks/coverage/misc/pass/conditional-arrow-alternate-return-type.ts
|
||||
Unresolved references mismatch:
|
||||
after transform: ["Pick", "Record"]
|
||||
rebuilt : []
|
||||
|
||||
semantic Error: tasks/coverage/misc/pass/declare-let-private.ts
|
||||
Bindings mismatch:
|
||||
after transform: ScopeId(0): ["private"]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
transformer_misc Summary:
|
||||
AST Parsed : 64/64 (100.00%)
|
||||
Positive Passed: 64/64 (100.00%)
|
||||
AST Parsed : 65/65 (100.00%)
|
||||
Positive Passed: 65/65 (100.00%)
|
||||
Reference in new issue
Block a user