Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
chore: 🤖 cr issues
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Sep 10, 2022
1 parent 9e84738 commit 7defc3f
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/rome_js_parser/src/syntax/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,9 @@ fn parse_member_expression_rest(
lhs
}

// test_err ts ts_new_operator
// new A<test><test>();

// test ts ts_new_operator
// var c2 = new T<string>; // Ok
// var x1 = new SS<number>(); // OK
Expand Down
88 changes: 88 additions & 0 deletions crates/rome_js_parser/test_data/inline/err/ts_new_operator.rast
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
JsModule {
interpreter_token: missing (optional),
directives: JsDirectiveList [],
items: JsModuleItemList [
JsExpressionStatement {
expression: JsBinaryExpression {
left: JsBinaryExpression {
left: JsNewExpression {
new_token: NEW_KW@0..4 "new" [] [Whitespace(" ")],
callee: JsIdentifierExpression {
name: JsReferenceIdentifier {
value_token: IDENT@4..5 "A" [] [],
},
},
type_arguments: missing (optional),
arguments: missing (optional),
},
operator_token: L_ANGLE@5..6 "<" [] [],
right: JsIdentifierExpression {
name: JsReferenceIdentifier {
value_token: IDENT@6..10 "test" [] [],
},
},
},
operator_token: R_ANGLE@10..11 ">" [] [],
right: TsTypeAssertionExpression {
l_angle_token: L_ANGLE@11..12 "<" [] [],
ty: TsReferenceType {
name: JsReferenceIdentifier {
value_token: IDENT@12..16 "test" [] [],
},
type_arguments: missing (optional),
},
r_angle_token: R_ANGLE@16..17 ">" [] [],
expression: JsParenthesizedExpression {
l_paren_token: L_PAREN@17..18 "(" [] [],
expression: missing (required),
r_paren_token: R_PAREN@18..19 ")" [] [],
},
},
},
semicolon_token: SEMICOLON@19..20 ";" [] [],
},
],
eof_token: EOF@20..21 "" [Newline("\n")] [],
}

0: JS_MODULE@0..21
0: (empty)
1: JS_DIRECTIVE_LIST@0..0
2: JS_MODULE_ITEM_LIST@0..20
0: JS_EXPRESSION_STATEMENT@0..20
0: JS_BINARY_EXPRESSION@0..19
0: JS_BINARY_EXPRESSION@0..10
0: JS_NEW_EXPRESSION@0..5
0: NEW_KW@0..4 "new" [] [Whitespace(" ")]
1: JS_IDENTIFIER_EXPRESSION@4..5
0: JS_REFERENCE_IDENTIFIER@4..5
0: IDENT@4..5 "A" [] []
2: (empty)
3: (empty)
1: L_ANGLE@5..6 "<" [] []
2: JS_IDENTIFIER_EXPRESSION@6..10
0: JS_REFERENCE_IDENTIFIER@6..10
0: IDENT@6..10 "test" [] []
1: R_ANGLE@10..11 ">" [] []
2: TS_TYPE_ASSERTION_EXPRESSION@11..19
0: L_ANGLE@11..12 "<" [] []
1: TS_REFERENCE_TYPE@12..16
0: JS_REFERENCE_IDENTIFIER@12..16
0: IDENT@12..16 "test" [] []
1: (empty)
2: R_ANGLE@16..17 ">" [] []
3: JS_PARENTHESIZED_EXPRESSION@17..19
0: L_PAREN@17..18 "(" [] []
1: (empty)
2: R_PAREN@18..19 ")" [] []
1: SEMICOLON@19..20 ";" [] []
3: EOF@20..21 "" [Newline("\n")] []
--
error[SyntaxError]: Parenthesized expression didnt contain anything
┌─ ts_new_operator.ts:1:19
1 │ new A<test><test>();
│ ^ Expected an expression here

--
new A<test><test>();
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
new A<test><test>();

0 comments on commit 7defc3f

Please sign in to comment.