KT-847 Allow "this" without {} in string templates
This commit is contained in:
committed by
Nikolay Krasko
parent
94ad86e79e
commit
55c11d0f44
@@ -0,0 +1,3 @@
|
||||
fun <T> T.mustBe(t : T) {
|
||||
"$this must be$<!SYNTAX!>as<!>$t"
|
||||
}
|
||||
@@ -7,6 +7,7 @@ fun demo() {
|
||||
fun buzz(f : fun () : Any?) : Int = 1
|
||||
val sdf = 1
|
||||
val foo = 3;
|
||||
"$this must be$as$t"
|
||||
"$abc"
|
||||
"$abc\"
|
||||
"$"
|
||||
|
||||
@@ -157,6 +157,25 @@ JetFile: StringTemplates.jet
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
STRING_TEMPLATE
|
||||
PsiElement(OPEN_QUOTE)('"')
|
||||
SHORT_STRING_TEMPLATE_ENTRY
|
||||
PsiElement(SHORT_TEMPLATE_ENTRY_START)('$')
|
||||
THIS_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(this)('this')
|
||||
LITERAL_STRING_TEMPLATE_ENTRY
|
||||
PsiElement(REGULAR_STRING_PART)(' must be')
|
||||
SHORT_STRING_TEMPLATE_ENTRY
|
||||
PsiElement(SHORT_TEMPLATE_ENTRY_START)('$')
|
||||
PsiErrorElement:Keyword cannot be used as a reference
|
||||
PsiElement(as)('as')
|
||||
SHORT_STRING_TEMPLATE_ENTRY
|
||||
PsiElement(SHORT_TEMPLATE_ENTRY_START)('$')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('t')
|
||||
PsiElement(CLOSING_QUOTE)('"')
|
||||
PsiWhiteSpace('\n ')
|
||||
STRING_TEMPLATE
|
||||
PsiElement(OPEN_QUOTE)('"')
|
||||
SHORT_STRING_TEMPLATE_ENTRY
|
||||
|
||||
Reference in New Issue
Block a user