Add test data for parsing of complicated <..> and <..>= combinations
^KT-52684 Related ^KT-8263 Related
This commit is contained in:
+22
@@ -31153,6 +31153,28 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/syntax")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Syntax {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInSyntax() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/syntax"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGT.kt")
|
||||||
|
public void testComplicatedLTGT() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGT.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGTE.kt")
|
||||||
|
public void testComplicatedLTGTE() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGTE.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+22
@@ -31153,6 +31153,28 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/syntax")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Syntax {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInSyntax() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/syntax"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGT.kt")
|
||||||
|
public void testComplicatedLTGT() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGT.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGTE.kt")
|
||||||
|
public void testComplicatedLTGTE() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGTE.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+22
@@ -31153,6 +31153,28 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/syntax")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Syntax {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInSyntax() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/syntax"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGT.kt")
|
||||||
|
public void testComplicatedLTGT() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGT.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGTE.kt")
|
||||||
|
public void testComplicatedLTGTE() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGTE.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// ISSUE: KT-8263
|
||||||
|
|
||||||
|
fun test(x: Int, y: Int) {
|
||||||
|
if (<!CONDITION_TYPE_MISMATCH!>x < (<!SYNTAX!>if<!><!SYNTAX!><!> <!SYNTAX!>(<!><!UNRESOLVED_REFERENCE!><!SYNTAX!><!>y<!> ><!><!SYNTAX!><!> 115<!SYNTAX!>) 1 else 2))<!> {
|
||||||
|
Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// ISSUE: KT-8263
|
||||||
|
|
||||||
|
fun test(x: Int, y: Int) {
|
||||||
|
if (<!UNRESOLVED_REFERENCE!>x<!> < (<!SYNTAX!>if<!><!SYNTAX!><!> <!SYNTAX!>(<!><!UNRESOLVED_REFERENCE!><!SYNTAX!><!>y<!> ><!SYNTAX!><!> 115<!SYNTAX!>) 1 else 2))<!> {
|
||||||
|
Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// ISSUE: KT-52684
|
||||||
|
|
||||||
|
fun test(x: Int, y: Int) {
|
||||||
|
if (<!ASSIGNMENT_IN_EXPRESSION_CONTEXT!>x < (<!SYNTAX!>if<!><!SYNTAX!><!> <!SYNTAX!>(<!><!SYNTAX!><!>y >= 115<!>) 1 else 2<!SYNTAX!>))<!> {
|
||||||
|
Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// ISSUE: KT-52684
|
||||||
|
|
||||||
|
fun test(x: Int, y: Int) {
|
||||||
|
if (<!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!UNRESOLVED_REFERENCE!>x<!> < (<!SYNTAX!>if<!><!SYNTAX!><!> <!SYNTAX!>(<!><!UNRESOLVED_REFERENCE!><!SYNTAX!><!>y<!> >= 115<!>) 1 else 2<!SYNTAX!>))<!> {
|
||||||
|
Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fun test(x: Int, y: Int) {
|
||||||
|
if (x < (if (y > 115) 1 else 2)) {}
|
||||||
|
}
|
||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
KtFile: complicateLTGT.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('test')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Int')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Int')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
IF
|
||||||
|
PsiElement(if)('if')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
CONDITION
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_ARGUMENT_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PROJECTION
|
||||||
|
TYPE_REFERENCE
|
||||||
|
FUNCTION_TYPE
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiErrorElement:Type expected
|
||||||
|
PsiElement(if)('if')
|
||||||
|
PsiErrorElement:Expecting comma or ')'
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting ')'
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting '->' to specify return type of a function type
|
||||||
|
<empty list>
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiErrorElement:Expecting ')
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
THEN
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('115')
|
||||||
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(else)('else')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
fun test(x: Int, y: Int) {
|
||||||
|
if (x < (if (y >= 115) 1 else 2)) {}
|
||||||
|
}
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
KtFile: complicateLTGTE.kt
|
||||||
|
PACKAGE_DIRECTIVE
|
||||||
|
<empty list>
|
||||||
|
IMPORT_LIST
|
||||||
|
<empty list>
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('test')
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Int')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('Int')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
IF
|
||||||
|
PsiElement(if)('if')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
CONDITION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
CALL_EXPRESSION
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('x')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_ARGUMENT_LIST
|
||||||
|
PsiElement(LT)('<')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
TYPE_PROJECTION
|
||||||
|
TYPE_REFERENCE
|
||||||
|
FUNCTION_TYPE
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
VALUE_PARAMETER
|
||||||
|
TYPE_REFERENCE
|
||||||
|
PsiErrorElement:Type expected
|
||||||
|
PsiElement(if)('if')
|
||||||
|
PsiErrorElement:Expecting comma or ')'
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting ')'
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting '->' to specify return type of a function type
|
||||||
|
<empty list>
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('y')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
OPERATION_REFERENCE
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('115')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
THEN
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(else)('else')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
ELSE
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('2')
|
||||||
|
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
LAMBDA_EXPRESSION
|
||||||
|
FUNCTION_LITERAL
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
BLOCK
|
||||||
|
<empty list>
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
Generated
+22
@@ -31243,6 +31243,28 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/syntax")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Syntax {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInSyntax() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/syntax"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGT.kt")
|
||||||
|
public void testComplicatedLTGT() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGT.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("complicatedLTGTE.kt")
|
||||||
|
public void testComplicatedLTGTE() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/syntax/complicatedLTGTE.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
@TestMetadata("compiler/testData/diagnostics/tests/syntheticExtensions")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
@@ -131,6 +131,16 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
|||||||
runTest("compiler/testData/psi/CommentsBindingInStatementBlock.kt");
|
runTest("compiler/testData/psi/CommentsBindingInStatementBlock.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("complicateLTGT.kt")
|
||||||
|
public void testComplicateLTGT() throws Exception {
|
||||||
|
runTest("compiler/testData/psi/complicateLTGT.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("complicateLTGTE.kt")
|
||||||
|
public void testComplicateLTGTE() throws Exception {
|
||||||
|
runTest("compiler/testData/psi/complicateLTGTE.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("Constructors.kt")
|
@TestMetadata("Constructors.kt")
|
||||||
public void testConstructors() throws Exception {
|
public void testConstructors() throws Exception {
|
||||||
runTest("compiler/testData/psi/Constructors.kt");
|
runTest("compiler/testData/psi/Constructors.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user