[FIR] introduce FirReceiverParameter
^KT-54417
This commit is contained in:
committed by
Space Team
parent
e6801abce8
commit
be7d282974
+8
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ internal class KtSymbolByFirBuilder constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun buildExtensionReceiverSymbol(firCallableSymbol: FirCallableSymbol<*>): KtReceiverParameterSymbol? {
|
fun buildExtensionReceiverSymbol(firCallableSymbol: FirCallableSymbol<*>): KtReceiverParameterSymbol? {
|
||||||
if (firCallableSymbol.fir.receiverTypeRef == null) return null
|
if (firCallableSymbol.fir.receiverParameter == null) return null
|
||||||
return extensionReceiverSymbolsCache.cache(firCallableSymbol) {
|
return extensionReceiverSymbolsCache.cache(firCallableSymbol) {
|
||||||
KtFirReceiverParameterSymbol(firCallableSymbol, firResolveSession, token, this@KtSymbolByFirBuilder)
|
KtFirReceiverParameterSymbol(firCallableSymbol, firResolveSession, token, this@KtSymbolByFirBuilder)
|
||||||
}
|
}
|
||||||
@@ -666,7 +666,7 @@ private fun collectReferencedTypeParameters(declaration: FirCallableDeclaration)
|
|||||||
override fun visitSimpleFunction(simpleFunction: FirSimpleFunction) {
|
override fun visitSimpleFunction(simpleFunction: FirSimpleFunction) {
|
||||||
simpleFunction.typeParameters.forEach { it.accept(this) }
|
simpleFunction.typeParameters.forEach { it.accept(this) }
|
||||||
|
|
||||||
simpleFunction.receiverTypeRef?.accept(this)
|
simpleFunction.receiverParameter?.accept(this)
|
||||||
simpleFunction.valueParameters.forEach { it.returnTypeRef.accept(this) }
|
simpleFunction.valueParameters.forEach { it.returnTypeRef.accept(this) }
|
||||||
simpleFunction.returnTypeRef.accept(this)
|
simpleFunction.returnTypeRef.accept(this)
|
||||||
}
|
}
|
||||||
@@ -674,10 +674,14 @@ private fun collectReferencedTypeParameters(declaration: FirCallableDeclaration)
|
|||||||
override fun visitProperty(property: FirProperty) {
|
override fun visitProperty(property: FirProperty) {
|
||||||
property.typeParameters.forEach { it.accept(this) }
|
property.typeParameters.forEach { it.accept(this) }
|
||||||
|
|
||||||
property.receiverTypeRef?.accept(this)
|
property.receiverParameter?.accept(this)
|
||||||
property.returnTypeRef.accept(this)
|
property.returnTypeRef.accept(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun visitReceiverParameter(receiverParameter: FirReceiverParameter) {
|
||||||
|
receiverParameter.type.accept(this)
|
||||||
|
}
|
||||||
|
|
||||||
override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef) {
|
override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef) {
|
||||||
super.visitResolvedTypeRef(resolvedTypeRef)
|
super.visitResolvedTypeRef(resolvedTypeRef)
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -29,15 +29,14 @@ internal class KtFirReceiverParameterSymbol(
|
|||||||
override val token: KtLifetimeToken,
|
override val token: KtLifetimeToken,
|
||||||
private val builder: KtSymbolByFirBuilder
|
private val builder: KtSymbolByFirBuilder
|
||||||
) : KtReceiverParameterSymbol(), KtLifetimeOwner {
|
) : KtReceiverParameterSymbol(), KtLifetimeOwner {
|
||||||
override val psi: PsiElement? by cached { firSymbol.fir.receiverTypeRef?.findPsi(firSymbol.fir.moduleData.session) }
|
override val psi: PsiElement? by cached { firSymbol.fir.receiverParameter?.type?.findPsi(firSymbol.fir.moduleData.session) }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
require(firSymbol.fir.receiverTypeRef != null) { "$firSymbol doesn't have an extension receiver." }
|
require(firSymbol.fir.receiverParameter != null) { "$firSymbol doesn't have an extension receiver." }
|
||||||
}
|
}
|
||||||
|
|
||||||
override val type: KtType by cached {
|
override val type: KtType by cached {
|
||||||
firSymbol.receiverType(builder)
|
firSymbol.receiverType(builder) ?: error("$firSymbol doesn't have an extension receiver.")
|
||||||
?: error("$firSymbol doesn't have an extension receiver.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override val owningCallableSymbol: KtCallableSymbol by cached { builder.callableBuilder.buildCallableSymbol(firSymbol) }
|
override val owningCallableSymbol: KtCallableSymbol by cached { builder.callableBuilder.buildCallableSymbol(firSymbol) }
|
||||||
|
|||||||
-28
@@ -1,28 +0,0 @@
|
|||||||
KtFunctionSymbol:
|
|
||||||
annotationsList: []
|
|
||||||
callableIdIfNonLocal: /foo
|
|
||||||
contextReceivers: []
|
|
||||||
hasStableParameterNames: true
|
|
||||||
isBuiltinFunctionInvoke: false
|
|
||||||
isExtension: true
|
|
||||||
isExternal: false
|
|
||||||
isInfix: false
|
|
||||||
isInline: false
|
|
||||||
isOperator: false
|
|
||||||
isOverride: false
|
|
||||||
isStatic: false
|
|
||||||
isSuspend: false
|
|
||||||
modality: FINAL
|
|
||||||
name: foo
|
|
||||||
origin: SOURCE
|
|
||||||
receiverType: [
|
|
||||||
ReceiverTypeAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
] @R|ReceiverTypeAnnotation|() kotlin/Int
|
|
||||||
returnType: kotlin/Unit
|
|
||||||
symbolKind: TOP_LEVEL
|
|
||||||
typeParameters: []
|
|
||||||
valueParameters: []
|
|
||||||
visibility: Public
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
fun @ReceiverAnnotation @ReceiverTypeAnnotation kotlin.Int.foo()
|
fun @ReceiverTypeAnnotation kotlin.Int.foo()
|
||||||
Vendored
+1
-3
@@ -16,11 +16,9 @@ KtFunctionSymbol:
|
|||||||
name: foo
|
name: foo
|
||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
receiverType: [
|
receiverType: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Int
|
] @R|ReceiverTypeAnnotation|() kotlin/Int
|
||||||
returnType: kotlin/Unit
|
returnType: kotlin/Unit
|
||||||
symbolKind: TOP_LEVEL
|
symbolKind: TOP_LEVEL
|
||||||
typeParameters: []
|
typeParameters: []
|
||||||
|
|||||||
Vendored
+1
-3
@@ -16,11 +16,9 @@ KtPropertyGetterSymbol:
|
|||||||
modality: FINAL
|
modality: FINAL
|
||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
receiverType: [
|
receiverType: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Long
|
] @R|ReceiverTypeAnnotation|() kotlin/Long
|
||||||
returnType: kotlin/Int
|
returnType: kotlin/Int
|
||||||
symbolKind: ACCESSOR
|
symbolKind: ACCESSOR
|
||||||
typeParameters: []
|
typeParameters: []
|
||||||
|
|||||||
-57
@@ -1,57 +0,0 @@
|
|||||||
KtKotlinPropertySymbol:
|
|
||||||
annotationsList: []
|
|
||||||
callableIdIfNonLocal: /prop
|
|
||||||
contextReceivers: []
|
|
||||||
getter: KtPropertyGetterSymbol:
|
|
||||||
annotationsList: []
|
|
||||||
callableIdIfNonLocal: null
|
|
||||||
contextReceivers: []
|
|
||||||
hasBody: true
|
|
||||||
hasStableParameterNames: true
|
|
||||||
isDefault: false
|
|
||||||
isExtension: false
|
|
||||||
isInline: false
|
|
||||||
isOverride: false
|
|
||||||
modality: FINAL
|
|
||||||
origin: SOURCE
|
|
||||||
receiverType: [
|
|
||||||
ReceiverTypeAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
] @R|ReceiverTypeAnnotation|() kotlin/Long
|
|
||||||
returnType: kotlin/Boolean
|
|
||||||
symbolKind: ACCESSOR
|
|
||||||
typeParameters: []
|
|
||||||
valueParameters: []
|
|
||||||
visibility: Public
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
hasBackingField: false
|
|
||||||
hasGetter: true
|
|
||||||
hasSetter: false
|
|
||||||
initializer: null
|
|
||||||
isConst: false
|
|
||||||
isDelegatedProperty: false
|
|
||||||
isExtension: true
|
|
||||||
isFromPrimaryConstructor: false
|
|
||||||
isLateInit: false
|
|
||||||
isOverride: false
|
|
||||||
isStatic: false
|
|
||||||
isVal: true
|
|
||||||
modality: FINAL
|
|
||||||
name: prop
|
|
||||||
origin: SOURCE
|
|
||||||
receiverType: [
|
|
||||||
ReceiverTypeAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
] @R|ReceiverTypeAnnotation|() kotlin/Long
|
|
||||||
returnType: kotlin/Boolean
|
|
||||||
setter: null
|
|
||||||
symbolKind: TOP_LEVEL
|
|
||||||
typeParameters: []
|
|
||||||
visibility: Public
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
getterDeprecationStatus: null
|
|
||||||
javaGetterName: getProp
|
|
||||||
javaSetterName: null
|
|
||||||
setterDeprecationStatus: null
|
|
||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
val @ReceiverAnnotation @ReceiverTypeAnnotation kotlin.Long.prop: kotlin.Boolean
|
val @ReceiverTypeAnnotation kotlin.Long.prop: kotlin.Boolean
|
||||||
get()
|
get()
|
||||||
Vendored
+2
-6
@@ -15,11 +15,9 @@ KtKotlinPropertySymbol:
|
|||||||
modality: FINAL
|
modality: FINAL
|
||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
receiverType: [
|
receiverType: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Long
|
] @R|ReceiverTypeAnnotation|() kotlin/Long
|
||||||
returnType: kotlin/Boolean
|
returnType: kotlin/Boolean
|
||||||
symbolKind: ACCESSOR
|
symbolKind: ACCESSOR
|
||||||
typeParameters: []
|
typeParameters: []
|
||||||
@@ -43,11 +41,9 @@ KtKotlinPropertySymbol:
|
|||||||
name: prop
|
name: prop
|
||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
receiverType: [
|
receiverType: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Long
|
] @R|ReceiverTypeAnnotation|() kotlin/Long
|
||||||
returnType: kotlin/Boolean
|
returnType: kotlin/Boolean
|
||||||
setter: null
|
setter: null
|
||||||
symbolKind: TOP_LEVEL
|
symbolKind: TOP_LEVEL
|
||||||
|
|||||||
Vendored
+1
-3
@@ -2,8 +2,6 @@ KtReceiverParameterSymbol:
|
|||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
owningCallableSymbol: KtFunctionSymbol(/foo)
|
owningCallableSymbol: KtFunctionSymbol(/foo)
|
||||||
type: [
|
type: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Int
|
] @R|ReceiverTypeAnnotation|() kotlin/Int
|
||||||
+1
-3
@@ -2,11 +2,9 @@ KtReceiverParameterSymbol:
|
|||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
owningCallableSymbol: KtFunctionSymbol(/foo)
|
owningCallableSymbol: KtFunctionSymbol(/foo)
|
||||||
type: [
|
type: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Int
|
] @R|ReceiverTypeAnnotation|() kotlin/Int
|
||||||
getContainingModule: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
getContainingModule: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
||||||
|
|
||||||
deprecationStatus: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
deprecationStatus: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
||||||
|
|||||||
Vendored
+1
-3
@@ -2,8 +2,6 @@ KtReceiverParameterSymbol:
|
|||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
owningCallableSymbol: KtKotlinPropertySymbol(/prop)
|
owningCallableSymbol: KtKotlinPropertySymbol(/prop)
|
||||||
type: [
|
type: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Long
|
] @R|ReceiverTypeAnnotation|() kotlin/Long
|
||||||
+1
-3
@@ -2,11 +2,9 @@ KtReceiverParameterSymbol:
|
|||||||
origin: SOURCE
|
origin: SOURCE
|
||||||
owningCallableSymbol: KtKotlinPropertySymbol(/prop)
|
owningCallableSymbol: KtKotlinPropertySymbol(/prop)
|
||||||
type: [
|
type: [
|
||||||
ReceiverAnnotation()
|
|
||||||
psi: KtAnnotationEntry
|
|
||||||
ReceiverTypeAnnotation()
|
ReceiverTypeAnnotation()
|
||||||
psi: KtAnnotationEntry
|
psi: KtAnnotationEntry
|
||||||
] @RECEIVER:R|ReceiverAnnotation|() @R|ReceiverTypeAnnotation|() kotlin/Long
|
] @R|ReceiverTypeAnnotation|() kotlin/Long
|
||||||
getContainingModule: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
getContainingModule: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
||||||
|
|
||||||
deprecationStatus: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
deprecationStatus: Could not render due to java.lang.IllegalArgumentException: Failed requirement.
|
||||||
|
|||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -41,8 +41,8 @@ object KtDeclarationAndFirDeclarationEqualityChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun receiverTypeMatch(psi: KtCallableDeclaration, fir: FirCallableDeclaration): Boolean {
|
private fun receiverTypeMatch(psi: KtCallableDeclaration, fir: FirCallableDeclaration): Boolean {
|
||||||
if ((fir.receiverTypeRef != null) != (psi.receiverTypeReference != null)) return false
|
if ((fir.receiverParameter != null) != (psi.receiverTypeReference != null)) return false
|
||||||
if (fir.receiverTypeRef != null && !isTheSameTypes(psi.receiverTypeReference!!, fir.receiverTypeRef!!, isVararg = false)) {
|
if (fir.receiverParameter != null && !isTheSameTypes(psi.receiverTypeReference!!, fir.receiverParameter!!.type, isVararg = false)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@@ -223,7 +223,7 @@ object KtDeclarationAndFirDeclarationEqualityChecker {
|
|||||||
|
|
||||||
@TestOnly
|
@TestOnly
|
||||||
fun renderFir(firFunction: FirFunction): String = buildString {
|
fun renderFir(firFunction: FirFunction): String = buildString {
|
||||||
appendLine("receiver: ${firFunction.receiverTypeRef?.renderTypeAsKotlinType()}")
|
appendLine("receiver: ${firFunction.receiverParameter?.type?.renderTypeAsKotlinType()}")
|
||||||
firFunction.valueParameters.forEach { parameter ->
|
firFunction.valueParameters.forEach { parameter ->
|
||||||
appendLine("${parameter.name}: ${parameter.returnTypeRef.renderTypeAsKotlinType()}")
|
appendLine("${parameter.name}: ${parameter.returnTypeRef.renderTypeAsKotlinType()}")
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,8 +9,8 @@ import org.jetbrains.kotlin.fir.FirSession
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirVariable
|
import org.jetbrains.kotlin.fir.declarations.FirVariable
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.*
|
import org.jetbrains.kotlin.fir.resolve.calls.*
|
||||||
import org.jetbrains.kotlin.fir.types.receiverType
|
|
||||||
import org.jetbrains.kotlin.fir.types.coneType
|
import org.jetbrains.kotlin.fir.types.coneType
|
||||||
|
import org.jetbrains.kotlin.fir.types.receiverType
|
||||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +87,7 @@ class CheckExtensionForCompletionCandidateInfoProvider(
|
|||||||
val callHasExtensionReceiver = explicitReceiverKind() == ExplicitReceiverKind.EXTENSION_RECEIVER
|
val callHasExtensionReceiver = explicitReceiverKind() == ExplicitReceiverKind.EXTENSION_RECEIVER
|
||||||
|| implicitExtensionReceiverValue() != null
|
|| implicitExtensionReceiverValue() != null
|
||||||
val fir = callableSymbol.fir
|
val fir = callableSymbol.fir
|
||||||
val candidateHasExtensionReceiver = fir.receiverTypeRef != null
|
val candidateHasExtensionReceiver = fir.receiverParameter != null
|
||||||
|| fir is FirVariable && fir.returnTypeRef.coneType.receiverType(firSession) != null
|
|| fir is FirVariable && fir.returnTypeRef.coneType.receiverType(firSession) != null
|
||||||
callHasExtensionReceiver != candidateHasExtensionReceiver
|
callHasExtensionReceiver != candidateHasExtensionReceiver
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ internal fun checkReturnTypeRefIsResolved(declaration: FirCallableDeclaration, a
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun checkReceiverTypeRefIsResolved(declaration: FirCallableDeclaration, acceptImplicitTypeRef: Boolean = false) {
|
internal fun checkReceiverTypeRefIsResolved(declaration: FirCallableDeclaration, acceptImplicitTypeRef: Boolean = false) {
|
||||||
val receiverTypeRef = declaration.receiverTypeRef ?: return
|
val receiverTypeRef = declaration.receiverParameter?.type ?: return
|
||||||
checkTypeRefIsResolved(receiverTypeRef, typeRefName = "receiver type", declaration, acceptImplicitTypeRef)
|
checkTypeRefIsResolved(receiverTypeRef, typeRefName = "receiver type", declaration, acceptImplicitTypeRef)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,13 +9,13 @@ import kotlinx.collections.immutable.PersistentMap
|
|||||||
import kotlinx.collections.immutable.persistentMapOf
|
import kotlinx.collections.immutable.persistentMapOf
|
||||||
import org.jetbrains.kotlin.KtSourceElement
|
import org.jetbrains.kotlin.KtSourceElement
|
||||||
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
|
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
|
||||||
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.analysis.cfa.util.*
|
import org.jetbrains.kotlin.fir.analysis.cfa.util.*
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
|
||||||
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
|
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
|
||||||
import org.jetbrains.kotlin.fir.contracts.coneEffects
|
import org.jetbrains.kotlin.fir.contracts.coneEffects
|
||||||
import org.jetbrains.kotlin.fir.contracts.description.ConeCallsEffectDeclaration
|
import org.jetbrains.kotlin.fir.contracts.description.ConeCallsEffectDeclaration
|
||||||
@@ -56,7 +56,7 @@ object FirCallsEffectAnalyzer : FirControlFlowChecker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function.receiverTypeRef.isFunctionalTypeRef(session)) {
|
if (function.receiverParameter?.type.isFunctionalTypeRef(session)) {
|
||||||
val effectDeclaration = function.contractDescription.getParameterCallsEffectDeclaration(-1)
|
val effectDeclaration = function.contractDescription.getParameterCallsEffectDeclaration(-1)
|
||||||
if (effectDeclaration != null) functionalTypeEffects[function.symbol] = effectDeclaration
|
if (effectDeclaration != null) functionalTypeEffects[function.symbol] = effectDeclaration
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -1,19 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* 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.analysis.cfa
|
package org.jetbrains.kotlin.fir.analysis.cfa
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
import org.jetbrains.kotlin.fir.BuiltinTypes
|
import org.jetbrains.kotlin.fir.BuiltinTypes
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.analysis.cfa.util.previousCfgNodes
|
import org.jetbrains.kotlin.fir.analysis.cfa.util.previousCfgNodes
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker
|
import org.jetbrains.kotlin.fir.analysis.checkers.cfa.FirControlFlowChecker
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.isSupertypeOf
|
import org.jetbrains.kotlin.fir.analysis.checkers.isSupertypeOf
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
|
||||||
import org.jetbrains.kotlin.fir.contracts.FirResolvedContractDescription
|
import org.jetbrains.kotlin.fir.contracts.FirResolvedContractDescription
|
||||||
import org.jetbrains.kotlin.fir.contracts.coneEffects
|
import org.jetbrains.kotlin.fir.contracts.coneEffects
|
||||||
import org.jetbrains.kotlin.fir.contracts.description.*
|
import org.jetbrains.kotlin.fir.contracts.description.*
|
||||||
@@ -226,9 +226,9 @@ object FirReturnsImpliesAnalyzer : FirControlFlowChecker() {
|
|||||||
private fun FirFunction.getParameterType(symbol: FirBasedSymbol<*>, context: CheckerContext): ConeKotlinType? {
|
private fun FirFunction.getParameterType(symbol: FirBasedSymbol<*>, context: CheckerContext): ConeKotlinType? {
|
||||||
val typeRef = if (this.symbol == symbol) {
|
val typeRef = if (this.symbol == symbol) {
|
||||||
if (symbol is FirPropertyAccessorSymbol) {
|
if (symbol is FirPropertyAccessorSymbol) {
|
||||||
context.containingProperty?.receiverTypeRef
|
context.containingProperty?.receiverParameter?.type
|
||||||
} else {
|
} else {
|
||||||
receiverTypeRef
|
receiverParameter?.type
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
valueParameters.find { it.symbol == symbol }?.returnTypeRef
|
valueParameters.find { it.symbol == symbol }?.returnTypeRef
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ interface FirDeclarationPresenter {
|
|||||||
|
|
||||||
fun represent(it: FirVariable) = buildString {
|
fun represent(it: FirVariable) = buildString {
|
||||||
append('[')
|
append('[')
|
||||||
it.receiverTypeRef?.let {
|
it.receiverParameter?.type?.let {
|
||||||
appendRepresentation(it)
|
appendRepresentation(it)
|
||||||
}
|
}
|
||||||
append(']')
|
append(']')
|
||||||
@@ -172,7 +172,7 @@ interface FirDeclarationPresenter {
|
|||||||
}
|
}
|
||||||
append('>')
|
append('>')
|
||||||
append('[')
|
append('[')
|
||||||
it.receiverTypeRef?.let {
|
it.receiverParameter?.type?.let {
|
||||||
appendRepresentation(it)
|
appendRepresentation(it)
|
||||||
}
|
}
|
||||||
append(']')
|
append(']')
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ object FirClassVarianceChecker : FirClassChecker() {
|
|||||||
|
|
||||||
checkVarianceConflict(member.returnTypeRef, returnTypeVariance, context, reporter, returnSource)
|
checkVarianceConflict(member.returnTypeRef, returnTypeVariance, context, reporter, returnSource)
|
||||||
|
|
||||||
val receiverTypeRef = member.receiverTypeRef
|
val receiverTypeRef = member.receiverParameter?.type
|
||||||
if (receiverTypeRef != null) {
|
if (receiverTypeRef != null) {
|
||||||
checkVarianceConflict(receiverTypeRef, Variance.IN_VARIANCE, context, reporter)
|
checkVarianceConflict(receiverTypeRef, Variance.IN_VARIANCE, context, reporter)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ object FirExposedVisibilityDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkMemberReceiver(declaration.receiverTypeRef, declaration as? FirCallableDeclaration, reporter, context)
|
checkMemberReceiver(declaration.receiverParameter?.type, declaration as? FirCallableDeclaration, reporter, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkProperty(declaration: FirProperty, reporter: DiagnosticReporter, context: CheckerContext) {
|
private fun checkProperty(declaration: FirProperty, reporter: DiagnosticReporter, context: CheckerContext) {
|
||||||
@@ -172,7 +172,7 @@ object FirExposedVisibilityDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkMemberReceiver(declaration.receiverTypeRef, declaration, reporter, context)
|
checkMemberReceiver(declaration.receiverParameter?.type, declaration, reporter, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkMemberReceiver(
|
private fun checkMemberReceiver(
|
||||||
|
|||||||
+5
-5
@@ -1,18 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* 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.analysis.checkers.declaration
|
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
|
||||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||||
|
|
||||||
object FirInfixFunctionDeclarationChecker : FirBasicDeclarationChecker() {
|
object FirInfixFunctionDeclarationChecker : FirBasicDeclarationChecker() {
|
||||||
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
@@ -30,7 +30,7 @@ object FirInfixFunctionDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
function: FirSimpleFunction,
|
function: FirSimpleFunction,
|
||||||
context: CheckerContext
|
context: CheckerContext
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (function.receiverTypeRef != null) return true
|
if (function.receiverParameter != null) return true
|
||||||
return context.containingDeclarations.lastOrNull() is FirClass
|
return context.containingDeclarations.lastOrNull() is FirClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-9
@@ -1,16 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2010-2021 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.
|
* 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.analysis.checkers.declaration
|
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||||
|
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.Checks.Returns
|
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.Checks.Returns
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.Checks.ValueParametersCount
|
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.Checks.ValueParametersCount
|
||||||
@@ -21,7 +18,6 @@ import org.jetbrains.kotlin.fir.analysis.checkers.declaration.Checks.noDefaultAn
|
|||||||
import org.jetbrains.kotlin.fir.analysis.checkers.hasModifier
|
import org.jetbrains.kotlin.fir.analysis.checkers.hasModifier
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.isSupertypeOf
|
import org.jetbrains.kotlin.fir.analysis.checkers.isSupertypeOf
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.overriddenFunctions
|
import org.jetbrains.kotlin.fir.analysis.checkers.overriddenFunctions
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
||||||
@@ -101,7 +97,7 @@ private object Checks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val memberOrExtension = simple("must be a member or an extension function") {
|
val memberOrExtension = simple("must be a member or an extension function") {
|
||||||
it.dispatchReceiverType != null || it.receiverTypeRef != null
|
it.dispatchReceiverType != null || it.receiverParameter != null
|
||||||
}
|
}
|
||||||
|
|
||||||
val member = simple("must be a member function") {
|
val member = simple("must be a member function") {
|
||||||
@@ -213,7 +209,7 @@ private object OperatorFunctionChecks {
|
|||||||
setOf(INC, DEC),
|
setOf(INC, DEC),
|
||||||
memberOrExtension,
|
memberOrExtension,
|
||||||
Checks.full("receiver must be a supertype of the return type") { ctx, function ->
|
Checks.full("receiver must be a supertype of the return type") { ctx, function ->
|
||||||
val receiver = function.dispatchReceiverType ?: function.receiverTypeRef?.coneType ?: return@full false
|
val receiver = function.dispatchReceiverType ?: function.receiverParameter?.type?.coneType ?: return@full false
|
||||||
function.returnTypeRef.coneType.isSubtypeOf(ctx.session.typeContext, receiver)
|
function.returnTypeRef.coneType.isSubtypeOf(ctx.session.typeContext, receiver)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ object FirPropertyTypeParametersChecker : FirPropertyChecker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declaration.receiverTypeRef?.let { collectAllTypes(it.coneType) }
|
declaration.receiverParameter?.type?.let { collectAllTypes(it.coneType) }
|
||||||
declaration.contextReceivers.forEach { collectAllTypes(it.typeRef.coneType) }
|
declaration.contextReceivers.forEach { collectAllTypes(it.typeRef.coneType) }
|
||||||
|
|
||||||
val usedNames = usedTypes.filterIsInstance<ConeTypeParameterType>().map { it.lookupTag.name }
|
val usedNames = usedTypes.filterIsInstance<ConeTypeParameterType>().map { it.lookupTag.name }
|
||||||
|
|||||||
+4
-4
@@ -1,18 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* 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.analysis.checkers.declaration
|
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||||
|
|
||||||
import org.jetbrains.kotlin.KtFakeSourceElementKind
|
import org.jetbrains.kotlin.KtFakeSourceElementKind
|
||||||
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.SourceNavigator
|
import org.jetbrains.kotlin.fir.analysis.checkers.SourceNavigator
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.checkUnderscoreDiagnostics
|
import org.jetbrains.kotlin.fir.analysis.checkers.checkUnderscoreDiagnostics
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.isUnderscore
|
import org.jetbrains.kotlin.fir.analysis.checkers.isUnderscore
|
||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
import org.jetbrains.kotlin.fir.types.FirUserTypeRef
|
||||||
@@ -69,7 +69,7 @@ object FirReservedUnderscoreDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
|
|
||||||
val returnOrReceiverTypeRef = when (declaration) {
|
val returnOrReceiverTypeRef = when (declaration) {
|
||||||
is FirValueParameter -> declaration.returnTypeRef
|
is FirValueParameter -> declaration.returnTypeRef
|
||||||
is FirFunction -> declaration.receiverTypeRef
|
is FirFunction -> declaration.receiverParameter?.type
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ internal fun checkPropertyInitializer(
|
|||||||
!backingFieldRequired -> {
|
!backingFieldRequired -> {
|
||||||
reporter.reportOn(it, FirErrors.PROPERTY_INITIALIZER_NO_BACKING_FIELD, context)
|
reporter.reportOn(it, FirErrors.PROPERTY_INITIALIZER_NO_BACKING_FIELD, context)
|
||||||
}
|
}
|
||||||
property.receiverTypeRef != null -> {
|
property.receiverParameter != null -> {
|
||||||
reporter.reportOn(it, FirErrors.EXTENSION_PROPERTY_WITH_BACKING_FIELD, context)
|
reporter.reportOn(it, FirErrors.EXTENSION_PROPERTY_WITH_BACKING_FIELD, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ internal fun checkPropertyInitializer(
|
|||||||
!isExternal &&
|
!isExternal &&
|
||||||
!property.hasExplicitBackingField
|
!property.hasExplicitBackingField
|
||||||
) {
|
) {
|
||||||
if (property.receiverTypeRef != null && !property.hasAccessorImplementation) {
|
if (property.receiverParameter != null && !property.hasAccessorImplementation) {
|
||||||
reporter.reportOn(propertySource, FirErrors.EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT, context)
|
reporter.reportOn(propertySource, FirErrors.EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT, context)
|
||||||
} else if (reachable) { // TODO: can be suppressed not to report diagnostics about no body
|
} else if (reachable) { // TODO: can be suppressed not to report diagnostics about no body
|
||||||
if (containingClass == null || property.hasAccessorImplementation) {
|
if (containingClass == null || property.hasAccessorImplementation) {
|
||||||
|
|||||||
+2
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.descriptors.ClassKind
|
|||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.hasModifier
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.modality
|
import org.jetbrains.kotlin.fir.analysis.checkers.modality
|
||||||
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
||||||
import org.jetbrains.kotlin.fir.containingClassForStaticMemberAttr
|
import org.jetbrains.kotlin.fir.containingClassForStaticMemberAttr
|
||||||
@@ -21,8 +20,6 @@ import org.jetbrains.kotlin.fir.symbols.impl.*
|
|||||||
import org.jetbrains.kotlin.fir.types.classId
|
import org.jetbrains.kotlin.fir.types.classId
|
||||||
import org.jetbrains.kotlin.fir.types.coneType
|
import org.jetbrains.kotlin.fir.types.coneType
|
||||||
import org.jetbrains.kotlin.fir.types.isBoolean
|
import org.jetbrains.kotlin.fir.types.isBoolean
|
||||||
import org.jetbrains.kotlin.fir.types.isNullableAny
|
|
||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
|
|
||||||
internal fun isInsideExpectClass(containingClass: FirClass, context: CheckerContext): Boolean {
|
internal fun isInsideExpectClass(containingClass: FirClass, context: CheckerContext): Boolean {
|
||||||
@@ -122,7 +119,7 @@ fun FirClassSymbol<*>.primaryConstructorSymbol(): FirConstructorSymbol? {
|
|||||||
fun FirSimpleFunction.isTypedEqualsInInlineClass(session: FirSession): Boolean =
|
fun FirSimpleFunction.isTypedEqualsInInlineClass(session: FirSession): Boolean =
|
||||||
containingClassLookupTag()?.toFirRegularClassSymbol(session)?.run {
|
containingClassLookupTag()?.toFirRegularClassSymbol(session)?.run {
|
||||||
with(this@isTypedEqualsInInlineClass) {
|
with(this@isTypedEqualsInInlineClass) {
|
||||||
contextReceivers.isEmpty() && receiverTypeRef == null && name == OperatorNameConventions.EQUALS
|
contextReceivers.isEmpty() && receiverParameter == null && name == OperatorNameConventions.EQUALS
|
||||||
&& this@run.isInline && valueParameters.size == 1 && returnTypeRef.isBoolean
|
&& this@run.isInline && valueParameters.size == 1 && returnTypeRef.isBoolean
|
||||||
&& valueParameters[0].returnTypeRef.coneType.classId == this@run.classId
|
&& valueParameters[0].returnTypeRef.coneType.classId == this@run.classId
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ import org.jetbrains.kotlin.fir.scopes.processDirectlyOverriddenFunctions
|
|||||||
import org.jetbrains.kotlin.fir.scopes.processDirectlyOverriddenProperties
|
import org.jetbrains.kotlin.fir.scopes.processDirectlyOverriddenProperties
|
||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
|
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
|
||||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -173,7 +173,7 @@ object FirOptInUsageBaseChecker {
|
|||||||
if (fir !is FirConstructor) {
|
if (fir !is FirConstructor) {
|
||||||
// Without coneTypeSafe v fails in MT test (FirRenderer.kt)
|
// Without coneTypeSafe v fails in MT test (FirRenderer.kt)
|
||||||
fir.returnTypeRef.coneTypeSafe<ConeKotlinType>().addExperimentalities(context, result, visited)
|
fir.returnTypeRef.coneTypeSafe<ConeKotlinType>().addExperimentalities(context, result, visited)
|
||||||
fir.receiverTypeRef?.coneType.addExperimentalities(context, result, visited)
|
fir.receiverParameter?.type?.coneType.addExperimentalities(context, result, visited)
|
||||||
if (fir is FirSimpleFunction) {
|
if (fir is FirSimpleFunction) {
|
||||||
fir.valueParameters.forEach {
|
fir.valueParameters.forEach {
|
||||||
it.returnTypeRef.coneType.addExperimentalities(context, result, visited)
|
it.returnTypeRef.coneType.addExperimentalities(context, result, visited)
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ object FirSuspendCallChecker : FirQualifiedAccessExpressionChecker() {
|
|||||||
|
|
||||||
val enclosingSuspendFunctionDispatchReceiverOwnerSymbol =
|
val enclosingSuspendFunctionDispatchReceiverOwnerSymbol =
|
||||||
(enclosingSuspendFunction.dispatchReceiverType as? ConeClassLikeType)?.lookupTag?.toFirRegularClassSymbol(session)
|
(enclosingSuspendFunction.dispatchReceiverType as? ConeClassLikeType)?.lookupTag?.toFirRegularClassSymbol(session)
|
||||||
val enclosingSuspendFunctionExtensionReceiverOwnerSymbol = enclosingSuspendFunction.takeIf { it.receiverTypeRef != null }?.symbol
|
val enclosingSuspendFunctionExtensionReceiverOwnerSymbol = enclosingSuspendFunction.takeIf { it.receiverParameter != null }?.symbol
|
||||||
|
|
||||||
val (dispatchReceiverExpression, extensionReceiverExpression, extensionReceiverParameterType) =
|
val (dispatchReceiverExpression, extensionReceiverExpression, extensionReceiverParameterType) =
|
||||||
expression.computeReceiversInfo(session, calledDeclarationSymbol)
|
expression.computeReceiversInfo(session, calledDeclarationSymbol)
|
||||||
|
|||||||
+19
-9
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.FirElement
|
|||||||
import org.jetbrains.kotlin.fir.PrivateForInline
|
import org.jetbrains.kotlin.fir.PrivateForInline
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.builder.buildReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.resolve.defaultType
|
import org.jetbrains.kotlin.fir.resolve.defaultType
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
@@ -63,10 +64,13 @@ abstract class AbstractDiagnosticCollectorVisitor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun visitClassAndChildren(klass: FirClass, type: ConeClassLikeType) {
|
private fun visitClassAndChildren(klass: FirClass, type: ConeClassLikeType) {
|
||||||
val typeRef = buildResolvedTypeRef {
|
val receiverParameter = buildReceiverParameter {
|
||||||
this.type = type
|
this.type = buildResolvedTypeRef {
|
||||||
|
this.type = type
|
||||||
|
}
|
||||||
}
|
}
|
||||||
visitWithDeclarationAndReceiver(klass, (klass as? FirRegularClass)?.name, typeRef)
|
|
||||||
|
visitWithDeclarationAndReceiver(klass, (klass as? FirRegularClass)?.name, receiverParameter)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitRegularClass(regularClass: FirRegularClass, data: Nothing?) {
|
override fun visitRegularClass(regularClass: FirRegularClass, data: Nothing?) {
|
||||||
@@ -87,7 +91,7 @@ abstract class AbstractDiagnosticCollectorVisitor(
|
|||||||
|
|
||||||
override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: Nothing?) {
|
override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: Nothing?) {
|
||||||
withAnnotationContainer(simpleFunction) {
|
withAnnotationContainer(simpleFunction) {
|
||||||
visitWithDeclarationAndReceiver(simpleFunction, simpleFunction.name, simpleFunction.receiverTypeRef)
|
visitWithDeclarationAndReceiver(simpleFunction, simpleFunction.name, simpleFunction.receiverParameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +111,7 @@ abstract class AbstractDiagnosticCollectorVisitor(
|
|||||||
visitWithDeclarationAndReceiver(
|
visitWithDeclarationAndReceiver(
|
||||||
anonymousFunction,
|
anonymousFunction,
|
||||||
labelName,
|
labelName,
|
||||||
anonymousFunction.receiverTypeRef
|
anonymousFunction.receiverParameter
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,7 +131,13 @@ abstract class AbstractDiagnosticCollectorVisitor(
|
|||||||
override fun visitPropertyAccessor(propertyAccessor: FirPropertyAccessor, data: Nothing?) {
|
override fun visitPropertyAccessor(propertyAccessor: FirPropertyAccessor, data: Nothing?) {
|
||||||
val property = context.containingDeclarations.last() as FirProperty
|
val property = context.containingDeclarations.last() as FirProperty
|
||||||
withAnnotationContainer(propertyAccessor) {
|
withAnnotationContainer(propertyAccessor) {
|
||||||
visitWithDeclarationAndReceiver(propertyAccessor, property.name, property.receiverTypeRef)
|
visitWithDeclarationAndReceiver(propertyAccessor, property.name, property.receiverParameter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitReceiverParameter(receiverParameter: FirReceiverParameter, data: Nothing?) {
|
||||||
|
withAnnotationContainer(receiverParameter) {
|
||||||
|
visitNestedElements(receiverParameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,12 +241,12 @@ abstract class AbstractDiagnosticCollectorVisitor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun visitWithDeclarationAndReceiver(declaration: FirDeclaration, labelName: Name?, receiverTypeRef: FirTypeRef?) {
|
private fun visitWithDeclarationAndReceiver(declaration: FirDeclaration, labelName: Name?, receiverParameter: FirReceiverParameter?) {
|
||||||
visitWithDeclaration(declaration) {
|
visitWithDeclaration(declaration) {
|
||||||
withLabelAndReceiverType(
|
withLabelAndReceiverType(
|
||||||
labelName,
|
labelName,
|
||||||
declaration,
|
declaration,
|
||||||
receiverTypeRef?.coneType
|
receiverParameter?.type?.coneType
|
||||||
) {
|
) {
|
||||||
visitNestedElements(declaration)
|
visitNestedElements(declaration)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* that can be found in the license/LICENSE.txt file.
|
* 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.dump
|
package org.jetbrains.kotlin.fir.dump
|
||||||
@@ -967,7 +967,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun FlowContent.generateReceiver(declaration: FirCallableDeclaration) {
|
private fun FlowContent.generateReceiver(declaration: FirCallableDeclaration) {
|
||||||
generateReceiver(declaration.receiverTypeRef)
|
generateReceiver(declaration.receiverParameter?.type)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun FlowContent.generateReceiver(receiverTypeRef: FirTypeRef?) {
|
private fun FlowContent.generateReceiver(receiverTypeRef: FirTypeRef?) {
|
||||||
@@ -1119,7 +1119,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
|||||||
private fun FlowContent.describeVerbose(symbol: FirCallableSymbol<*>, fir: FirFunction) {
|
private fun FlowContent.describeVerbose(symbol: FirCallableSymbol<*>, fir: FirFunction) {
|
||||||
describeTypeParameters(fir)
|
describeTypeParameters(fir)
|
||||||
|
|
||||||
fir.receiverTypeRef?.let {
|
fir.receiverParameter?.type?.let {
|
||||||
+"("
|
+"("
|
||||||
generate(it)
|
generate(it)
|
||||||
+")."
|
+")."
|
||||||
@@ -1138,7 +1138,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
|||||||
private fun FlowContent.describeVerbose(symbol: FirCallableSymbol<*>, fir: FirVariable) {
|
private fun FlowContent.describeVerbose(symbol: FirCallableSymbol<*>, fir: FirVariable) {
|
||||||
if (fir is FirTypeParametersOwner) describeTypeParameters(fir)
|
if (fir is FirTypeParametersOwner) describeTypeParameters(fir)
|
||||||
|
|
||||||
fir.receiverTypeRef?.let {
|
fir.receiverParameter?.type?.let {
|
||||||
+"("
|
+"("
|
||||||
generate(it)
|
generate(it)
|
||||||
+")."
|
+")."
|
||||||
@@ -1766,7 +1766,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
|||||||
iline {
|
iline {
|
||||||
generateLabel(anonymousFunction.label)
|
generateLabel(anonymousFunction.label)
|
||||||
keyword("fun ")
|
keyword("fun ")
|
||||||
generateReceiver(anonymousFunction.receiverTypeRef)
|
generateReceiver(anonymousFunction.receiverParameter?.type)
|
||||||
|
|
||||||
+"("
|
+"("
|
||||||
generateList(anonymousFunction.valueParameters) {
|
generateList(anonymousFunction.valueParameters) {
|
||||||
|
|||||||
+2
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -7,15 +7,12 @@ package org.jetbrains.kotlin.fir.deserialization
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
|
import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange
|
||||||
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
|
import org.jetbrains.kotlin.fir.contracts.FirContractDescription
|
||||||
import org.jetbrains.kotlin.fir.contracts.FirEffectDeclaration
|
|
||||||
import org.jetbrains.kotlin.fir.contracts.builder.buildEffectDeclaration
|
|
||||||
import org.jetbrains.kotlin.fir.contracts.builder.buildResolvedContractDescription
|
import org.jetbrains.kotlin.fir.contracts.builder.buildResolvedContractDescription
|
||||||
import org.jetbrains.kotlin.fir.contracts.description.*
|
import org.jetbrains.kotlin.fir.contracts.description.*
|
||||||
import org.jetbrains.kotlin.fir.contracts.toFirEffectDeclaration
|
import org.jetbrains.kotlin.fir.contracts.toFirEffectDeclaration
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
import org.jetbrains.kotlin.fir.declarations.FirContractDescriptionOwner
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||||
import org.jetbrains.kotlin.fir.expressions.LogicOperationKind
|
import org.jetbrains.kotlin.fir.expressions.LogicOperationKind
|
||||||
import org.jetbrains.kotlin.fir.types.ConeAttributes
|
|
||||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||||
import org.jetbrains.kotlin.fir.types.isBoolean
|
import org.jetbrains.kotlin.fir.types.isBoolean
|
||||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||||
@@ -132,7 +129,7 @@ class FirContractDeserializer(private val c: FirDeserializationContext) {
|
|||||||
val name: String
|
val name: String
|
||||||
val typeRef = if (valueParameterIndex < 0) {
|
val typeRef = if (valueParameterIndex < 0) {
|
||||||
name = "this"
|
name = "this"
|
||||||
ownerFunction.receiverTypeRef
|
ownerFunction.receiverParameter?.type
|
||||||
} else {
|
} else {
|
||||||
val parameter = ownerFunction.valueParameters.getOrNull(valueParameterIndex) ?: return null
|
val parameter = ownerFunction.valueParameters.getOrNull(valueParameterIndex) ?: return null
|
||||||
name = parameter.name.asString()
|
name = parameter.name.asString()
|
||||||
|
|||||||
+17
-6
@@ -1,13 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* 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.deserialization
|
package org.jetbrains.kotlin.fir.deserialization
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.fir.*
|
import org.jetbrains.kotlin.fir.FirModuleData
|
||||||
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.caches.firCachesFactory
|
import org.jetbrains.kotlin.fir.caches.firCachesFactory
|
||||||
|
import org.jetbrains.kotlin.fir.containingClassForStaticMemberAttr
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.*
|
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
||||||
@@ -20,6 +22,7 @@ import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionStub
|
|||||||
import org.jetbrains.kotlin.fir.resolve.defaultType
|
import org.jetbrains.kotlin.fir.resolve.defaultType
|
||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
|
import org.jetbrains.kotlin.fir.toEffectiveVisibility
|
||||||
import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType
|
import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType
|
||||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
@@ -366,9 +369,13 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
moduleData = c.moduleData
|
moduleData = c.moduleData
|
||||||
origin = FirDeclarationOrigin.Library
|
origin = FirDeclarationOrigin.Library
|
||||||
this.returnTypeRef = returnTypeRef
|
this.returnTypeRef = returnTypeRef
|
||||||
receiverTypeRef = proto.receiverType(c.typeTable)?.toTypeRef(local).apply {
|
receiverParameter = proto.receiverType(c.typeTable)?.toTypeRef(local)?.let { receiverType ->
|
||||||
annotations += receiverAnnotations
|
buildReceiverParameter {
|
||||||
|
type = receiverType
|
||||||
|
annotations += receiverAnnotations
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
name = callableName
|
name = callableName
|
||||||
this.isVar = isVar
|
this.isVar = isVar
|
||||||
this.symbol = symbol
|
this.symbol = symbol
|
||||||
@@ -467,9 +474,13 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
moduleData = c.moduleData
|
moduleData = c.moduleData
|
||||||
origin = deserializationOrigin
|
origin = deserializationOrigin
|
||||||
returnTypeRef = proto.returnType(local.typeTable).toTypeRef(local)
|
returnTypeRef = proto.returnType(local.typeTable).toTypeRef(local)
|
||||||
receiverTypeRef = proto.receiverType(local.typeTable)?.toTypeRef(local).apply {
|
receiverParameter = proto.receiverType(local.typeTable)?.toTypeRef(local)?.let { receiverType ->
|
||||||
annotations += receiverAnnotations
|
buildReceiverParameter {
|
||||||
|
type = receiverType
|
||||||
|
annotations += receiverAnnotations
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
name = callableName
|
name = callableName
|
||||||
val visibility = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags))
|
val visibility = ProtoEnumFlags.visibility(Flags.VISIBILITY.get(flags))
|
||||||
status = FirResolvedDeclarationStatusImpl(
|
status = FirResolvedDeclarationStatusImpl(
|
||||||
|
|||||||
+9
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -178,8 +178,9 @@ class FirElementSerializer private constructor(
|
|||||||
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(representation.underlyingPropertyName)
|
builder.inlineClassUnderlyingPropertyName = getSimpleNameIndex(representation.underlyingPropertyName)
|
||||||
|
|
||||||
val property = callableMembers.single {
|
val property = callableMembers.single {
|
||||||
it is FirProperty && it.receiverTypeRef == null && it.name == representation.underlyingPropertyName
|
it is FirProperty && it.receiverParameter == null && it.name == representation.underlyingPropertyName
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!property.visibility.isPublicAPI) {
|
if (!property.visibility.isPublicAPI) {
|
||||||
if (useTypeTable()) {
|
if (useTypeTable()) {
|
||||||
builder.inlineClassUnderlyingTypeId = typeId(representation.underlyingType)
|
builder.inlineClassUnderlyingTypeId = typeId(representation.underlyingType)
|
||||||
@@ -328,8 +329,9 @@ class FirElementSerializer private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val receiverTypeRef = property.receiverTypeRef
|
val receiverParameter = property.receiverParameter
|
||||||
if (receiverTypeRef != null) {
|
if (receiverParameter != null) {
|
||||||
|
val receiverTypeRef = receiverParameter.type
|
||||||
if (useTypeTable()) {
|
if (useTypeTable()) {
|
||||||
builder.receiverTypeId = local.typeId(receiverTypeRef)
|
builder.receiverTypeId = local.typeId(receiverTypeRef)
|
||||||
} else {
|
} else {
|
||||||
@@ -411,8 +413,9 @@ class FirElementSerializer private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val receiverTypeRef = function.receiverTypeRef
|
val receiverParameter = function.receiverParameter
|
||||||
if (receiverTypeRef != null) {
|
if (receiverParameter != null) {
|
||||||
|
val receiverTypeRef = receiverParameter.type
|
||||||
if (useTypeTable()) {
|
if (useTypeTable()) {
|
||||||
builder.receiverTypeId = local.typeId(receiverTypeRef)
|
builder.receiverTypeId = local.typeId(receiverTypeRef)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ open class FirJvmMangleComputer(
|
|||||||
mangleType(builder, it.typeRef.coneType)
|
mangleType(builder, it.typeRef.coneType)
|
||||||
}
|
}
|
||||||
|
|
||||||
val receiverType = receiverTypeRef ?: (this as? FirPropertyAccessor)?.propertySymbol?.fir?.receiverTypeRef
|
val receiverType = receiverParameter?.type ?: (this as? FirPropertyAccessor)?.propertySymbol?.fir?.receiverParameter?.type
|
||||||
receiverType?.let {
|
receiverType?.let {
|
||||||
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
|
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
|
||||||
mangleType(builder, it.coneType)
|
mangleType(builder, it.coneType)
|
||||||
@@ -317,7 +317,7 @@ open class FirJvmMangleComputer(
|
|||||||
builder.appendSignature(MangleConstant.STATIC_MEMBER_MARK)
|
builder.appendSignature(MangleConstant.STATIC_MEMBER_MARK)
|
||||||
}
|
}
|
||||||
|
|
||||||
variable.receiverTypeRef?.let {
|
variable.receiverParameter?.type?.let {
|
||||||
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
|
builder.appendSignature(MangleConstant.EXTENSION_RECEIVER_PREFIX)
|
||||||
mangleType(builder, it.coneType)
|
mangleType(builder, it.coneType)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ class FirJvmSerializerExtension(
|
|||||||
this is FirSimpleFunction && isInline && !isSuspend && !isParamAssertionsDisabled &&
|
this is FirSimpleFunction && isInline && !isSuspend && !isParamAssertionsDisabled &&
|
||||||
!Visibilities.isPrivate(visibility) &&
|
!Visibilities.isPrivate(visibility) &&
|
||||||
(valueParameters.any { it.returnTypeRef.coneType.isBuiltinFunctionalType(session) } ||
|
(valueParameters.any { it.returnTypeRef.coneType.isBuiltinFunctionalType(session) } ||
|
||||||
receiverTypeRef?.coneType?.isBuiltinFunctionalType(session) == true)
|
receiverParameter?.type?.coneType?.isBuiltinFunctionalType(session) == true)
|
||||||
|
|
||||||
override fun serializeProperty(
|
override fun serializeProperty(
|
||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
@@ -320,7 +320,7 @@ class FirJvmSerializerExtension(
|
|||||||
private fun requiresSignature(function: FirFunction, desc: String): Boolean {
|
private fun requiresSignature(function: FirFunction, desc: String): Boolean {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
sb.append("(")
|
sb.append("(")
|
||||||
val receiverTypeRef = function.receiverTypeRef
|
val receiverTypeRef = function.receiverParameter?.type
|
||||||
if (receiverTypeRef != null) {
|
if (receiverTypeRef != null) {
|
||||||
val receiverDesc = mapTypeDefault(receiverTypeRef) ?: return true
|
val receiverDesc = mapTypeDefault(receiverTypeRef) ?: return true
|
||||||
sb.append(receiverDesc)
|
sb.append(receiverDesc)
|
||||||
|
|||||||
+16
-7
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -17,10 +17,7 @@ import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
|
|||||||
import org.jetbrains.kotlin.fir.backend.FirMetadataSource
|
import org.jetbrains.kotlin.fir.backend.FirMetadataSource
|
||||||
import org.jetbrains.kotlin.fir.containingClassForLocal
|
import org.jetbrains.kotlin.fir.containingClassForLocal
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildAnonymousFunction
|
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildProperty
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildPropertyAccessor
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameterCopy
|
|
||||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
import org.jetbrains.kotlin.fir.languageVersionSettings
|
||||||
import org.jetbrains.kotlin.fir.packageFqName
|
import org.jetbrains.kotlin.fir.packageFqName
|
||||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||||
@@ -192,11 +189,18 @@ private fun FirFunction.copyToFreeAnonymousFunction(approximator: AbstractTypeAp
|
|||||||
val function = this
|
val function = this
|
||||||
return buildAnonymousFunction {
|
return buildAnonymousFunction {
|
||||||
val typeParameterSet = function.typeParameters.filterIsInstanceTo(mutableSetOf<FirTypeParameter>())
|
val typeParameterSet = function.typeParameters.filterIsInstanceTo(mutableSetOf<FirTypeParameter>())
|
||||||
|
annotations += function.annotations
|
||||||
moduleData = function.moduleData
|
moduleData = function.moduleData
|
||||||
origin = FirDeclarationOrigin.Source
|
origin = FirDeclarationOrigin.Source
|
||||||
symbol = FirAnonymousFunctionSymbol()
|
symbol = FirAnonymousFunctionSymbol()
|
||||||
returnTypeRef = function.returnTypeRef.approximated(approximator, typeParameterSet, toSuper = true)
|
returnTypeRef = function.returnTypeRef.approximated(approximator, typeParameterSet, toSuper = true)
|
||||||
receiverTypeRef = function.receiverTypeRef?.approximated(approximator, typeParameterSet, toSuper = false)
|
receiverParameter = function.receiverParameter?.let { receiverParameter ->
|
||||||
|
buildReceiverParameter {
|
||||||
|
type = receiverParameter.type.approximated(approximator, typeParameterSet, toSuper = false)
|
||||||
|
annotations += receiverParameter.annotations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isLambda = (function as? FirAnonymousFunction)?.isLambda == true
|
isLambda = (function as? FirAnonymousFunction)?.isLambda == true
|
||||||
hasExplicitParameterList = (function as? FirAnonymousFunction)?.hasExplicitParameterList == true
|
hasExplicitParameterList = (function as? FirAnonymousFunction)?.hasExplicitParameterList == true
|
||||||
valueParameters.addAll(function.valueParameters.map {
|
valueParameters.addAll(function.valueParameters.map {
|
||||||
@@ -242,7 +246,12 @@ internal fun FirProperty.copyToFreeProperty(approximator: AbstractTypeApproximat
|
|||||||
val newPropertySymbol = FirPropertySymbol(property.symbol.callableId)
|
val newPropertySymbol = FirPropertySymbol(property.symbol.callableId)
|
||||||
symbol = newPropertySymbol
|
symbol = newPropertySymbol
|
||||||
returnTypeRef = property.returnTypeRef.approximated(approximator, typeParameterSet, toSuper = true)
|
returnTypeRef = property.returnTypeRef.approximated(approximator, typeParameterSet, toSuper = true)
|
||||||
receiverTypeRef = property.receiverTypeRef?.approximated(approximator, typeParameterSet, toSuper = false)
|
receiverParameter = property.receiverParameter?.let { receiverParameter ->
|
||||||
|
buildReceiverParameter {
|
||||||
|
type = receiverParameter.type.approximated(approximator, typeParameterSet, toSuper = false)
|
||||||
|
annotations += receiverParameter.annotations
|
||||||
|
}
|
||||||
|
}
|
||||||
name = property.name
|
name = property.name
|
||||||
initializer = property.initializer
|
initializer = property.initializer
|
||||||
delegate = property.delegate
|
delegate = property.delegate
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
val thisOrigin = IrDeclarationOrigin.DEFINED
|
val thisOrigin = IrDeclarationOrigin.DEFINED
|
||||||
if (function !is FirConstructor) {
|
if (function !is FirConstructor) {
|
||||||
val receiverTypeRef =
|
val receiverTypeRef =
|
||||||
if (function !is FirPropertyAccessor && function != null) function.receiverTypeRef
|
if (function !is FirPropertyAccessor && function != null) function.receiverParameter?.type
|
||||||
else parentPropertyReceiverType
|
else parentPropertyReceiverType
|
||||||
if (receiverTypeRef != null) {
|
if (receiverTypeRef != null) {
|
||||||
extensionReceiverParameter = receiverTypeRef.convertWithOffsets { startOffset, endOffset ->
|
extensionReceiverParameter = receiverTypeRef.convertWithOffsets { startOffset, endOffset ->
|
||||||
@@ -729,7 +729,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
bindAndDeclareParameters(
|
bindAndDeclareParameters(
|
||||||
propertyAccessor, irParent,
|
propertyAccessor, irParent,
|
||||||
thisReceiverOwner, isStatic = irParent !is IrClass || propertyAccessor?.isStatic == true,
|
thisReceiverOwner, isStatic = irParent !is IrClass || propertyAccessor?.isStatic == true,
|
||||||
parentPropertyReceiverType = property.receiverTypeRef
|
parentPropertyReceiverType = property.receiverParameter?.type
|
||||||
)
|
)
|
||||||
leaveScope(this)
|
leaveScope(this)
|
||||||
if (irParent != null) {
|
if (irParent != null) {
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ class CallAndReferenceGenerator(
|
|||||||
qualifiedAccess.convertWithOffsets { startOffset, endOffset ->
|
qualifiedAccess.convertWithOffsets { startOffset, endOffset ->
|
||||||
val callableDeclaration = firSymbol?.fir as? FirCallableDeclaration
|
val callableDeclaration = firSymbol?.fir as? FirCallableDeclaration
|
||||||
val targetType = callableDeclaration?.dispatchReceiverType?.toIrType()
|
val targetType = callableDeclaration?.dispatchReceiverType?.toIrType()
|
||||||
?: callableDeclaration?.receiverTypeRef?.toIrType()
|
?: callableDeclaration?.receiverParameter?.type?.toIrType()
|
||||||
?: error("Couldn't get the proper receiver")
|
?: error("Couldn't get the proper receiver")
|
||||||
IrTypeOperatorCallImpl(
|
IrTypeOperatorCallImpl(
|
||||||
startOffset, endOffset, targetType,
|
startOffset, endOffset, targetType,
|
||||||
@@ -1061,7 +1061,7 @@ class CallAndReferenceGenerator(
|
|||||||
if (ownerFunction?.extensionReceiverParameter != null) {
|
if (ownerFunction?.extensionReceiverParameter != null) {
|
||||||
extensionReceiver = qualifiedAccess.findIrExtensionReceiver(explicitReceiverExpression)?.let {
|
extensionReceiver = qualifiedAccess.findIrExtensionReceiver(explicitReceiverExpression)?.let {
|
||||||
((qualifiedAccess.calleeReference as FirResolvedNamedReference)
|
((qualifiedAccess.calleeReference as FirResolvedNamedReference)
|
||||||
.resolvedSymbol.fir as? FirCallableDeclaration)?.receiverTypeRef?.let { receiverType ->
|
.resolvedSymbol.fir as? FirCallableDeclaration)?.receiverParameter?.type?.let { receiverType ->
|
||||||
with(visitor.implicitCastInserter) {
|
with(visitor.implicitCastInserter) {
|
||||||
it.cast(
|
it.cast(
|
||||||
qualifiedAccess.extensionReceiver,
|
qualifiedAccess.extensionReceiver,
|
||||||
|
|||||||
+6
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -7,16 +7,17 @@ package org.jetbrains.kotlin.fir.backend.generators
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.fir.backend.*
|
import org.jetbrains.kotlin.fir.backend.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.ConeDynamicType
|
||||||
|
import org.jetbrains.kotlin.fir.types.coneType
|
||||||
|
import org.jetbrains.kotlin.fir.types.isMarkedNullable
|
||||||
|
import org.jetbrains.kotlin.fir.types.isNullable
|
||||||
import org.jetbrains.kotlin.ir.builders.primitiveOp1
|
import org.jetbrains.kotlin.ir.builders.primitiveOp1
|
||||||
import org.jetbrains.kotlin.ir.builders.primitiveOp2
|
import org.jetbrains.kotlin.ir.builders.primitiveOp2
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrDynamicType
|
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
|
||||||
import org.jetbrains.kotlin.ir.util.getSimpleFunction
|
import org.jetbrains.kotlin.ir.util.getSimpleFunction
|
||||||
|
|
||||||
internal class OperatorExpressionGenerator(
|
internal class OperatorExpressionGenerator(
|
||||||
@@ -73,7 +74,7 @@ internal class OperatorExpressionGenerator(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comparisonExpression.compareToCall.toResolvedCallableSymbol()?.fir?.receiverTypeRef != null) {
|
if (comparisonExpression.compareToCall.toResolvedCallableSymbol()?.fir?.receiverParameter != null) {
|
||||||
return fallbackToRealCall()
|
return fallbackToRealCall()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ class Fir2IrLazyPropertyAccessor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override var extensionReceiverParameter: IrValueParameter? by lazyVar(lock) {
|
override var extensionReceiverParameter: IrValueParameter? by lazyVar(lock) {
|
||||||
firParentProperty.receiverTypeRef?.let {
|
firParentProperty.receiverParameter?.type?.let {
|
||||||
createThisReceiverParameter(it.toIrType(typeConverter, conversionTypeContext))
|
createThisReceiverParameter(it.toIrType(typeConverter, conversionTypeContext))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -13,7 +13,10 @@ import org.jetbrains.kotlin.fir.declarations.FirFunction
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||||
import org.jetbrains.kotlin.fir.initialSignatureAttr
|
import org.jetbrains.kotlin.fir.initialSignatureAttr
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||||
import org.jetbrains.kotlin.ir.declarations.lazy.lazyVar
|
import org.jetbrains.kotlin.ir.declarations.lazy.lazyVar
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||||
@@ -56,7 +59,7 @@ class Fir2IrLazySimpleFunction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override var extensionReceiverParameter: IrValueParameter? by lazyVar(lock) {
|
override var extensionReceiverParameter: IrValueParameter? by lazyVar(lock) {
|
||||||
fir.receiverTypeRef?.let {
|
fir.receiverParameter?.type?.let {
|
||||||
createThisReceiverParameter(it.toIrType(typeConverter))
|
createThisReceiverParameter(it.toIrType(typeConverter))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
|||||||
override var resolvePhase: FirResolvePhase,
|
override var resolvePhase: FirResolvePhase,
|
||||||
override val dispatchReceiverType: ConeSimpleKotlinType?,
|
override val dispatchReceiverType: ConeSimpleKotlinType?,
|
||||||
) : FirConstructor() {
|
) : FirConstructor() {
|
||||||
override val receiverTypeRef: FirTypeRef? get() = null
|
override val receiverParameter: FirReceiverParameter? get() = null
|
||||||
override var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
override var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -96,7 +96,7 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirJavaConstructor {
|
override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirJavaConstructor {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,8 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
|||||||
valueParameters += newValueParameters
|
valueParameters += newValueParameters
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {}
|
override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?) {}
|
||||||
|
|
||||||
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
||||||
deprecationsProvider = newDeprecationsProvider
|
deprecationsProvider = newDeprecationsProvider
|
||||||
}
|
}
|
||||||
@@ -196,8 +197,8 @@ class FirJavaConstructorBuilder : FirConstructorBuilder() {
|
|||||||
throw IllegalStateException()
|
throw IllegalStateException()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Modification of 'receiverTypeRef' has no impact for FirJavaConstructorBuilder", level = DeprecationLevel.HIDDEN)
|
@Deprecated("Modification of 'receiverParameter' has no impact for FirJavaConstructorBuilder", level = DeprecationLevel.HIDDEN)
|
||||||
override var receiverTypeRef: FirTypeRef?
|
override var receiverParameter: FirReceiverParameter?
|
||||||
get() = throw IllegalStateException()
|
get() = throw IllegalStateException()
|
||||||
set(@Suppress("UNUSED_PARAMETER") value) {
|
set(@Suppress("UNUSED_PARAMETER") value) {
|
||||||
throw IllegalStateException()
|
throw IllegalStateException()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ class FirJavaField @FirImplementationDetail constructor(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val receiverTypeRef: FirTypeRef? get() = null
|
override val receiverParameter: FirReceiverParameter? get() = null
|
||||||
override val isVal: Boolean get() = !isVar
|
override val isVal: Boolean get() = !isVar
|
||||||
override val getter: FirPropertyAccessor? get() = null
|
override val getter: FirPropertyAccessor? get() = null
|
||||||
override val setter: FirPropertyAccessor? get() = null
|
override val setter: FirPropertyAccessor? get() = null
|
||||||
@@ -91,7 +91,7 @@ class FirJavaField @FirImplementationDetail constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirField {
|
override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirField {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ class FirJavaField @FirImplementationDetail constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {}
|
override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?) {}
|
||||||
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {}
|
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {}
|
||||||
|
|
||||||
override fun <D> transformDelegate(transformer: FirTransformer<D>, data: D): FirField {
|
override fun <D> transformDelegate(transformer: FirTransformer<D>, data: D): FirField {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
|||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val receiverTypeRef: FirTypeRef?
|
override val receiverParameter: FirReceiverParameter?
|
||||||
get() = null
|
get() = null
|
||||||
|
|
||||||
override val body: FirBlock?
|
override val body: FirBlock?
|
||||||
@@ -89,7 +89,7 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
|||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
returnTypeRef.accept(visitor, data)
|
returnTypeRef.accept(visitor, data)
|
||||||
receiverTypeRef?.accept(visitor, data)
|
receiverParameter?.accept(visitor, data)
|
||||||
controlFlowGraphReference?.accept(visitor, data)
|
controlFlowGraphReference?.accept(visitor, data)
|
||||||
valueParameters.forEach { it.accept(visitor, data) }
|
valueParameters.forEach { it.accept(visitor, data) }
|
||||||
body?.accept(visitor, data)
|
body?.accept(visitor, data)
|
||||||
@@ -101,7 +101,7 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
|||||||
|
|
||||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
|
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
|
||||||
transformReturnTypeRef(transformer, data)
|
transformReturnTypeRef(transformer, data)
|
||||||
transformReceiverTypeRef(transformer, data)
|
transformReceiverParameter(transformer, data)
|
||||||
controlFlowGraphReference = controlFlowGraphReference?.transformSingle(transformer, data)
|
controlFlowGraphReference = controlFlowGraphReference?.transformSingle(transformer, data)
|
||||||
transformValueParameters(transformer, data)
|
transformValueParameters(transformer, data)
|
||||||
transformBody(transformer, data)
|
transformBody(transformer, data)
|
||||||
@@ -117,7 +117,7 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
|
override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirSimpleFunction {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,8 +156,7 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
|||||||
returnTypeRef = newReturnTypeRef
|
returnTypeRef = newReturnTypeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {
|
override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?) {}
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
||||||
deprecationsProvider = newDeprecationsProvider
|
deprecationsProvider = newDeprecationsProvider
|
||||||
|
|||||||
+4
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class FirJavaValueParameter @FirImplementationDetail constructor(
|
|||||||
|
|
||||||
override val annotations: List<FirAnnotation> by lazy { annotationBuilder() }
|
override val annotations: List<FirAnnotation> by lazy { annotationBuilder() }
|
||||||
|
|
||||||
override val receiverTypeRef: FirTypeRef?
|
override val receiverParameter: FirReceiverParameter?
|
||||||
get() = null
|
get() = null
|
||||||
|
|
||||||
override val deprecationsProvider: DeprecationsProvider
|
override val deprecationsProvider: DeprecationsProvider
|
||||||
@@ -116,7 +116,7 @@ class FirJavaValueParameter @FirImplementationDetail constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirValueParameter {
|
override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirValueParameter {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,8 +165,7 @@ class FirJavaValueParameter @FirImplementationDetail constructor(
|
|||||||
returnTypeRef = newReturnTypeRef
|
returnTypeRef = newReturnTypeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {
|
override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?) {}
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
||||||
|
|
||||||
|
|||||||
+10
-8
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -13,10 +13,7 @@ import org.jetbrains.kotlin.fir.caches.FirCachesFactory
|
|||||||
import org.jetbrains.kotlin.fir.caches.createCache
|
import org.jetbrains.kotlin.fir.caches.createCache
|
||||||
import org.jetbrains.kotlin.fir.caches.firCachesFactory
|
import org.jetbrains.kotlin.fir.caches.firCachesFactory
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.FirConstructorBuilder
|
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.FirPrimaryConstructorBuilder
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.FirSimpleFunctionBuilder
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
||||||
@@ -215,7 +212,7 @@ class FirSignatureEnhancement(
|
|||||||
|
|
||||||
val defaultQualifiers = firMethod.computeDefaultQualifiers()
|
val defaultQualifiers = firMethod.computeDefaultQualifiers()
|
||||||
val overriddenMembers = (firMethod as? FirSimpleFunction)?.overridden().orEmpty()
|
val overriddenMembers = (firMethod as? FirSimpleFunction)?.overridden().orEmpty()
|
||||||
val hasReceiver = overriddenMembers.any { it.receiverTypeRef != null }
|
val hasReceiver = overriddenMembers.any { it.receiverParameter != null }
|
||||||
|
|
||||||
val newReceiverTypeRef = if (firMethod is FirJavaMethod && hasReceiver) {
|
val newReceiverTypeRef = if (firMethod is FirJavaMethod && hasReceiver) {
|
||||||
enhanceReceiverType(firMethod, overriddenMembers, defaultQualifiers)
|
enhanceReceiverType(firMethod, overriddenMembers, defaultQualifiers)
|
||||||
@@ -306,7 +303,12 @@ class FirSignatureEnhancement(
|
|||||||
moduleData = this@FirSignatureEnhancement.moduleData
|
moduleData = this@FirSignatureEnhancement.moduleData
|
||||||
origin = FirDeclarationOrigin.Enhancement
|
origin = FirDeclarationOrigin.Enhancement
|
||||||
returnTypeRef = newReturnTypeRef
|
returnTypeRef = newReturnTypeRef
|
||||||
receiverTypeRef = newReceiverTypeRef
|
receiverParameter = newReceiverTypeRef?.let { receiverType ->
|
||||||
|
buildReceiverParameter {
|
||||||
|
type = receiverType
|
||||||
|
annotations += firMethod.valueParameters.first().annotations
|
||||||
|
}
|
||||||
|
}
|
||||||
this.name = name!!
|
this.name = name!!
|
||||||
status = firMethod.status
|
status = firMethod.status
|
||||||
symbol = FirNamedFunctionSymbol(methodId)
|
symbol = FirNamedFunctionSymbol(methodId)
|
||||||
@@ -504,7 +506,7 @@ class FirSignatureEnhancement(
|
|||||||
object Receiver : TypeInSignature() {
|
object Receiver : TypeInSignature() {
|
||||||
override fun getTypeRef(member: FirCallableDeclaration): FirTypeRef {
|
override fun getTypeRef(member: FirCallableDeclaration): FirTypeRef {
|
||||||
if (member is FirJavaMethod) return member.valueParameters[0].returnTypeRef
|
if (member is FirJavaMethod) return member.valueParameters[0].returnTypeRef
|
||||||
return member.receiverTypeRef!!
|
return member.receiverParameter?.type!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ class JavaOverrideChecker internal constructor(
|
|||||||
|
|
||||||
private fun FirCallableDeclaration.isTypeParameterDependent(): Boolean =
|
private fun FirCallableDeclaration.isTypeParameterDependent(): Boolean =
|
||||||
typeParameters.isNotEmpty() || returnTypeRef.isTypeParameterDependent() ||
|
typeParameters.isNotEmpty() || returnTypeRef.isTypeParameterDependent() ||
|
||||||
receiverTypeRef.isTypeParameterDependent() ||
|
receiverParameter?.type.isTypeParameterDependent() ||
|
||||||
this is FirSimpleFunction && valueParameters.any { it.returnTypeRef.isTypeParameterDependent() }
|
this is FirSimpleFunction && valueParameters.any { it.returnTypeRef.isTypeParameterDependent() }
|
||||||
|
|
||||||
private fun FirTypeRef.extractTypeParametersTo(result: MutableCollection<FirTypeParameterRef>) {
|
private fun FirTypeRef.extractTypeParametersTo(result: MutableCollection<FirTypeParameterRef>) {
|
||||||
@@ -195,7 +195,7 @@ class JavaOverrideChecker internal constructor(
|
|||||||
private fun FirCallableDeclaration.extractTypeParametersTo(result: MutableCollection<FirTypeParameterRef>) {
|
private fun FirCallableDeclaration.extractTypeParametersTo(result: MutableCollection<FirTypeParameterRef>) {
|
||||||
result += typeParameters
|
result += typeParameters
|
||||||
returnTypeRef.extractTypeParametersTo(result)
|
returnTypeRef.extractTypeParametersTo(result)
|
||||||
receiverTypeRef?.extractTypeParametersTo(result)
|
receiverParameter?.type?.extractTypeParametersTo(result)
|
||||||
if (this is FirSimpleFunction) {
|
if (this is FirSimpleFunction) {
|
||||||
this.valueParameters.forEach { it.returnTypeRef.extractTypeParametersTo(result) }
|
this.valueParameters.forEach { it.returnTypeRef.extractTypeParametersTo(result) }
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ class JavaOverrideChecker internal constructor(
|
|||||||
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||||
|
|
||||||
// NB: overrideCandidate is from Java and has no receiver
|
// NB: overrideCandidate is from Java and has no receiver
|
||||||
val receiverTypeRef = baseDeclaration.receiverTypeRef
|
val receiverTypeRef = baseDeclaration.receiverParameter?.type
|
||||||
val baseParameterTypes = listOfNotNull(receiverTypeRef) + baseDeclaration.valueParameters.map { it.returnTypeRef }
|
val baseParameterTypes = listOfNotNull(receiverTypeRef) + baseDeclaration.valueParameters.map { it.returnTypeRef }
|
||||||
|
|
||||||
if (overrideCandidate.valueParameters.size != baseParameterTypes.size) return false
|
if (overrideCandidate.valueParameters.size != baseParameterTypes.size) return false
|
||||||
@@ -247,7 +247,7 @@ class JavaOverrideChecker internal constructor(
|
|||||||
overrideCandidate.lazyResolveToPhase(FirResolvePhase.TYPES)
|
overrideCandidate.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||||
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||||
|
|
||||||
val receiverTypeRef = baseDeclaration.receiverTypeRef
|
val receiverTypeRef = baseDeclaration.receiverParameter?.type
|
||||||
return when (overrideCandidate) {
|
return when (overrideCandidate) {
|
||||||
is FirSimpleFunction -> {
|
is FirSimpleFunction -> {
|
||||||
if (receiverTypeRef == null) {
|
if (receiverTypeRef == null) {
|
||||||
@@ -259,7 +259,7 @@ class JavaOverrideChecker internal constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
is FirProperty -> {
|
is FirProperty -> {
|
||||||
val overrideReceiverTypeRef = overrideCandidate.receiverTypeRef
|
val overrideReceiverTypeRef = overrideCandidate.receiverParameter?.type
|
||||||
return when {
|
return when {
|
||||||
receiverTypeRef == null -> overrideReceiverTypeRef == null
|
receiverTypeRef == null -> overrideReceiverTypeRef == null
|
||||||
overrideReceiverTypeRef == null -> false
|
overrideReceiverTypeRef == null -> false
|
||||||
|
|||||||
+6
-3
@@ -1,12 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* 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.resolve.calls.jvm
|
package org.jetbrains.kotlin.fir.resolve.calls.jvm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
import org.jetbrains.kotlin.fir.containingClassLookupTag
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirVariable
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
||||||
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.AbstractConeCallConflictResolver
|
import org.jetbrains.kotlin.fir.resolve.calls.AbstractConeCallConflictResolver
|
||||||
@@ -58,7 +61,7 @@ class ConeEquivalentCallConflictResolver(
|
|||||||
): Boolean {
|
): Boolean {
|
||||||
if (first.symbol.callableId != second.symbol.callableId) return false
|
if (first.symbol.callableId != second.symbol.callableId) return false
|
||||||
if (first.isExpect != second.isExpect) return false
|
if (first.isExpect != second.isExpect) return false
|
||||||
if (first.receiverTypeRef?.coneType != second.receiverTypeRef?.coneType) {
|
if (first.receiverParameter?.type?.coneType != second.receiverParameter?.type?.coneType) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (first is FirVariable != second is FirVariable) {
|
if (first is FirVariable != second is FirVariable) {
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ class FirClassSubstitutionScope(
|
|||||||
forceTypeParametersRecreation = dispatchReceiverTypeForSubstitutedMembers.lookupTag != member.dispatchReceiverClassLookupTagOrNull()
|
forceTypeParametersRecreation = dispatchReceiverTypeForSubstitutedMembers.lookupTag != member.dispatchReceiverClassLookupTagOrNull()
|
||||||
)
|
)
|
||||||
|
|
||||||
val receiverType = member.receiverTypeRef?.coneType
|
val receiverType = member.receiverParameter?.type?.coneType
|
||||||
val newReceiverType = receiverType?.substitute(substitutor)
|
val newReceiverType = receiverType?.substitute(substitutor)
|
||||||
|
|
||||||
val newDispatchReceiverType = dispatchReceiverTypeForSubstitutedMembers.substitute(substitutor)
|
val newDispatchReceiverType = dispatchReceiverTypeForSubstitutedMembers.substitute(substitutor)
|
||||||
|
|||||||
+22
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -147,9 +147,15 @@ object FirFakeOverrideGenerator {
|
|||||||
// TODO: consider using here some light-weight functions instead of pseudo-real FirMemberFunctionImpl
|
// TODO: consider using here some light-weight functions instead of pseudo-real FirMemberFunctionImpl
|
||||||
// As second alternative, we can invent some light-weight kind of FirRegularClass
|
// As second alternative, we can invent some light-weight kind of FirRegularClass
|
||||||
return buildConstructor {
|
return buildConstructor {
|
||||||
|
annotations += baseConstructor.annotations
|
||||||
moduleData = session.moduleData
|
moduleData = session.moduleData
|
||||||
this.origin = origin
|
this.origin = origin
|
||||||
receiverTypeRef = baseConstructor.receiverTypeRef?.withReplacedConeType(null)
|
receiverParameter = baseConstructor.receiverParameter?.let { receiverParameter ->
|
||||||
|
buildReceiverParameterCopy(receiverParameter) {
|
||||||
|
type = receiverParameter.type.withReplacedConeType(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status = baseConstructor.status.copy(isExpect = isExpect)
|
status = baseConstructor.status.copy(isExpect = isExpect)
|
||||||
symbol = fakeOverrideSymbol
|
symbol = fakeOverrideSymbol
|
||||||
|
|
||||||
@@ -261,7 +267,11 @@ object FirFakeOverrideGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this is FirSimpleFunctionBuilder) {
|
if (this is FirSimpleFunctionBuilder) {
|
||||||
receiverTypeRef = baseFunction.receiverTypeRef?.withReplacedConeType(newReceiverType)
|
receiverParameter = baseFunction.receiverParameter?.let { receiverParameter ->
|
||||||
|
buildReceiverParameterCopy(receiverParameter) {
|
||||||
|
type = receiverParameter.type.withReplacedConeType(newReceiverType)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
valueParameters += baseFunction.valueParameters.zip(
|
valueParameters += baseFunction.valueParameters.zip(
|
||||||
newParameterTypes ?: List(baseFunction.valueParameters.size) { null }
|
newParameterTypes ?: List(baseFunction.valueParameters.size) { null }
|
||||||
@@ -408,7 +418,7 @@ object FirFakeOverrideGenerator {
|
|||||||
): Triple<ConeKotlinType?, List<ConeKotlinType?>, Maybe<ConeKotlinType?>> {
|
): Triple<ConeKotlinType?, List<ConeKotlinType?>, Maybe<ConeKotlinType?>> {
|
||||||
val copiedReceiverType = newReceiverType?.let {
|
val copiedReceiverType = newReceiverType?.let {
|
||||||
substitutor.substituteOrNull(it)
|
substitutor.substituteOrNull(it)
|
||||||
} ?: baseCallable.receiverTypeRef?.let {
|
} ?: baseCallable.receiverParameter?.type?.let {
|
||||||
substitutor.substituteOrNull(it.coneType)
|
substitutor.substituteOrNull(it.coneType)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,13 +454,20 @@ object FirFakeOverrideGenerator {
|
|||||||
val fakeOverrideSubstitution = fakeOverrideSubstitution ?: runIf(baseProperty.returnTypeRef is FirImplicitTypeRef) {
|
val fakeOverrideSubstitution = fakeOverrideSubstitution ?: runIf(baseProperty.returnTypeRef is FirImplicitTypeRef) {
|
||||||
FakeOverrideSubstitution(ConeSubstitutor.Empty, baseProperty.symbol)
|
FakeOverrideSubstitution(ConeSubstitutor.Empty, baseProperty.symbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fakeOverrideSubstitution != null) {
|
if (fakeOverrideSubstitution != null) {
|
||||||
returnTypeRef = buildImplicitTypeRef()
|
returnTypeRef = buildImplicitTypeRef()
|
||||||
attributes.fakeOverrideSubstitution = fakeOverrideSubstitution
|
attributes.fakeOverrideSubstitution = fakeOverrideSubstitution
|
||||||
} else {
|
} else {
|
||||||
returnTypeRef = baseProperty.returnTypeRef.withReplacedReturnType(newReturnType)
|
returnTypeRef = baseProperty.returnTypeRef.withReplacedReturnType(newReturnType)
|
||||||
}
|
}
|
||||||
receiverTypeRef = baseProperty.receiverTypeRef?.withReplacedConeType(newReceiverType)
|
|
||||||
|
receiverParameter = baseProperty.receiverParameter?.let { receiverParameter ->
|
||||||
|
buildReceiverParameterCopy(receiverParameter) {
|
||||||
|
type = receiverParameter.type.withReplacedConeType(newReceiverType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contextReceivers += baseProperty.contextReceivers.zip(
|
contextReceivers += baseProperty.contextReceivers.zip(
|
||||||
newContextReceiverTypes ?: List(baseProperty.contextReceivers.size) { null }
|
newContextReceiverTypes ?: List(baseProperty.contextReceivers.size) { null }
|
||||||
) { contextReceiver, newType ->
|
) { contextReceiver, newType ->
|
||||||
|
|||||||
+8
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -130,7 +130,12 @@ class FirStandardOverrideChecker(private val session: FirSession) : FirAbstractO
|
|||||||
|
|
||||||
overrideCandidate.lazyResolveToPhase(FirResolvePhase.TYPES)
|
overrideCandidate.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||||
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||||
if (!isEqualReceiverTypes(overrideCandidate.receiverTypeRef, baseDeclaration.receiverTypeRef, substitutor)) return false
|
if (!isEqualReceiverTypes(
|
||||||
|
overrideCandidate.receiverParameter?.type,
|
||||||
|
baseDeclaration.receiverParameter?.type,
|
||||||
|
substitutor,
|
||||||
|
)
|
||||||
|
) return false
|
||||||
|
|
||||||
return overrideCandidate.valueParameters.zip(baseDeclaration.valueParameters).all { (memberParam, selfParam) ->
|
return overrideCandidate.valueParameters.zip(baseDeclaration.valueParameters).all { (memberParam, selfParam) ->
|
||||||
isEqualTypes(memberParam.returnTypeRef, selfParam.returnTypeRef, substitutor)
|
isEqualTypes(memberParam.returnTypeRef, selfParam.returnTypeRef, substitutor)
|
||||||
@@ -147,6 +152,6 @@ class FirStandardOverrideChecker(private val session: FirSession) : FirAbstractO
|
|||||||
val substitutor = buildTypeParametersSubstitutorIfCompatible(overrideCandidate, baseDeclaration) ?: return false
|
val substitutor = buildTypeParametersSubstitutorIfCompatible(overrideCandidate, baseDeclaration) ?: return false
|
||||||
overrideCandidate.lazyResolveToPhase(FirResolvePhase.TYPES)
|
overrideCandidate.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||||
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
baseDeclaration.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||||
return isEqualReceiverTypes(overrideCandidate.receiverTypeRef, baseDeclaration.receiverTypeRef, substitutor)
|
return isEqualReceiverTypes(overrideCandidate.receiverParameter?.type, baseDeclaration.receiverParameter?.type, substitutor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ fun ConeKotlinType.valueParameterTypesIncludingReceiver(session: FirSession): Li
|
|||||||
}
|
}
|
||||||
|
|
||||||
val FirAnonymousFunction.returnType: ConeKotlinType? get() = returnTypeRef.coneTypeSafe()
|
val FirAnonymousFunction.returnType: ConeKotlinType? get() = returnTypeRef.coneTypeSafe()
|
||||||
val FirAnonymousFunction.receiverType: ConeKotlinType? get() = receiverTypeRef?.coneTypeSafe()
|
val FirAnonymousFunction.receiverType: ConeKotlinType? get() = receiverParameter?.type?.coneTypeSafe()
|
||||||
|
|
||||||
fun ConeTypeContext.isTypeMismatchDueToNullability(
|
fun ConeTypeContext.isTypeMismatchDueToNullability(
|
||||||
actualType: ConeKotlinType,
|
actualType: ConeKotlinType,
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.*
|
|||||||
import org.jetbrains.kotlin.ElementTypeUtils.isExpression
|
import org.jetbrains.kotlin.ElementTypeUtils.isExpression
|
||||||
import org.jetbrains.kotlin.KtNodeTypes.*
|
import org.jetbrains.kotlin.KtNodeTypes.*
|
||||||
import org.jetbrains.kotlin.builtins.StandardNames
|
import org.jetbrains.kotlin.builtins.StandardNames
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
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.descriptors.Visibilities
|
||||||
@@ -1184,7 +1183,8 @@ class DeclarationsConverter(
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
this.isLocal = false
|
this.isLocal = false
|
||||||
receiverTypeRef = receiverType
|
receiverParameter = receiverType?.convertToReceiverParameter()
|
||||||
|
|
||||||
dispatchReceiverType = currentDispatchReceiverType()
|
dispatchReceiverType = currentDispatchReceiverType()
|
||||||
withCapturedTypeParameters(true, propertySource, firTypeParameters) {
|
withCapturedTypeParameters(true, propertySource, firTypeParameters) {
|
||||||
typeParameters += firTypeParameters
|
typeParameters += firTypeParameters
|
||||||
@@ -1611,7 +1611,7 @@ class DeclarationsConverter(
|
|||||||
functionSymbol = FirAnonymousFunctionSymbol()
|
functionSymbol = FirAnonymousFunctionSymbol()
|
||||||
FirAnonymousFunctionBuilder().apply {
|
FirAnonymousFunctionBuilder().apply {
|
||||||
source = functionSource
|
source = functionSource
|
||||||
receiverTypeRef = receiverType
|
receiverParameter = receiverType?.convertToReceiverParameter()
|
||||||
symbol = functionSymbol
|
symbol = functionSymbol
|
||||||
isLambda = false
|
isLambda = false
|
||||||
hasExplicitParameterList = true
|
hasExplicitParameterList = true
|
||||||
@@ -1626,7 +1626,7 @@ class DeclarationsConverter(
|
|||||||
functionSymbol = FirNamedFunctionSymbol(callableIdForName(functionName))
|
functionSymbol = FirNamedFunctionSymbol(callableIdForName(functionName))
|
||||||
FirSimpleFunctionBuilder().apply {
|
FirSimpleFunctionBuilder().apply {
|
||||||
source = functionSource
|
source = functionSource
|
||||||
receiverTypeRef = receiverType
|
receiverParameter = receiverType?.convertToReceiverParameter()
|
||||||
name = functionName
|
name = functionName
|
||||||
status = FirDeclarationStatusImpl(
|
status = FirDeclarationStatusImpl(
|
||||||
if (isLocal) Visibilities.Local else modifiers.getVisibility(),
|
if (isLocal) Visibilities.Local else modifiers.getVisibility(),
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ class ExpressionsConverter(
|
|||||||
moduleData = baseModuleData
|
moduleData = baseModuleData
|
||||||
origin = FirDeclarationOrigin.Source
|
origin = FirDeclarationOrigin.Source
|
||||||
returnTypeRef = implicitType
|
returnTypeRef = implicitType
|
||||||
receiverTypeRef = implicitType
|
receiverParameter = implicitType.asReceiverParameter()
|
||||||
symbol = FirAnonymousFunctionSymbol()
|
symbol = FirAnonymousFunctionSymbol()
|
||||||
isLambda = true
|
isLambda = true
|
||||||
hasExplicitParameterList = hasArrow
|
hasExplicitParameterList = hasArrow
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -597,7 +597,6 @@ open class RawFirBuilder(
|
|||||||
moduleData = baseModuleData
|
moduleData = baseModuleData
|
||||||
origin = FirDeclarationOrigin.Source
|
origin = FirDeclarationOrigin.Source
|
||||||
returnTypeRef = type.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyFromParameter)
|
returnTypeRef = type.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyFromParameter)
|
||||||
receiverTypeRef = null
|
|
||||||
name = propertyName
|
name = propertyName
|
||||||
initializer = buildPropertyAccessExpression {
|
initializer = buildPropertyAccessExpression {
|
||||||
source = propertySource
|
source = propertySource
|
||||||
@@ -1302,7 +1301,7 @@ open class RawFirBuilder(
|
|||||||
val isAnonymousFunction = function.name == null && !function.parent.let { it is KtFile || it is KtClassBody }
|
val isAnonymousFunction = function.name == null && !function.parent.let { it is KtFile || it is KtClassBody }
|
||||||
val functionBuilder = if (isAnonymousFunction) {
|
val functionBuilder = if (isAnonymousFunction) {
|
||||||
FirAnonymousFunctionBuilder().apply {
|
FirAnonymousFunctionBuilder().apply {
|
||||||
receiverTypeRef = receiverType
|
receiverParameter = receiverType?.convertToReceiverParameter()
|
||||||
symbol = FirAnonymousFunctionSymbol()
|
symbol = FirAnonymousFunctionSymbol()
|
||||||
isLambda = false
|
isLambda = false
|
||||||
hasExplicitParameterList = true
|
hasExplicitParameterList = true
|
||||||
@@ -1311,7 +1310,7 @@ open class RawFirBuilder(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FirSimpleFunctionBuilder().apply {
|
FirSimpleFunctionBuilder().apply {
|
||||||
receiverTypeRef = receiverType
|
receiverParameter = receiverType?.convertToReceiverParameter()
|
||||||
name = function.nameAsSafeName
|
name = function.nameAsSafeName
|
||||||
labelName = runIf(!name.isSpecial) { name.identifier }
|
labelName = runIf(!name.isSpecial) { name.identifier }
|
||||||
symbol = FirNamedFunctionSymbol(callableIdForName(function.nameAsSafeName))
|
symbol = FirNamedFunctionSymbol(callableIdForName(function.nameAsSafeName))
|
||||||
@@ -1420,7 +1419,7 @@ open class RawFirBuilder(
|
|||||||
moduleData = baseModuleData
|
moduleData = baseModuleData
|
||||||
origin = FirDeclarationOrigin.Source
|
origin = FirDeclarationOrigin.Source
|
||||||
returnTypeRef = returnType
|
returnTypeRef = returnType
|
||||||
receiverTypeRef = receiverType
|
receiverParameter = receiverType.asReceiverParameter()
|
||||||
symbol = FirAnonymousFunctionSymbol()
|
symbol = FirAnonymousFunctionSymbol()
|
||||||
isLambda = true
|
isLambda = true
|
||||||
hasExplicitParameterList = expression.functionLiteral.arrow != null
|
hasExplicitParameterList = expression.functionLiteral.arrow != null
|
||||||
@@ -1643,7 +1642,7 @@ open class RawFirBuilder(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isLocal = false
|
isLocal = false
|
||||||
receiverTypeRef = receiverTypeReference.convertSafe()
|
receiverParameter = receiverTypeReference.convertSafe<FirTypeRef>()?.convertToReceiverParameter()
|
||||||
symbol = FirPropertySymbol(callableIdForName(propertyName))
|
symbol = FirPropertySymbol(callableIdForName(propertyName))
|
||||||
dispatchReceiverType = currentDispatchReceiverType()
|
dispatchReceiverType = currentDispatchReceiverType()
|
||||||
extractTypeParametersTo(this, symbol)
|
extractTypeParametersTo(this, symbol)
|
||||||
@@ -2024,7 +2023,6 @@ open class RawFirBuilder(
|
|||||||
moduleData = baseModuleData
|
moduleData = baseModuleData
|
||||||
origin = FirDeclarationOrigin.Source
|
origin = FirDeclarationOrigin.Source
|
||||||
returnTypeRef = ktSubjectExpression.typeReference.toFirOrImplicitType()
|
returnTypeRef = ktSubjectExpression.typeReference.toFirOrImplicitType()
|
||||||
receiverTypeRef = null
|
|
||||||
this.name = name
|
this.name = name
|
||||||
initializer = subjectExpression
|
initializer = subjectExpression
|
||||||
delegate = null
|
delegate = null
|
||||||
|
|||||||
+1
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1124,7 +1124,6 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
|||||||
moduleData = baseModuleData
|
moduleData = baseModuleData
|
||||||
origin = FirDeclarationOrigin.Source
|
origin = FirDeclarationOrigin.Source
|
||||||
returnTypeRef = firProperty.returnTypeRef
|
returnTypeRef = firProperty.returnTypeRef
|
||||||
receiverTypeRef = null
|
|
||||||
this.name = name
|
this.name = name
|
||||||
status = FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL).apply {
|
status = FirDeclarationStatusImpl(Visibilities.Public, Modality.FINAL).apply {
|
||||||
isOperator = true
|
isOperator = true
|
||||||
|
|||||||
+18
-7
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.fir.contracts.FirContractDescription
|
|||||||
import org.jetbrains.kotlin.fir.contracts.builder.buildLegacyRawContractDescription
|
import org.jetbrains.kotlin.fir.contracts.builder.buildLegacyRawContractDescription
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
|
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirVariable
|
import org.jetbrains.kotlin.fir.declarations.FirVariable
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.*
|
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||||
@@ -36,6 +37,7 @@ import org.jetbrains.kotlin.fir.symbols.constructStarProjectedType
|
|||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||||
import org.jetbrains.kotlin.fir.types.ConeStarProjection
|
import org.jetbrains.kotlin.fir.types.ConeStarProjection
|
||||||
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildImplicitTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildImplicitTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
import org.jetbrains.kotlin.fir.types.impl.*
|
import org.jetbrains.kotlin.fir.types.impl.*
|
||||||
@@ -561,16 +563,25 @@ fun FirExpression.pullUpSafeCallIfNecessary(): FirExpression {
|
|||||||
fun List<FirAnnotationCall>.filterUseSiteTarget(target: AnnotationUseSiteTarget): List<FirAnnotationCall> =
|
fun List<FirAnnotationCall>.filterUseSiteTarget(target: AnnotationUseSiteTarget): List<FirAnnotationCall> =
|
||||||
mapNotNull {
|
mapNotNull {
|
||||||
if (it.useSiteTarget != target) null
|
if (it.useSiteTarget != target) null
|
||||||
else buildAnnotationCall {
|
else buildAnnotationCallCopy(it) {
|
||||||
source = it.source?.fakeElement(KtFakeSourceElementKind.FromUseSiteTarget)
|
source = it.source?.fakeElement(KtFakeSourceElementKind.FromUseSiteTarget)
|
||||||
useSiteTarget = it.useSiteTarget
|
|
||||||
annotationTypeRef = it.annotationTypeRef
|
|
||||||
argumentList = it.argumentList
|
|
||||||
calleeReference = it.calleeReference
|
|
||||||
argumentMapping = it.argumentMapping
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun FirTypeRef.convertToReceiverParameter(): FirReceiverParameter {
|
||||||
|
val typeRef = this
|
||||||
|
return buildReceiverParameter {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
annotations += (typeRef.annotations as List<FirAnnotationCall>).filterUseSiteTarget(AnnotationUseSiteTarget.RECEIVER)
|
||||||
|
(typeRef.annotations as MutableList<FirAnnotation>).removeIf { it.useSiteTarget == AnnotationUseSiteTarget.RECEIVER }
|
||||||
|
type = typeRef
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun FirImplicitTypeRef.asReceiverParameter(): FirReceiverParameter = buildReceiverParameter {
|
||||||
|
type = this@asReceiverParameter
|
||||||
|
}
|
||||||
|
|
||||||
fun <T> FirCallableDeclaration.initContainingClassAttr(context: Context<T>) {
|
fun <T> FirCallableDeclaration.initContainingClassAttr(context: Context<T>) {
|
||||||
containingClassForStaticMemberAttr = currentDispatchReceiverType(context)?.lookupTag ?: return
|
containingClassForStaticMemberAttr = currentDispatchReceiverType(context)?.lookupTag ?: return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -63,10 +63,11 @@ fun List<FirQualifierPart>.toTypeProjections(): Array<ConeTypeProjection> =
|
|||||||
|
|
||||||
fun FirFunction.constructFunctionalType(isSuspend: Boolean = false): ConeLookupTagBasedType {
|
fun FirFunction.constructFunctionalType(isSuspend: Boolean = false): ConeLookupTagBasedType {
|
||||||
val receiverTypeRef = when (this) {
|
val receiverTypeRef = when (this) {
|
||||||
is FirSimpleFunction -> receiverTypeRef
|
is FirSimpleFunction -> receiverParameter
|
||||||
is FirAnonymousFunction -> receiverTypeRef
|
is FirAnonymousFunction -> receiverParameter
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}?.type
|
||||||
|
|
||||||
val parameters = valueParameters.map {
|
val parameters = valueParameters.map {
|
||||||
it.returnTypeRef.coneTypeSafe<ConeKotlinType>() ?: ConeErrorType(
|
it.returnTypeRef.coneTypeSafe<ConeKotlinType>() ?: ConeErrorType(
|
||||||
ConeSimpleDiagnostic(
|
ConeSimpleDiagnostic(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@ private fun FirSimpleFunction.getFunctionTypeForAbstractMethod(): ConeLookupTagB
|
|||||||
|
|
||||||
return createFunctionalType(
|
return createFunctionalType(
|
||||||
parameterTypes,
|
parameterTypes,
|
||||||
receiverType = receiverTypeRef?.coneType,
|
receiverType = receiverParameter?.type?.coneType,
|
||||||
rawReturnType = returnTypeRef.coneType,
|
rawReturnType = returnTypeRef.coneType,
|
||||||
isSuspend = this.isSuspend
|
isSuspend = this.isSuspend
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ abstract class AbstractConeCallConflictResolver(
|
|||||||
origin = call,
|
origin = call,
|
||||||
typeParameters = (variable as? FirProperty)?.typeParameters?.map { it.symbol.toLookupTag() }.orEmpty(),
|
typeParameters = (variable as? FirProperty)?.typeParameters?.map { it.symbol.toLookupTag() }.orEmpty(),
|
||||||
valueParameterTypes = computeSignatureTypes(call, variable),
|
valueParameterTypes = computeSignatureTypes(call, variable),
|
||||||
hasExtensionReceiver = variable.receiverTypeRef != null,
|
hasExtensionReceiver = variable.receiverParameter != null,
|
||||||
contextReceiverCount = variable.contextReceivers.size,
|
contextReceiverCount = variable.contextReceivers.size,
|
||||||
hasVarargs = false,
|
hasVarargs = false,
|
||||||
numDefaults = 0,
|
numDefaults = 0,
|
||||||
@@ -139,7 +139,7 @@ abstract class AbstractConeCallConflictResolver(
|
|||||||
origin = call,
|
origin = call,
|
||||||
typeParameters = constructor.typeParameters.map { it.symbol.toLookupTag() },
|
typeParameters = constructor.typeParameters.map { it.symbol.toLookupTag() },
|
||||||
valueParameterTypes = computeSignatureTypes(call, constructor),
|
valueParameterTypes = computeSignatureTypes(call, constructor),
|
||||||
//constructor.receiverTypeRef != null,
|
//constructor.receiverParameter != null,
|
||||||
hasExtensionReceiver = false,
|
hasExtensionReceiver = false,
|
||||||
contextReceiverCount = constructor.contextReceivers.size,
|
contextReceiverCount = constructor.contextReceivers.size,
|
||||||
hasVarargs = constructor.valueParameters.any { it.isVararg },
|
hasVarargs = constructor.valueParameters.any { it.isVararg },
|
||||||
@@ -154,7 +154,7 @@ abstract class AbstractConeCallConflictResolver(
|
|||||||
origin = call,
|
origin = call,
|
||||||
typeParameters = function.typeParameters.map { it.symbol.toLookupTag() },
|
typeParameters = function.typeParameters.map { it.symbol.toLookupTag() },
|
||||||
valueParameterTypes = computeSignatureTypes(call, function),
|
valueParameterTypes = computeSignatureTypes(call, function),
|
||||||
hasExtensionReceiver = function.receiverTypeRef != null,
|
hasExtensionReceiver = function.receiverParameter != null,
|
||||||
contextReceiverCount = function.contextReceivers.size,
|
contextReceiverCount = function.contextReceivers.size,
|
||||||
hasVarargs = function.valueParameters.any { it.isVararg },
|
hasVarargs = function.valueParameters.any { it.isVararg },
|
||||||
numDefaults = call.numDefaults,
|
numDefaults = call.numDefaults,
|
||||||
@@ -175,7 +175,7 @@ abstract class AbstractConeCallConflictResolver(
|
|||||||
): List<TypeWithConversion> {
|
): List<TypeWithConversion> {
|
||||||
return buildList {
|
return buildList {
|
||||||
val session = inferenceComponents.session
|
val session = inferenceComponents.session
|
||||||
addIfNotNull(called.receiverTypeRef?.coneType?.fullyExpandedType(session)?.let { TypeWithConversion(it) })
|
addIfNotNull(called.receiverParameter?.type?.coneType?.fullyExpandedType(session)?.let { TypeWithConversion(it) })
|
||||||
val typeForCallableReference = call.resultingTypeForCallableReference
|
val typeForCallableReference = call.resultingTypeForCallableReference
|
||||||
if (typeForCallableReference != null) {
|
if (typeForCallableReference != null) {
|
||||||
// Return type isn't needed here v
|
// Return type isn't needed here v
|
||||||
|
|||||||
+4
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.fir.resolve.DoubleColonLHS
|
|||||||
import org.jetbrains.kotlin.fir.resolve.createFunctionalType
|
import org.jetbrains.kotlin.fir.resolve.createFunctionalType
|
||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnsupportedCallableReferenceTarget
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnsupportedCallableReferenceTarget
|
||||||
import org.jetbrains.kotlin.fir.resolve.inference.extractInputOutputTypesFromCallableReferenceExpectedType
|
import org.jetbrains.kotlin.fir.resolve.inference.extractInputOutputTypesFromCallableReferenceExpectedType
|
||||||
import org.jetbrains.kotlin.fir.types.isSuspendFunctionType
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||||
@@ -71,8 +70,7 @@ internal object CheckCallableReferenceExpectedType : CheckerStage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val declarationReceiverType: ConeKotlinType? =
|
val declarationReceiverType: ConeKotlinType? =
|
||||||
fir.receiverTypeRef?.coneType
|
fir.receiverParameter?.type?.coneType?.let(candidate.substitutor::substituteOrSelf)
|
||||||
?.let(candidate.substitutor::substituteOrSelf)
|
|
||||||
|
|
||||||
if (resultingReceiverType != null && declarationReceiverType != null) {
|
if (resultingReceiverType != null && declarationReceiverType != null) {
|
||||||
val capturedReceiver = context.session.typeContext.captureFromExpression(resultingReceiverType) ?: resultingReceiverType
|
val capturedReceiver = context.session.typeContext.captureFromExpression(resultingReceiverType) ?: resultingReceiverType
|
||||||
@@ -115,7 +113,7 @@ private fun buildReflectionType(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val parameters = mutableListOf<ConeKotlinType>()
|
val parameters = mutableListOf<ConeKotlinType>()
|
||||||
if (fir.receiverTypeRef == null && receiverType != null) {
|
if (fir.receiverParameter == null && receiverType != null) {
|
||||||
parameters += receiverType
|
parameters += receiverType
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +132,7 @@ private fun buildReflectionType(
|
|||||||
callableReferenceAdaptation?.suspendConversionStrategy == SuspendConversionStrategy.SUSPEND_CONVERSION
|
callableReferenceAdaptation?.suspendConversionStrategy == SuspendConversionStrategy.SUSPEND_CONVERSION
|
||||||
return createFunctionalType(
|
return createFunctionalType(
|
||||||
parameters,
|
parameters,
|
||||||
receiverType = receiverType.takeIf { fir.receiverTypeRef != null },
|
receiverType = receiverType.takeIf { fir.receiverParameter != null },
|
||||||
rawReturnType = returnType,
|
rawReturnType = returnType,
|
||||||
isKFunctionType = true,
|
isKFunctionType = true,
|
||||||
isSuspend = isSuspend
|
isSuspend = isSuspend
|
||||||
|
|||||||
+8
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.fir.FirSession
|
|||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildConstructedClassTypeParameterRef
|
import org.jetbrains.kotlin.fir.declarations.builder.buildConstructedClassTypeParameterRef
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildConstructorCopy
|
import org.jetbrains.kotlin.fir.declarations.builder.buildConstructorCopy
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.builder.buildReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.classId
|
import org.jetbrains.kotlin.fir.declarations.utils.classId
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isInner
|
import org.jetbrains.kotlin.fir.declarations.utils.isInner
|
||||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
import org.jetbrains.kotlin.fir.languageVersionSettings
|
||||||
@@ -21,8 +22,8 @@ import org.jetbrains.kotlin.fir.scopes.FirScope
|
|||||||
import org.jetbrains.kotlin.fir.scopes.impl.FirFakeOverrideGenerator
|
import org.jetbrains.kotlin.fir.scopes.impl.FirFakeOverrideGenerator
|
||||||
import org.jetbrains.kotlin.fir.scopes.processClassifiersByName
|
import org.jetbrains.kotlin.fir.scopes.processClassifiersByName
|
||||||
import org.jetbrains.kotlin.fir.scopes.scopeForClass
|
import org.jetbrains.kotlin.fir.scopes.scopeForClass
|
||||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.visibilityChecker
|
import org.jetbrains.kotlin.fir.visibilityChecker
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
@@ -316,7 +317,11 @@ private class TypeAliasConstructorsSubstitutingScope(
|
|||||||
// fun Outer.OI(): OI = ...
|
// fun Outer.OI(): OI = ...
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
receiverTypeRef = originalConstructorSymbol.fir.returnTypeRef.withReplacedConeType(outerType)
|
receiverParameter = originalConstructorSymbol.fir.returnTypeRef.withReplacedConeType(outerType).let {
|
||||||
|
buildReceiverParameter {
|
||||||
|
type = it
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}.apply {
|
}.apply {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,8 +29,8 @@ import org.jetbrains.kotlin.fir.scopes.FirUnstableSmartcastTypeScope
|
|||||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||||
import org.jetbrains.kotlin.fir.scopes.processOverriddenFunctions
|
import org.jetbrains.kotlin.fir.scopes.processOverriddenFunctions
|
||||||
import org.jetbrains.kotlin.fir.symbols.SyntheticSymbol
|
import org.jetbrains.kotlin.fir.symbols.SyntheticSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.visibilityChecker
|
import org.jetbrains.kotlin.fir.visibilityChecker
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
@@ -128,7 +128,7 @@ object CheckExtensionReceiver : ResolutionStage() {
|
|||||||
|
|
||||||
private fun Candidate.getExpectedReceiverType(): ConeKotlinType? {
|
private fun Candidate.getExpectedReceiverType(): ConeKotlinType? {
|
||||||
val callableSymbol = symbol as? FirCallableSymbol<*> ?: return null
|
val callableSymbol = symbol as? FirCallableSymbol<*> ?: return null
|
||||||
return callableSymbol.fir.receiverTypeRef?.coneType
|
return callableSymbol.fir.receiverParameter?.type?.coneType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ class ScopeTowerLevel(
|
|||||||
candidate: FirCallableSymbol<*>,
|
candidate: FirCallableSymbol<*>,
|
||||||
processor: TowerScopeLevelProcessor<T>
|
processor: TowerScopeLevelProcessor<T>
|
||||||
) {
|
) {
|
||||||
val candidateReceiverTypeRef = candidate.fir.receiverTypeRef
|
val candidateReceiverTypeRef = candidate.fir.receiverParameter?.type
|
||||||
if (withHideMembersOnly && candidate.getAnnotationByClassId(HidesMembers) == null) {
|
if (withHideMembersOnly && candidate.getAnnotationByClassId(HidesMembers) == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -471,5 +471,5 @@ class ScopeTowerLevel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun FirCallableSymbol<*>.hasExtensionReceiver(): Boolean {
|
private fun FirCallableSymbol<*>.hasExtensionReceiver(): Boolean {
|
||||||
return fir.receiverTypeRef != null
|
return fir.receiverParameter != null
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ object ConeConstraintSystemUtilContext : ConstraintSystemUtilContext {
|
|||||||
else null
|
else null
|
||||||
} else { // function expression - all types are explicit, shouldn't return null
|
} else { // function expression - all types are explicit, shouldn't return null
|
||||||
buildList {
|
buildList {
|
||||||
atom.receiverTypeRef?.coneType?.let { add(it) }
|
atom.receiverParameter?.type?.coneType?.let { add(it) }
|
||||||
addAll(atom.collectDeclaredValueParameterTypes())
|
addAll(atom.collectDeclaredValueParameterTypes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,9 @@ object ConeConstraintSystemUtilContext : ConstraintSystemUtilContext {
|
|||||||
|
|
||||||
override fun PostponedAtomWithRevisableExpectedType.isFunctionExpressionWithReceiver(): Boolean {
|
override fun PostponedAtomWithRevisableExpectedType.isFunctionExpressionWithReceiver(): Boolean {
|
||||||
require(this is PostponedResolvedAtom)
|
require(this is PostponedResolvedAtom)
|
||||||
return this is LambdaWithTypeVariableAsExpectedTypeAtom && !this.atom.anonymousFunction.isLambda && this.atom.anonymousFunction.receiverTypeRef?.coneType != null
|
return this is LambdaWithTypeVariableAsExpectedTypeAtom &&
|
||||||
|
!this.atom.anonymousFunction.isLambda &&
|
||||||
|
this.atom.anonymousFunction.receiverParameter?.type?.coneType != null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun PostponedAtomWithRevisableExpectedType.isLambda(): Boolean {
|
override fun PostponedAtomWithRevisableExpectedType.isLambda(): Boolean {
|
||||||
|
|||||||
+10
-5
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildContextReceiver
|
import org.jetbrains.kotlin.fir.declarations.builder.buildContextReceiver
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.builder.buildReceiverParameterCopy
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter
|
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.resolve.ResolutionMode
|
import org.jetbrains.kotlin.fir.resolve.ResolutionMode
|
||||||
@@ -305,9 +306,13 @@ class FirCallCompleter(
|
|||||||
|
|
||||||
val expectedReturnTypeRef = expectedReturnType?.let { lambdaArgument.returnTypeRef.resolvedTypeFromPrototype(it) }
|
val expectedReturnTypeRef = expectedReturnType?.let { lambdaArgument.returnTypeRef.resolvedTypeFromPrototype(it) }
|
||||||
|
|
||||||
lambdaArgument.replaceReceiverTypeRef(
|
lambdaArgument.replaceReceiverParameter(
|
||||||
receiverType?.approximateLambdaInputType()?.let {
|
lambdaArgument.receiverParameter?.let { receiverParameter ->
|
||||||
lambdaArgument.receiverTypeRef?.resolvedTypeFromPrototype(it)
|
receiverType?.approximateLambdaInputType()?.let { approximatedType ->
|
||||||
|
buildReceiverParameterCopy(receiverParameter) {
|
||||||
|
type = receiverParameter.type.resolvedTypeFromPrototype(approximatedType)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -394,7 +399,7 @@ internal fun FirFunction.isFunctionForExpectTypeFromCastFeature(): Boolean {
|
|||||||
coneTypeSafe<ConeKotlinType>()
|
coneTypeSafe<ConeKotlinType>()
|
||||||
?.contains { (it.unwrap() as? ConeTypeParameterType)?.lookupTag == typeParameter.symbol.toLookupTag() } != false
|
?.contains { (it.unwrap() as? ConeTypeParameterType)?.lookupTag == typeParameter.symbol.toLookupTag() } != false
|
||||||
|
|
||||||
if (valueParameters.any { it.returnTypeRef.isBadType() } || receiverTypeRef?.isBadType() == true) return false
|
if (valueParameters.any { it.returnTypeRef.isBadType() } || receiverParameter?.type?.isBadType() == true) return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-11
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* that can be found in the license/LICENSE.txt file.
|
* 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.resolve.transformers
|
package org.jetbrains.kotlin.fir.resolve.transformers
|
||||||
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.descriptors.Visibility
|
|||||||
import org.jetbrains.kotlin.fakeElement
|
import org.jetbrains.kotlin.fakeElement
|
||||||
import org.jetbrains.kotlin.fir.*
|
import org.jetbrains.kotlin.fir.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.builder.buildReceiverParameterCopy
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isInline
|
import org.jetbrains.kotlin.fir.declarations.utils.isInline
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isLocal
|
import org.jetbrains.kotlin.fir.declarations.utils.isLocal
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||||
@@ -32,10 +33,6 @@ import org.jetbrains.kotlin.fir.resolve.inference.ResolvedLambdaAtom
|
|||||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.*
|
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.*
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirArrayOfCallTransformer
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.remapArgumentsWithVararg
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.writeResultType
|
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.ConvertibleIntegerOperators.binaryOperatorsWithSignedArgument
|
import org.jetbrains.kotlin.fir.scopes.impl.ConvertibleIntegerOperators.binaryOperatorsWithSignedArgument
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperator
|
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperator
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperatorForUnsignedType
|
import org.jetbrains.kotlin.fir.scopes.impl.isWrappedIntegerOperatorForUnsignedType
|
||||||
@@ -134,7 +131,7 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
var extensionReceiver = subCandidate.chosenExtensionReceiverExpression()
|
var extensionReceiver = subCandidate.chosenExtensionReceiverExpression()
|
||||||
if (!declaration.isWrappedIntegerOperator()) {
|
if (!declaration.isWrappedIntegerOperator()) {
|
||||||
val expectedDispatchReceiverType = (declaration as? FirCallableDeclaration)?.dispatchReceiverType
|
val expectedDispatchReceiverType = (declaration as? FirCallableDeclaration)?.dispatchReceiverType
|
||||||
val expectedExtensionReceiverType = (declaration as? FirCallableDeclaration)?.receiverTypeRef?.coneType
|
val expectedExtensionReceiverType = (declaration as? FirCallableDeclaration)?.receiverParameter?.type?.coneType
|
||||||
dispatchReceiver = dispatchReceiver.transformSingle(integerOperatorApproximator, expectedDispatchReceiverType)
|
dispatchReceiver = dispatchReceiver.transformSingle(integerOperatorApproximator, expectedDispatchReceiverType)
|
||||||
extensionReceiver = extensionReceiver.transformSingle(integerOperatorApproximator, expectedExtensionReceiverType)
|
extensionReceiver = extensionReceiver.transformSingle(integerOperatorApproximator, expectedExtensionReceiverType)
|
||||||
}
|
}
|
||||||
@@ -617,10 +614,15 @@ class FirCallCompletionResultsWriterTransformer(
|
|||||||
|
|
||||||
var needUpdateLambdaType = false
|
var needUpdateLambdaType = false
|
||||||
|
|
||||||
val initialReceiverType = anonymousFunction.receiverTypeRef?.coneTypeSafe<ConeKotlinType>()
|
val receiverParameter = anonymousFunction.receiverParameter
|
||||||
|
val initialReceiverType = receiverParameter?.type?.coneTypeSafe<ConeKotlinType>()
|
||||||
val resultReceiverType = initialReceiverType?.let { finalSubstitutor.substituteOrNull(it) }
|
val resultReceiverType = initialReceiverType?.let { finalSubstitutor.substituteOrNull(it) }
|
||||||
if (resultReceiverType != null) {
|
if (resultReceiverType != null) {
|
||||||
anonymousFunction.replaceReceiverTypeRef(anonymousFunction.receiverTypeRef!!.resolvedTypeFromPrototype(resultReceiverType))
|
anonymousFunction.replaceReceiverParameter(
|
||||||
|
buildReceiverParameterCopy(receiverParameter) {
|
||||||
|
type = receiverParameter.type.resolvedTypeFromPrototype(resultReceiverType)
|
||||||
|
}
|
||||||
|
)
|
||||||
needUpdateLambdaType = true
|
needUpdateLambdaType = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,7 +934,7 @@ internal class FirDeclarationCompletionResultsWriter(
|
|||||||
else ApproximationData.ApproximateByStatus(simpleFunction.visibility, simpleFunction.isInline)
|
else ApproximationData.ApproximateByStatus(simpleFunction.visibility, simpleFunction.isInline)
|
||||||
simpleFunction.transformReturnTypeRef(this, newData)
|
simpleFunction.transformReturnTypeRef(this, newData)
|
||||||
simpleFunction.transformValueParameters(this, ApproximationData.NoApproximation)
|
simpleFunction.transformValueParameters(this, ApproximationData.NoApproximation)
|
||||||
simpleFunction.transformReceiverTypeRef(this, newData)
|
simpleFunction.transformReceiverParameter(this, newData)
|
||||||
return simpleFunction
|
return simpleFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -942,7 +944,7 @@ internal class FirDeclarationCompletionResultsWriter(
|
|||||||
property.transformGetter(this, newData)
|
property.transformGetter(this, newData)
|
||||||
property.transformSetter(this, newData)
|
property.transformSetter(this, newData)
|
||||||
property.transformReturnTypeRef(this, newData)
|
property.transformReturnTypeRef(this, newData)
|
||||||
property.transformReceiverTypeRef(this, newData)
|
property.transformReceiverParameter(this, newData)
|
||||||
return property
|
return property
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -16,13 +16,11 @@ import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
|||||||
import org.jetbrains.kotlin.fir.declarations.utils.isOverride
|
import org.jetbrains.kotlin.fir.declarations.utils.isOverride
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||||
import org.jetbrains.kotlin.fir.extensions.*
|
import org.jetbrains.kotlin.fir.extensions.*
|
||||||
import org.jetbrains.kotlin.fir.render
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||||
import org.jetbrains.kotlin.fir.toEffectiveVisibility
|
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.name.StandardClassIds
|
import org.jetbrains.kotlin.name.StandardClassIds
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
@@ -306,7 +304,7 @@ class FirStatusResolver(
|
|||||||
if (declaration is FirConstructor) return false
|
if (declaration is FirConstructor) return false
|
||||||
if (containingClass.typeParameters.all { it.symbol.variance == Variance.INVARIANT }) return false
|
if (containingClass.typeParameters.all { it.symbol.variance == Variance.INVARIANT }) return false
|
||||||
|
|
||||||
if (declaration.receiverTypeRef?.contradictsWith(Variance.IN_VARIANCE) == true) {
|
if (declaration.receiverParameter?.type?.contradictsWith(Variance.IN_VARIANCE) == true) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (declaration.returnTypeRef.contradictsWith(
|
if (declaration.returnTypeRef.contradictsWith(
|
||||||
|
|||||||
+6
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -114,12 +114,16 @@ open class FirTypeResolveTransformer(
|
|||||||
return enumEntry
|
return enumEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun transformReceiverParameter(receiverParameter: FirReceiverParameter, data: Any?): FirReceiverParameter {
|
||||||
|
return receiverParameter.transformAnnotations(this, data).transformType(this, data)
|
||||||
|
}
|
||||||
|
|
||||||
override fun transformProperty(property: FirProperty, data: Any?): FirProperty {
|
override fun transformProperty(property: FirProperty, data: Any?): FirProperty {
|
||||||
return withScopeCleanup {
|
return withScopeCleanup {
|
||||||
property.addTypeParametersScope()
|
property.addTypeParametersScope()
|
||||||
property.transformTypeParameters(this, data)
|
property.transformTypeParameters(this, data)
|
||||||
.transformReturnTypeRef(this, data)
|
.transformReturnTypeRef(this, data)
|
||||||
.transformReceiverTypeRef(this, data)
|
.transformReceiverParameter(this, data)
|
||||||
.transformContextReceivers(this, data)
|
.transformContextReceivers(this, data)
|
||||||
.transformGetter(this, data)
|
.transformGetter(this, data)
|
||||||
.transformSetter(this, data)
|
.transformSetter(this, data)
|
||||||
|
|||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ class BodyResolveContext(
|
|||||||
for (parameter in function.valueParameters) {
|
for (parameter in function.valueParameters) {
|
||||||
storeVariable(parameter, holder.session)
|
storeVariable(parameter, holder.session)
|
||||||
}
|
}
|
||||||
val receiverTypeRef = function.receiverTypeRef
|
val receiverTypeRef = function.receiverParameter?.type
|
||||||
val type = receiverTypeRef?.coneType
|
val type = receiverTypeRef?.coneType
|
||||||
val additionalLabelName = type?.labelName()
|
val additionalLabelName = type?.labelName()
|
||||||
withLabelAndReceiverType(function.name, function, type, holder, additionalLabelName, f)
|
withLabelAndReceiverType(function.name, function, type, holder, additionalLabelName, f)
|
||||||
@@ -622,7 +622,7 @@ class BodyResolveContext(
|
|||||||
}
|
}
|
||||||
return withTowerDataCleanup {
|
return withTowerDataCleanup {
|
||||||
addLocalScope(FirLocalScope(holder.session))
|
addLocalScope(FirLocalScope(holder.session))
|
||||||
val receiverTypeRef = anonymousFunction.receiverTypeRef
|
val receiverTypeRef = anonymousFunction.receiverParameter?.type
|
||||||
val labelName = anonymousFunction.label?.name?.let { Name.identifier(it) }
|
val labelName = anonymousFunction.label?.name?.let { Name.identifier(it) }
|
||||||
withContainer(anonymousFunction) {
|
withContainer(anonymousFunction) {
|
||||||
withLabelAndReceiverType(labelName, anonymousFunction, receiverTypeRef?.coneType, holder) {
|
withLabelAndReceiverType(labelName, anonymousFunction, receiverTypeRef?.coneType, holder) {
|
||||||
@@ -717,7 +717,7 @@ class BodyResolveContext(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return withTowerDataCleanup {
|
return withTowerDataCleanup {
|
||||||
val receiverTypeRef = property.receiverTypeRef
|
val receiverTypeRef = property.receiverParameter?.type
|
||||||
addLocalScope(FirLocalScope(holder.session))
|
addLocalScope(FirLocalScope(holder.session))
|
||||||
if (!forContracts && receiverTypeRef == null && property.returnTypeRef !is FirImplicitTypeRef &&
|
if (!forContracts && receiverTypeRef == null && property.returnTypeRef !is FirImplicitTypeRef &&
|
||||||
!property.isLocal && property.delegate == null
|
!property.isLocal && property.delegate == null
|
||||||
|
|||||||
+2
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
|||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.isArrayType
|
import org.jetbrains.kotlin.fir.types.isArrayType
|
||||||
import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer
|
import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer
|
||||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A transformer that converts resolved arrayOf() call to [FirArrayOfCall].
|
* A transformer that converts resolved arrayOf() call to [FirArrayOfCall].
|
||||||
@@ -30,7 +29,7 @@ internal class FirArrayOfCallTransformer : FirDefaultTransformer<Nothing?>() {
|
|||||||
return function is FirSimpleFunction &&
|
return function is FirSimpleFunction &&
|
||||||
function.returnTypeRef.isArrayType &&
|
function.returnTypeRef.isArrayType &&
|
||||||
isArrayOf(function, arguments) &&
|
isArrayOf(function, arguments) &&
|
||||||
function.receiverTypeRef == null
|
function.receiverParameter == null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun toArrayOfCall(functionCall: FirFunctionCall): FirArrayOfCall? {
|
private fun toArrayOfCall(functionCall: FirFunctionCall): FirArrayOfCall? {
|
||||||
|
|||||||
+15
-8
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.*
|
|||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildAnonymousFunctionCopy
|
import org.jetbrains.kotlin.fir.declarations.builder.buildAnonymousFunctionCopy
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildContextReceiver
|
import org.jetbrains.kotlin.fir.declarations.builder.buildContextReceiver
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.builder.buildReceiverParameterCopy
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter
|
import org.jetbrains.kotlin.fir.declarations.builder.buildValueParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor
|
||||||
@@ -82,7 +83,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
|
|||||||
|
|
||||||
private fun prepareSignatureForBodyResolve(callableMember: FirCallableDeclaration) {
|
private fun prepareSignatureForBodyResolve(callableMember: FirCallableDeclaration) {
|
||||||
callableMember.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent)
|
callableMember.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent)
|
||||||
callableMember.transformReceiverTypeRef(transformer, ResolutionMode.ContextIndependent)
|
callableMember.transformReceiverParameter(transformer, ResolutionMode.ContextIndependent)
|
||||||
if (callableMember is FirFunction) {
|
if (callableMember is FirFunction) {
|
||||||
callableMember.valueParameters.forEach {
|
callableMember.valueParameters.forEach {
|
||||||
it.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent)
|
it.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent)
|
||||||
@@ -132,7 +133,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
|
|||||||
return property
|
return property
|
||||||
}
|
}
|
||||||
|
|
||||||
property.transformReceiverTypeRef(transformer, ResolutionMode.ContextIndependent)
|
property.transformReceiverParameter(transformer, ResolutionMode.ContextIndependent)
|
||||||
dataFlowAnalyzer.enterProperty(property)
|
dataFlowAnalyzer.enterProperty(property)
|
||||||
doTransformTypeParameters(property)
|
doTransformTypeParameters(property)
|
||||||
val shouldResolveEverything = !implicitTypeOnly
|
val shouldResolveEverything = !implicitTypeOnly
|
||||||
@@ -231,7 +232,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
|
|||||||
val typeRef = propertyReferenceAccess.typeRef
|
val typeRef = propertyReferenceAccess.typeRef
|
||||||
if (typeRef is FirResolvedTypeRef && property.returnTypeRef is FirResolvedTypeRef) {
|
if (typeRef is FirResolvedTypeRef && property.returnTypeRef is FirResolvedTypeRef) {
|
||||||
val typeArguments = (typeRef.type as ConeClassLikeType).typeArguments
|
val typeArguments = (typeRef.type as ConeClassLikeType).typeArguments
|
||||||
val extensionType = property.receiverTypeRef?.coneType
|
val extensionType = property.receiverParameter?.type?.coneType
|
||||||
val dispatchType = context.containingClass?.let { containingClass ->
|
val dispatchType = context.containingClass?.let { containingClass ->
|
||||||
containingClass.symbol.constructStarProjectedType(containingClass.typeParameters.size)
|
containingClass.symbol.constructStarProjectedType(containingClass.typeParameters.size)
|
||||||
}
|
}
|
||||||
@@ -702,7 +703,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
|
|||||||
context.withConstructor(constructor) {
|
context.withConstructor(constructor) {
|
||||||
constructor.transformTypeParameters(transformer, data)
|
constructor.transformTypeParameters(transformer, data)
|
||||||
.transformAnnotations(transformer, data)
|
.transformAnnotations(transformer, data)
|
||||||
.transformReceiverTypeRef(transformer, data)
|
.transformReceiverParameter(transformer, data)
|
||||||
.transformReturnTypeRef(transformer, data)
|
.transformReturnTypeRef(transformer, data)
|
||||||
|
|
||||||
context.forConstructorParameters(constructor, owningClass, components) {
|
context.forConstructorParameters(constructor, owningClass, components) {
|
||||||
@@ -757,7 +758,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
|
|||||||
// Either ContextDependent, ContextIndependent or WithExpectedType could be here
|
// Either ContextDependent, ContextIndependent or WithExpectedType could be here
|
||||||
if (data !is ResolutionMode.LambdaResolution) {
|
if (data !is ResolutionMode.LambdaResolution) {
|
||||||
anonymousFunction.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent)
|
anonymousFunction.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent)
|
||||||
anonymousFunction.transformReceiverTypeRef(transformer, ResolutionMode.ContextIndependent)
|
anonymousFunction.transformReceiverParameter(transformer, ResolutionMode.ContextIndependent)
|
||||||
anonymousFunction.valueParameters.forEach { it.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent) }
|
anonymousFunction.valueParameters.forEach { it.transformReturnTypeRef(transformer, ResolutionMode.ContextIndependent) }
|
||||||
}
|
}
|
||||||
return when (data) {
|
return when (data) {
|
||||||
@@ -815,8 +816,14 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
|
|||||||
val returnTypeRefFromResolvedAtom =
|
val returnTypeRefFromResolvedAtom =
|
||||||
resolvedLambdaAtom?.returnType?.let { lambda.returnTypeRef.resolvedTypeFromPrototype(it) }
|
resolvedLambdaAtom?.returnType?.let { lambda.returnTypeRef.resolvedTypeFromPrototype(it) }
|
||||||
lambda = buildAnonymousFunctionCopy(lambda) {
|
lambda = buildAnonymousFunctionCopy(lambda) {
|
||||||
receiverTypeRef = lambda.receiverTypeRef?.takeIf { it !is FirImplicitTypeRef }
|
receiverParameter = lambda.receiverParameter?.takeIf { it.type !is FirImplicitTypeRef }
|
||||||
?: resolvedLambdaAtom?.receiver?.let { lambda.receiverTypeRef?.resolvedTypeFromPrototype(it) }
|
?: resolvedLambdaAtom?.receiver?.let { coneKotlinType ->
|
||||||
|
lambda.receiverParameter?.let {
|
||||||
|
buildReceiverParameterCopy(it) {
|
||||||
|
type = it.type.resolvedTypeFromPrototype(coneKotlinType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contextReceivers.clear()
|
contextReceivers.clear()
|
||||||
contextReceivers.addAll(
|
contextReceivers.addAll(
|
||||||
|
|||||||
+3
-1
@@ -168,7 +168,9 @@ abstract class FirAbstractContractResolveTransformerDispatcher(
|
|||||||
moduleData = session.moduleData
|
moduleData = session.moduleData
|
||||||
origin = FirDeclarationOrigin.Source
|
origin = FirDeclarationOrigin.Source
|
||||||
returnTypeRef = buildImplicitTypeRef()
|
returnTypeRef = buildImplicitTypeRef()
|
||||||
receiverTypeRef = buildImplicitTypeRef()
|
receiverParameter = buildReceiverParameter {
|
||||||
|
type = buildImplicitTypeRef()
|
||||||
|
}
|
||||||
symbol = FirAnonymousFunctionSymbol()
|
symbol = FirAnonymousFunctionSymbol()
|
||||||
isLambda = true
|
isLambda = true
|
||||||
hasExplicitParameterList = true
|
hasExplicitParameterList = true
|
||||||
|
|||||||
+10
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ private class FirDeclarationsResolveTransformerForArgumentAnnotations(
|
|||||||
): FirSimpleFunction {
|
): FirSimpleFunction {
|
||||||
simpleFunction
|
simpleFunction
|
||||||
.transformReturnTypeRef(transformer, data)
|
.transformReturnTypeRef(transformer, data)
|
||||||
.transformReceiverTypeRef(transformer, data)
|
.transformReceiverParameter(transformer, data)
|
||||||
.transformValueParameters(transformer, data)
|
.transformValueParameters(transformer, data)
|
||||||
.transformAnnotations(transformer, data)
|
.transformAnnotations(transformer, data)
|
||||||
return simpleFunction
|
return simpleFunction
|
||||||
@@ -68,7 +68,7 @@ private class FirDeclarationsResolveTransformerForArgumentAnnotations(
|
|||||||
override fun transformConstructor(constructor: FirConstructor, data: ResolutionMode): FirConstructor {
|
override fun transformConstructor(constructor: FirConstructor, data: ResolutionMode): FirConstructor {
|
||||||
constructor
|
constructor
|
||||||
.transformReturnTypeRef(transformer, data)
|
.transformReturnTypeRef(transformer, data)
|
||||||
.transformReceiverTypeRef(transformer, data)
|
.transformReceiverParameter(transformer, data)
|
||||||
.transformValueParameters(transformer, data)
|
.transformValueParameters(transformer, data)
|
||||||
.transformAnnotations(transformer, data)
|
.transformAnnotations(transformer, data)
|
||||||
return constructor
|
return constructor
|
||||||
@@ -84,7 +84,7 @@ private class FirDeclarationsResolveTransformerForArgumentAnnotations(
|
|||||||
override fun transformProperty(property: FirProperty, data: ResolutionMode): FirProperty {
|
override fun transformProperty(property: FirProperty, data: ResolutionMode): FirProperty {
|
||||||
property
|
property
|
||||||
.transformAnnotations(transformer, data)
|
.transformAnnotations(transformer, data)
|
||||||
.transformReceiverTypeRef(transformer, data)
|
.transformReceiverParameter(transformer, data)
|
||||||
.transformReturnTypeRef(transformer, data)
|
.transformReturnTypeRef(transformer, data)
|
||||||
.transformGetter(transformer, data)
|
.transformGetter(transformer, data)
|
||||||
.transformSetter(transformer, data)
|
.transformSetter(transformer, data)
|
||||||
@@ -99,7 +99,7 @@ private class FirDeclarationsResolveTransformerForArgumentAnnotations(
|
|||||||
propertyAccessor
|
propertyAccessor
|
||||||
.transformValueParameters(transformer, data)
|
.transformValueParameters(transformer, data)
|
||||||
.transformReturnTypeRef(transformer, data)
|
.transformReturnTypeRef(transformer, data)
|
||||||
.transformReceiverTypeRef(transformer, data)
|
.transformReceiverParameter(transformer, data)
|
||||||
.transformReturnTypeRef(transformer, data)
|
.transformReturnTypeRef(transformer, data)
|
||||||
.transformAnnotations(transformer, data)
|
.transformAnnotations(transformer, data)
|
||||||
return propertyAccessor
|
return propertyAccessor
|
||||||
@@ -113,13 +113,17 @@ private class FirDeclarationsResolveTransformerForArgumentAnnotations(
|
|||||||
context.forEnumEntry {
|
context.forEnumEntry {
|
||||||
enumEntry
|
enumEntry
|
||||||
.transformAnnotations(transformer, data)
|
.transformAnnotations(transformer, data)
|
||||||
.transformReceiverTypeRef(transformer, data)
|
.transformReceiverParameter(transformer, data)
|
||||||
.transformReturnTypeRef(transformer, data)
|
.transformReturnTypeRef(transformer, data)
|
||||||
.transformTypeParameters(transformer, data)
|
.transformTypeParameters(transformer, data)
|
||||||
}
|
}
|
||||||
return enumEntry
|
return enumEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun transformReceiverParameter(receiverParameter: FirReceiverParameter, data: ResolutionMode): FirReceiverParameter {
|
||||||
|
return receiverParameter.transformAnnotations(transformer, data).transformType(transformer, data)
|
||||||
|
}
|
||||||
|
|
||||||
override fun transformField(field: FirField, data: ResolutionMode): FirField {
|
override fun transformField(field: FirField, data: ResolutionMode): FirField {
|
||||||
return field.transformAnnotations(transformer, data)
|
return field.transformAnnotations(transformer, data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ fun FirSimpleFunction.isEquals(): Boolean {
|
|||||||
if (name != OperatorNameConventions.EQUALS) return false
|
if (name != OperatorNameConventions.EQUALS) return false
|
||||||
if (valueParameters.size != 1) return false
|
if (valueParameters.size != 1) return false
|
||||||
if (contextReceivers.isNotEmpty()) return false
|
if (contextReceivers.isNotEmpty()) return false
|
||||||
if (receiverTypeRef != null) return false
|
if (receiverParameter != null) return false
|
||||||
val parameter = valueParameters.first()
|
val parameter = valueParameters.first()
|
||||||
return parameter.returnTypeRef.isNullableAny
|
return parameter.returnTypeRef.isNullableAny
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 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.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ class VariableStorageImpl(private val session: FirSession) : VariableStorage() {
|
|||||||
property.delegate != null -> PropertyStability.DELEGATED_PROPERTY
|
property.delegate != null -> PropertyStability.DELEGATED_PROPERTY
|
||||||
property.isLocal -> if (property.isVal) PropertyStability.STABLE_VALUE else PropertyStability.LOCAL_VAR
|
property.isLocal -> if (property.isVal) PropertyStability.STABLE_VALUE else PropertyStability.LOCAL_VAR
|
||||||
property.isVar -> PropertyStability.MUTABLE_PROPERTY
|
property.isVar -> PropertyStability.MUTABLE_PROPERTY
|
||||||
property.receiverTypeRef != null -> PropertyStability.PROPERTY_WITH_GETTER
|
property.receiverParameter != null -> PropertyStability.PROPERTY_WITH_GETTER
|
||||||
property.getter.let { it != null && it !is FirDefaultPropertyAccessor } -> PropertyStability.PROPERTY_WITH_GETTER
|
property.getter.let { it != null && it !is FirDefaultPropertyAccessor } -> PropertyStability.PROPERTY_WITH_GETTER
|
||||||
property.modality != Modality.FINAL -> {
|
property.modality != Modality.FINAL -> {
|
||||||
val dispatchReceiver = (originalFir.unwrapElement() as? FirQualifiedAccess)?.dispatchReceiver ?: return null
|
val dispatchReceiver = (originalFir.unwrapElement() as? FirQualifiedAccess)?.dispatchReceiver ?: return null
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract class FirAnonymousFunction : FirFunction(), FirTypeParametersOwner {
|
|||||||
abstract override val attributes: FirDeclarationAttributes
|
abstract override val attributes: FirDeclarationAttributes
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -60,7 +60,7 @@ abstract class FirAnonymousFunction : FirFunction(), FirTypeParametersOwner {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ abstract class FirAnonymousFunction : FirFunction(), FirTypeParametersOwner {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
||||||
|
|
||||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ abstract class FirBackingField : FirVariable(), FirTypeParametersOwner, FirState
|
|||||||
abstract override val origin: FirDeclarationOrigin
|
abstract override val origin: FirDeclarationOrigin
|
||||||
abstract override val attributes: FirDeclarationAttributes
|
abstract override val attributes: FirDeclarationAttributes
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -60,7 +60,7 @@ abstract class FirBackingField : FirVariable(), FirTypeParametersOwner, FirState
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ abstract class FirBackingField : FirVariable(), FirTypeParametersOwner, FirState
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirBackingField
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirBackingField
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirBackingField
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirBackingField
|
||||||
|
|
||||||
abstract override fun <D> transformDelegate(transformer: FirTransformer<D>, data: D): FirBackingField
|
abstract override fun <D> transformDelegate(transformer: FirTransformer<D>, data: D): FirBackingField
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -30,7 +30,7 @@ sealed class FirCallableDeclaration : FirMemberDeclaration() {
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract val returnTypeRef: FirTypeRef
|
abstract val returnTypeRef: FirTypeRef
|
||||||
abstract val receiverTypeRef: FirTypeRef?
|
abstract val receiverParameter: FirReceiverParameter?
|
||||||
abstract val deprecationsProvider: DeprecationsProvider
|
abstract val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val symbol: FirCallableSymbol<out FirCallableDeclaration>
|
abstract override val symbol: FirCallableSymbol<out FirCallableDeclaration>
|
||||||
abstract val containerSource: DeserializedContainerSource?
|
abstract val containerSource: DeserializedContainerSource?
|
||||||
@@ -47,7 +47,7 @@ sealed class FirCallableDeclaration : FirMemberDeclaration() {
|
|||||||
|
|
||||||
abstract fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -61,5 +61,5 @@ sealed class FirCallableDeclaration : FirMemberDeclaration() {
|
|||||||
|
|
||||||
abstract fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirCallableDeclaration
|
abstract fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirCallableDeclaration
|
||||||
|
|
||||||
abstract fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirCallableDeclaration
|
abstract fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirCallableDeclaration
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ abstract class FirConstructor : FirFunction(), FirTypeParameterRefsOwner {
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -55,7 +55,7 @@ abstract class FirConstructor : FirFunction(), FirTypeParameterRefsOwner {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ abstract class FirConstructor : FirFunction(), FirTypeParameterRefsOwner {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirConstructor
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirConstructor
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirConstructor
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirConstructor
|
||||||
|
|
||||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirConstructor
|
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirConstructor
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ abstract class FirEnumEntry : FirVariable() {
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -57,7 +57,7 @@ abstract class FirEnumEntry : FirVariable() {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ abstract class FirEnumEntry : FirVariable() {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
||||||
|
|
||||||
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirEnumEntry
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract class FirErrorFunction : FirFunction(), FirDiagnosticHolder {
|
|||||||
abstract override val attributes: FirDeclarationAttributes
|
abstract override val attributes: FirDeclarationAttributes
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -55,7 +55,7 @@ abstract class FirErrorFunction : FirFunction(), FirDiagnosticHolder {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ abstract class FirErrorFunction : FirFunction(), FirDiagnosticHolder {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
||||||
|
|
||||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirErrorFunction
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract class FirErrorProperty : FirVariable(), FirDiagnosticHolder {
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -60,7 +60,7 @@ abstract class FirErrorProperty : FirVariable(), FirDiagnosticHolder {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ abstract class FirErrorProperty : FirVariable(), FirDiagnosticHolder {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||||
|
|
||||||
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ abstract class FirField : FirVariable(), FirControlFlowGraphOwner {
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -59,7 +59,7 @@ abstract class FirField : FirVariable(), FirControlFlowGraphOwner {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ abstract class FirField : FirVariable(), FirControlFlowGraphOwner {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirField
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirField
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirField
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirField
|
||||||
|
|
||||||
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirField
|
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirField
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ sealed class FirFunction : FirCallableDeclaration(), FirTargetElement, FirContro
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -54,7 +54,7 @@ sealed class FirFunction : FirCallableDeclaration(), FirTargetElement, FirContro
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ sealed class FirFunction : FirCallableDeclaration(), FirTargetElement, FirContro
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirFunction
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirFunction
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirFunction
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirFunction
|
||||||
|
|
||||||
abstract fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirFunction
|
abstract fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirFunction
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ abstract class FirProperty : FirVariable(), FirTypeParametersOwner, FirControlFl
|
|||||||
abstract override val attributes: FirDeclarationAttributes
|
abstract override val attributes: FirDeclarationAttributes
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -63,7 +63,7 @@ abstract class FirProperty : FirVariable(), FirTypeParametersOwner, FirControlFl
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ abstract class FirProperty : FirVariable(), FirTypeParametersOwner, FirControlFl
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirProperty
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirProperty
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirProperty
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirProperty
|
||||||
|
|
||||||
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirProperty
|
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirProperty
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ abstract class FirPropertyAccessor : FirFunction(), FirContractDescriptionOwner,
|
|||||||
abstract override val attributes: FirDeclarationAttributes
|
abstract override val attributes: FirDeclarationAttributes
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -58,7 +58,7 @@ abstract class FirPropertyAccessor : FirFunction(), FirContractDescriptionOwner,
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ abstract class FirPropertyAccessor : FirFunction(), FirContractDescriptionOwner,
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
||||||
|
|
||||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2022 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.KtSourceElement
|
||||||
|
import org.jetbrains.kotlin.fir.FirAnnotationContainer
|
||||||
|
import org.jetbrains.kotlin.fir.FirElement
|
||||||
|
import org.jetbrains.kotlin.fir.FirPureAbstractElement
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||||
|
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||||
|
import org.jetbrains.kotlin.fir.visitors.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file was generated automatically
|
||||||
|
* DO NOT MODIFY IT MANUALLY
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class FirReceiverParameter : FirPureAbstractElement(), FirAnnotationContainer {
|
||||||
|
abstract override val source: KtSourceElement?
|
||||||
|
abstract val type: FirTypeRef
|
||||||
|
abstract override val annotations: List<FirAnnotation>
|
||||||
|
|
||||||
|
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitReceiverParameter(this, data)
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
override fun <E: FirElement, D> transform(transformer: FirTransformer<D>, data: D): E =
|
||||||
|
transformer.transformReceiverParameter(this, data) as E
|
||||||
|
|
||||||
|
abstract fun <D> transformType(transformer: FirTransformer<D>, data: D): FirReceiverParameter
|
||||||
|
|
||||||
|
abstract override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirReceiverParameter
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ abstract class FirSimpleFunction : FirFunction(), FirContractDescriptionOwner, F
|
|||||||
abstract override val attributes: FirDeclarationAttributes
|
abstract override val attributes: FirDeclarationAttributes
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -56,7 +56,7 @@ abstract class FirSimpleFunction : FirFunction(), FirContractDescriptionOwner, F
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ abstract class FirSimpleFunction : FirFunction(), FirContractDescriptionOwner, F
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
||||||
|
|
||||||
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirSimpleFunction
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ abstract class FirValueParameter : FirVariable(), FirControlFlowGraphOwner {
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -63,7 +63,7 @@ abstract class FirValueParameter : FirVariable(), FirControlFlowGraphOwner {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ abstract class FirValueParameter : FirVariable(), FirControlFlowGraphOwner {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirValueParameter
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirValueParameter
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirValueParameter
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirValueParameter
|
||||||
|
|
||||||
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirValueParameter
|
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirValueParameter
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ sealed class FirVariable : FirCallableDeclaration(), FirStatement {
|
|||||||
abstract override val typeParameters: List<FirTypeParameterRef>
|
abstract override val typeParameters: List<FirTypeParameterRef>
|
||||||
abstract override val status: FirDeclarationStatus
|
abstract override val status: FirDeclarationStatus
|
||||||
abstract override val returnTypeRef: FirTypeRef
|
abstract override val returnTypeRef: FirTypeRef
|
||||||
abstract override val receiverTypeRef: FirTypeRef?
|
abstract override val receiverParameter: FirReceiverParameter?
|
||||||
abstract override val deprecationsProvider: DeprecationsProvider
|
abstract override val deprecationsProvider: DeprecationsProvider
|
||||||
abstract override val containerSource: DeserializedContainerSource?
|
abstract override val containerSource: DeserializedContainerSource?
|
||||||
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
abstract override val dispatchReceiverType: ConeSimpleKotlinType?
|
||||||
@@ -58,7 +58,7 @@ sealed class FirVariable : FirCallableDeclaration(), FirStatement {
|
|||||||
|
|
||||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||||
|
|
||||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
abstract override fun replaceReceiverParameter(newReceiverParameter: FirReceiverParameter?)
|
||||||
|
|
||||||
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
abstract override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider)
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ sealed class FirVariable : FirCallableDeclaration(), FirStatement {
|
|||||||
|
|
||||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirVariable
|
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirVariable
|
||||||
|
|
||||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirVariable
|
abstract override fun <D> transformReceiverParameter(transformer: FirTransformer<D>, data: D): FirVariable
|
||||||
|
|
||||||
abstract fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirVariable
|
abstract fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirVariable
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.declarations.FirContextReceiver
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||||
@@ -52,7 +53,7 @@ interface FirAbstractConstructorBuilder : FirFunctionBuilder {
|
|||||||
abstract override val valueParameters: MutableList<FirValueParameter>
|
abstract override val valueParameters: MutableList<FirValueParameter>
|
||||||
abstract override var body: FirBlock?
|
abstract override var body: FirBlock?
|
||||||
abstract val typeParameters: MutableList<FirTypeParameterRef>
|
abstract val typeParameters: MutableList<FirTypeParameterRef>
|
||||||
abstract var receiverTypeRef: FirTypeRef?
|
abstract var receiverParameter: FirReceiverParameter?
|
||||||
abstract var controlFlowGraphReference: FirControlFlowGraphReference?
|
abstract var controlFlowGraphReference: FirControlFlowGraphReference?
|
||||||
abstract var symbol: FirConstructorSymbol
|
abstract var symbol: FirConstructorSymbol
|
||||||
abstract var delegatedConstructor: FirDelegatedConstructorCall?
|
abstract var delegatedConstructor: FirDelegatedConstructorCall?
|
||||||
|
|||||||
+4
-3
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.FirContextReceiver
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||||
@@ -51,7 +52,7 @@ class FirAnonymousFunctionBuilder : FirFunctionBuilder, FirAnnotationContainerBu
|
|||||||
override lateinit var origin: FirDeclarationOrigin
|
override lateinit var origin: FirDeclarationOrigin
|
||||||
override var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
override var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
||||||
override lateinit var returnTypeRef: FirTypeRef
|
override lateinit var returnTypeRef: FirTypeRef
|
||||||
var receiverTypeRef: FirTypeRef? = null
|
var receiverParameter: FirReceiverParameter? = null
|
||||||
override var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
override var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
||||||
override var containerSource: DeserializedContainerSource? = null
|
override var containerSource: DeserializedContainerSource? = null
|
||||||
override var dispatchReceiverType: ConeSimpleKotlinType? = null
|
override var dispatchReceiverType: ConeSimpleKotlinType? = null
|
||||||
@@ -76,7 +77,7 @@ class FirAnonymousFunctionBuilder : FirFunctionBuilder, FirAnnotationContainerBu
|
|||||||
origin,
|
origin,
|
||||||
attributes,
|
attributes,
|
||||||
returnTypeRef,
|
returnTypeRef,
|
||||||
receiverTypeRef,
|
receiverParameter,
|
||||||
deprecationsProvider,
|
deprecationsProvider,
|
||||||
containerSource,
|
containerSource,
|
||||||
dispatchReceiverType,
|
dispatchReceiverType,
|
||||||
@@ -131,7 +132,7 @@ inline fun buildAnonymousFunctionCopy(original: FirAnonymousFunction, init: FirA
|
|||||||
copyBuilder.origin = original.origin
|
copyBuilder.origin = original.origin
|
||||||
copyBuilder.attributes = original.attributes.copy()
|
copyBuilder.attributes = original.attributes.copy()
|
||||||
copyBuilder.returnTypeRef = original.returnTypeRef
|
copyBuilder.returnTypeRef = original.returnTypeRef
|
||||||
copyBuilder.receiverTypeRef = original.receiverTypeRef
|
copyBuilder.receiverParameter = original.receiverParameter
|
||||||
copyBuilder.deprecationsProvider = original.deprecationsProvider
|
copyBuilder.deprecationsProvider = original.deprecationsProvider
|
||||||
copyBuilder.containerSource = original.containerSource
|
copyBuilder.containerSource = original.containerSource
|
||||||
copyBuilder.dispatchReceiverType = original.dispatchReceiverType
|
copyBuilder.dispatchReceiverType = original.dispatchReceiverType
|
||||||
|
|||||||
+3
-2
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.UnresolvedDeprecationProvider
|
import org.jetbrains.kotlin.fir.declarations.UnresolvedDeprecationProvider
|
||||||
@@ -47,7 +48,7 @@ class FirBackingFieldBuilder : FirAnnotationContainerBuilder {
|
|||||||
lateinit var origin: FirDeclarationOrigin
|
lateinit var origin: FirDeclarationOrigin
|
||||||
var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
||||||
lateinit var returnTypeRef: FirTypeRef
|
lateinit var returnTypeRef: FirTypeRef
|
||||||
var receiverTypeRef: FirTypeRef? = null
|
var receiverParameter: FirReceiverParameter? = null
|
||||||
var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
||||||
var containerSource: DeserializedContainerSource? = null
|
var containerSource: DeserializedContainerSource? = null
|
||||||
var dispatchReceiverType: ConeSimpleKotlinType? = null
|
var dispatchReceiverType: ConeSimpleKotlinType? = null
|
||||||
@@ -75,7 +76,7 @@ class FirBackingFieldBuilder : FirAnnotationContainerBuilder {
|
|||||||
origin,
|
origin,
|
||||||
attributes,
|
attributes,
|
||||||
returnTypeRef,
|
returnTypeRef,
|
||||||
receiverTypeRef,
|
receiverParameter,
|
||||||
deprecationsProvider,
|
deprecationsProvider,
|
||||||
containerSource,
|
containerSource,
|
||||||
dispatchReceiverType,
|
dispatchReceiverType,
|
||||||
|
|||||||
+4
-3
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.declarations.FirContextReceiver
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||||
@@ -49,7 +50,7 @@ open class FirConstructorBuilder : FirAbstractConstructorBuilder, FirAnnotationC
|
|||||||
override val typeParameters: MutableList<FirTypeParameterRef> = mutableListOf()
|
override val typeParameters: MutableList<FirTypeParameterRef> = mutableListOf()
|
||||||
override lateinit var status: FirDeclarationStatus
|
override lateinit var status: FirDeclarationStatus
|
||||||
override lateinit var returnTypeRef: FirTypeRef
|
override lateinit var returnTypeRef: FirTypeRef
|
||||||
override var receiverTypeRef: FirTypeRef? = null
|
override var receiverParameter: FirReceiverParameter? = null
|
||||||
override var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
override var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
||||||
override var containerSource: DeserializedContainerSource? = null
|
override var containerSource: DeserializedContainerSource? = null
|
||||||
override var dispatchReceiverType: ConeSimpleKotlinType? = null
|
override var dispatchReceiverType: ConeSimpleKotlinType? = null
|
||||||
@@ -70,7 +71,7 @@ open class FirConstructorBuilder : FirAbstractConstructorBuilder, FirAnnotationC
|
|||||||
typeParameters,
|
typeParameters,
|
||||||
status,
|
status,
|
||||||
returnTypeRef,
|
returnTypeRef,
|
||||||
receiverTypeRef,
|
receiverParameter,
|
||||||
deprecationsProvider,
|
deprecationsProvider,
|
||||||
containerSource,
|
containerSource,
|
||||||
dispatchReceiverType,
|
dispatchReceiverType,
|
||||||
@@ -114,7 +115,7 @@ inline fun buildConstructorCopy(original: FirConstructor, init: FirConstructorBu
|
|||||||
copyBuilder.typeParameters.addAll(original.typeParameters)
|
copyBuilder.typeParameters.addAll(original.typeParameters)
|
||||||
copyBuilder.status = original.status
|
copyBuilder.status = original.status
|
||||||
copyBuilder.returnTypeRef = original.returnTypeRef
|
copyBuilder.returnTypeRef = original.returnTypeRef
|
||||||
copyBuilder.receiverTypeRef = original.receiverTypeRef
|
copyBuilder.receiverParameter = original.receiverParameter
|
||||||
copyBuilder.deprecationsProvider = original.deprecationsProvider
|
copyBuilder.deprecationsProvider = original.deprecationsProvider
|
||||||
copyBuilder.containerSource = original.containerSource
|
copyBuilder.containerSource = original.containerSource
|
||||||
copyBuilder.dispatchReceiverType = original.dispatchReceiverType
|
copyBuilder.dispatchReceiverType = original.dispatchReceiverType
|
||||||
|
|||||||
+3
-2
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||||
@@ -48,7 +49,7 @@ class FirDefaultSetterValueParameterBuilder : FirAnnotationContainerBuilder {
|
|||||||
lateinit var origin: FirDeclarationOrigin
|
lateinit var origin: FirDeclarationOrigin
|
||||||
var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
var attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
||||||
lateinit var returnTypeRef: FirTypeRef
|
lateinit var returnTypeRef: FirTypeRef
|
||||||
var receiverTypeRef: FirTypeRef? = null
|
var receiverParameter: FirReceiverParameter? = null
|
||||||
var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
var deprecationsProvider: DeprecationsProvider = UnresolvedDeprecationProvider
|
||||||
var containerSource: DeserializedContainerSource? = null
|
var containerSource: DeserializedContainerSource? = null
|
||||||
var dispatchReceiverType: ConeSimpleKotlinType? = null
|
var dispatchReceiverType: ConeSimpleKotlinType? = null
|
||||||
@@ -75,7 +76,7 @@ class FirDefaultSetterValueParameterBuilder : FirAnnotationContainerBuilder {
|
|||||||
origin,
|
origin,
|
||||||
attributes,
|
attributes,
|
||||||
returnTypeRef,
|
returnTypeRef,
|
||||||
receiverTypeRef,
|
receiverParameter,
|
||||||
deprecationsProvider,
|
deprecationsProvider,
|
||||||
containerSource,
|
containerSource,
|
||||||
dispatchReceiverType,
|
dispatchReceiverType,
|
||||||
|
|||||||
+1
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
import org.jetbrains.kotlin.fir.declarations.FirEnumEntry
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
||||||
import org.jetbrains.kotlin.fir.declarations.UnresolvedDeprecationProvider
|
import org.jetbrains.kotlin.fir.declarations.UnresolvedDeprecationProvider
|
||||||
|
|||||||
+1
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
|
||||||
|
|||||||
+1
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
import org.jetbrains.kotlin.fir.declarations.FirDeclarationStatus
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirErrorProperty
|
import org.jetbrains.kotlin.fir.declarations.FirErrorProperty
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
import org.jetbrains.kotlin.fir.declarations.FirTypeParameterRef
|
||||||
import org.jetbrains.kotlin.fir.declarations.UnresolvedDeprecationProvider
|
import org.jetbrains.kotlin.fir.declarations.UnresolvedDeprecationProvider
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user