FIR: Render fun status flag in FirRenderer.
This commit is contained in:
committed by
teamcityserver
parent
efe3f7b87e
commit
578fcf2ebf
+1
-1
@@ -1,4 +1,4 @@
|
||||
public abstract interface F : R|kotlin/Any| {
|
||||
public abstract fun interface F : R|kotlin/Any| {
|
||||
public abstract fun R|kotlin/String|.f(x: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,36 +1,36 @@
|
||||
FILE: funInterfaceDeclaration.kt
|
||||
public abstract interface Test1 : R|kotlin/Any| {
|
||||
public abstract fun interface Test1 : R|kotlin/Any| {
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
public abstract fun boo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Test2 : R|kotlin/Any| {
|
||||
public abstract fun interface Test2 : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface Test3 : R|kotlin/Any| {
|
||||
public abstract fun interface Test3 : R|kotlin/Any| {
|
||||
public abstract val a: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Test4 : R|kotlin/Any| {
|
||||
public abstract fun interface Test4 : R|kotlin/Any| {
|
||||
public abstract fun <T> foo(a: R|T|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Test5 : R|kotlin/Any| {
|
||||
public abstract fun interface Test5 : R|kotlin/Any| {
|
||||
public abstract fun foo(a: R|kotlin/Int| = Int(5)): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Test6 : R|kotlin/Any| {
|
||||
public abstract fun interface Test6 : R|kotlin/Any| {
|
||||
public abstract suspend fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Test7 : R|kotlin/Any| {
|
||||
public abstract fun interface Test7 : R|kotlin/Any| {
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Test8 : R|Test7| {
|
||||
public abstract fun interface Test8 : R|Test7| {
|
||||
public abstract fun boo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ FILE: funInterfaceDeclaration.kt
|
||||
}
|
||||
|
||||
}
|
||||
public abstract interface Test10 : R|Test9| {
|
||||
public abstract fun interface Test10 : R|Test9| {
|
||||
public abstract fun test(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ FILE: funInterfaceDeclaration.kt
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
public abstract interface Test12 : R|Test11| {
|
||||
public abstract fun interface Test12 : R|Test11| {
|
||||
public abstract fun test(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
@@ -57,5 +57,5 @@ FILE: funInterfaceDeclaration.kt
|
||||
public abstract suspend fun test(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Test15 : R|Test14| {
|
||||
public abstract fun interface Test15 : R|Test14| {
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: funInterfaceConstructorReference.kt
|
||||
public abstract interface Test : R|kotlin/Any| {
|
||||
public abstract fun interface Test : R|kotlin/Any| {
|
||||
public abstract fun foo(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
FILE: kotlinSam.kt
|
||||
public abstract interface MyRunnable : R|kotlin/Any| {
|
||||
public abstract fun interface MyRunnable : R|kotlin/Any| {
|
||||
public abstract fun foo(x: R|kotlin/Int|): R|kotlin/Boolean|
|
||||
|
||||
}
|
||||
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
|
||||
}
|
||||
private abstract interface PrivateRunnable : R|kotlin/Any| {
|
||||
private abstract fun interface PrivateRunnable : R|kotlin/Any| {
|
||||
public abstract fun bar(x: R|kotlin/String|): R|kotlin/Boolean|
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,22 +1,22 @@
|
||||
FILE: kotlinSam.kt
|
||||
public abstract interface MyRunnable : R|kotlin/Any| {
|
||||
public abstract fun interface MyRunnable : R|kotlin/Any| {
|
||||
public abstract fun foo(x: R|kotlin/Int|): R|kotlin/Boolean|
|
||||
|
||||
}
|
||||
public abstract interface WithProperty : R|kotlin/Any| {
|
||||
public abstract fun interface WithProperty : R|kotlin/Any| {
|
||||
public abstract val x: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
public abstract interface TwoAbstract : R|MyRunnable| {
|
||||
public abstract fun interface TwoAbstract : R|MyRunnable| {
|
||||
public abstract fun bar(): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface Super : R|kotlin/Any| {
|
||||
public abstract fun interface Super : R|kotlin/Any| {
|
||||
public abstract fun foo(x: R|kotlin/Int|): R|kotlin/Any|
|
||||
|
||||
}
|
||||
public abstract interface Derived : R|Super| {
|
||||
public abstract fun interface Derived : R|Super| {
|
||||
public abstract override fun foo(x: R|kotlin/Int|): R|kotlin/Boolean|
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: sam.kt
|
||||
public abstract interface MySam : R|kotlin/Any| {
|
||||
public abstract fun interface MySam : R|kotlin/Any| {
|
||||
public abstract fun run(x: R|kotlin/String|): R|kotlin/Int|
|
||||
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ internal fun IrDeclarationParent.declareThisReceiverParameter(
|
||||
|
||||
fun FirClass<*>.irOrigin(firProvider: FirProvider): IrDeclarationOrigin = when {
|
||||
firProvider.getFirClassifierContainerFileIfAny(symbol) != null -> IrDeclarationOrigin.DEFINED
|
||||
origin == FirDeclarationOrigin.Java -> IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
|
||||
isJava -> IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
|
||||
else -> IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ class JavaScopeProvider(
|
||||
}
|
||||
} ?: return null
|
||||
|
||||
if (superClass.origin is FirDeclarationOrigin.Java) return superClass
|
||||
if (superClass.isJava) return superClass
|
||||
|
||||
return superClass.findJavaSuperClass(useSiteSession)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.EffectiveVisibility
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
@@ -324,7 +325,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
|
||||
print("inner ")
|
||||
}
|
||||
|
||||
// `companion/data` modifiers are only valid for FirRegularClass, but we render them to make sure they are not
|
||||
// `companion/data/fun` modifiers are only valid for FirRegularClass, but we render them to make sure they are not
|
||||
// incorrectly loaded for other declarations during deserialization.
|
||||
if (memberDeclaration.status.isCompanion) {
|
||||
print("companion ")
|
||||
@@ -332,6 +333,13 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
|
||||
if (memberDeclaration.status.isData) {
|
||||
print("data ")
|
||||
}
|
||||
// All Java interfaces are considered `fun` (functional interfaces) for resolution purposes
|
||||
// (see JavaSymbolProvider.createFirJavaClass). Don't render `fun` for Java interfaces; it's not a modifier in Java.
|
||||
val isJavaInterface =
|
||||
memberDeclaration is FirRegularClass && memberDeclaration.classKind == ClassKind.INTERFACE && memberDeclaration.isJava
|
||||
if (memberDeclaration.status.isFun && !isJavaInterface) {
|
||||
print("fun ")
|
||||
}
|
||||
|
||||
if (memberDeclaration.isInline) {
|
||||
print("inline ")
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.fir.declarations.builder.FirTypeParameterBuilder
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirFileImpl
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirRegularClassImpl
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess
|
||||
import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirAnonymousObjectSymbol
|
||||
@@ -23,8 +22,6 @@ import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
import org.jetbrains.kotlin.fir.types.ConeFlexibleType
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.coneTypeSafe
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||
|
||||
fun FirTypeParameterBuilder.addDefaultBoundIfNecessary(isFlexible: Boolean = false) {
|
||||
if (bounds.isEmpty()) {
|
||||
@@ -227,6 +224,8 @@ val FirQualifiedAccess.referredPropertySymbol: FirPropertySymbol?
|
||||
return reference.resolvedSymbol as? FirPropertySymbol
|
||||
}
|
||||
|
||||
inline val FirDeclaration.isJava: Boolean
|
||||
get() = origin == FirDeclarationOrigin.Java
|
||||
inline val FirDeclaration.isFromLibrary: Boolean
|
||||
get() = origin == FirDeclarationOrigin.Library
|
||||
inline val FirDeclaration.isSynthetic: Boolean
|
||||
|
||||
Reference in New Issue
Block a user