Support trailing comma
^KT-34743 Fixed
This commit is contained in:
@@ -25,8 +25,6 @@ KtFile: CollectionLiterals_ERR.kt
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting an element
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n ')
|
||||
|
||||
+1
-5
@@ -533,8 +533,6 @@ KtFile: ForWithMultiDecl.kt
|
||||
DESTRUCTURING_DECLARATION_ENTRY
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -593,8 +591,6 @@ KtFile: ForWithMultiDecl.kt
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -687,4 +683,4 @@ KtFile: ForWithMultiDecl.kt
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
+3
-11
@@ -80,8 +80,6 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
DESTRUCTURING_DECLARATION_ENTRY
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -245,10 +243,7 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
PsiErrorElement:Expecting parameter name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
@@ -306,10 +301,7 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
PsiErrorElement:Expecting parameter name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
@@ -827,4 +819,4 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
+2
@@ -20,3 +20,5 @@ typealias f = T<A, B>.T<x>.() -> Unit
|
||||
typealias f = @[a] T.() -> Unit
|
||||
typealias f = @[a] T.T.() -> Unit
|
||||
typealias f = @[a] T<A, B>.T<x>.() -> Unit
|
||||
|
||||
typealias f = (a, ) -> b
|
||||
|
||||
+28
-1
@@ -680,4 +680,31 @@ KtFile: FunctionTypes.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiWhiteSpace('\n\n')
|
||||
TYPEALIAS
|
||||
PsiElement(typealias)('typealias')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
-1
@@ -1 +0,0 @@
|
||||
typealias f = (a, ) -> b
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
KtFile: FunctionTypes_ERR.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
IMPORT_LIST
|
||||
<empty list>
|
||||
TYPEALIAS
|
||||
PsiElement(typealias)('typealias')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a parameter declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
+1
-5
@@ -298,8 +298,6 @@ KtFile: MultiVariableDeclarations.kt
|
||||
DESTRUCTURING_DECLARATION_ENTRY
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -350,8 +348,6 @@ KtFile: MultiVariableDeclarations.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -616,4 +612,4 @@ KtFile: MultiVariableDeclarations.kt
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
-2
@@ -139,8 +139,6 @@ KtFile: TypeAlias_ERR.kt
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Type parameter declaration expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
@@ -95,11 +95,9 @@ KtFile: MapEntry.kt
|
||||
PsiErrorElement:Unexpected token
|
||||
PsiElement(EXCL)('!')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a parameter declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
class A(
|
||||
val x: String,
|
||||
val y: String,
|
||||
) {
|
||||
constructor(
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>> ,
|
||||
) {}
|
||||
|
||||
var x: Int
|
||||
get() = 10
|
||||
set(value,) {
|
||||
|
||||
}
|
||||
|
||||
var x: Int
|
||||
get() = 10
|
||||
set(value,/*...*/) {
|
||||
|
||||
}
|
||||
|
||||
var x: Int
|
||||
get() = 10
|
||||
set(value/*...*/,) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(
|
||||
x: Int,
|
||||
y: Number
|
||||
,
|
||||
) {}
|
||||
|
||||
val foo: (Int, Int) -> Int = fun(x,
|
||||
y, ): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
val foo: (Int, Int, Int) -> Int =
|
||||
fun (x,
|
||||
y: Int, z,
|
||||
): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
"foo bar something"
|
||||
,
|
||||
)
|
||||
|
||||
fun foo() {
|
||||
val x = x[
|
||||
1,
|
||||
3
|
||||
, ]
|
||||
val y = x[
|
||||
1,
|
||||
3
|
||||
,
|
||||
]
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>
|
||||
,->
|
||||
println("1")
|
||||
}
|
||||
val y = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>,
|
||||
-> println("1")
|
||||
}
|
||||
val z = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>
|
||||
,
|
||||
->
|
||||
println("1")
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class,->
|
||||
println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class
|
||||
,
|
||||
->
|
||||
println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
@Anno([1, 2, 3, 4
|
||||
,]
|
||||
)
|
||||
fun foo() {}
|
||||
|
||||
fun main() {
|
||||
val (
|
||||
y,
|
||||
z,
|
||||
) = Pair(1, 2)
|
||||
val (
|
||||
y,
|
||||
z
|
||||
, ) = Pair(1, 2)
|
||||
}
|
||||
|
||||
class A<
|
||||
T1: Number,
|
||||
T2: Iterable<Iterable<Iterable<Number>>>,
|
||||
T3: Comparable<Comparable<Comparable<Number>>>,
|
||||
> { }
|
||||
|
||||
fun <
|
||||
T1: Comparable<Comparable<Number>>,
|
||||
T2: Iterable<Iterable<Number>>
|
||||
,
|
||||
> foo() {}
|
||||
|
||||
fun main() {
|
||||
foo<Comparable<Comparable<Number>>, Iterable<Iterable<Number>>,>()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x: (
|
||||
y: Comparable<Comparable<Number>>,
|
||||
z: Iterable<Iterable<Number>>,
|
||||
) -> Int = { 10 }
|
||||
|
||||
val y = foo(1,) {}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception,) {
|
||||
|
||||
}
|
||||
}
|
||||
+1537
File diff suppressed because it is too large
Load Diff
+109
@@ -0,0 +1,109 @@
|
||||
class A: A1, A2, { }
|
||||
|
||||
class A<T1, T2> where
|
||||
T1: Comparable<Comparable<Number>>,
|
||||
T2: Iterable<Iterable<Number>>, { }
|
||||
|
||||
class A(
|
||||
val x: String,
|
||||
val y: String,,
|
||||
) {
|
||||
constructor(,) {}
|
||||
}
|
||||
|
||||
fun foo(
|
||||
x: Int,
|
||||
y: Number
|
||||
,
|
||||
,
|
||||
) {}
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
"foo bar something",
|
||||
,
|
||||
)
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
,"foo bar something")
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
,"foo bar something",
|
||||
)
|
||||
|
||||
fun foo() {
|
||||
val x = x[
|
||||
1,
|
||||
3,
|
||||
,]
|
||||
val y = x[,]
|
||||
val z1 = x[,1]
|
||||
val z2 = x[,,1]
|
||||
val z3 = x[,1,]
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x = { x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>,
|
||||
, ->
|
||||
println("1")
|
||||
}
|
||||
val y = { , ->
|
||||
println("1")
|
||||
}
|
||||
val () = Pair(1,2)
|
||||
val (,) = Pair(1,2)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class,
|
||||
,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
,Comparable::class,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
,Comparable::class -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
, -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
true -> println(1)
|
||||
else, -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
true, ,-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo() = foo(,) {}
|
||||
|
||||
fun foo() = foo {},
|
||||
|
||||
fun foo() = foo(1) {},
|
||||
|
||||
fun <T, : Number> foo10() {
|
||||
fun <T1,T2,T3,:Comparable<Int>> foo10() {}
|
||||
}
|
||||
|
||||
fun foo() = when (x) {
|
||||
1,, -> null
|
||||
}
|
||||
|
||||
fun <T1,T2,,>foo() {}
|
||||
+1289
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user