[Parser] Fix OOM in parsing of incorrect string literals

^KT-46455 Fixed
KT-34410
KT-46564
This commit is contained in:
Dmitriy Novozhilov
2021-05-10 12:20:26 +03:00
committed by TeamCityServer
parent c284eab2dd
commit 3532ce7fbc
5 changed files with 79 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
// ISSUE: KT-46455
class A {
fun bar() =
x foo(*z) ?: "${z.joinToString()}"
}
+66
View File
@@ -0,0 +1,66 @@
KtFile: kt46455.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
PsiComment(EOL_COMMENT)('// ISSUE: KT-46455')
PsiWhiteSpace('\n\n')
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('bar')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(IDENTIFIER)('foo')
BINARY_EXPRESSION
PARENTHESIZED
PsiElement(LPAR)('(')
PsiErrorElement:Expecting an expression
<empty list>
OPERATION_REFERENCE
PsiElement(MUL)('*')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('z')
PsiErrorElement:Expecting member declaration
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting member declaration
PsiElement(ELVIS)('?:')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting member declaration
PsiElement(OPEN_QUOTE)('"')
PsiErrorElement:Expecting member declaration
PsiElement(LONG_TEMPLATE_ENTRY_START)('${')
PsiErrorElement:Expecting member declaration
PsiElement(IDENTIFIER)('z')
PsiErrorElement:Expecting member declaration
PsiElement(DOT)('.')
PsiErrorElement:Expecting member declaration
PsiElement(IDENTIFIER)('joinToString')
PsiErrorElement:Expecting member declaration
PsiElement(LPAR)('(')
PsiErrorElement:Expecting member declaration
PsiElement(RPAR)(')')
PsiErrorElement:Expecting member declaration
PsiElement(LONG_TEMPLATE_ENTRY_END)('}')
PsiErrorElement:Expecting member declaration
PsiElement(CLOSING_QUOTE)('"')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')