Raw FIR: Fix downward propagation of external and inline from
property to default accessors for light-tree.
This commit is contained in:
committed by
Ilya Kirillov
parent
7d31ea3e8f
commit
10d16d10d5
+1
-1
@@ -9,7 +9,7 @@ FILE: annotationArgumentKClassLiteralTypeError.kt
|
||||
|
||||
}
|
||||
public final val <reified T> R|T|.test: R|kotlin/Any|
|
||||
public get(): R|<anonymous><T>| {
|
||||
public inline get(): R|<anonymous><T>| {
|
||||
^ @R|Ann|(<implicitArrayOf>(<getClass>(R|T|), <getClass>(Q|kotlin/Array|))) object : R|kotlin/Any| {
|
||||
private constructor(): R|<anonymous><T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
|
||||
+10
-6
@@ -40,8 +40,6 @@ import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeProjectionModifier
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildSimpleNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirReferencePlaceholderForResolvedAnnotations
|
||||
import org.jetbrains.kotlin.fir.scopes.FirScopeProvider
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.LocalCallableIdConstructor
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.fir.types.builder.*
|
||||
@@ -50,10 +48,7 @@ import org.jetbrains.kotlin.fir.types.impl.FirQualifierPartImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirTypeArgumentListImpl
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.name.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
|
||||
class DeclarationsConverter(
|
||||
@@ -1009,11 +1004,19 @@ class DeclarationsConverter(
|
||||
|
||||
val propertyVisibility = modifiers.getVisibility()
|
||||
|
||||
fun defaultAccessorStatus() =
|
||||
// Downward propagation of `inline` and `external` modifiers (from property to its accessors)
|
||||
FirDeclarationStatusImpl(propertyVisibility, modifiers.getModality()).apply {
|
||||
isInline = modifiers.hasInline()
|
||||
isExternal = modifiers.hasExternal()
|
||||
}
|
||||
|
||||
val convertedAccessors = accessors.map { convertGetterOrSetter(it, returnType, propertyVisibility, modifiers) }
|
||||
this.getter = convertedAccessors.find { it.isGetter }
|
||||
?: FirDefaultPropertyGetter(
|
||||
null, session, FirDeclarationOrigin.Source, returnType, propertyVisibility
|
||||
).also {
|
||||
it.status = defaultAccessorStatus()
|
||||
currentDispatchReceiverType()?.lookupTag?.let { lookupTag ->
|
||||
it.containingClassAttr = lookupTag
|
||||
}
|
||||
@@ -1024,6 +1027,7 @@ class DeclarationsConverter(
|
||||
FirDefaultPropertySetter(
|
||||
null, session, FirDeclarationOrigin.Source, returnType, propertyVisibility
|
||||
).also {
|
||||
it.status = defaultAccessorStatus()
|
||||
currentDispatchReceiverType()?.lookupTag?.let { lookupTag ->
|
||||
it.containingClassAttr = lookupTag
|
||||
}
|
||||
|
||||
+5
@@ -91,6 +91,11 @@ public class LightTree2FirConverterTestCaseGenerated extends AbstractLightTree2F
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("external.kt")
|
||||
public void testExternal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("F.kt")
|
||||
public void testF() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
external class External
|
||||
|
||||
external fun foo(): String
|
||||
|
||||
external val x: Int
|
||||
|
||||
class NotExternal {
|
||||
external fun bar(): String
|
||||
var y: Int
|
||||
external get
|
||||
set(value) {}
|
||||
}
|
||||
|
||||
var z: Int
|
||||
external get
|
||||
external set
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
FILE: external.kt
|
||||
public? final? external class External : R|kotlin/Any| {
|
||||
public? constructor(): R|External| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? external fun foo(): String
|
||||
public? final? external val x: Int
|
||||
public? external get(): Int
|
||||
public? final? class NotExternal : R|kotlin/Any| {
|
||||
public? constructor(): R|NotExternal| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public? final? external fun bar(): String
|
||||
|
||||
public? final? var y: Int
|
||||
public? external get(): Int
|
||||
public? set(value: Int): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
}
|
||||
public? final? external var z: Int
|
||||
public? external get(): Int
|
||||
public? external set(value: Int): R|kotlin/Unit|
|
||||
@@ -0,0 +1,26 @@
|
||||
FILE: external.kt
|
||||
public? final? external class External : R|kotlin/Any| {
|
||||
public? constructor(): R|External| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? external fun foo(): String
|
||||
public? final? external val x: Int
|
||||
public? external get(): Int
|
||||
public? final? class NotExternal : R|kotlin/Any| {
|
||||
public? constructor(): R|NotExternal| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public? final? external fun bar(): String
|
||||
|
||||
public? final? var y: Int
|
||||
public? external get(): Int
|
||||
public? set(value: Int): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public? final? external var z: Int
|
||||
public? external get(): Int
|
||||
public? external set(value: Int): R|kotlin/Unit|
|
||||
+5
@@ -91,6 +91,11 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("external.kt")
|
||||
public void testExternal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("F.kt")
|
||||
public void testF() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
|
||||
|
||||
+5
@@ -91,6 +91,11 @@ public class RawFirBuilderTestCaseGenerated extends AbstractRawFirBuilderTestCas
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("external.kt")
|
||||
public void testExternal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("F.kt")
|
||||
public void testF() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
|
||||
|
||||
@@ -295,6 +295,9 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
|
||||
if (memberDeclaration.isActual) {
|
||||
print("actual ")
|
||||
}
|
||||
if (memberDeclaration.isExternal) {
|
||||
print("external ")
|
||||
}
|
||||
if (memberDeclaration is FirCallableMemberDeclaration<*>) {
|
||||
if (memberDeclaration.isOverride) {
|
||||
print("override ")
|
||||
@@ -329,9 +332,6 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
|
||||
if (memberDeclaration.isTailRec) {
|
||||
print("tailrec ")
|
||||
}
|
||||
if (memberDeclaration.isExternal) {
|
||||
print("external ")
|
||||
}
|
||||
if (memberDeclaration.isSuspend) {
|
||||
print("suspend ")
|
||||
}
|
||||
@@ -514,6 +514,8 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
|
||||
propertyAccessor.renderPhaseIfNeeded()
|
||||
propertyAccessor.annotations.renderAnnotations()
|
||||
print(propertyAccessor.visibility.asString() + " ")
|
||||
print(if (propertyAccessor.isInline) "inline " else "")
|
||||
print(if (propertyAccessor.isExternal) "external " else "")
|
||||
print(if (propertyAccessor.isGetter) "get" else "set")
|
||||
propertyAccessor.valueParameters.renderParameters()
|
||||
print(": ")
|
||||
|
||||
+5
@@ -91,6 +91,11 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("external.kt")
|
||||
public void testExternal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("F.kt")
|
||||
public void testF() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
|
||||
|
||||
+5
@@ -91,6 +91,11 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("external.kt")
|
||||
public void testExternal() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("F.kt")
|
||||
public void testF() throws Exception {
|
||||
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
|
||||
|
||||
Reference in New Issue
Block a user