Support modifiers on types in parser

(required for 'suspend' on functional types).

TYPE_REFERENCE element now has MODIFIER_LIST child, which hosts annotations and modifiers for the corresponding type reference.

Annotations and modifiers written before an extension function type are now parsed as annotations and modifiers for the functional type, not the receiver type.
So, '@Ann A.(B) -> C' was '(@Ann A).(B) -> C', and became '@Ann (A.(B) -> C)'.
NB: DSL_SCOPE_VIOLATION testData updated accordingly.

Type projection variance modifiers ('in', 'out') belong to a separate modifier list under corresponding type projection (not under a type reference).
'A<in suspend T>' is 'A<(in (suspend T))>', 'A<suspend in T>' is an error.

In stub builder, create a modifier list node to host annotations and modifiers (none so far; TODO properly serialize/deserialize types with modifiers).
This commit is contained in:
Dmitry Petrov
2016-12-13 15:25:38 +03:00
committed by Stanislav Erokhin
parent 6649f64e9f
commit a15d423db4
45 changed files with 2223 additions and 1247 deletions
@@ -4,7 +4,7 @@ public interface Some {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public abstract fun f1(): kotlin.String.() -> kotlin.Int
public abstract fun f2(): kotlin.String.() -> kotlin.Int
public abstract fun f3(): @ann kotlin.String.() -> kotlin.Int
public abstract fun f3(): @ann() (kotlin.String.() -> kotlin.Int)
public abstract fun f4(): @ann() (kotlin.String.() -> kotlin.Int)
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String