-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not try to lazy parse a block without opening bracket
It can consume the whole file in such case which will result PsiBuilder going crazy #KT-36191 fixed
- Loading branch information
1 parent
4f9364f
commit 1535873
Showing
6 changed files
with
96 additions
and
5 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
3 changes: 3 additions & 0 deletions
3
compiler/testData/psi/stringTemplates/StringTemplateWithTryWithoutBlockInLongEntry.kt
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,3 @@ | ||
fun foo() { | ||
println("${try}") | ||
} |
40 changes: 40 additions & 0 deletions
40
compiler/testData/psi/stringTemplates/StringTemplateWithTryWithoutBlockInLongEntry.txt
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,40 @@ | ||
KtFile: StringTemplateWithTryWithoutBlockInLongEntry.kt | ||
PACKAGE_DIRECTIVE | ||
<empty list> | ||
IMPORT_LIST | ||
<empty list> | ||
FUN | ||
PsiElement(fun)('fun') | ||
PsiWhiteSpace(' ') | ||
PsiElement(IDENTIFIER)('foo') | ||
VALUE_PARAMETER_LIST | ||
PsiElement(LPAR)('(') | ||
PsiElement(RPAR)(')') | ||
PsiWhiteSpace(' ') | ||
BLOCK | ||
PsiElement(LBRACE)('{') | ||
PsiWhiteSpace('\n ') | ||
CALL_EXPRESSION | ||
REFERENCE_EXPRESSION | ||
PsiElement(IDENTIFIER)('println') | ||
VALUE_ARGUMENT_LIST | ||
PsiElement(LPAR)('(') | ||
VALUE_ARGUMENT | ||
STRING_TEMPLATE | ||
PsiElement(OPEN_QUOTE)('"') | ||
LONG_STRING_TEMPLATE_ENTRY | ||
PsiElement(LONG_TEMPLATE_ENTRY_START)('${') | ||
TRY | ||
PsiElement(try)('try') | ||
BLOCK | ||
PsiErrorElement:Expecting '{' to open a block | ||
<empty list> | ||
PsiErrorElement:Expecting an element | ||
PsiElement(LONG_TEMPLATE_ENTRY_END)('}') | ||
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line) | ||
PsiElement(CLOSING_QUOTE)('"') | ||
PsiElement(RPAR)(')') | ||
PsiWhiteSpace('\n') | ||
PsiElement(RBRACE)('}') | ||
PsiErrorElement:Expecting 'catch' or 'finally' | ||
<empty list> |
3 changes: 3 additions & 0 deletions
3
compiler/testData/psi/stringTemplates/StringTemplateWithTryWithoutBlockInShortEntry.kt
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,3 @@ | ||
fun foo() { | ||
println("$try") | ||
} |
32 changes: 32 additions & 0 deletions
32
compiler/testData/psi/stringTemplates/StringTemplateWithTryWithoutBlockInShortEntry.txt
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,32 @@ | ||
KtFile: StringTemplateWithTryWithoutBlockInShortEntry.kt | ||
PACKAGE_DIRECTIVE | ||
<empty list> | ||
IMPORT_LIST | ||
<empty list> | ||
FUN | ||
PsiElement(fun)('fun') | ||
PsiWhiteSpace(' ') | ||
PsiElement(IDENTIFIER)('foo') | ||
VALUE_PARAMETER_LIST | ||
PsiElement(LPAR)('(') | ||
PsiElement(RPAR)(')') | ||
PsiWhiteSpace(' ') | ||
BLOCK | ||
PsiElement(LBRACE)('{') | ||
PsiWhiteSpace('\n ') | ||
CALL_EXPRESSION | ||
REFERENCE_EXPRESSION | ||
PsiElement(IDENTIFIER)('println') | ||
VALUE_ARGUMENT_LIST | ||
PsiElement(LPAR)('(') | ||
VALUE_ARGUMENT | ||
STRING_TEMPLATE | ||
PsiElement(OPEN_QUOTE)('"') | ||
SHORT_STRING_TEMPLATE_ENTRY | ||
PsiElement(SHORT_TEMPLATE_ENTRY_START)('$') | ||
PsiErrorElement:Keyword cannot be used as a reference | ||
PsiElement(try)('try') | ||
PsiElement(CLOSING_QUOTE)('"') | ||
PsiElement(RPAR)(')') | ||
PsiWhiteSpace('\n') | ||
PsiElement(RBRACE)('}') |
10 changes: 10 additions & 0 deletions
10
compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.