New enum syntax: Short constructor syntax introduced for entries, optional commas between entries, semicolon after entries. #KT-7605 Fixed.
Grammar changed accordingly. Semicolons prohibited after an entry except the last one. Only one initializer is allowed per entry. EnumReferenceExpression AST node introduced. Some tests fixed, a pair of new tests written. Kotlin code inside project fixed. Formatter and intendation tests fixed accordingly. Stub version is incremented.
This commit is contained in:
@@ -120,6 +120,7 @@ public interface JetNodeTypes {
|
||||
JetNodeType ANNOTATED_EXPRESSION = new JetNodeType("ANNOTATED_EXPRESSION", JetAnnotatedExpression.class);
|
||||
|
||||
IElementType REFERENCE_EXPRESSION = JetStubElementTypes.REFERENCE_EXPRESSION;
|
||||
IElementType ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION = JetStubElementTypes.ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION;
|
||||
JetNodeType OPERATION_REFERENCE = new JetNodeType("OPERATION_REFERENCE", JetOperationReferenceExpression.class);
|
||||
JetNodeType LABEL = new JetNodeType("LABEL", JetLabelReferenceExpression.class);
|
||||
|
||||
|
||||
@@ -740,7 +740,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
/*
|
||||
* enumClassBody
|
||||
* : "{" enumEntries members "}"
|
||||
* : "{" enumEntries ";"? members "}"
|
||||
* ;
|
||||
*/
|
||||
private void parseEnumClassBody() {
|
||||
@@ -752,6 +752,8 @@ public class JetParsing extends AbstractJetParsing {
|
||||
advance(); // LBRACE
|
||||
|
||||
parseEnumEntries();
|
||||
// TODO: syntax without SEMICOLON is deprecated, KT-7605
|
||||
consumeIf(SEMICOLON);
|
||||
parseMembers();
|
||||
|
||||
expect(RBRACE, "Expecting '}' to close enum class body");
|
||||
@@ -761,52 +763,73 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
/**
|
||||
* enumEntries
|
||||
* : enumEntry*
|
||||
* : (enumEntry ","? )?
|
||||
* ;
|
||||
*/
|
||||
private void parseEnumEntries() {
|
||||
while (!eof() && !at(RBRACE)) {
|
||||
PsiBuilder.Marker entry = mark();
|
||||
|
||||
ModifierDetector detector = new ModifierDetector();
|
||||
parseModifierList(detector, ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
||||
|
||||
// ?: how can we find ourselves at SOFT_KEYWORDS_AT_MEMBER_START if we are at identifier?
|
||||
// Or, is it just for performance?
|
||||
if (!atSet(SOFT_KEYWORDS_AT_MEMBER_START) && at(IDENTIFIER)) {
|
||||
parseEnumEntry();
|
||||
closeDeclarationWithCommentBinders(entry, ENUM_ENTRY, true);
|
||||
}
|
||||
else {
|
||||
entry.rollbackTo();
|
||||
if (!parseEnumEntry()) {
|
||||
break;
|
||||
}
|
||||
// TODO: syntax without COMMA is deprecated (only last entry is an exception), KT-7605
|
||||
consumeIf(COMMA);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* enumEntry
|
||||
* : modifiers SimpleName (":" initializer{","})? classBody?
|
||||
* : modifiers SimpleName ((":" initializer) | ("(" arguments ")"))? classBody?
|
||||
* ;
|
||||
*/
|
||||
private void parseEnumEntry() {
|
||||
assert _at(IDENTIFIER);
|
||||
private boolean parseEnumEntry() {
|
||||
PsiBuilder.Marker entry = mark();
|
||||
|
||||
PsiBuilder.Marker nameAsDeclaration = mark();
|
||||
advance(); // IDENTIFIER
|
||||
nameAsDeclaration.done(OBJECT_DECLARATION_NAME);
|
||||
ModifierDetector detector = new ModifierDetector();
|
||||
parseModifierList(detector, ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
||||
|
||||
if (at(COLON)) {
|
||||
advance(); // COLON
|
||||
if (!atSet(SOFT_KEYWORDS_AT_MEMBER_START) && at(IDENTIFIER)) {
|
||||
PsiBuilder.Marker nameAsDeclaration = mark();
|
||||
advance(); // IDENTIFIER
|
||||
nameAsDeclaration.done(OBJECT_DECLARATION_NAME);
|
||||
|
||||
parseInitializerList();
|
||||
if (at(LPAR)) {
|
||||
// Arguments should be parsed here
|
||||
// Also, "fake" constructor call tree is created,
|
||||
// with empty type name inside
|
||||
PsiBuilder.Marker initializerList = mark();
|
||||
PsiBuilder.Marker delegatorSuperCall = mark();
|
||||
|
||||
PsiBuilder.Marker callee = mark();
|
||||
PsiBuilder.Marker typeReference = mark();
|
||||
PsiBuilder.Marker type = mark();
|
||||
PsiBuilder.Marker referenceExpr = mark();
|
||||
referenceExpr.done(ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION);
|
||||
type.done(USER_TYPE);
|
||||
typeReference.done(TYPE_REFERENCE);
|
||||
callee.done(CONSTRUCTOR_CALLEE);
|
||||
|
||||
myExpressionParsing.parseValueArgumentList();
|
||||
delegatorSuperCall.done(DELEGATOR_SUPER_CALL);
|
||||
initializerList.done(INITIALIZER_LIST);
|
||||
}
|
||||
// TODO: syntax with COLON is deprecated, should be changed to syntax with LPAR above, KT-7605
|
||||
else if (at(COLON)) {
|
||||
advance(); // COLON
|
||||
|
||||
parseInitializerList();
|
||||
}
|
||||
if (at(LBRACE)) {
|
||||
parseClassBody();
|
||||
}
|
||||
|
||||
// Probably some helper function
|
||||
closeDeclarationWithCommentBinders(entry, ENUM_ENTRY, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (at(LBRACE)) {
|
||||
parseClassBody();
|
||||
else {
|
||||
entry.rollbackTo();
|
||||
return false;
|
||||
}
|
||||
|
||||
consumeIf(SEMICOLON);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -988,16 +1011,15 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
|
||||
/*
|
||||
* initializer{","}
|
||||
* initializerList
|
||||
* : initializer
|
||||
*
|
||||
*/
|
||||
private void parseInitializerList() {
|
||||
// In practice, only one initializer is always in use
|
||||
PsiBuilder.Marker list = mark();
|
||||
while (true) {
|
||||
if (at(COMMA)) errorAndAdvance("Expecting a this or super constructor call");
|
||||
parseInitializer();
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
}
|
||||
if (at(COMMA)) errorAndAdvance("Expecting a this or super constructor call");
|
||||
parseInitializer();
|
||||
list.done(INITIALIZER_LIST);
|
||||
}
|
||||
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.psi
|
||||
|
||||
import com.intellij.lang.ASTNode
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import com.intellij.psi.tree.TokenSet
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinEnumEntrySuperclassReferenceExpressionStub
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes
|
||||
|
||||
// This node represents "fake" reference expression for ENUM_ENTRY(arguments) constructor syntax
|
||||
// It uses the superclass enum node to provide access to the real constructor name
|
||||
public class JetEnumEntrySuperclassReferenceExpression:
|
||||
JetExpressionImplStub<KotlinEnumEntrySuperclassReferenceExpressionStub>, JetSimpleNameExpression {
|
||||
|
||||
public constructor(node: ASTNode) : super(node)
|
||||
|
||||
public constructor(stub: KotlinEnumEntrySuperclassReferenceExpressionStub) :
|
||||
super(stub, JetStubElementTypes.ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION)
|
||||
|
||||
// It is the owner enum class (not an enum entry but the whole enum)
|
||||
private val referencedElement: JetClass
|
||||
get() = calcReferencedElement()!!
|
||||
|
||||
private fun calcReferencedElement(): JetClass? {
|
||||
val owner = this.getStrictParentOfType<JetEnumEntry>() as? JetEnumEntry
|
||||
return owner?.getParent()?.getParent() as? JetClass
|
||||
}
|
||||
|
||||
override fun getReferencedName(): String {
|
||||
val stub = getStub()
|
||||
if (stub != null) {
|
||||
return stub.getReferencedName()
|
||||
}
|
||||
val text = getReferencedNameElement().getNode()!!.getText()
|
||||
return JetPsiUtil.unquoteIdentifierOrFieldReference(text)
|
||||
}
|
||||
|
||||
override fun getReferencedNameAsName(): Name {
|
||||
return referencedElement.getName()?.let { Name.guess(it) } ?: SpecialNames.NO_NAME_PROVIDED;
|
||||
}
|
||||
|
||||
override fun getReferencedNameElement(): PsiElement {
|
||||
return referencedElement
|
||||
}
|
||||
|
||||
override fun getIdentifier(): PsiElement? {
|
||||
return referencedElement.getNameIdentifier()
|
||||
}
|
||||
|
||||
override fun getReferencedNameElementType(): IElementType {
|
||||
return getReferencedNameElement().getNode()!!.getElementType()
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: JetVisitor<R, D>, data: D): R {
|
||||
return visitor.visitSimpleNameExpression(this, data)
|
||||
}
|
||||
}
|
||||
@@ -72,8 +72,9 @@ public class JetUserType extends JetElementImplStub<KotlinUserTypeStub> implemen
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
public JetNameReferenceExpression getReferenceExpression() {
|
||||
return getStubOrPsiChild(JetStubElementTypes.REFERENCE_EXPRESSION);
|
||||
public JetSimpleNameExpression getReferenceExpression() {
|
||||
JetNameReferenceExpression nameRefExpr = getStubOrPsiChild(JetStubElementTypes.REFERENCE_EXPRESSION);
|
||||
return nameRefExpr != null ? nameRefExpr : getStubOrPsiChild(JetStubElementTypes.ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -92,7 +93,7 @@ public class JetUserType extends JetElementImplStub<KotlinUserTypeStub> implemen
|
||||
|
||||
@Nullable
|
||||
public String getReferencedName() {
|
||||
JetNameReferenceExpression referenceExpression = getReferenceExpression();
|
||||
JetSimpleNameExpression referenceExpression = getReferenceExpression();
|
||||
return referenceExpression == null ? null : referenceExpression.getReferencedName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,10 @@ public trait KotlinNameReferenceExpressionStub : StubElement<JetNameReferenceExp
|
||||
public fun getReferencedName(): String
|
||||
}
|
||||
|
||||
public trait KotlinEnumEntrySuperclassReferenceExpressionStub : StubElement<JetEnumEntrySuperclassReferenceExpression> {
|
||||
public fun getReferencedName(): String
|
||||
}
|
||||
|
||||
public trait KotlinParameterStub : KotlinStubWithFqName<JetParameter> {
|
||||
public fun isMutable(): Boolean
|
||||
public fun hasValOrVarNode(): Boolean
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.psi.stubs.elements
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.psi.stubs.StubInputStream
|
||||
import com.intellij.psi.stubs.StubOutputStream
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.psi.JetEnumEntrySuperclassReferenceExpression
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinEnumEntrySuperclassReferenceExpressionStub
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.KotlinEnumEntrySuperclassReferenceExpressionStubImpl
|
||||
|
||||
public class JetEnumEntrySuperClassReferenceExpressionElementType(NonNls debugName: String)
|
||||
: JetStubElementType<KotlinEnumEntrySuperclassReferenceExpressionStub, JetEnumEntrySuperclassReferenceExpression>(
|
||||
debugName,
|
||||
javaClass<JetEnumEntrySuperclassReferenceExpression>(),
|
||||
javaClass<KotlinEnumEntrySuperclassReferenceExpressionStub>()
|
||||
) {
|
||||
|
||||
override fun createStub(psi: JetEnumEntrySuperclassReferenceExpression, parentStub: StubElement<*>): KotlinEnumEntrySuperclassReferenceExpressionStub {
|
||||
return KotlinEnumEntrySuperclassReferenceExpressionStubImpl(parentStub, StringRef.fromString(psi.getReferencedName())!!)
|
||||
}
|
||||
|
||||
override fun serialize(stub: KotlinEnumEntrySuperclassReferenceExpressionStub, dataStream: StubOutputStream) {
|
||||
dataStream.writeName(stub.getReferencedName())
|
||||
}
|
||||
|
||||
override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<*>): KotlinEnumEntrySuperclassReferenceExpressionStub {
|
||||
return KotlinEnumEntrySuperclassReferenceExpressionStubImpl(parentStub, dataStream.readName())
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl;
|
||||
import java.io.IOException;
|
||||
|
||||
public class JetFileElementType extends IStubFileElementType<KotlinFileStub> {
|
||||
public static final int STUB_VERSION = 43;
|
||||
public static final int STUB_VERSION = 44;
|
||||
|
||||
private static final String NAME = "kotlin.FILE";
|
||||
|
||||
|
||||
@@ -93,6 +93,8 @@ public interface JetStubElementTypes {
|
||||
|
||||
JetNameReferenceExpressionElementType REFERENCE_EXPRESSION = new JetNameReferenceExpressionElementType("REFERENCE_EXPRESSION");
|
||||
JetDotQualifiedExpressionElementType DOT_QUALIFIED_EXPRESSION = new JetDotQualifiedExpressionElementType("DOT_QUALIFIED_EXPRESSION");
|
||||
JetEnumEntrySuperClassReferenceExpressionElementType
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION = new JetEnumEntrySuperClassReferenceExpressionElementType("ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION");
|
||||
JetPlaceHolderStubElementType<JetTypeArgumentList> TYPE_ARGUMENT_LIST =
|
||||
new JetPlaceHolderStubElementType<JetTypeArgumentList>("TYPE_ARGUMENT_LIST", JetTypeArgumentList.class);
|
||||
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.kotlin.psi.JetEnumEntrySuperclassReferenceExpression
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinEnumEntrySuperclassReferenceExpressionStub
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.JetStubElementTypes
|
||||
|
||||
public class KotlinEnumEntrySuperclassReferenceExpressionStubImpl(parent: StubElement<*>, private val referencedName: StringRef)
|
||||
: KotlinStubBaseImpl<JetEnumEntrySuperclassReferenceExpression>(parent, JetStubElementTypes.ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION), KotlinEnumEntrySuperclassReferenceExpressionStub {
|
||||
|
||||
override fun getReferencedName() = referencedName.getString()
|
||||
}
|
||||
@@ -5,6 +5,6 @@ fun box() = Context.OsType.OK.toString()
|
||||
object Context
|
||||
{
|
||||
public enum class OsType {
|
||||
WIN2000; WINDOWS; MACOSX; LINUX; OTHER; OK
|
||||
WIN2000, WINDOWS, MACOSX, LINUX, OTHER, OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
enum class Color(val rgb: Int) {
|
||||
RED(0xff0000),
|
||||
GREEN(0x00ff00),
|
||||
BLUE(0x0000ff);
|
||||
}
|
||||
|
||||
fun foo(): Int {
|
||||
return Color.RED.rgb + Color.GREEN.rgb + Color.BLUE.rgb
|
||||
}
|
||||
|
||||
fun box() = if (foo() == 0xffffff) "OK" else "Fail: ${foo()}"
|
||||
@@ -5,8 +5,8 @@ public class Context
|
||||
companion object
|
||||
{
|
||||
public enum class OsType {
|
||||
LINUX;
|
||||
OTHER
|
||||
LINUX,
|
||||
OTHER;
|
||||
}
|
||||
|
||||
public val operatingSystemType: OsType
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Error: name should present
|
||||
enum class<!SYNTAX!><!>(val rgb : Int) {
|
||||
RED(0xFF000),
|
||||
GREEN(0x00FF00),
|
||||
BLUE(0x0000FF)
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package
|
||||
|
||||
internal final enum class <no name provided> : kotlin.Enum<<no name provided>> {
|
||||
public enum entry RED : <no name provided> {
|
||||
private constructor RED()
|
||||
internal final override /*1*/ /*fake_override*/ val rgb: kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: <no name provided>): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public enum entry GREEN : <no name provided> {
|
||||
private constructor GREEN()
|
||||
internal final override /*1*/ /*fake_override*/ val rgb: kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: <no name provided>): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public enum entry BLUE : <no name provided> {
|
||||
private constructor BLUE()
|
||||
internal final override /*1*/ /*fake_override*/ val rgb: kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: <no name provided>): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
private constructor <no name provided>(/*0*/ rgb: kotlin.Int)
|
||||
internal final val rgb: kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: <no name provided>): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): <no name provided>
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<<no name provided>>
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
enum class Color {
|
||||
NORTH,
|
||||
SOUTH,
|
||||
WEST,
|
||||
EAST,
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
JetFile: EnumCommas.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(enum)('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('NORTH')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('SOUTH')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('WEST')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('EAST')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,6 @@
|
||||
// Error: name should present
|
||||
enum class(val rgb : Int) {
|
||||
RED(0xFF000),
|
||||
GREEN(0x00FF00),
|
||||
BLUE(0x0000FF)
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
JetFile: EnumMissingName.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiComment(EOL_COMMENT)('// Error: name should present')
|
||||
PsiWhiteSpace('\n')
|
||||
MODIFIER_LIST
|
||||
PsiElement(enum)('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiErrorElement:Name expected
|
||||
<empty list>
|
||||
PRIMARY_CONSTRUCTOR
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('rgb')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('RED')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0xFF000')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('GREEN')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x00FF00')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('BLUE')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x0000FF')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,6 @@
|
||||
enum class Color(val rgb : Int) {
|
||||
RED(0xFF000),
|
||||
GREEN(0x00FF00),
|
||||
BLUE(0x0000FF),
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
JetFile: EnumShortCommas.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(enum)('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
PRIMARY_CONSTRUCTOR
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('rgb')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('RED')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0xFF000')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('GREEN')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x00FF00')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('BLUE')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x0000FF')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,7 @@
|
||||
// NB: this test uses deprecated syntax
|
||||
// Delete it when this syntax is no longer supported
|
||||
enum class Color(val rgb : Int) {
|
||||
RED(0xFF000)
|
||||
GREEN(0x00FF00)
|
||||
BLUE(0x0000FF)
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
JetFile: EnumShortNoCommas.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
PsiComment(EOL_COMMENT)('// NB: this test uses deprecated syntax')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiComment(EOL_COMMENT)('// Delete it when this syntax is no longer supported')
|
||||
PsiWhiteSpace('\n')
|
||||
MODIFIER_LIST
|
||||
PsiElement(enum)('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
PRIMARY_CONSTRUCTOR
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('rgb')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('RED')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0xFF000')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('GREEN')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x00FF00')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('BLUE')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x0000FF')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,13 @@
|
||||
enum class Color(val rgb : Int) {
|
||||
RED(0xFF000) {
|
||||
override fun foo(): Int { return 1 }
|
||||
},
|
||||
GREEN(0x00FF00) {
|
||||
override fun foo(): Int { return 2 }
|
||||
},
|
||||
BLUE(0x0000FF) {
|
||||
override fun foo(): Int { return 3 }
|
||||
};
|
||||
|
||||
abstract fun foo(): Int
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
JetFile: EnumShortWithOverload.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(enum)('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
PRIMARY_CONSTRUCTOR
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('rgb')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('RED')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0xFF000')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(override)('override')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('GREEN')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x00FF00')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(override)('override')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('BLUE')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x0000FF')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(override)('override')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n \n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(abstract)('abstract')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -0,0 +1,13 @@
|
||||
enum class Color(val rgb : Int) {
|
||||
RED(0xFF000) {
|
||||
override fun foo(): Int { return 1 }
|
||||
}
|
||||
GREEN(0x00FF00) {
|
||||
override fun foo(): Int { return 2 }
|
||||
}
|
||||
BLUE(0x0000FF) {
|
||||
override fun foo(): Int { return 3 }
|
||||
}
|
||||
|
||||
abstract fun foo(): Int
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
JetFile: EnumShortWithOverloadNoCommas.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
CLASS
|
||||
MODIFIER_LIST
|
||||
PsiElement(enum)('enum')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('Color')
|
||||
PRIMARY_CONSTRUCTOR
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('rgb')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('RED')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0xFF000')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(override)('override')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('GREEN')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x00FF00')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(override)('override')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('2')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('BLUE')
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0x0000FF')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
CLASS_BODY
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(override)('override')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('3')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n \n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
PsiElement(abstract)('abstract')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -133,20 +133,23 @@ JetFile: enumEntries.kt
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('Ann')
|
||||
PsiErrorElement:Expecting member declaration
|
||||
PsiElement(LPAR)('(')
|
||||
PsiErrorElement:Expecting member declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
INITIALIZER_LIST
|
||||
DELEGATOR_SUPER_CALL
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('W')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION
|
||||
<empty list>
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('W')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
FUN
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
PsiElement(AT)('@')
|
||||
CONSTRUCTOR_CALLEE
|
||||
|
||||
@@ -5,7 +5,7 @@ fun naturalOrder<in T : Comparable<T>>(a : T, b : T) : Int = a.compareTo(b)
|
||||
fun castingNaturalOrder(a : Object, b : Object) : Int = (a as Comparable<Object>).compareTo(b as Comparable<Object>)
|
||||
|
||||
enum class ComparisonResult {
|
||||
LS; EQ; GR
|
||||
LS, EQ, GR;
|
||||
}
|
||||
|
||||
typealias MatchableComparison<in T> = (T, T) -> ComparisonResult
|
||||
|
||||
@@ -217,16 +217,17 @@ JetFile: Comparison.kt
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('LS')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('EQ')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('GR')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
|
||||
@@ -138,9 +138,7 @@ JetFile: EnumEntryInitList.kt
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting constructor call (<class-name>(...))
|
||||
<empty list>
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
@@ -175,10 +173,8 @@ JetFile: EnumEntryInitList.kt
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting constructor call (<class-name>(...))
|
||||
<empty list>
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
|
||||
@@ -4206,6 +4206,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumMissingName.kt")
|
||||
public void testEnumMissingName() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumMissingName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumModifier.kt")
|
||||
public void testEnumModifier() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumModifier.kt");
|
||||
|
||||
@@ -112,7 +112,7 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testEnumClass() throws Exception {
|
||||
loadText("enum class Direction { NORTH; SOUTH; EAST; WEST }");
|
||||
loadText("enum class Direction { NORTH, SOUTH, EAST, WEST; }");
|
||||
Class<?> direction = generateClass("Direction");
|
||||
Field north = direction.getField("NORTH");
|
||||
assertEquals(direction, north.getType());
|
||||
@@ -120,7 +120,7 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testEnumConstantConstructors() throws Exception {
|
||||
loadText("enum class Color(val rgb: Int) { RED: Color(0xFF0000); GREEN: Color(0x00FF00); }");
|
||||
loadText("enum class Color(val rgb: Int) { RED: Color(0xFF0000), GREEN: Color(0x00FF00); }");
|
||||
Class<?> colorClass = generateClass("Color");
|
||||
Field redField = colorClass.getField("RED");
|
||||
Object redValue = redField.get(null);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class EnumGenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void testEnumConstantConstructors() throws Exception {
|
||||
loadText("enum class Color(val rgb: Int) { RED: Color(0xFF0000); GREEN: Color(0x00FF00); }");
|
||||
loadText("enum class Color(val rgb: Int) { RED: Color(0xFF0000), GREEN: Color(0x00FF00); }");
|
||||
Class<?> colorClass = generateClass("Color");
|
||||
Field redField = colorClass.getField("RED");
|
||||
Object redValue = redField.get(null);
|
||||
|
||||
+6
@@ -3136,6 +3136,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumShort.kt")
|
||||
public void testEnumShort() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/enumShort.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumWithLambdaParameter.kt")
|
||||
public void testEnumWithLambdaParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/enumWithLambdaParameter.kt");
|
||||
|
||||
@@ -205,12 +205,48 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumCommas.kt")
|
||||
public void testEnumCommas() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/EnumCommas.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumMissingName.kt")
|
||||
public void testEnumMissingName() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/EnumMissingName.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumNoAnnotations.kt")
|
||||
public void testEnumNoAnnotations() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/EnumNoAnnotations.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumShortCommas.kt")
|
||||
public void testEnumShortCommas() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/EnumShortCommas.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumShortNoCommas.kt")
|
||||
public void testEnumShortNoCommas() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/EnumShortNoCommas.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumShortWithOverload.kt")
|
||||
public void testEnumShortWithOverload() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/EnumShortWithOverload.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumShortWithOverloadNoCommas.kt")
|
||||
public void testEnumShortWithOverloadNoCommas() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/EnumShortWithOverloadNoCommas.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Enums.kt")
|
||||
public void testEnums() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/Enums.kt");
|
||||
|
||||
@@ -12,6 +12,11 @@ enumEntries
|
||||
: enumEntry*
|
||||
;
|
||||
|
||||
enumEntry
|
||||
: modifiers SimpleName (":" initializer{","})? classBody?
|
||||
enumEntries
|
||||
: (enumEntry ","? )?
|
||||
;
|
||||
|
||||
|
||||
enumEntry
|
||||
: modifiers SimpleName ((":" initializer) | ("(" arguments ")"))? classBody?
|
||||
;
|
||||
|
||||
@@ -27,14 +27,9 @@ open class C1
|
||||
open class C2
|
||||
|
||||
enum class Test : A1 {
|
||||
FIRST_ITEM : Test(), C1(),
|
||||
C2()
|
||||
FIRST_ITEM : Test()
|
||||
SECOND_ITEM :
|
||||
Test()
|
||||
|
||||
THIRD_ITEM : Test(),
|
||||
C1()
|
||||
FORTH_ITEM : Test()
|
||||
}
|
||||
|
||||
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
|
||||
@@ -27,14 +27,9 @@ open class C1
|
||||
open class C2
|
||||
|
||||
enum class Test : A1 {
|
||||
FIRST_ITEM : Test(), C1(),
|
||||
C2()
|
||||
FIRST_ITEM : Test()
|
||||
SECOND_ITEM :
|
||||
Test()
|
||||
|
||||
THIRD_ITEM : Test(),
|
||||
C1()
|
||||
FORTH_ITEM : Test()
|
||||
}
|
||||
|
||||
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
|
||||
@@ -27,13 +27,9 @@ open class C1
|
||||
open class C2
|
||||
|
||||
enum class Test : A1 {
|
||||
FIRST_ITEM : Test(), C1(),
|
||||
C2()
|
||||
FIRST_ITEM : Test()
|
||||
SECOND_ITEM :
|
||||
Test()
|
||||
|
||||
THIRD_ITEM : Test(),
|
||||
C1() FORTH_ITEM : Test()
|
||||
}
|
||||
|
||||
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
|
||||
@@ -0,0 +1,6 @@
|
||||
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
|
||||
|
||||
enum class EnumTest {
|
||||
ENTRY: EnumTest();
|
||||
<caret>
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
|
||||
|
||||
enum class EnumTest {
|
||||
ENTRY: EnumTest();
|
||||
<caret>
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
|
||||
|
||||
enum class EnumTest {
|
||||
ENTRY: EnumTest(); <caret>
|
||||
}
|
||||
@@ -4,5 +4,5 @@ interface A1
|
||||
|
||||
enum class EnumTest {
|
||||
ENTRY: EnumTest(),
|
||||
<caret>
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ interface A1
|
||||
|
||||
enum class EnumTest {
|
||||
ENTRY: EnumTest(),
|
||||
<caret>
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ interface A1
|
||||
|
||||
enum class EnumTest {
|
||||
ENTRY: EnumTest(),
|
||||
<caret>A1
|
||||
<caret>A1
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ interface A1
|
||||
|
||||
enum class EnumTest {
|
||||
ENTRY: EnumTest(),
|
||||
<caret>A1
|
||||
<caret>A1
|
||||
}
|
||||
|
||||
@@ -169,6 +169,12 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
|
||||
doNewlineTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InEnumAfterSemicolon.after.kt")
|
||||
public void testInEnumAfterSemicolon() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumAfterSemicolon.after.kt");
|
||||
doNewlineTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InEnumInitializerListAfterColon.after.kt")
|
||||
public void testInEnumInitializerListAfterColon() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumInitializerListAfterColon.after.kt");
|
||||
@@ -385,6 +391,12 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
|
||||
doNewlineTestWithInvert(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InEnumAfterSemicolon.after.inv.kt")
|
||||
public void testInEnumAfterSemicolon() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumAfterSemicolon.after.inv.kt");
|
||||
doNewlineTestWithInvert(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InEnumInitializerListAfterColon.after.inv.kt")
|
||||
public void testInEnumInitializerListAfterColon() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumInitializerListAfterColon.after.inv.kt");
|
||||
|
||||
@@ -93,7 +93,7 @@ object DocCommentConverter {
|
||||
getValueElement() ?: getDataElements().firstOrNull { it !is PsiWhiteSpace }
|
||||
|
||||
private class HtmlToMarkdownConverter() : XmlRecursiveElementVisitor() {
|
||||
private enum class ListType { Ordered; Unordered }
|
||||
private enum class ListType { Ordered Unordered; }
|
||||
data class MarkdownSpan(val prefix: String, val suffix: String) {
|
||||
companion object {
|
||||
val Empty = MarkdownSpan("", "")
|
||||
|
||||
Reference in New Issue
Block a user