'where' clause in type alias declaration is a syntax error
(type alias parameters can't have bounds)
This commit is contained in:
@@ -1195,9 +1195,12 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
|
||||
expect(IDENTIFIER, "Type name expected", TokenSet.orSet(TokenSet.create(LT, EQ, SEMICOLON), TOP_LEVEL_DECLARATION_FIRST));
|
||||
|
||||
// TODO drop type constraints parsing
|
||||
if (parseTypeParameterList(TYPE_PARAMETER_GT_RECOVERY_SET)) {
|
||||
parseTypeParameterList(TYPE_PARAMETER_GT_RECOVERY_SET);
|
||||
|
||||
if (at(WHERE_KEYWORD)) {
|
||||
PsiBuilder.Marker error = mark();
|
||||
parseTypeConstraints();
|
||||
error.error("Type alias parameters can't have bounds");
|
||||
}
|
||||
|
||||
expect(EQ, "Expecting '='", TokenSet.orSet(TOP_LEVEL_DECLARATION_FIRST, TokenSet.create(SEMICOLON)));
|
||||
|
||||
@@ -2,4 +2,6 @@ typealias WithVariance<<!VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED!>in<!> X, <!VARI
|
||||
typealias WithBounds1<T : <!BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED!>T<!>> = Int
|
||||
typealias WithBounds2<X : <!BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED!>Y<!>, Y : <!BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED!>X<!>> = Int
|
||||
|
||||
typealias WithBounds3<X> <!SYNTAX!>where <!DEBUG_INFO_MISSING_UNRESOLVED!>X<!> : <!DEBUG_INFO_MISSING_UNRESOLVED!>Any<!><!> = Int
|
||||
|
||||
val x: WithVariance<Int, Int> = 0
|
||||
|
||||
@@ -2,5 +2,6 @@ package
|
||||
|
||||
public typealias WithBounds1</*0*/ T : [ERROR : Cyclic upper bounds]> = kotlin.Int
|
||||
public typealias WithBounds2</*0*/ X : [ERROR : Cyclic upper bounds], /*1*/ Y : [ERROR : Cyclic upper bounds]> = kotlin.Int
|
||||
public typealias WithBounds3</*0*/ X> = kotlin.Int
|
||||
public typealias WithVariance</*0*/ in X, /*1*/ out Y> = kotlin.Int
|
||||
public val x: WithVariance<kotlin.Int, kotlin.Int> [= kotlin.Int] = 0
|
||||
|
||||
Reference in New Issue
Block a user