Support non-parenthesized annotations on functional types without receiver

^KT-31734 Fixed
This commit is contained in:
victor.petukhov
2019-07-05 19:02:05 +03:00
parent 60e3787800
commit 6a679d86ab
32 changed files with 11735 additions and 11 deletions
@@ -0,0 +1,11 @@
// Issue: KT-31734
fun foo() {
for (@Foo (i: Int) in y) {}
for (@Foo (i: () -> Unit) in y) {}
for (@Foo (i) in y) {}
for (@Foo (i, j) in y) {}
for (@Foo (i, j: Int) in y) {}
for (@Foo i: Int in y) {}
for (@Foo i in y) {}
}
@@ -0,0 +1,282 @@
KtFile: forDestructuring.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
PsiComment(EOL_COMMENT)('// Issue: KT-31734')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiErrorElement:Unexpected type specification
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('y')
PsiErrorElement:Expecting 'in'
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiErrorElement:Expecting ')'
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
DESTRUCTURING_DECLARATION
PsiElement(LPAR)('(')
PsiErrorElement:Expecting a name
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting 'in'
PsiElement(ARROW)('->')
PsiErrorElement:Expecting ')'
<empty list>
PsiWhiteSpace(' ')
BODY
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Unit')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('y')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('y')
PsiErrorElement:Expecting 'in'
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('j')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('y')
PsiErrorElement:Expecting 'in'
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('j')
PsiErrorElement:Unexpected type specification
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('y')
PsiErrorElement:Expecting 'in'
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('i')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
LOOP_RANGE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('y')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
FOR
PsiElement(for)('for')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
VALUE_PARAMETER
MODIFIER_LIST
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('i')
PsiWhiteSpace(' ')
PsiElement(in)('in')
PsiWhiteSpace(' ')
LOOP_RANGE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('y')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BODY
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
@@ -0,0 +1,9 @@
// Issue: KT-31734
fun foo() {
val x = { @Foo (foo, bar) -> }
val x = { @Foo (foo: kotlin.Any, bar) -> }
val x = { @Foo (foo, bar: Any) -> }
val x = { @Foo ((foo, bar: Any)) -> }
val x = { @Foo () -> Unit }
}
@@ -0,0 +1,230 @@
KtFile: lambdaParameterDeclaration.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
PsiComment(EOL_COMMENT)('// Issue: KT-31734')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
BLOCK
ANNOTATED_EXPRESSION
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting an element
<empty list>
PsiWhiteSpace(' ')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
BLOCK
ANNOTATED_EXPRESSION
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiErrorElement:Unexpected type specification
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('kotlin')
PsiErrorElement:Expecting ')'
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Any')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('bar')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
BLOCK
ANNOTATED_EXPRESSION
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiErrorElement:Unexpected type specification
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Any')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting an element
<empty list>
PsiWhiteSpace(' ')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
BLOCK
ANNOTATED_EXPRESSION
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
PARENTHESIZED
PsiElement(LPAR)('(')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
PsiErrorElement:Expecting ')'
<empty list>
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiErrorElement:Unexpected type specification
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Any')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting an element
<empty list>
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
BLOCK
ANNOTATED_EXPRESSION
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting an element
<empty list>
PsiWhiteSpace(' ')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Unit')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
@@ -0,0 +1,9 @@
// Issue: KT-31734
fun foo() {
val @Foo (i) = Pair(1, 2)
var @Foo (i: () -> Unit) = Pair(1, 2)
var @Foo (i: Int) = Pair(1, 2)
val @Foo (i, j) = Pair(1, 2)
val @Foo (i, j: Int) = Pair(1, 2)
}
@@ -0,0 +1,230 @@
KtFile: variableDestructuring.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
PsiComment(EOL_COMMENT)('// Issue: KT-31734')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Annotations are not allowed in this position
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting property name or receiver type
<empty list>
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Pair')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('2')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
DESTRUCTURING_DECLARATION
PsiElement(var)('var')
PsiWhiteSpace(' ')
PsiErrorElement:Annotations are not allowed in this position
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiErrorElement:Expecting ')'
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(LPAR)('(')
PsiErrorElement:Expecting a name
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(ARROW)('->')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Unit')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Pair')
PsiElement(LPAR)('(')
PsiElement(INTEGER_LITERAL)('1')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
PsiElement(INTEGER_LITERAL)('2')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(var)('var')
PsiWhiteSpace(' ')
PsiErrorElement:Annotations are not allowed in this position
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiErrorElement:Unexpected type specification
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting property name or receiver type
<empty list>
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Pair')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('2')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Annotations are not allowed in this position
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('j')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting property name or receiver type
<empty list>
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Pair')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('2')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Annotations are not allowed in this position
ANNOTATION_ENTRY
PsiElement(AT)('@')
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
PsiWhiteSpace(' ')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('i')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('j')
PsiErrorElement:Unexpected type specification
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiErrorElement:Expecting property name or receiver type
<empty list>
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Pair')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_ARGUMENT
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('2')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
@@ -0,0 +1,47 @@
// Issue: KT-31734
val x: (@Foo(10) suspend (Int) -> Unit) get() = {}
val x: @Foo({}) ((x: @Foo(10) (@Foo(11) () -> Int) -> Int) -> Unit) get() = {}
val x: suspend @Foo(10) (x: @Foo(10) (@Foo("") (x: kotlin.Any) -> Int) -> Int) -> Unit get() = {}
val x: Comparable<@Foo(10) @Bar(10) @Foo(listOf(10)) (x: kotlin.Any = {}) -> Unit> get() = {}
val x: Any = {} as @Foo({ x: Int -> 10}) suspend (x: @Foo(10) Foo) -> (y: @Foo(10) Bar) -> Unit
fun foo(x: (@Foo(10) (@Foo({ x: Int -> 10}) kotlin.Any)->()->Unit)) = x
fun foo(x: suspend @Foo(10) @Bar(10 + @Foo 3) (kotlin.Any) -> Unit = { x: Int -> x }) {}
fun foo() {
val x: @Foo(10) suspend @Bar(throw Exception()) (Coomparable<kotlin.Any>) -> Unit = {}
}
fun foo() {
val x = { x: suspend @Foo(null) (Coomparable<@Foo(10) @Bar(10) @Foo(10) () -> Unit>) -> () -> Unit -> x }
}
abstract class A {
abstract var x: @Foo(10 as @Foo suspend (Int) -> ((Int) -> Unit)) suspend (suspend (Int) -> ((Int) -> Unit)) -> Int
}
fun foo(vararg x: @Foo(10) @Bar(10) @Foo(Any) (Any) -> Unit) = 10
fun foo(): @Foo.Bar(@Foo x) suspend (Nothing) -> Unit = {}
fun foo(): () -> @Foo.Bar('1') suspend (Bar) -> Unit = {}
val x: Any get() = fun(): @Foo("") (Coomparable<Nothing>) -> Unit {}
fun foo() {
var x: (@Foo(object {}) (()->Unit)-> ()->Unit) -> Unit = {}
}
fun foo(x: Any) {
if (x as @Foo({}) @Bar(10) @Foo(10) (()->Unit) -> Unit is suspend @Foo(10) @Bar(10) @Foo(10) (()->Unit) -> Unit) {}
}
fun foo(y: Any) {
var x = y as (@Foo({}) suspend (()->Unit) -> (()->Unit) -> Unit) -> Unit
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
// Issue: KT-31734
val x: (@Foo() () -> Unit) get() = {}
val x: @Foo() (() -> Unit) get() = {}
val x: @Foo() () -> Unit get() = {}
val x: Comparable<@Fo() @Bar(10) @Foo() () -> Unit> get() = {}
val x: Any = {} as @Foo() () -> Unit
fun foo(x: (@Foo() () -> Unit)) = x
fun foo(x: @Foo(10) @Bar() () -> Unit = { x: Int -> x }) {}
fun foo() {
val x: @Foo() @Bar() () -> Unit = {}
}
fun foo() {
val x = { x: @Foo() () -> () -> Unit -> x }
}
abstract class A {
abstract var x: @Foo() (() -> (() -> Unit)) -> Int
}
fun foo(vararg x: @Foo() @Bar(10) @Foo() () -> Unit) = 10
fun foo(): @Foo.Bar() () -> Unit = {}
fun foo(): () -> @Foo.Bar() () -> Unit = {}
val x: Any get() = fun(): @Foo() () -> Unit {}
fun foo() {
var x: (@Foo() ()->()->Unit) -> Unit = {}
}
fun foo(x: Any) {
if (x as @Foo() @Bar(10) @Foo() () -> Unit is @Foo() @Bar(10) @Foo() () -> Unit) {}
}
fun foo(y: Any) {
var x = y as (@Foo() () -> () -> Unit) -> Unit
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
// Issue: KT-31734
val x: (@[Foo] suspend (Int) -> Unit) get() = {}
val x: (@[Foo] () -> Unit) get() = {}
val x: (@[Foo] suspend () -> Unit) get() = {}
val x: @[Foo] ((x: @[Foo] (@[Foo Foo] () -> Int) -> Int) -> Unit) get() = {}
val x: suspend @[Foo] (x: @[Foo Foo] (@[Foo Foo] (x: kotlin.Any) -> Int) -> Int) -> Unit get() = {}
val x: Comparable<@[Foo] @[Bar(10)] @[Foo] () -> Unit> get() = {}
val x: Any = {} as @[Foo Foo] suspend (x: @[Foo] Foo) -> (y: @[Foo] Bar) -> Unit
fun foo(x: (@Foo ()->()->Unit)) = x
fun foo(x: suspend @[Foo Foo(10)] @[Bar] (kotlin.Any) -> Unit = { x: Int -> x }) {}
fun foo() {
val x: @[Foo(10)] @[Bar] (Coomparable<kotlin.Any>) -> Unit = {}
}
fun foo() {
val x = { x: suspend @[Foo Bar] (Coomparable<@[Foo Bar Bar Bar Bar Bar] @[Bar(10)] @[Foo Bar] () -> Unit>) -> () -> Unit -> x }
}
abstract class A {
abstract var x: @[Foo Bar] suspend (() -> ((Int) -> Unit)) -> Int
}
fun foo(vararg x: @[Foo Bar] @[Bar(10)] @[Foo Bar] () -> Unit) = 10
fun foo(): @[Foo.Bar Foo.Bar(1)] suspend () -> Unit = {}
fun foo(): () -> @[Foo.Bar] () -> Unit = {}
val x: Any get() = fun(): @[Foo()] (Coomparable<Nothing>) -> Unit {}
fun foo() {
var x: (@[Foo Bar] (()->Unit)-> ()->Unit) -> Unit = {}
}
fun foo(x: Any) {
if (x as @[Foo] @[Bar(10) Bar] @[Foo Bar] (()->Unit) -> Unit is suspend @[Foo] @[Bar (10)] @[Foo Bar (10)] (()->Unit) -> Unit) {}
}
fun foo(y: Any) {
var x = y as (@[Foo Bar] suspend (()->Unit) -> (()->Unit) -> Unit) -> Unit
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
// Issue: KT-31734
val x: (@Foo suspend (Int) -> Unit) get() = {}
val x: @Foo ((x: @Foo (@Foo () -> Int) -> Int) -> Unit) get() = {}
val x: suspend @Foo (x: @Foo (@Foo (x: kotlin.Any) -> Int) -> Int) -> Unit get() = {}
val x: Comparable<@Foo @Bar(10) @Foo (x: kotlin.Any = {}) -> Unit> get() = {}
val x: Any = {} as @Foo suspend (x: @Foo Foo) -> (y: @Foo Bar) -> Unit
fun foo(x: (@Foo (@Foo kotlin.Any)->()->Unit)) = x
fun foo(x: suspend @Foo(10) @Bar (kotlin.Any) -> Unit = { x: Int -> x }) {}
fun foo() {
val x: @Foo suspend @Bar (Coomparable<kotlin.Any>) -> Unit = {}
}
fun foo() {
val x = { x: suspend @Foo (Coomparable<@Foo @Bar(10) @Foo () -> Unit>) -> () -> Unit -> x }
}
abstract class A {
abstract var x: @Foo suspend (suspend (Int) -> ((Int) -> Unit)) -> Int
}
fun foo(vararg x: @Foo @Bar(10) @Foo (Any) -> Unit) = 10
fun foo(): @Foo.Bar suspend (Nothing) -> Unit = {}
fun foo(): () -> @Foo.Bar suspend (Bar) -> Unit = {}
val x: Any get() = fun(): @Foo (Coomparable<Nothing>) -> Unit {}
fun foo() {
var x: (@Foo (()->Unit)-> ()->Unit) -> Unit = {}
}
fun foo(x: Any) {
if (x as @Foo @Bar(10) @Foo (()->Unit) -> Unit is suspend @Foo @Bar(10) @Foo (()->Unit) -> Unit) {}
}
fun foo(y: Any) {
var x = y as (@Foo suspend (()->Unit) -> (()->Unit) -> Unit) -> Unit
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
// Issue: KT-31734
val x: (@Foo suspend Int.() -> Unit) get() = {}
val x: @Foo Int.() -> Unit get() = {}
val x: @Foo Int.(x: kotlin.Int) -> Unit get() = {}
val x: @Foo ((x: @Foo (@Foo () -> Int) -> Int.(@Foo () -> Int) -> Int) -> Unit) get() = {}
val x: suspend @Foo (x: @Foo (@Foo ((x: kotlin.Any) -> Int).(x: kotlin.Any) -> Int) -> Int) -> Unit get() = {}
val x: Comparable<@Foo @Bar(10) @Foo Unit.(x: kotlin.Any = {}) -> Unit> get() = {}
val x: Any = {} as @Foo suspend Int.(x: @Foo Foo) -> (y: @Foo Bar) -> Unit
fun foo(x: (@Foo ((@Foo kotlin.Any)->(Int)).(@Foo kotlin.Any)->()->Unit)) = x
fun foo(x: suspend @Foo(10) @Bar Comparable<T>.(kotlin.Any) -> Unit = { x: Int -> x }) {}
fun foo() {
val x: @Foo suspend @Bar (Coomparable<kotlin.Any>) -> Unit.(Coomparable<kotlin.Any>) -> Unit = {}
}
fun foo() {
val x = { x: suspend @Foo @Foo () -> Unit.(Coomparable<@Foo @Bar(10) @Foo () -> Unit>) -> () -> Unit -> x }
}
abstract class A {
abstract var x: @Foo suspend (@Foo () -> Unit).(suspend (Int) -> ((Int) -> Unit)) -> Int
}
fun foo(vararg x: @Foo @Bar(10) @Foo Any.(Any) -> Unit) = 10
fun foo(): @Foo.Bar suspend Nothing.(Nothing) -> Unit = {}
fun foo(): () -> @Foo.Bar suspend Iterable<@Foo.Bar Int.(Bar) -> Unit>.(Bar) -> Unit = {}
val x: Any get() = fun(): @Foo (@Foo (Coomparable<Nothing>) -> Unit).(Coomparable<Nothing>) -> Unit {}
fun foo() {
var x: (@Foo (()->Unit)-> @Foo Int.()->Unit) -> Unit = {}
}
fun foo(x: Any) {
if (x as @Foo @Bar(10) @Foo ()->Unit.(()->Unit) -> Unit is suspend @Foo @Bar(10) @Foo ((()->Unit).()->Unit) -> Unit) {}
}
fun foo(y: Any) {
var x = y as (@Foo suspend (suspend (()->Unit)->Int).(()->Unit) -> (Float.()->Unit) -> Unit) -> Unit
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
// Issue: KT-31734
val x: (@Foo () -> Unit) get() = {}
val x: @Foo (() -> Unit) get() = {}
val x: @Foo () -> Unit get() = {}
val x: Comparable<@Foo @Bar(10) @Foo () -> Unit> get() = {}
val x: Any = {} as @Foo () -> Unit
fun foo(x: (@Foo () -> Unit)) = x
fun foo(x: @Foo(10) @Bar () -> Unit = { x: Int -> x }) {}
fun foo() {
val x: @Foo @Bar () -> Unit = {}
}
fun foo() {
val x = { x: @Foo () -> () -> Unit -> x }
}
abstract class A {
abstract var x: @Foo (() -> (() -> Unit)) -> Int
}
fun foo(vararg x: @Foo @Bar(10) @Foo () -> Unit) = 10
fun foo(): @Foo.Bar () -> Unit = {}
fun foo(): () -> @Foo.Bar () -> Unit = {}
val x: Any get() = fun(): @Foo () -> Unit {}
fun foo() {
var x: (@Foo ()->()->Unit) -> Unit = {}
}
fun foo(x: Any) {
if (x as @Foo @Bar(10) @Foo () -> Unit is @Foo @Bar(10) @Foo () -> Unit) {}
}
fun foo(y: Any) {
var x = y as (@Foo () -> () -> Unit) -> Unit
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
// Issue: KT-31734
val x: (@Foo suspend () -> Unit) get() = {}
val x: @Foo (suspend () -> Unit) get() = {}
val x: suspend @Foo () -> Unit get() = {}
val x: Comparable<@Foo suspend @Bar(10) @Foo () -> Unit> get() = {}
val x: Any = {} as @Foo suspend () -> Unit
fun foo(x: (suspend @Foo () -> Unit)) = x
fun foo(x: suspend @Foo(10) @Bar () -> Unit = { x: Int -> x }) {}
fun foo() {
val x: @Foo suspend @Bar () -> Unit = {}
}
fun foo() {
val x = { x: suspend @Foo () -> () -> Unit -> x }
}
abstract class A {
abstract var x: @Foo suspend (suspend () -> (() -> Unit)) -> Int
}
fun foo(vararg x: @Foo @Bar(10) @Foo () -> Unit) = 10
fun foo(): @Foo.Bar suspend () -> Unit = {}
fun foo(): () -> @Foo.Bar suspend () -> Unit = {}
val x: Any get() = fun(): @Foo suspend () -> Unit {}
fun foo() {
var x: (@Foo ()->suspend ()->Unit) -> Unit = {}
}
fun foo(x: Any) {
if (x as @Foo @Bar(10) suspend @Foo () -> Unit is suspend @Foo @Bar(10) @Foo () -> Unit) {}
}
fun foo(y: Any) {
var x = y as (@Foo suspend () -> () -> Unit) -> Unit
}