[FIR] Start enum entries reworking
This commit is contained in:
committed by
Mikhail Glukhikh
parent
68d64f1b5c
commit
13132e69a3
@@ -13,6 +13,8 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
data class CallableId(val packageName: FqName, val className: FqName?, val callableName: Name) {
|
data class CallableId(val packageName: FqName, val className: FqName?, val callableName: Name) {
|
||||||
val classId: ClassId? get() = className?.let { ClassId(packageName, it, false) }
|
val classId: ClassId? get() = className?.let { ClassId(packageName, it, false) }
|
||||||
|
|
||||||
|
constructor(classId: ClassId, callableName: Name) : this(classId.packageFqName, classId.relativeClassName, callableName)
|
||||||
|
|
||||||
constructor(packageName: FqName, callableName: Name) : this(packageName, null, callableName)
|
constructor(packageName: FqName, callableName: Name) : this(packageName, null, callableName)
|
||||||
|
|
||||||
@Deprecated("TODO: Better solution for local callables?")
|
@Deprecated("TODO: Better solution for local callables?")
|
||||||
|
|||||||
+1
-9
@@ -10,7 +10,6 @@ import com.intellij.openapi.project.Project
|
|||||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirEnumEntryImpl
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirPropertyImpl
|
||||||
import org.jetbrains.kotlin.fir.deserialization.FirDeserializationContext
|
import org.jetbrains.kotlin.fir.deserialization.FirDeserializationContext
|
||||||
@@ -212,11 +211,6 @@ class KotlinDeserializedJvmSymbolsProvider(
|
|||||||
).firstOrNull()
|
).firstOrNull()
|
||||||
|
|
||||||
this.calleeReference = when {
|
this.calleeReference = when {
|
||||||
entryClassSymbol != null && (entryClassSymbol as? FirClassSymbol)?.fir is FirEnumEntry -> {
|
|
||||||
FirResolvedNamedReferenceImpl(
|
|
||||||
null, name, entryClassSymbol
|
|
||||||
)
|
|
||||||
}
|
|
||||||
entryCallableSymbol != null -> {
|
entryCallableSymbol != null -> {
|
||||||
FirResolvedNamedReferenceImpl(
|
FirResolvedNamedReferenceImpl(
|
||||||
null, name, entryCallableSymbol
|
null, name, entryCallableSymbol
|
||||||
@@ -340,9 +334,7 @@ class KotlinDeserializedJvmSymbolsProvider(
|
|||||||
kotlinScopeProvider,
|
kotlinScopeProvider,
|
||||||
parentContext, this::findAndDeserializeClass
|
parentContext, this::findAndDeserializeClass
|
||||||
)
|
)
|
||||||
symbol.fir.declarations.filterIsInstance<FirEnumEntryImpl>().forEach {
|
|
||||||
classesCache[it.symbol.classId] = it.symbol
|
|
||||||
}
|
|
||||||
classesCache[classId] = symbol
|
classesCache[classId] = symbol
|
||||||
val annotations = mutableListOf<FirAnnotationCall>()
|
val annotations = mutableListOf<FirAnnotationCall>()
|
||||||
kotlinJvmBinaryClass.loadClassAnnotations(object : KotlinJvmBinaryClass.AnnotationVisitor {
|
kotlinJvmBinaryClass.loadClassAnnotations(object : KotlinJvmBinaryClass.AnnotationVisitor {
|
||||||
|
|||||||
@@ -365,11 +365,11 @@ internal fun ConeKotlinType.lexicalCastFrom(session: FirSession, value: String):
|
|||||||
val firElement = lookupTag.toSymbol(session)?.fir
|
val firElement = lookupTag.toSymbol(session)?.fir
|
||||||
if (firElement is FirRegularClass && firElement.classKind == ClassKind.ENUM_CLASS) {
|
if (firElement is FirRegularClass && firElement.classKind == ClassKind.ENUM_CLASS) {
|
||||||
val name = Name.identifier(value)
|
val name = Name.identifier(value)
|
||||||
val firEnumEntry = firElement.declarations.filterIsInstance<FirEnumEntry>().find { it.name == name }
|
val firEnumEntry = firElement.collectEnumEntries().find { it.callableId.callableName == name }
|
||||||
|
|
||||||
return if (firEnumEntry != null) FirQualifiedAccessExpressionImpl(null).apply {
|
return if (firEnumEntry != null) FirQualifiedAccessExpressionImpl(null).apply {
|
||||||
calleeReference = FirSimpleNamedReference(
|
calleeReference = FirResolvedNamedReferenceImpl(
|
||||||
null, name, null // TODO: , firEnumEntry.symbol
|
null, name, firEnumEntry
|
||||||
)
|
)
|
||||||
} else if (firElement is FirJavaClass) {
|
} else if (firElement is FirJavaClass) {
|
||||||
val firStaticProperty = firElement.declarations.filterIsInstance<FirJavaField>().find {
|
val firStaticProperty = firElement.declarations.filterIsInstance<FirJavaField>().find {
|
||||||
|
|||||||
+52
-30
@@ -489,7 +489,7 @@ class DeclarationsConverter(
|
|||||||
val delegatedType = delegatedSuperTypeRef ?: implicitAnyType
|
val delegatedType = delegatedSuperTypeRef ?: implicitAnyType
|
||||||
|
|
||||||
return withChildClassName(ANONYMOUS_OBJECT_NAME) {
|
return withChildClassName(ANONYMOUS_OBJECT_NAME) {
|
||||||
FirAnonymousObjectImpl(null, session, scopeProvider, FirAnonymousObjectSymbol()).apply {
|
FirAnonymousObjectImpl(null, session, ClassKind.OBJECT, scopeProvider, FirAnonymousObjectSymbol()).apply {
|
||||||
annotations += modifiers.annotations
|
annotations += modifiers.annotations
|
||||||
this.superTypeRefs += superTypeRefs
|
this.superTypeRefs += superTypeRefs
|
||||||
this.typeRef = superTypeRefs.first()
|
this.typeRef = superTypeRefs.first()
|
||||||
@@ -515,12 +515,11 @@ class DeclarationsConverter(
|
|||||||
/**
|
/**
|
||||||
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseEnumEntry
|
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseEnumEntry
|
||||||
*/
|
*/
|
||||||
private fun convertEnumEntry(enumEntry: LighterASTNode, classWrapper: ClassWrapper): FirEnumEntryImpl {
|
private fun convertEnumEntry(enumEntry: LighterASTNode, classWrapper: ClassWrapper): FirProperty {
|
||||||
var modifiers = Modifier()
|
var modifiers = Modifier()
|
||||||
lateinit var identifier: String
|
lateinit var identifier: String
|
||||||
var hasInitializerList = false
|
var hasInitializerList = false
|
||||||
val enumSuperTypeCallEntry = mutableListOf<FirExpression>()
|
val enumSuperTypeCallEntry = mutableListOf<FirExpression>()
|
||||||
val firDeclarations = mutableListOf<FirDeclaration>()
|
|
||||||
var classBodyNode: LighterASTNode? = null
|
var classBodyNode: LighterASTNode? = null
|
||||||
enumEntry.forEachChildren {
|
enumEntry.forEachChildren {
|
||||||
when (it.tokenType) {
|
when (it.tokenType) {
|
||||||
@@ -535,32 +534,46 @@ class DeclarationsConverter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val enumEntryName = identifier.nameAsSafeName()
|
val enumEntryName = identifier.nameAsSafeName()
|
||||||
return withChildClassName(enumEntryName) {
|
return FirPropertyImpl(
|
||||||
val firEnumEntry = FirEnumEntryImpl(
|
null,
|
||||||
|
session,
|
||||||
|
classWrapper.delegatedSelfTypeRef,
|
||||||
|
receiverTypeRef = null,
|
||||||
|
name = enumEntryName,
|
||||||
|
initializer = FirAnonymousObjectImpl(
|
||||||
null,
|
null,
|
||||||
session,
|
session,
|
||||||
enumEntryName,
|
ClassKind.ENUM_ENTRY,
|
||||||
scopeProvider,
|
scopeProvider,
|
||||||
FirRegularClassSymbol(context.currentClassId)
|
FirAnonymousObjectSymbol()
|
||||||
)
|
).apply {
|
||||||
firEnumEntry.annotations += modifiers.annotations
|
annotations += modifiers.annotations
|
||||||
|
val enumClassWrapper = ClassWrapper(
|
||||||
val defaultDelegatedSuperTypeRef = implicitAnyType
|
enumEntryName, modifiers, ClassKind.ENUM_ENTRY, hasPrimaryConstructor = true,
|
||||||
|
hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
|
||||||
val enumClassWrapper = ClassWrapper(
|
delegatedSelfTypeRef = FirResolvedTypeRefImpl(
|
||||||
enumEntryName, modifiers, ClassKind.ENUM_ENTRY, hasPrimaryConstructor = true,
|
null,
|
||||||
hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
|
ConeClassLikeTypeImpl(
|
||||||
delegatedSelfTypeRef = null.toDelegatedSelfType(firEnumEntry),
|
symbol.toLookupTag(),
|
||||||
delegatedSuperTypeRef = if (hasInitializerList) classWrapper.getFirUserTypeFromClassName() else defaultDelegatedSuperTypeRef,
|
emptyArray(),
|
||||||
superTypeCallEntry = enumSuperTypeCallEntry
|
isNullable = false
|
||||||
)
|
)
|
||||||
firEnumEntry.superTypeRefs += enumClassWrapper.delegatedSuperTypeRef
|
),
|
||||||
convertPrimaryConstructor(null, enumClassWrapper)?.let { firEnumEntry.addDeclaration(it.firConstructor) }
|
delegatedSuperTypeRef = classWrapper.delegatedSelfTypeRef,
|
||||||
classBodyNode?.also { firDeclarations += convertClassBody(it, enumClassWrapper) }
|
superTypeCallEntry = enumSuperTypeCallEntry
|
||||||
firDeclarations.forEach { firEnumEntry.addDeclaration(it) }
|
)
|
||||||
|
superTypeRefs += enumClassWrapper.delegatedSuperTypeRef
|
||||||
return@withChildClassName firEnumEntry
|
convertPrimaryConstructor(null, enumClassWrapper)?.let { declarations += it.firConstructor }
|
||||||
}
|
classBodyNode?.also { declarations += convertClassBody(it, enumClassWrapper) }
|
||||||
|
},
|
||||||
|
delegate = null,
|
||||||
|
isVar = false,
|
||||||
|
symbol = FirPropertySymbol(CallableId(context.currentClassId, enumEntryName)),
|
||||||
|
isLocal = false,
|
||||||
|
status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
|
||||||
|
isStatic = true
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -686,7 +699,13 @@ class DeclarationsConverter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val delegatedSelfTypeRef =
|
val delegatedSelfTypeRef =
|
||||||
if (classWrapper.isObjectLiteral()) FirErrorTypeRefImpl(null, FirSimpleDiagnostic("Constructor in object", DiagnosticKind.ConstructorInObject))
|
if (classWrapper.isObjectLiteral()) FirErrorTypeRefImpl(
|
||||||
|
null,
|
||||||
|
FirSimpleDiagnostic(
|
||||||
|
"Constructor in object",
|
||||||
|
DiagnosticKind.ConstructorInObject
|
||||||
|
)
|
||||||
|
)
|
||||||
else classWrapper.delegatedSelfTypeRef
|
else classWrapper.delegatedSelfTypeRef
|
||||||
|
|
||||||
val status = FirDeclarationStatusImpl(modifiers.getVisibility(), Modality.FINAL).apply {
|
val status = FirDeclarationStatusImpl(modifiers.getVisibility(), Modality.FINAL).apply {
|
||||||
@@ -827,7 +846,8 @@ class DeclarationsConverter(
|
|||||||
val parentNode = property.getParent()
|
val parentNode = property.getParent()
|
||||||
val isLocal = !(parentNode?.tokenType == KT_FILE || parentNode?.tokenType == CLASS_BODY)
|
val isLocal = !(parentNode?.tokenType == KT_FILE || parentNode?.tokenType == CLASS_BODY)
|
||||||
return if (isLocal) {
|
return if (isLocal) {
|
||||||
val receiver = delegateExpression?.let { expressionConverter.getAsFirExpression<FirExpression>(it, "Incorrect delegate expression") }
|
val receiver =
|
||||||
|
delegateExpression?.let { expressionConverter.getAsFirExpression<FirExpression>(it, "Incorrect delegate expression") }
|
||||||
FirPropertyImpl(
|
FirPropertyImpl(
|
||||||
null,
|
null,
|
||||||
session,
|
session,
|
||||||
@@ -895,7 +915,8 @@ class DeclarationsConverter(
|
|||||||
private fun convertDestructingDeclaration(destructingDeclaration: LighterASTNode): DestructuringDeclaration {
|
private fun convertDestructingDeclaration(destructingDeclaration: LighterASTNode): DestructuringDeclaration {
|
||||||
var isVar = false
|
var isVar = false
|
||||||
val entries = mutableListOf<FirVariable<*>>()
|
val entries = mutableListOf<FirVariable<*>>()
|
||||||
var firExpression: FirExpression = FirErrorExpressionImpl(null, FirSimpleDiagnostic("Destructuring declaration without initializer", DiagnosticKind.Syntax))
|
var firExpression: FirExpression =
|
||||||
|
FirErrorExpressionImpl(null, FirSimpleDiagnostic("Destructuring declaration without initializer", DiagnosticKind.Syntax))
|
||||||
destructingDeclaration.forEachChildren {
|
destructingDeclaration.forEachChildren {
|
||||||
when (it.tokenType) {
|
when (it.tokenType) {
|
||||||
VAR_KEYWORD -> isVar = true
|
VAR_KEYWORD -> isVar = true
|
||||||
@@ -1297,7 +1318,8 @@ class DeclarationsConverter(
|
|||||||
NULLABLE_TYPE -> firType = convertNullableType(it)
|
NULLABLE_TYPE -> firType = convertNullableType(it)
|
||||||
FUNCTION_TYPE -> firType = convertFunctionType(it)
|
FUNCTION_TYPE -> firType = convertFunctionType(it)
|
||||||
DYNAMIC_TYPE -> firType = FirDynamicTypeRefImpl(null, false)
|
DYNAMIC_TYPE -> firType = FirDynamicTypeRefImpl(null, false)
|
||||||
TokenType.ERROR_ELEMENT -> firType = FirErrorTypeRefImpl(null, FirSimpleDiagnostic("Unwrapped type is null", DiagnosticKind.Syntax))
|
TokenType.ERROR_ELEMENT -> firType =
|
||||||
|
FirErrorTypeRefImpl(null, FirSimpleDiagnostic("Unwrapped type is null", DiagnosticKind.Syntax))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
|||||||
owner,
|
owner,
|
||||||
hasPrimaryConstructor
|
hasPrimaryConstructor
|
||||||
)
|
)
|
||||||
|
is KtEnumEntry -> toFirEnumEntry(delegatedSelfType!!)
|
||||||
else -> convert<FirDeclaration>()
|
else -> convert<FirDeclaration>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,7 +322,10 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun KtClassOrObject.extractSuperTypeListEntriesTo(
|
private fun KtClassOrObject.extractSuperTypeListEntriesTo(
|
||||||
container: FirModifiableClass<*>, delegatedSelfTypeRef: FirTypeRef?, classKind: ClassKind
|
container: FirModifiableClass<*>,
|
||||||
|
delegatedSelfTypeRef: FirTypeRef?,
|
||||||
|
delegatedEnumSuperTypeRef: FirTypeRef?,
|
||||||
|
classKind: ClassKind
|
||||||
): FirTypeRef? {
|
): FirTypeRef? {
|
||||||
var superTypeCallEntry: KtSuperTypeCallEntry? = null
|
var superTypeCallEntry: KtSuperTypeCallEntry? = null
|
||||||
var delegatedSuperTypeRef: FirTypeRef? = null
|
var delegatedSuperTypeRef: FirTypeRef? = null
|
||||||
@@ -367,7 +371,13 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val defaultDelegatedSuperTypeRef = implicitAnyType
|
val defaultDelegatedSuperTypeRef =
|
||||||
|
when {
|
||||||
|
classKind == ClassKind.ENUM_ENTRY && this is KtClass -> delegatedEnumSuperTypeRef ?: implicitAnyType
|
||||||
|
else -> implicitAnyType
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (container.superTypeRefs.isEmpty()) {
|
if (container.superTypeRefs.isEmpty()) {
|
||||||
container.superTypeRefs += defaultDelegatedSuperTypeRef
|
container.superTypeRefs += defaultDelegatedSuperTypeRef
|
||||||
}
|
}
|
||||||
@@ -454,27 +464,45 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
|||||||
return firFile
|
return firFile
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnumEntry(enumEntry: KtEnumEntry, data: Unit): FirElement {
|
private fun KtEnumEntry.toFirEnumEntry(delegatedEnumSelfTypeRef: FirTypeRef): FirDeclaration {
|
||||||
return withChildClassName(enumEntry.nameAsSafeName) {
|
val obj = FirAnonymousObjectImpl(
|
||||||
val firEnumEntry = FirEnumEntryImpl(
|
source = toFirSourceElement(),
|
||||||
enumEntry.toFirSourceElement(),
|
session,
|
||||||
session,
|
ClassKind.ENUM_ENTRY,
|
||||||
enumEntry.nameAsSafeName,
|
scopeProvider,
|
||||||
scopeProvider,
|
FirAnonymousObjectSymbol()
|
||||||
FirRegularClassSymbol(context.currentClassId)
|
)
|
||||||
|
val delegatedEntrySelfType =
|
||||||
|
FirResolvedTypeRefImpl(source = null, ConeClassLikeTypeImpl(obj.symbol.toLookupTag(), emptyArray(), isNullable = false))
|
||||||
|
|
||||||
|
extractSuperTypeListEntriesTo(obj, delegatedEntrySelfType, delegatedEnumSelfTypeRef, ClassKind.ENUM_ENTRY)
|
||||||
|
|
||||||
|
for (declaration in declarations) {
|
||||||
|
obj.declarations += declaration.toFirDeclaration(
|
||||||
|
delegatedEnumSelfTypeRef,
|
||||||
|
delegatedSelfType = null,
|
||||||
|
this,
|
||||||
|
hasPrimaryConstructor = false
|
||||||
)
|
)
|
||||||
enumEntry.extractAnnotationsTo(firEnumEntry)
|
|
||||||
val delegatedSelfType = enumEntry.toDelegatedSelfType(firEnumEntry)
|
|
||||||
val delegatedSuperType = enumEntry.extractSuperTypeListEntriesTo(firEnumEntry, delegatedSelfType, ClassKind.ENUM_ENTRY)
|
|
||||||
for (declaration in enumEntry.declarations) {
|
|
||||||
firEnumEntry.addDeclaration(
|
|
||||||
declaration.toFirDeclaration(
|
|
||||||
delegatedSuperType, delegatedSelfType, enumEntry, hasPrimaryConstructor = true
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
firEnumEntry
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FirPropertyImpl(
|
||||||
|
source = toFirSourceElement(),
|
||||||
|
session,
|
||||||
|
delegatedEnumSelfTypeRef,
|
||||||
|
receiverTypeRef = null,
|
||||||
|
name = nameAsSafeName,
|
||||||
|
initializer = obj,
|
||||||
|
delegate = null,
|
||||||
|
isVar = false,
|
||||||
|
isLocal = false,
|
||||||
|
status = FirDeclarationStatusImpl(
|
||||||
|
Visibilities.PUBLIC, Modality.FINAL
|
||||||
|
).apply {
|
||||||
|
isStatic = true
|
||||||
|
},
|
||||||
|
symbol = FirPropertySymbol(callableIdForName(nameAsSafeName))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitClassOrObject(classOrObject: KtClassOrObject, data: Unit): FirElement {
|
override fun visitClassOrObject(classOrObject: KtClassOrObject, data: Unit): FirElement {
|
||||||
@@ -525,7 +553,7 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
|||||||
classOrObject.extractAnnotationsTo(firClass)
|
classOrObject.extractAnnotationsTo(firClass)
|
||||||
classOrObject.extractTypeParametersTo(firClass)
|
classOrObject.extractTypeParametersTo(firClass)
|
||||||
val delegatedSelfType = classOrObject.toDelegatedSelfType(firClass)
|
val delegatedSelfType = classOrObject.toDelegatedSelfType(firClass)
|
||||||
val delegatedSuperType = classOrObject.extractSuperTypeListEntriesTo(firClass, delegatedSelfType, classKind)
|
val delegatedSuperType = classOrObject.extractSuperTypeListEntriesTo(firClass, delegatedSelfType, null, classKind)
|
||||||
val primaryConstructor = classOrObject.primaryConstructor
|
val primaryConstructor = classOrObject.primaryConstructor
|
||||||
val firPrimaryConstructor = firClass.declarations.firstOrNull() as? FirConstructor
|
val firPrimaryConstructor = firClass.declarations.firstOrNull() as? FirConstructor
|
||||||
if (primaryConstructor != null && firPrimaryConstructor != null) {
|
if (primaryConstructor != null && firPrimaryConstructor != null) {
|
||||||
@@ -568,9 +596,11 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
|||||||
override fun visitObjectLiteralExpression(expression: KtObjectLiteralExpression, data: Unit): FirElement {
|
override fun visitObjectLiteralExpression(expression: KtObjectLiteralExpression, data: Unit): FirElement {
|
||||||
val objectDeclaration = expression.objectDeclaration
|
val objectDeclaration = expression.objectDeclaration
|
||||||
return withChildClassName(ANONYMOUS_OBJECT_NAME) {
|
return withChildClassName(ANONYMOUS_OBJECT_NAME) {
|
||||||
FirAnonymousObjectImpl(expression.toFirSourceElement(), session, scopeProvider, FirAnonymousObjectSymbol()).apply {
|
FirAnonymousObjectImpl(
|
||||||
|
expression.toFirSourceElement(), session, ClassKind.OBJECT, scopeProvider, FirAnonymousObjectSymbol()
|
||||||
|
).apply {
|
||||||
objectDeclaration.extractAnnotationsTo(this)
|
objectDeclaration.extractAnnotationsTo(this)
|
||||||
objectDeclaration.extractSuperTypeListEntriesTo(this, null, ClassKind.CLASS)
|
objectDeclaration.extractSuperTypeListEntriesTo(this, null, null, ClassKind.CLASS)
|
||||||
this.typeRef = superTypeRefs.first() // TODO
|
this.typeRef = superTypeRefs.first() // TODO
|
||||||
|
|
||||||
for (declaration in objectDeclaration.declarations) {
|
for (declaration in objectDeclaration.declarations) {
|
||||||
|
|||||||
+27
-15
@@ -4,27 +4,33 @@ FILE: enums.kt
|
|||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry FIRST : R|kotlin/Any| {
|
public final static val FIRST: R|Order| = object : R|Order| {
|
||||||
public? constructor(): R|Order.FIRST| {
|
public? constructor(): R|Order| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|Order|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry SECOND : R|kotlin/Any| {
|
|
||||||
public? constructor(): R|Order.SECOND| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val SECOND: R|Order| = object : R|Order| {
|
||||||
|
public? constructor(): R|Order| {
|
||||||
|
super<R|Order|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry THIRD : R|kotlin/Any| {
|
|
||||||
public? constructor(): R|Order.THIRD| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val THIRD: R|Order| = object : R|Order| {
|
||||||
|
public? constructor(): R|Order| {
|
||||||
|
super<R|Order|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final static fun values(): R|kotlin/Array<Order>| {
|
public final static fun values(): R|kotlin/Array<Order>| {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +49,8 @@ FILE: enums.kt
|
|||||||
internal final? val r: Double = R|<local>/r|
|
internal final? val r: Double = R|<local>/r|
|
||||||
internal get(): Double
|
internal get(): Double
|
||||||
|
|
||||||
public? final enum entry MERCURY : Planet {
|
public final static val MERCURY: R|Planet| = object : Planet {
|
||||||
public? constructor(): R|Planet.MERCURY| {
|
public? constructor(): Planet {
|
||||||
super<Planet>(Double(1.0), Double(2.0))
|
super<Planet>(Double(1.0), Double(2.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +60,10 @@ FILE: enums.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry VENERA : Planet {
|
|
||||||
public? constructor(): R|Planet.VENERA| {
|
|
||||||
|
public final static val VENERA: R|Planet| = object : Planet {
|
||||||
|
public? constructor(): Planet {
|
||||||
super<Planet>(Double(3.0), Double(4.0))
|
super<Planet>(Double(3.0), Double(4.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +73,10 @@ FILE: enums.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry EARTH : Planet {
|
|
||||||
public? constructor(): R|Planet.EARTH| {
|
|
||||||
|
public final static val EARTH: R|Planet| = object : Planet {
|
||||||
|
public? constructor(): Planet {
|
||||||
super<Planet>(Double(5.0), Double(6.0))
|
super<Planet>(Double(5.0), Double(6.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,6 +86,8 @@ FILE: enums.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public? final? val g: Double = G#.times#(m#).div#(r#.times#(r#))
|
public? final? val g: Double = G#.times#(m#).div#(r#.times#(r#))
|
||||||
public? get(): Double
|
public? get(): Double
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ FILE: enums2.kt
|
|||||||
public? final? val x: Some = R|<local>/x|
|
public? final? val x: Some = R|<local>/x|
|
||||||
public? get(): Some
|
public? get(): Some
|
||||||
|
|
||||||
public? final enum entry FIRST : SomeEnum {
|
public final static val FIRST: R|SomeEnum| = object : SomeEnum {
|
||||||
public? constructor(): R|SomeEnum.FIRST| {
|
public? constructor(): SomeEnum {
|
||||||
super<SomeEnum>(O1#)
|
super<SomeEnum>(O1#)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,8 +32,10 @@ FILE: enums2.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry SECOND : SomeEnum {
|
|
||||||
public? constructor(): R|SomeEnum.SECOND| {
|
|
||||||
|
public final static val SECOND: R|SomeEnum| = object : SomeEnum {
|
||||||
|
public? constructor(): SomeEnum {
|
||||||
super<SomeEnum>(O2#)
|
super<SomeEnum>(O2#)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +45,8 @@ FILE: enums2.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public? abstract fun check(y: Some): Boolean
|
public? abstract fun check(y: Some): Boolean
|
||||||
|
|
||||||
public final static fun values(): R|kotlin/Array<SomeEnum>| {
|
public final static fun values(): R|kotlin/Array<SomeEnum>| {
|
||||||
|
|||||||
+10
-5
@@ -8,6 +8,8 @@ package org.jetbrains.kotlin.fir.deserialization
|
|||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.collectEnumEntries
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.FirSimpleDiagnostic
|
import org.jetbrains.kotlin.fir.diagnostics.FirSimpleDiagnostic
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||||
@@ -19,7 +21,6 @@ import org.jetbrains.kotlin.fir.resolve.constructType
|
|||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.FirUnresolvedSymbolError
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.FirUnresolvedSymbolError
|
||||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.impl.FirErrorTypeRefImpl
|
import org.jetbrains.kotlin.fir.types.impl.FirErrorTypeRefImpl
|
||||||
@@ -133,10 +134,14 @@ abstract class AbstractAnnotationDeserializer(
|
|||||||
ENUM -> FirFunctionCallImpl(null).apply {
|
ENUM -> FirFunctionCallImpl(null).apply {
|
||||||
val classId = nameResolver.getClassId(value.classId)
|
val classId = nameResolver.getClassId(value.classId)
|
||||||
val entryName = nameResolver.getName(value.enumValueId)
|
val entryName = nameResolver.getName(value.enumValueId)
|
||||||
val entryClassId = classId.createNestedClassId(entryName)
|
|
||||||
val entryLookupTag = ConeClassLikeLookupTagImpl(entryClassId)
|
|
||||||
val entrySymbol = entryLookupTag.toSymbol(this@AbstractAnnotationDeserializer.session)
|
val enumLookupTag = ConeClassLikeLookupTagImpl(classId)
|
||||||
this.calleeReference = entrySymbol?.let {
|
val enumSymbol = enumLookupTag.toSymbol(this@AbstractAnnotationDeserializer.session)
|
||||||
|
val firClass = enumSymbol?.fir as? FirRegularClass
|
||||||
|
val enumEntries = firClass?.collectEnumEntries() ?: emptyList()
|
||||||
|
val enumEntrySymbol = enumEntries.find { it.callableId.callableName == entryName }
|
||||||
|
this.calleeReference = enumEntrySymbol?.let {
|
||||||
FirResolvedNamedReferenceImpl(null, entryName, it)
|
FirResolvedNamedReferenceImpl(null, entryName, it)
|
||||||
} ?: FirErrorNamedReferenceImpl(
|
} ?: FirErrorNamedReferenceImpl(
|
||||||
null,
|
null,
|
||||||
|
|||||||
+30
-9
@@ -5,7 +5,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.deserialization
|
package org.jetbrains.kotlin.fir.deserialization
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.addDeclarations
|
import org.jetbrains.kotlin.fir.declarations.addDeclarations
|
||||||
@@ -14,7 +16,11 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
|||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirEnumEntryImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirEnumEntryImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirSealedClassImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirSealedClassImpl
|
||||||
import org.jetbrains.kotlin.fir.scopes.KotlinScopeProvider
|
import org.jetbrains.kotlin.fir.scopes.KotlinScopeProvider
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.impl.*
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirAnonymousObjectSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl
|
import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl
|
||||||
@@ -121,19 +127,34 @@ fun deserializeClassToSymbol(
|
|||||||
addDeclarations(
|
addDeclarations(
|
||||||
classProto.enumEntryList.mapNotNull { enumEntryProto ->
|
classProto.enumEntryList.mapNotNull { enumEntryProto ->
|
||||||
val enumEntryName = nameResolver.getName(enumEntryProto.name)
|
val enumEntryName = nameResolver.getName(enumEntryProto.name)
|
||||||
val enumEntryId = classId.createNestedClassId(enumEntryName)
|
|
||||||
|
|
||||||
val symbol = FirRegularClassSymbol(enumEntryId)
|
val enumType = ConeClassLikeTypeImpl(symbol.toLookupTag(), emptyArray(), false)
|
||||||
FirEnumEntryImpl(null, session, enumEntryId.shortClassName, scopeProvider, symbol).apply {
|
val property = FirPropertyImpl(
|
||||||
resolvePhase = FirResolvePhase.DECLARATIONS
|
null,
|
||||||
superTypeRefs += FirResolvedTypeRefImpl(
|
session,
|
||||||
|
FirResolvedTypeRefImpl(null, enumType),
|
||||||
|
null,
|
||||||
|
enumEntryName,
|
||||||
|
initializer = FirAnonymousObjectImpl(
|
||||||
null,
|
null,
|
||||||
ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(classId), emptyArray(), false)
|
session,
|
||||||
)
|
classKind = ClassKind.ENUM_ENTRY,
|
||||||
|
symbol = FirAnonymousObjectSymbol()
|
||||||
|
).apply {
|
||||||
|
superTypeRefs += FirResolvedTypeRefImpl(source = null, type = enumType)
|
||||||
|
},
|
||||||
|
delegate = null,
|
||||||
|
isVar = false,
|
||||||
|
symbol = FirPropertySymbol(CallableId(classId, enumEntryName)),
|
||||||
|
isLocal = false,
|
||||||
|
status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
|
||||||
|
isStatic = true
|
||||||
|
}
|
||||||
|
).apply {
|
||||||
|
resolvePhase = FirResolvePhase.DECLARATIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property
|
||||||
symbol.fir
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -317,19 +317,14 @@ fun BodyResolveComponents.typeForQualifier(resolvedQualifier: FirResolvedQualifi
|
|||||||
val classId = resolvedQualifier.classId
|
val classId = resolvedQualifier.classId
|
||||||
val resultType = resolvedQualifier.resultType
|
val resultType = resolvedQualifier.resultType
|
||||||
if (classId != null) {
|
if (classId != null) {
|
||||||
val classSymbol = symbolProvider.getClassLikeSymbolByFqName(classId)!!
|
val classSymbol = symbolProvider.getClassLikeSymbolByFqName(classId)
|
||||||
|
?: return FirErrorTypeRefImpl(source = null, diagnostic = FirSimpleDiagnostic("No type for qualifier", DiagnosticKind.Other))
|
||||||
val declaration = classSymbol.phasedFir
|
val declaration = classSymbol.phasedFir
|
||||||
typeForQualifierByDeclaration(declaration, resultType)?.let { return it }
|
typeForQualifierByDeclaration(declaration, resultType)?.let { return it }
|
||||||
if (declaration is FirRegularClass && declaration.classKind == ClassKind.ENUM_ENTRY) {
|
|
||||||
val enumClassSymbol = symbolProvider.getClassLikeSymbolByFqName(classSymbol.classId.outerClassId!!)!!
|
|
||||||
return resultType.resolvedTypeFromPrototype(
|
|
||||||
enumClassSymbol.constructType(emptyArray(), false)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// TODO: Handle no value type here
|
// TODO: Handle no value type here
|
||||||
return resultType.resolvedTypeFromPrototype(
|
return resultType.resolvedTypeFromPrototype(
|
||||||
session.builtinTypes.unitType.type//StandardClassIds.Unit(symbolProvider).constructType(emptyArray(), isNullable = false)
|
session.builtinTypes.unitType.type
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,15 +403,9 @@ private fun BodyResolveComponents.typeFromSymbol(symbol: AbstractFirBasedSymbol<
|
|||||||
is FirClassifierSymbol<*> -> {
|
is FirClassifierSymbol<*> -> {
|
||||||
val fir = (symbol as? AbstractFirBasedSymbol<*>)?.phasedFir
|
val fir = (symbol as? AbstractFirBasedSymbol<*>)?.phasedFir
|
||||||
// TODO: unhack
|
// TODO: unhack
|
||||||
if (fir is FirEnumEntry) {
|
FirResolvedTypeRefImpl(
|
||||||
(fir.superTypeRefs.firstOrNull() as? FirResolvedTypeRef) ?: FirErrorTypeRefImpl(
|
null, symbol.constructType(emptyArray(), isNullable = false)
|
||||||
null,
|
)
|
||||||
FirSimpleDiagnostic("No enum item supertype", DiagnosticKind.EnumAsSupertype)
|
|
||||||
)
|
|
||||||
} else
|
|
||||||
FirResolvedTypeRefImpl(
|
|
||||||
null, symbol.constructType(emptyArray(), isNullable = false)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
else -> error("WTF ! $symbol")
|
else -> error("WTF ! $symbol")
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-22
@@ -85,30 +85,16 @@ class FirLibrarySymbolProviderImpl(val session: FirSession, val kotlinScopeProvi
|
|||||||
parentContext: FirDeserializationContext? = null
|
parentContext: FirDeserializationContext? = null
|
||||||
): FirRegularClassSymbol? {
|
): FirRegularClassSymbol? {
|
||||||
val classIdExists = classId in classDataFinder.allClassIds
|
val classIdExists = classId in classDataFinder.allClassIds
|
||||||
val shouldBeEnumEntry = !classIdExists && classId.outerClassId in classDataFinder.allClassIds
|
if (!classIdExists) return null
|
||||||
if (!classIdExists && !shouldBeEnumEntry) return null
|
|
||||||
if (shouldBeEnumEntry) {
|
|
||||||
val outerClassData = classDataFinder.findClassData(classId.outerClassId!!)!!
|
|
||||||
val outerClassProto = outerClassData.classProto
|
|
||||||
if (outerClassProto.enumEntryList.none { nameResolver.getName(it.name) == classId.shortClassName }) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return lookup.getOrPut(classId, { FirRegularClassSymbol(classId) }) { symbol ->
|
return lookup.getOrPut(classId, { FirRegularClassSymbol(classId) }) { symbol ->
|
||||||
if (shouldBeEnumEntry) {
|
val classData = classDataFinder.findClassData(classId)!!
|
||||||
FirEnumEntryImpl(null, session, classId.shortClassName, kotlinScopeProvider, symbol).apply {
|
val classProto = classData.classProto
|
||||||
resolvePhase = FirResolvePhase.DECLARATIONS
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
val classData = classDataFinder.findClassData(classId)!!
|
|
||||||
val classProto = classData.classProto
|
|
||||||
|
|
||||||
deserializeClassToSymbol(
|
deserializeClassToSymbol(
|
||||||
classId, classProto, symbol, nameResolver, session,
|
classId, classProto, symbol, nameResolver, session,
|
||||||
null, kotlinScopeProvider, parentContext,
|
null, kotlinScopeProvider, parentContext,
|
||||||
this::findAndDeserializeClass
|
this::findAndDeserializeClass
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -133,7 +133,6 @@ class FirStatusResolveTransformer : FirAbstractTreeTransformer<FirDeclarationSta
|
|||||||
|
|
||||||
private fun FirDeclaration.resolveModality(containingClass: FirRegularClass?): Modality {
|
private fun FirDeclaration.resolveModality(containingClass: FirRegularClass?): Modality {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is FirEnumEntry -> Modality.FINAL
|
|
||||||
is FirRegularClass -> if (classKind == ClassKind.INTERFACE) Modality.ABSTRACT else Modality.FINAL
|
is FirRegularClass -> if (classKind == ClassKind.INTERFACE) Modality.ABSTRACT else Modality.FINAL
|
||||||
is FirCallableMemberDeclaration<*> -> {
|
is FirCallableMemberDeclaration<*> -> {
|
||||||
when {
|
when {
|
||||||
|
|||||||
+14
-10
@@ -11,12 +11,14 @@ import org.jetbrains.kotlin.fir.FirElement
|
|||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition
|
import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition
|
||||||
|
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||||
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
||||||
import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider
|
import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||||
import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType
|
import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType
|
||||||
import org.jetbrains.kotlin.fir.types.ConeNullability
|
import org.jetbrains.kotlin.fir.types.ConeNullability
|
||||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||||
@@ -72,16 +74,16 @@ class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyRe
|
|||||||
|
|
||||||
private fun checkEnumExhaustiveness(whenExpression: FirWhenExpression, enum: FirRegularClass, nullable: Boolean): Boolean {
|
private fun checkEnumExhaustiveness(whenExpression: FirWhenExpression, enum: FirRegularClass, nullable: Boolean): Boolean {
|
||||||
val data = EnumExhaustivenessData(
|
val data = EnumExhaustivenessData(
|
||||||
enum.collectEnumEntries().associateByTo(mutableMapOf(), { it.classId }, { false }),
|
enum.collectEnumEntries().toMutableSet(),
|
||||||
!nullable
|
!nullable
|
||||||
)
|
)
|
||||||
for (branch in whenExpression.branches) {
|
for (branch in whenExpression.branches) {
|
||||||
branch.condition.accept(EnumExhaustivenessVisitor, data)
|
branch.condition.accept(EnumExhaustivenessVisitor, data)
|
||||||
}
|
}
|
||||||
return data.containsNull && data.visitedEntries.values.all { it }
|
return data.containsNull && data.remainingEntries.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EnumExhaustivenessData(val visitedEntries: MutableMap<ClassId, Boolean>, var containsNull: Boolean)
|
private class EnumExhaustivenessData(val remainingEntries: MutableSet<FirPropertySymbol>, var containsNull: Boolean)
|
||||||
|
|
||||||
private object EnumExhaustivenessVisitor : FirVisitor<Unit, EnumExhaustivenessData>() {
|
private object EnumExhaustivenessVisitor : FirVisitor<Unit, EnumExhaustivenessData>() {
|
||||||
override fun visitElement(element: FirElement, data: EnumExhaustivenessData) {}
|
override fun visitElement(element: FirElement, data: EnumExhaustivenessData) {}
|
||||||
@@ -94,9 +96,11 @@ class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyRe
|
|||||||
data.containsNull = true
|
data.containsNull = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is FirResolvedQualifier -> {
|
is FirQualifiedAccessExpression -> {
|
||||||
val classId = argument.classId ?: return
|
val reference = argument.calleeReference as? FirResolvedNamedReference ?: return
|
||||||
data.visitedEntries.replace(classId, true)
|
val symbol = reference.resolvedSymbol
|
||||||
|
if (symbol is FirPropertySymbol)
|
||||||
|
data.remainingEntries.remove(symbol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,18 +119,18 @@ class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyRe
|
|||||||
if (sealedClass.inheritors.isEmpty()) return true
|
if (sealedClass.inheritors.isEmpty()) return true
|
||||||
val data = SealedExhaustivenessData(
|
val data = SealedExhaustivenessData(
|
||||||
sealedClass.session.firSymbolProvider,
|
sealedClass.session.firSymbolProvider,
|
||||||
sealedClass.inheritors.associateByTo(mutableMapOf(), { it }, { false }),
|
sealedClass.inheritors.toMutableSet(),
|
||||||
!nullable
|
!nullable
|
||||||
)
|
)
|
||||||
for (branch in whenExpression.branches) {
|
for (branch in whenExpression.branches) {
|
||||||
branch.condition.accept(SealedExhaustivenessVisitor, data)
|
branch.condition.accept(SealedExhaustivenessVisitor, data)
|
||||||
}
|
}
|
||||||
return data.containsNull && data.visitedInheritors.values.all { it }
|
return data.containsNull && data.remainingInheritors.isEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SealedExhaustivenessData(
|
private class SealedExhaustivenessData(
|
||||||
val symbolProvider: FirSymbolProvider,
|
val symbolProvider: FirSymbolProvider,
|
||||||
val visitedInheritors: MutableMap<ClassId, Boolean>,
|
val remainingInheritors: MutableSet<ClassId>,
|
||||||
var containsNull: Boolean
|
var containsNull: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -151,7 +155,7 @@ class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyRe
|
|||||||
override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: SealedExhaustivenessData) {
|
override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: SealedExhaustivenessData) {
|
||||||
val lookupTag = (resolvedTypeRef.type as? ConeLookupTagBasedType)?.lookupTag ?: return
|
val lookupTag = (resolvedTypeRef.type as? ConeLookupTagBasedType)?.lookupTag ?: return
|
||||||
val symbol = data.symbolProvider.getSymbolByLookupTag(lookupTag) as? FirClassSymbol ?: return
|
val symbol = data.symbolProvider.getSymbolByLookupTag(lookupTag) as? FirClassSymbol ?: return
|
||||||
data.visitedInheritors.replace(symbol.classId, true)
|
data.remainingInheritors.remove(symbol.classId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitBinaryLogicExpression(binaryLogicExpression: FirBinaryLogicExpression, data: SealedExhaustivenessData) {
|
override fun visitBinaryLogicExpression(binaryLogicExpression: FirBinaryLogicExpression, data: SealedExhaustivenessData) {
|
||||||
|
|||||||
+9
-3
@@ -365,15 +365,21 @@ public abstract interface Comparable<in T> : R|kotlin/Any| {
|
|||||||
public final enum class DeprecationLevel : R|kotlin/Enum<kotlin/DeprecationLevel>| {
|
public final enum class DeprecationLevel : R|kotlin/Enum<kotlin/DeprecationLevel>| {
|
||||||
private constructor(): R|kotlin/DeprecationLevel|
|
private constructor(): R|kotlin/DeprecationLevel|
|
||||||
|
|
||||||
public? final enum entry WARNING : R|kotlin/DeprecationLevel| {
|
public final static val WARNING: R|kotlin/DeprecationLevel| = object : R|kotlin/DeprecationLevel| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry ERROR : R|kotlin/DeprecationLevel| {
|
|
||||||
|
|
||||||
|
public final static val ERROR: R|kotlin/DeprecationLevel| = object : R|kotlin/DeprecationLevel| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry HIDDEN : R|kotlin/DeprecationLevel| {
|
|
||||||
|
|
||||||
|
public final static val HIDDEN: R|kotlin/DeprecationLevel| = object : R|kotlin/DeprecationLevel| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>| {
|
public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>| {
|
||||||
|
|||||||
Vendored
+4
-1
@@ -6,9 +6,11 @@
|
|||||||
public final enum class E : R|kotlin/Enum<test/E>| {
|
public final enum class E : R|kotlin/Enum<test/E>| {
|
||||||
private constructor(): R|test/E|
|
private constructor(): R|test/E|
|
||||||
|
|
||||||
public? final enum entry ENTRY : R|test/E| {
|
public final static val ENTRY: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final annotation class EnumOption : R|kotlin/Annotation| {
|
public final annotation class EnumOption : R|kotlin/Annotation| {
|
||||||
@@ -37,3 +39,4 @@ public final annotation class StringOptions : R|kotlin/Annotation| {
|
|||||||
public constructor(vararg option: R|kotlin/Array<out kotlin/String>|): R|test/StringOptions|
|
public constructor(vararg option: R|kotlin/Array<out kotlin/String>|): R|test/StringOptions|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-1
@@ -1,9 +1,11 @@
|
|||||||
public final enum class E : R|kotlin/Enum<test/E>| {
|
public final enum class E : R|kotlin/Enum<test/E>| {
|
||||||
private constructor(): R|test/E|
|
private constructor(): R|test/E|
|
||||||
|
|
||||||
public? final enum entry CAKE : R|test/E| {
|
public final static val CAKE: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final annotation class EnumAnno : R|kotlin/Annotation| {
|
public final annotation class EnumAnno : R|kotlin/Annotation| {
|
||||||
@@ -28,3 +30,4 @@ public final annotation class EnumArrayAnno : R|kotlin/Annotation| {
|
|||||||
public constructor(vararg value: R|kotlin/Array<out test/E>|): R|test/EnumArrayAnno|
|
public constructor(vararg value: R|kotlin/Array<out test/E>|): R|test/EnumArrayAnno|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-4
@@ -17,17 +17,25 @@ public final annotation class Bnno : R|kotlin/Annotation| {
|
|||||||
public final enum class Eee : R|kotlin/Enum<test/Eee>| {
|
public final enum class Eee : R|kotlin/Enum<test/Eee>| {
|
||||||
private constructor(): R|test/Eee|
|
private constructor(): R|test/Eee|
|
||||||
|
|
||||||
public? final enum entry Entry1 : R|test/Eee| {
|
public final static val Entry1: R|test/Eee| = object : R|test/Eee| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry Entry2 : R|test/Eee| {
|
|
||||||
|
|
||||||
|
public final static val Entry2: R|test/Eee| = object : R|test/Eee| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry Entry3 : R|test/Eee| {
|
|
||||||
|
|
||||||
|
public final static val Entry3: R|test/Eee| = object : R|test/Eee| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry Entry4 : R|test/Eee| {
|
|
||||||
|
|
||||||
|
public final static val Entry4: R|test/Eee| = object : R|test/Eee| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,30 @@
|
|||||||
internal final enum class In : R|kotlin/Enum<test/In>| {
|
internal final enum class In : R|kotlin/Enum<test/In>| {
|
||||||
private constructor(): R|test/In|
|
private constructor(): R|test/In|
|
||||||
|
|
||||||
public? final enum entry A : R|test/In| {
|
public final static val A: R|test/In| = object : R|test/In| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final enum class Pr : R|kotlin/Enum<test/Pr>| {
|
private final enum class Pr : R|kotlin/Enum<test/Pr>| {
|
||||||
private constructor(): R|test/Pr|
|
private constructor(): R|test/Pr|
|
||||||
|
|
||||||
public? final enum entry A : R|test/Pr| {
|
public final static val A: R|test/Pr| = object : R|test/Pr| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum class Pu : R|kotlin/Enum<test/Pu>| {
|
public final enum class Pu : R|kotlin/Enum<test/Pu>| {
|
||||||
private constructor(): R|test/Pu|
|
private constructor(): R|test/Pu|
|
||||||
|
|
||||||
public? final enum entry A : R|test/Pu| {
|
public final static val A: R|test/Pu| = object : R|test/Pu| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -7,14 +7,20 @@ public final enum class En : R|kotlin/Enum<test/En>| {
|
|||||||
|
|
||||||
private constructor(b: R|kotlin/Boolean| = STUB, i: R|kotlin/Int| = STUB): R|test/En|
|
private constructor(b: R|kotlin/Boolean| = STUB, i: R|kotlin/Int| = STUB): R|test/En|
|
||||||
|
|
||||||
public? final enum entry E1 : R|test/En| {
|
public final static val E1: R|test/En| = object : R|test/En| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry E2 : R|test/En| {
|
|
||||||
|
|
||||||
|
public final static val E2: R|test/En| = object : R|test/En| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry E3 : R|test/En| {
|
|
||||||
|
|
||||||
|
public final static val E3: R|test/En| = object : R|test/En| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -19,11 +19,15 @@ public final enum class Enum : R|kotlin/Enum<test/Enum>| {
|
|||||||
public abstract interface Trait : R|kotlin/Any| {
|
public abstract interface Trait : R|kotlin/Any| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry ENTRY1 : R|test/Enum| {
|
public final static val ENTRY1: R|test/Enum| = object : R|test/Enum| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry ENTRY2 : R|test/Enum| {
|
|
||||||
|
|
||||||
|
public final static val ENTRY2: R|test/Enum| = object : R|test/Enum| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ public final class A : R|kotlin/Any| {
|
|||||||
public final enum class E : R|kotlin/Enum<test/A.E>| {
|
public final enum class E : R|kotlin/Enum<test/A.E>| {
|
||||||
private constructor(): R|test/A.E|
|
private constructor(): R|test/A.E|
|
||||||
|
|
||||||
public? final enum entry ENTRY : R|test/A.E| {
|
public final static val ENTRY: R|test/A.E| = object : R|test/A.E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -9,9 +9,11 @@ public final class A : R|kotlin/Any| {
|
|||||||
public final enum class E : R|kotlin/Enum<test/A.E>| {
|
public final enum class E : R|kotlin/Enum<test/A.E>| {
|
||||||
private constructor(): R|test/A.E|
|
private constructor(): R|test/A.E|
|
||||||
|
|
||||||
public? final enum entry ENTRY : R|test/A.E| {
|
public final static val ENTRY: R|test/A.E| = object : R|test/A.E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
public final enum class MyEnum : R|kotlin/Enum<test/MyEnum>| {
|
public final enum class MyEnum : R|kotlin/Enum<test/MyEnum>| {
|
||||||
private constructor(): R|test/MyEnum|
|
private constructor(): R|test/MyEnum|
|
||||||
|
|
||||||
public? final enum entry ENTRY : R|test/MyEnum| {
|
public final static val ENTRY: R|test/MyEnum| = object : R|test/MyEnum| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
public final enum class Test : R|kotlin/Enum<test/Test>| {
|
public final enum class Test : R|kotlin/Enum<test/Test>| {
|
||||||
private constructor(a: R|kotlin/Int|): R|test/Test|
|
private constructor(a: R|kotlin/Int|): R|test/Test|
|
||||||
|
|
||||||
public? final enum entry A : R|test/Test| {
|
public final static val A: R|test/Test| = object : R|test/Test| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry B : R|test/Test| {
|
|
||||||
|
|
||||||
|
public final static val B: R|test/Test| = object : R|test/Test| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
-8
@@ -1,29 +1,45 @@
|
|||||||
public final enum class E : R|kotlin/Enum<test/E>| {
|
public final enum class E : R|kotlin/Enum<test/E>| {
|
||||||
private constructor(): R|test/E|
|
private constructor(): R|test/E|
|
||||||
|
|
||||||
public? final enum entry ONE : R|test/E| {
|
public final static val ONE: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry TWO : R|test/E| {
|
|
||||||
|
|
||||||
|
public final static val TWO: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry THREE : R|test/E| {
|
|
||||||
|
|
||||||
|
public final static val THREE: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry FOUR : R|test/E| {
|
|
||||||
|
|
||||||
|
public final static val FOUR: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry FIVE : R|test/E| {
|
|
||||||
|
|
||||||
|
public final static val FIVE: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry SIX : R|test/E| {
|
|
||||||
|
|
||||||
|
public final static val SIX: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry SEVEN : R|test/E| {
|
|
||||||
|
|
||||||
|
public final static val SEVEN: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public? final enum entry EIGHT : R|test/E| {
|
|
||||||
|
|
||||||
|
public final static val EIGHT: R|test/E| = object : R|test/E| {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-4
@@ -21,8 +21,8 @@ FILE: enum.kt
|
|||||||
public final val x: R|Some| = R|<local>/x|
|
public final val x: R|Some| = R|<local>/x|
|
||||||
public get(): R|Some|
|
public get(): R|Some|
|
||||||
|
|
||||||
public final enum entry FIRST : R|SomeEnum| {
|
public final static val FIRST: R|SomeEnum| = object : R|SomeEnum| {
|
||||||
public constructor(): R|SomeEnum.FIRST| {
|
private constructor(): R|anonymous| {
|
||||||
super<R|SomeEnum|>(Q|O1|)
|
super<R|SomeEnum|>(Q|O1|)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,8 +32,10 @@ FILE: enum.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry SECOND : R|SomeEnum| {
|
|
||||||
public constructor(): R|SomeEnum.SECOND| {
|
|
||||||
|
public final static val SECOND: R|SomeEnum| = object : R|SomeEnum| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
super<R|SomeEnum|>(Q|O2|)
|
super<R|SomeEnum|>(Q|O2|)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +45,8 @@ FILE: enum.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public abstract fun check(y: R|Some|): R|kotlin/Boolean|
|
public abstract fun check(y: R|Some|): R|kotlin/Boolean|
|
||||||
|
|
||||||
public final static fun values(): R|kotlin/Array<SomeEnum>| {
|
public final static fun values(): R|kotlin/Array<SomeEnum>| {
|
||||||
|
|||||||
+12
-8
@@ -4,20 +4,24 @@ FILE: enumWithCompanion.kt
|
|||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry A : R|kotlin/Any| {
|
public final static val A: R|EC| = object : R|EC| {
|
||||||
public constructor(): R|EC.A| {
|
private constructor(): R|anonymous| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|EC|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry B : R|kotlin/Any| {
|
|
||||||
public constructor(): R|EC.B| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val B: R|EC| = object : R|EC| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
|
super<R|EC|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final companion object Companion : R|kotlin/Any| {
|
public final companion object Companion : R|kotlin/Any| {
|
||||||
private constructor(): R|EC.Companion| {
|
private constructor(): R|EC.Companion| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
@@ -25,10 +29,10 @@ FILE: enumWithCompanion.kt
|
|||||||
|
|
||||||
public final fun u(ec: R|EC|): R|kotlin/Boolean| {
|
public final fun u(ec: R|EC|): R|kotlin/Boolean| {
|
||||||
^u when (R|<local>/ec|) {
|
^u when (R|<local>/ec|) {
|
||||||
==($subj$, Q|EC.A|) -> {
|
==($subj$, R|/EC.A|) -> {
|
||||||
Boolean(true)
|
Boolean(true)
|
||||||
}
|
}
|
||||||
==($subj$, Q|EC.B|) -> {
|
==($subj$, R|/EC.B|) -> {
|
||||||
Boolean(false)
|
Boolean(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-28
@@ -4,27 +4,33 @@ FILE: exhaustiveness_enum.kt
|
|||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry A : R|kotlin/Any| {
|
public final static val A: R|Enum| = object : R|Enum| {
|
||||||
public constructor(): R|Enum.A| {
|
private constructor(): R|anonymous| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|Enum|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry B : R|kotlin/Any| {
|
|
||||||
public constructor(): R|Enum.B| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val B: R|Enum| = object : R|Enum| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
|
super<R|Enum|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry C : R|kotlin/Any| {
|
|
||||||
public constructor(): R|Enum.C| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val C: R|Enum| = object : R|Enum| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
|
super<R|Enum|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final static fun values(): R|kotlin/Array<Enum>| {
|
public final static fun values(): R|kotlin/Array<Enum>| {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,19 +40,19 @@ FILE: exhaustiveness_enum.kt
|
|||||||
}
|
}
|
||||||
public final fun test_1(e: R|Enum|): R|kotlin/Unit| {
|
public final fun test_1(e: R|Enum|): R|kotlin/Unit| {
|
||||||
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.B|) -> {
|
==($subj$, Q|Enum|.R|/Enum.B|) -> {
|
||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lval b: R|kotlin/Unit| = when (R|<local>/e|) {
|
lval b: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.B|) -> {
|
==($subj$, Q|Enum|.R|/Enum.B|) -> {
|
||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
($subj$ is R|kotlin/String|) -> {
|
($subj$ is R|kotlin/String|) -> {
|
||||||
@@ -55,19 +61,19 @@ FILE: exhaustiveness_enum.kt
|
|||||||
}
|
}
|
||||||
|
|
||||||
lval c: R|kotlin/Int| = when (R|<local>/e|) {
|
lval c: R|kotlin/Int| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.B|) -> {
|
==($subj$, Q|Enum|.R|/Enum.B|) -> {
|
||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.C|) -> {
|
==($subj$, Q|Enum|.R|/Enum.C|) -> {
|
||||||
Int(3)
|
Int(3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lval d: R|kotlin/Int| = when (R|<local>/e|) {
|
lval d: R|kotlin/Int| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
@@ -78,25 +84,25 @@ FILE: exhaustiveness_enum.kt
|
|||||||
}
|
}
|
||||||
public final fun test_2(e: R|Enum?|): R|kotlin/Unit| {
|
public final fun test_2(e: R|Enum?|): R|kotlin/Unit| {
|
||||||
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
lval a: R|kotlin/Unit| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.B|) -> {
|
==($subj$, Q|Enum|.R|/Enum.B|) -> {
|
||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.C|) -> {
|
==($subj$, Q|Enum|.R|/Enum.C|) -> {
|
||||||
Int(3)
|
Int(3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.B|) -> {
|
==($subj$, Q|Enum|.R|/Enum.B|) -> {
|
||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.C|) -> {
|
==($subj$, Q|Enum|.R|/Enum.C|) -> {
|
||||||
Int(3)
|
Int(3)
|
||||||
}
|
}
|
||||||
==($subj$, Null(null)) -> {
|
==($subj$, Null(null)) -> {
|
||||||
@@ -105,13 +111,13 @@ FILE: exhaustiveness_enum.kt
|
|||||||
}
|
}
|
||||||
|
|
||||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.B|) -> {
|
==($subj$, Q|Enum|.R|/Enum.B|) -> {
|
||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.C|) -> {
|
==($subj$, Q|Enum|.R|/Enum.C|) -> {
|
||||||
Int(3)
|
Int(3)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
@@ -122,10 +128,10 @@ FILE: exhaustiveness_enum.kt
|
|||||||
}
|
}
|
||||||
public final fun test_3(e: R|Enum|): R|kotlin/Unit| {
|
public final fun test_3(e: R|Enum|): R|kotlin/Unit| {
|
||||||
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
lval a: R|kotlin/Int| = when (R|<local>/e|) {
|
||||||
==($subj$, Q|Enum.A|) || ==($subj$, Q|Enum.B|) -> {
|
==($subj$, Q|Enum|.R|/Enum.A|) || ==($subj$, Q|Enum|.R|/Enum.B|) -> {
|
||||||
Int(1)
|
Int(1)
|
||||||
}
|
}
|
||||||
==($subj$, Q|Enum.C|) -> {
|
==($subj$, Q|Enum|.R|/Enum.C|) -> {
|
||||||
Int(2)
|
Int(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,27 +4,33 @@ FILE: enumValues.kt
|
|||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry FIRST : R|kotlin/Any| {
|
public final static val FIRST: R|MyEnum| = object : R|MyEnum| {
|
||||||
public constructor(): R|MyEnum.FIRST| {
|
private constructor(): R|anonymous| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|MyEnum|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry SECOND : R|kotlin/Any| {
|
|
||||||
public constructor(): R|MyEnum.SECOND| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val SECOND: R|MyEnum| = object : R|MyEnum| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
|
super<R|MyEnum|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry LAST : R|kotlin/Any| {
|
|
||||||
public constructor(): R|MyEnum.LAST| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val LAST: R|MyEnum| = object : R|MyEnum| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
|
super<R|MyEnum|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final fun bar(): R|kotlin/Int| {
|
public final fun bar(): R|kotlin/Int| {
|
||||||
^bar Int(42)
|
^bar Int(42)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-5
@@ -33,13 +33,15 @@ FILE: qualifiedExpressions.kt
|
|||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry entry : R|kotlin/Any| {
|
public final static val entry: R|a/b/E| = object : R|a/b/E| {
|
||||||
public constructor(): R|a/b/E.entry| {
|
private constructor(): R|anonymous| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|a/b/E|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final static fun values(): R|kotlin/Array<a/b/E>| {
|
public final static fun values(): R|kotlin/Array<a/b/E>| {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +60,6 @@ FILE: qualifiedExpressions.kt
|
|||||||
lval x: R|kotlin/Int| = Q|a/b|.R|a/b/f|
|
lval x: R|kotlin/Int| = Q|a/b|.R|a/b/f|
|
||||||
Q|a/b/C|.R|a/b/C.Companion.foo|()
|
Q|a/b/C|.R|a/b/C.Companion.foo|()
|
||||||
R|a/b/C.C|().R|a/b/C.foo|()
|
R|a/b/C.C|().R|a/b/C.foo|()
|
||||||
lval e: R|a/b/E| = Q|a/b/E.entry|
|
lval e: R|a/b/E| = Q|a/b/E|.R|a/b/E.entry|
|
||||||
lval e1: R|a/b/E| = Q|a/b/E.entry|
|
lval e1: R|a/b/E| = Q|a/b/E|.R|a/b/E.entry|
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-15
@@ -4,27 +4,33 @@ FILE: enums.kt
|
|||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry FIRST : R|kotlin/Any| {
|
public final static val FIRST: R|Order| = object : R|Order| {
|
||||||
public constructor(): R|Order.FIRST| {
|
private constructor(): R|anonymous| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|Order|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry SECOND : R|kotlin/Any| {
|
|
||||||
public constructor(): R|Order.SECOND| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val SECOND: R|Order| = object : R|Order| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
|
super<R|Order|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry THIRD : R|kotlin/Any| {
|
|
||||||
public constructor(): R|Order.THIRD| {
|
|
||||||
super<R|kotlin/Any|>()
|
public final static val THIRD: R|Order| = object : R|Order| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
|
super<R|Order|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final static fun values(): R|kotlin/Array<Order>| {
|
public final static fun values(): R|kotlin/Array<Order>| {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +49,8 @@ FILE: enums.kt
|
|||||||
internal final val r: R|kotlin/Double| = R|<local>/r|
|
internal final val r: R|kotlin/Double| = R|<local>/r|
|
||||||
internal get(): R|kotlin/Double|
|
internal get(): R|kotlin/Double|
|
||||||
|
|
||||||
public final enum entry MERCURY : R|Planet| {
|
public final static val MERCURY: R|Planet| = object : R|Planet| {
|
||||||
public constructor(): R|Planet.MERCURY| {
|
private constructor(): R|anonymous| {
|
||||||
super<R|Planet|>(Double(1.0), Double(2.0))
|
super<R|Planet|>(Double(1.0), Double(2.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +60,10 @@ FILE: enums.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry VENERA : R|Planet| {
|
|
||||||
public constructor(): R|Planet.VENERA| {
|
|
||||||
|
public final static val VENERA: R|Planet| = object : R|Planet| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
super<R|Planet|>(Double(3.0), Double(4.0))
|
super<R|Planet|>(Double(3.0), Double(4.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +73,10 @@ FILE: enums.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum entry EARTH : R|Planet| {
|
|
||||||
public constructor(): R|Planet.EARTH| {
|
|
||||||
|
public final static val EARTH: R|Planet| = object : R|Planet| {
|
||||||
|
private constructor(): R|anonymous| {
|
||||||
super<R|Planet|>(Double(5.0), Double(6.0))
|
super<R|Planet|>(Double(5.0), Double(6.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,6 +86,8 @@ FILE: enums.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final val g: R|kotlin/Double| = R|/Planet.Companion.G|.R|kotlin/Double.times|(R|<local>/m|).R|kotlin/Double.div|(R|<local>/r|.R|kotlin/Double.times|(R|<local>/r|))
|
public final val g: R|kotlin/Double| = R|/Planet.Companion.G|.R|kotlin/Double.times|(R|<local>/m|).R|kotlin/Double.div|(R|<local>/r|.R|kotlin/Double.times|(R|<local>/r|))
|
||||||
public get(): R|kotlin/Double|
|
public get(): R|kotlin/Double|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FILE: annotations.kt
|
FILE: annotations.kt
|
||||||
@R|kotlin/annotation/Target|(Q|kotlin/annotation/AnnotationTarget.FILE|, Q|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget.PROPERTY_GETTER|) public final annotation class Simple : R|kotlin/Annotation| {
|
@R|kotlin/annotation/Target|(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FILE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.TYPE|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.PROPERTY_GETTER|) public final annotation class Simple : R|kotlin/Annotation| {
|
||||||
public constructor(): R|annotations/Simple| {
|
public constructor(): R|annotations/Simple| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.fir.declarations
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
|
||||||
import org.jetbrains.kotlin.fir.FirPureAbstractElement
|
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
|
||||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirScopeProvider
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.fir.visitors.*
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file was generated automatically
|
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
|
||||||
|
|
||||||
abstract class FirEnumEntry : FirPureAbstractElement(), FirRegularClass {
|
|
||||||
abstract override val source: FirSourceElement?
|
|
||||||
abstract override val session: FirSession
|
|
||||||
abstract override val resolvePhase: FirResolvePhase
|
|
||||||
abstract override val name: Name
|
|
||||||
abstract override val annotations: List<FirAnnotationCall>
|
|
||||||
abstract override val typeParameters: List<FirTypeParameter>
|
|
||||||
abstract override val status: FirDeclarationStatus
|
|
||||||
abstract override val classKind: ClassKind
|
|
||||||
abstract override val declarations: List<FirDeclaration>
|
|
||||||
abstract override val scopeProvider: FirScopeProvider
|
|
||||||
abstract override val symbol: FirRegularClassSymbol
|
|
||||||
abstract override val companionObject: FirRegularClass?
|
|
||||||
abstract override val superTypeRefs: List<FirTypeRef>
|
|
||||||
abstract val arguments: List<FirExpression>
|
|
||||||
abstract val typeRef: FirTypeRef
|
|
||||||
|
|
||||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitEnumEntry(this, data)
|
|
||||||
|
|
||||||
abstract override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
|
||||||
|
|
||||||
abstract fun <D> transformArguments(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
|
||||||
}
|
|
||||||
+1
-1
@@ -27,11 +27,11 @@ import org.jetbrains.kotlin.fir.visitors.*
|
|||||||
class FirAnonymousObjectImpl(
|
class FirAnonymousObjectImpl(
|
||||||
override val source: FirSourceElement?,
|
override val source: FirSourceElement?,
|
||||||
override val session: FirSession,
|
override val session: FirSession,
|
||||||
|
override val classKind: ClassKind,
|
||||||
override val scopeProvider: FirScopeProvider,
|
override val scopeProvider: FirScopeProvider,
|
||||||
override val symbol: FirAnonymousObjectSymbol
|
override val symbol: FirAnonymousObjectSymbol
|
||||||
) : FirAnonymousObject(), FirModifiableClass<FirAnonymousObject>, FirAbstractAnnotatedElement {
|
) : FirAnonymousObject(), FirModifiableClass<FirAnonymousObject>, FirAbstractAnnotatedElement {
|
||||||
override var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR
|
override var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR
|
||||||
override val classKind: ClassKind get() = ClassKind.OBJECT
|
|
||||||
override val superTypeRefs: MutableList<FirTypeRef> = mutableListOf()
|
override val superTypeRefs: MutableList<FirTypeRef> = mutableListOf()
|
||||||
override val declarations: MutableList<FirDeclaration> = mutableListOf()
|
override val declarations: MutableList<FirDeclaration> = mutableListOf()
|
||||||
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.fir.declarations.impl
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
|
||||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
|
||||||
import org.jetbrains.kotlin.fir.impl.FirAbstractAnnotatedElement
|
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirScopeProvider
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.fir.visitors.*
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file was generated automatically
|
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
|
||||||
|
|
||||||
class FirEnumEntryImpl(
|
|
||||||
override val source: FirSourceElement?,
|
|
||||||
override val session: FirSession,
|
|
||||||
override val name: Name,
|
|
||||||
override val scopeProvider: FirScopeProvider,
|
|
||||||
override val symbol: FirRegularClassSymbol
|
|
||||||
) : FirEnumEntry(), FirModifiableClass<FirRegularClass>, FirModifiableTypeParametersOwner, FirAbstractAnnotatedElement {
|
|
||||||
override var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR
|
|
||||||
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
|
||||||
override val typeParameters: MutableList<FirTypeParameter> = mutableListOf()
|
|
||||||
override var status: FirDeclarationStatus = FirDeclarationStatusImpl(Visibilities.UNKNOWN, Modality.FINAL)
|
|
||||||
override val classKind: ClassKind get() = ClassKind.ENUM_ENTRY
|
|
||||||
override val declarations: MutableList<FirDeclaration> = mutableListOf()
|
|
||||||
override val companionObject: FirRegularClass? get() = null
|
|
||||||
override val superTypeRefs: MutableList<FirTypeRef> = mutableListOf()
|
|
||||||
override val arguments: MutableList<FirExpression> = mutableListOf()
|
|
||||||
override var typeRef: FirTypeRef = session.builtinTypes.enumType
|
|
||||||
|
|
||||||
init {
|
|
||||||
symbol.bind(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
|
||||||
typeParameters.forEach { it.accept(visitor, data) }
|
|
||||||
status.accept(visitor, data)
|
|
||||||
declarations.forEach { it.accept(visitor, data) }
|
|
||||||
superTypeRefs.forEach { it.accept(visitor, data) }
|
|
||||||
arguments.forEach { it.accept(visitor, data) }
|
|
||||||
typeRef.accept(visitor, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirEnumEntryImpl {
|
|
||||||
annotations.transformInplace(transformer, data)
|
|
||||||
typeParameters.transformInplace(transformer, data)
|
|
||||||
transformStatus(transformer, data)
|
|
||||||
declarations.transformInplace(transformer, data)
|
|
||||||
superTypeRefs.transformInplace(transformer, data)
|
|
||||||
transformArguments(transformer, data)
|
|
||||||
typeRef = typeRef.transformSingle(transformer, data)
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirEnumEntryImpl {
|
|
||||||
status = status.transformSingle(transformer, data)
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun <D> transformArguments(transformer: FirTransformer<D>, data: D): FirEnumEntryImpl {
|
|
||||||
arguments.transformInplace(transformer, data)
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
|
||||||
resolvePhase = newResolvePhase
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceSuperTypeRefs(newSuperTypeRefs: List<FirTypeRef>) {
|
|
||||||
superTypeRefs.clear()
|
|
||||||
superTypeRefs.addAll(newSuperTypeRefs)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.fir.declarations.FirClass
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirMemberFunction
|
import org.jetbrains.kotlin.fir.declarations.FirMemberFunction
|
||||||
@@ -258,10 +257,6 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
|||||||
return transformElement(typeAlias, data)
|
return transformElement(typeAlias, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun transformEnumEntry(enumEntry: FirEnumEntry, data: D): CompositeTransformResult<FirStatement> {
|
|
||||||
return transformElement(enumEntry, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun <F : FirFunction<F>> transformFunction(function: FirFunction<F>, data: D): CompositeTransformResult<FirStatement> {
|
open fun <F : FirFunction<F>> transformFunction(function: FirFunction<F>, data: D): CompositeTransformResult<FirStatement> {
|
||||||
return transformElement(function, data)
|
return transformElement(function, data)
|
||||||
}
|
}
|
||||||
@@ -714,10 +709,6 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
|||||||
return transformTypeAlias(typeAlias, data)
|
return transformTypeAlias(typeAlias, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun visitEnumEntry(enumEntry: FirEnumEntry, data: D): CompositeTransformResult<FirStatement> {
|
|
||||||
return transformEnumEntry(enumEntry, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
final override fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>, data: D): CompositeTransformResult<FirStatement> {
|
final override fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>, data: D): CompositeTransformResult<FirStatement> {
|
||||||
return transformFunction(function, data)
|
return transformFunction(function, data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.fir.declarations.FirClass
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirMemberFunction
|
import org.jetbrains.kotlin.fir.declarations.FirMemberFunction
|
||||||
@@ -192,8 +191,6 @@ abstract class FirVisitor<out R, in D> {
|
|||||||
|
|
||||||
open fun visitTypeAlias(typeAlias: FirTypeAlias, data: D): R = visitElement(typeAlias, data)
|
open fun visitTypeAlias(typeAlias: FirTypeAlias, data: D): R = visitElement(typeAlias, data)
|
||||||
|
|
||||||
open fun visitEnumEntry(enumEntry: FirEnumEntry, data: D): R = visitElement(enumEntry, data)
|
|
||||||
|
|
||||||
open fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>, data: D): R = visitElement(function, data)
|
open fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>, data: D): R = visitElement(function, data)
|
||||||
|
|
||||||
open fun visitContractDescriptionOwner(contractDescriptionOwner: FirContractDescriptionOwner, data: D): R = visitElement(contractDescriptionOwner, data)
|
open fun visitContractDescriptionOwner(contractDescriptionOwner: FirContractDescriptionOwner, data: D): R = visitElement(contractDescriptionOwner, data)
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.fir.declarations.FirClass
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirMemberFunction
|
import org.jetbrains.kotlin.fir.declarations.FirMemberFunction
|
||||||
@@ -256,10 +255,6 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
|||||||
visitElement(typeAlias)
|
visitElement(typeAlias)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun visitEnumEntry(enumEntry: FirEnumEntry) {
|
|
||||||
visitElement(enumEntry)
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>) {
|
open fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>) {
|
||||||
visitElement(function)
|
visitElement(function)
|
||||||
}
|
}
|
||||||
@@ -712,10 +707,6 @@ abstract class FirVisitorVoid : FirVisitor<Unit, Nothing?>() {
|
|||||||
visitTypeAlias(typeAlias)
|
visitTypeAlias(typeAlias)
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun visitEnumEntry(enumEntry: FirEnumEntry, data: Nothing?) {
|
|
||||||
visitEnumEntry(enumEntry)
|
|
||||||
}
|
|
||||||
|
|
||||||
final override fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>, data: Nothing?) {
|
final override fun <F : FirFunction<F>> visitFunction(function: FirFunction<F>, data: Nothing?) {
|
||||||
visitFunction(function)
|
visitFunction(function)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,9 +272,6 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnumEntry(enumEntry: FirEnumEntry) {
|
|
||||||
visitRegularClass(enumEntry)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private fun List<FirDeclaration>.renderDeclarations() {
|
private fun List<FirDeclaration>.renderDeclarations() {
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
package org.jetbrains.kotlin.fir.declarations
|
package org.jetbrains.kotlin.fir.declarations
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirEnumEntryImpl
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirModifiableRegularClass
|
import org.jetbrains.kotlin.fir.declarations.impl.FirModifiableRegularClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirAnonymousObjectSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirAnonymousObjectSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||||
import org.jetbrains.kotlin.fir.types.coneTypeSafe
|
import org.jetbrains.kotlin.fir.types.coneTypeSafe
|
||||||
@@ -55,9 +55,6 @@ fun FirModifiableRegularClass.addDeclarations(declarations: Collection<FirDeclar
|
|||||||
declarations.forEach(this::addDeclaration)
|
declarations.forEach(this::addDeclaration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun FirEnumEntryImpl.addDeclaration(declaration: FirDeclaration) {
|
|
||||||
declarations += declaration
|
|
||||||
}
|
|
||||||
|
|
||||||
val FirTypeAlias.expandedConeType: ConeClassLikeType? get() = expandedTypeRef.coneTypeSafe()
|
val FirTypeAlias.expandedConeType: ConeClassLikeType? get() = expandedTypeRef.coneTypeSafe()
|
||||||
|
|
||||||
@@ -71,7 +68,14 @@ val FirClassSymbol<*>.superConeTypes
|
|||||||
|
|
||||||
val FirClass<*>.superConeTypes get() = superTypeRefs.mapNotNull { it.coneTypeSafe<ConeClassLikeType>() }
|
val FirClass<*>.superConeTypes get() = superTypeRefs.mapNotNull { it.coneTypeSafe<ConeClassLikeType>() }
|
||||||
|
|
||||||
fun FirRegularClass.collectEnumEntries(): Collection<FirEnumEntry> {
|
fun FirRegularClass.collectEnumEntries(): Collection<FirPropertySymbol> {
|
||||||
assert(classKind == ClassKind.ENUM_CLASS)
|
assert(classKind == ClassKind.ENUM_CLASS)
|
||||||
return declarations.filterIsInstance<FirEnumEntry>()
|
return declarations
|
||||||
|
.mapNotNull {
|
||||||
|
if (it !is FirProperty) return@mapNotNull null
|
||||||
|
val initializer = it.initializer
|
||||||
|
if (initializer == null || initializer !is FirAnonymousObject || initializer.classKind != ClassKind.ENUM_ENTRY)
|
||||||
|
return@mapNotNull null
|
||||||
|
return@mapNotNull it.symbol
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.visitors
|
package org.jetbrains.kotlin.fir.visitors
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
@@ -73,9 +72,6 @@ abstract class FirDefaultTransformer<D> : FirTransformer<D>() {
|
|||||||
return transformJump(breakExpression, data)
|
return transformJump(breakExpression, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transformEnumEntry(enumEntry: FirEnumEntry, data: D): CompositeTransformResult<FirStatement> {
|
|
||||||
return transformRegularClass(enumEntry, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun transformLambdaArgumentExpression(lambdaArgumentExpression: FirLambdaArgumentExpression, data: D): CompositeTransformResult<FirStatement> {
|
override fun transformLambdaArgumentExpression(lambdaArgumentExpression: FirLambdaArgumentExpression, data: D): CompositeTransformResult<FirStatement> {
|
||||||
return transformWrappedArgumentExpression(lambdaArgumentExpression, data)
|
return transformWrappedArgumentExpression(lambdaArgumentExpression, data)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.visitors
|
package org.jetbrains.kotlin.fir.visitors
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
@@ -69,9 +68,6 @@ abstract class FirDefaultVisitor<R, D> : FirVisitor<R, D>() {
|
|||||||
return visitJump(breakExpression, data)
|
return visitJump(breakExpression, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnumEntry(enumEntry: FirEnumEntry, data: D): R {
|
|
||||||
return visitRegularClass(enumEntry, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun visitLambdaArgumentExpression(lambdaArgumentExpression: FirLambdaArgumentExpression, data: D): R {
|
override fun visitLambdaArgumentExpression(lambdaArgumentExpression: FirLambdaArgumentExpression, data: D): R {
|
||||||
return visitWrappedArgumentExpression(lambdaArgumentExpression, data)
|
return visitWrappedArgumentExpression(lambdaArgumentExpression, data)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.visitors
|
package org.jetbrains.kotlin.fir.visitors
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
import org.jetbrains.kotlin.fir.declarations.FirSealedClass
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
@@ -69,9 +68,6 @@ abstract class FirDefaultVisitorVoid : FirVisitorVoid() {
|
|||||||
return visitJump(breakExpression)
|
return visitJump(breakExpression)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitEnumEntry(enumEntry: FirEnumEntry) {
|
|
||||||
return visitRegularClass(enumEntry)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun visitLambdaArgumentExpression(lambdaArgumentExpression: FirLambdaArgumentExpression) {
|
override fun visitLambdaArgumentExpression(lambdaArgumentExpression: FirLambdaArgumentExpression) {
|
||||||
return visitWrappedArgumentExpression(lambdaArgumentExpression)
|
return visitWrappedArgumentExpression(lambdaArgumentExpression)
|
||||||
|
|||||||
-1
@@ -45,7 +45,6 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
|
|||||||
val regularClass = element("RegularClass", Declaration, memberDeclaration, typeParametersOwner, klass)
|
val regularClass = element("RegularClass", Declaration, memberDeclaration, typeParametersOwner, klass)
|
||||||
val sealedClass = element("SealedClass", Declaration, regularClass)
|
val sealedClass = element("SealedClass", Declaration, regularClass)
|
||||||
val typeAlias = element("TypeAlias", Declaration, classLikeDeclaration, memberDeclaration, typeParametersOwner)
|
val typeAlias = element("TypeAlias", Declaration, classLikeDeclaration, memberDeclaration, typeParametersOwner)
|
||||||
val enumEntry = element("EnumEntry", Declaration, regularClass)
|
|
||||||
|
|
||||||
val function = element("Function", Declaration, callableDeclaration, controlFlowGraphOwner, targetElement, annotationContainer, typeParametersOwner, statement)
|
val function = element("Function", Declaration, callableDeclaration, controlFlowGraphOwner, targetElement, annotationContainer, typeParametersOwner, statement)
|
||||||
|
|
||||||
|
|||||||
-19
@@ -67,27 +67,8 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
|||||||
|
|
||||||
impl(anonymousObject) {
|
impl(anonymousObject) {
|
||||||
parents += modifiableClass.withArg(anonymousObject)
|
parents += modifiableClass.withArg(anonymousObject)
|
||||||
default("classKind") {
|
|
||||||
value = "ClassKind.OBJECT"
|
|
||||||
withGetter = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl(enumEntry) {
|
|
||||||
parents += modifiableClass.withArg(regularClass)
|
|
||||||
parents += modifiableTypeParametersOwner
|
|
||||||
default("status", "FirDeclarationStatusImpl(Visibilities.UNKNOWN, Modality.FINAL)")
|
|
||||||
default("classKind") {
|
|
||||||
value = "ClassKind.ENUM_ENTRY"
|
|
||||||
withGetter = true
|
|
||||||
}
|
|
||||||
default("companionObject") {
|
|
||||||
value = "null"
|
|
||||||
withGetter = true
|
|
||||||
}
|
|
||||||
default("typeRef", "session.builtinTypes.enumType")
|
|
||||||
useTypes(visibilitiesType, modalityType)
|
|
||||||
}
|
|
||||||
|
|
||||||
impl(typeAlias) {
|
impl(typeAlias) {
|
||||||
parents += modifiableTypeParametersOwner
|
parents += modifiableTypeParametersOwner
|
||||||
|
|||||||
-5
@@ -243,11 +243,6 @@ object NodeConfigurator : AbstractFieldConfigurator() {
|
|||||||
+annotations
|
+annotations
|
||||||
}
|
}
|
||||||
|
|
||||||
enumEntry.configure {
|
|
||||||
+arguments.withTransform()
|
|
||||||
+field(typeRef)
|
|
||||||
}
|
|
||||||
|
|
||||||
anonymousFunction.configure {
|
anonymousFunction.configure {
|
||||||
parentArg(function, "F", anonymousFunction)
|
parentArg(function, "F", anonymousFunction)
|
||||||
+symbol("FirAnonymousFunctionSymbol")
|
+symbol("FirAnonymousFunctionSymbol")
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ fun <T> bar(a: Any): T = a as T
|
|||||||
fun <T> foo() {
|
fun <T> foo() {
|
||||||
foo<Color.RED>()
|
foo<Color.RED>()
|
||||||
foo<RedAlias>()
|
foo<RedAlias>()
|
||||||
bar<Color.RED>(Color.RED)
|
<!INAPPLICABLE_CANDIDATE!>bar<!><Color.RED>(Color.RED)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Array<Color.RED>.foo(entries: Array<Color.RED>): Array<Color.RED> = null!!
|
fun Array<Color.RED>.foo(entries: Array<Color.RED>): Array<Color.RED> = null!!
|
||||||
+4
-4
@@ -16,12 +16,12 @@ enum class C {
|
|||||||
|
|
||||||
E4 {
|
E4 {
|
||||||
fun c() {
|
fun c() {
|
||||||
this.<!UNRESOLVED_REFERENCE!>B<!>()
|
this.B()
|
||||||
|
|
||||||
C.A()
|
C.A()
|
||||||
A()
|
A()
|
||||||
//TODO: should be resolved with error
|
//TODO: should be resolved with error
|
||||||
this.<!UNRESOLVED_REFERENCE!>A<!>()
|
this.A()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,6 +45,6 @@ fun f() {
|
|||||||
C.A()
|
C.A()
|
||||||
C.<!UNRESOLVED_REFERENCE!>B<!>()
|
C.<!UNRESOLVED_REFERENCE!>B<!>()
|
||||||
|
|
||||||
C.E3.O_O
|
C.E3.<!UNRESOLVED_REFERENCE!>O_O<!>
|
||||||
C.E3.G()
|
C.E3.<!UNRESOLVED_REFERENCE!>G<!>()
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -16,12 +16,12 @@ enum class C {
|
|||||||
|
|
||||||
E4 {
|
E4 {
|
||||||
fun c() {
|
fun c() {
|
||||||
this.<!UNRESOLVED_REFERENCE!>B<!>()
|
this.B()
|
||||||
|
|
||||||
C.A()
|
C.A()
|
||||||
A()
|
A()
|
||||||
//TODO: should be resolved with error
|
//TODO: should be resolved with error
|
||||||
this.<!UNRESOLVED_REFERENCE!>A<!>()
|
this.A()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,6 +45,6 @@ fun f() {
|
|||||||
C.A()
|
C.A()
|
||||||
C.<!UNRESOLVED_REFERENCE!>B<!>()
|
C.<!UNRESOLVED_REFERENCE!>B<!>()
|
||||||
|
|
||||||
C.E3.O_O
|
C.E3.<!UNRESOLVED_REFERENCE!>O_O<!>
|
||||||
C.E3.G()
|
C.E3.<!UNRESOLVED_REFERENCE!>G<!>()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package kt1193
|
|||||||
|
|
||||||
enum class MyEnum(val i: Int) {
|
enum class MyEnum(val i: Int) {
|
||||||
A(12),
|
A(12),
|
||||||
B //no error
|
<!INAPPLICABLE_CANDIDATE!>B<!> //no error
|
||||||
}
|
}
|
||||||
|
|
||||||
open class A(x: Int = 1)
|
open class A(x: Int = 1)
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ enum class TestOk(val x: String = "OK") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class TestErrors(val x: String) {
|
enum class TestErrors(val x: String) {
|
||||||
TEST1,
|
<!INAPPLICABLE_CANDIDATE!>TEST1,<!>
|
||||||
TEST2<!INAPPLICABLE_CANDIDATE!><!>(),
|
TEST2<!INAPPLICABLE_CANDIDATE!><!>(),
|
||||||
TEST3("Hello")
|
TEST3("Hello")
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -13,4 +13,4 @@ fun f1() = E.FIRST.foo()
|
|||||||
fun f2() = E.FIRST.(foo)()
|
fun f2() = E.FIRST.(foo)()
|
||||||
fun f3() = E.SECOND.foo()
|
fun f3() = E.SECOND.foo()
|
||||||
fun f4() = E.SECOND.(foo)()
|
fun f4() = E.SECOND.(foo)()
|
||||||
fun f5() = E.SECOND.A()
|
fun f5() = E.SECOND.<!UNRESOLVED_REFERENCE!>A<!>()
|
||||||
|
|||||||
+1
-1
@@ -13,4 +13,4 @@ fun f1() = E.FIRST.foo()
|
|||||||
fun f2() = E.FIRST.(foo)()
|
fun f2() = E.FIRST.(foo)()
|
||||||
fun f3() = E.SECOND.foo()
|
fun f3() = E.SECOND.foo()
|
||||||
fun f4() = E.SECOND.(foo)()
|
fun f4() = E.SECOND.(foo)()
|
||||||
fun f5() = E.SECOND.A()
|
fun f5() = E.SECOND.<!UNRESOLVED_REFERENCE!>A<!>()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
enum interface Some {
|
enum interface Some {
|
||||||
// Enum part
|
// Enum part
|
||||||
D;
|
<!UNRESOLVED_REFERENCE!>D;<!>
|
||||||
|
|
||||||
// Interface like part
|
// Interface like part
|
||||||
fun test()
|
fun test()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
enum class E {
|
enum class E {
|
||||||
E1 {
|
E1 {
|
||||||
override fun foo() = outerFun() <!AMBIGUITY!>+<!> super.<!UNRESOLVED_REFERENCE!>outerFun<!>()
|
override fun foo() = outerFun() + super.outerFun()
|
||||||
},
|
},
|
||||||
E2 {
|
E2 {
|
||||||
override fun foo() = E1.foo()
|
override fun foo() = E1.foo()
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
// FILE: common.kt
|
// FILE: common.kt
|
||||||
|
|
||||||
expect enum class En(x: Int) {
|
expect enum class En(x: Int) {
|
||||||
E1,
|
<!INAPPLICABLE_CANDIDATE!>E1,<!>
|
||||||
E2(42),
|
E2(42),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -17,5 +17,5 @@ enum class En {
|
|||||||
|
|
||||||
fun ENTRY() = 42
|
fun ENTRY() = 42
|
||||||
|
|
||||||
fun SUBCLASS() = <!AMBIGUITY!>ENTRY<!>()
|
fun SUBCLASS() = ENTRY()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ object A {
|
|||||||
|
|
||||||
enum class B {
|
enum class B {
|
||||||
X() {
|
X() {
|
||||||
constructor()
|
<!CONSTRUCTOR_IN_OBJECT!>constructor()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ enum class MyEnum { A }
|
|||||||
typealias TestAlias = MyEnum
|
typealias TestAlias = MyEnum
|
||||||
|
|
||||||
val test1 = MyEnum.A
|
val test1 = MyEnum.A
|
||||||
val test2 = TestAlias.<!UNRESOLVED_REFERENCE!>A<!>
|
val test2 = TestAlias.A
|
||||||
@@ -25,6 +25,6 @@ import test.EnumAlias
|
|||||||
|
|
||||||
|
|
||||||
fun bar() {
|
fun bar() {
|
||||||
<!UNRESOLVED_REFERENCE!>Entry<!>
|
Entry
|
||||||
EnumAlias.<!UNRESOLVED_REFERENCE!>Entry<!>
|
EnumAlias.Entry
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user