FIR resolve: implement JVM K/J type mapping
Declared member scopes are now wrapped in JvmMappedScope
This commit is contained in:
@@ -11,11 +11,8 @@ import com.intellij.psi.search.GlobalSearchScope
|
|||||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.addDefaultBoundIfNecessary
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.visibility
|
|
||||||
import org.jetbrains.kotlin.fir.generateValueOfFunction
|
import org.jetbrains.kotlin.fir.generateValueOfFunction
|
||||||
import org.jetbrains.kotlin.fir.generateValuesFunction
|
import org.jetbrains.kotlin.fir.generateValuesFunction
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
||||||
@@ -103,6 +100,7 @@ class JavaSymbolProvider(
|
|||||||
useLazyNestedClassifierScope = regularClass is FirJavaClass,
|
useLazyNestedClassifierScope = regularClass is FirJavaClass,
|
||||||
existingNames = (regularClass as? FirJavaClass)?.existingNestedClassifierNames
|
existingNames = (regularClass as? FirJavaClass)?.existingNestedClassifierNames
|
||||||
)
|
)
|
||||||
|
val wrappedDeclaredScope = wrapScopeWithJvmMapped(regularClass.classId, declaredScope, useSiteSession, scopeSession)
|
||||||
val superTypeEnhancementScopes =
|
val superTypeEnhancementScopes =
|
||||||
lookupSuperTypes(regularClass, lookupInterfaces = true, deep = false, useSiteSession = useSiteSession)
|
lookupSuperTypes(regularClass, lookupInterfaces = true, deep = false, useSiteSession = useSiteSession)
|
||||||
.mapNotNull { useSiteSuperType ->
|
.mapNotNull { useSiteSuperType ->
|
||||||
@@ -119,7 +117,7 @@ class JavaSymbolProvider(
|
|||||||
}
|
}
|
||||||
JavaClassUseSiteMemberScope(
|
JavaClassUseSiteMemberScope(
|
||||||
regularClass, useSiteSession,
|
regularClass, useSiteSession,
|
||||||
JavaSuperTypeScope(regularClass, useSiteSession, superTypeEnhancementScopes), declaredScope
|
JavaSuperTypeScope(regularClass, useSiteSession, superTypeEnhancementScopes), wrappedDeclaredScope
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
|
|||||||
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.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
|
||||||
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
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
||||||
@@ -19,10 +18,8 @@ import org.jetbrains.kotlin.fir.expressions.FirArrayOfCall
|
|||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.*
|
import org.jetbrains.kotlin.fir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.fir.impl.FirAbstractAnnotatedElement
|
import org.jetbrains.kotlin.fir.impl.FirAbstractAnnotatedElement
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod
|
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaValueParameter
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaValueParameter
|
||||||
import org.jetbrains.kotlin.fir.java.enhancement.readOnlyToMutable
|
import org.jetbrains.kotlin.fir.java.enhancement.readOnlyToMutable
|
||||||
import org.jetbrains.kotlin.fir.java.types.FirJavaTypeRef
|
|
||||||
import org.jetbrains.kotlin.fir.references.impl.FirErrorNamedReferenceImpl
|
import org.jetbrains.kotlin.fir.references.impl.FirErrorNamedReferenceImpl
|
||||||
import org.jetbrains.kotlin.fir.references.impl.FirResolvedNamedReferenceImpl
|
import org.jetbrains.kotlin.fir.references.impl.FirResolvedNamedReferenceImpl
|
||||||
import org.jetbrains.kotlin.fir.resolve.constructClassType
|
import org.jetbrains.kotlin.fir.resolve.constructClassType
|
||||||
@@ -36,6 +33,7 @@ import org.jetbrains.kotlin.fir.types.*
|
|||||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||||
import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl
|
import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl
|
||||||
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||||
import org.jetbrains.kotlin.load.java.structure.*
|
import org.jetbrains.kotlin.load.java.structure.*
|
||||||
import org.jetbrains.kotlin.load.java.structure.impl.JavaElementImpl
|
import org.jetbrains.kotlin.load.java.structure.impl.JavaElementImpl
|
||||||
@@ -319,91 +317,3 @@ private fun JavaType.toFirResolvedTypeRef(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun FirFunction<*>.computeJvmDescriptor(): String = buildString {
|
|
||||||
if (this@computeJvmDescriptor is FirJavaMethod) {
|
|
||||||
append(name.asString())
|
|
||||||
} else {
|
|
||||||
append("<init>")
|
|
||||||
}
|
|
||||||
|
|
||||||
append("(")
|
|
||||||
for (parameter in valueParameters) {
|
|
||||||
appendErasedType(parameter.returnTypeRef)
|
|
||||||
}
|
|
||||||
append(")")
|
|
||||||
|
|
||||||
if (this@computeJvmDescriptor !is FirJavaMethod || (returnTypeRef as FirJavaTypeRef).isVoid()) {
|
|
||||||
append("V")
|
|
||||||
} else {
|
|
||||||
appendErasedType(returnTypeRef)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: primitive types, arrays, etc.
|
|
||||||
private fun StringBuilder.appendErasedType(typeRef: FirTypeRef) {
|
|
||||||
fun appendClass(klass: JavaClass) {
|
|
||||||
klass.fqName?.let {
|
|
||||||
append("L")
|
|
||||||
append(it.asString().replace(".", "/"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
when (typeRef) {
|
|
||||||
is FirResolvedTypeRef -> appendConeType(typeRef.type)
|
|
||||||
is FirJavaTypeRef -> {
|
|
||||||
when (val javaType = typeRef.type) {
|
|
||||||
is JavaClassifierType -> {
|
|
||||||
when (val classifier = javaType.classifier) {
|
|
||||||
is JavaClass -> appendClass(classifier)
|
|
||||||
is JavaTypeParameter -> {
|
|
||||||
val representative = classifier.upperBounds.firstOrNull { it.classifier is JavaClass }
|
|
||||||
if (representative == null) {
|
|
||||||
append("Ljava/lang/Object")
|
|
||||||
} else {
|
|
||||||
appendClass(representative.classifier as JavaClass)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> return
|
|
||||||
}
|
|
||||||
append(";")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun StringBuilder.appendConeType(coneType: ConeKotlinType) {
|
|
||||||
fun appendClassLikeType(type: ConeClassLikeType) {
|
|
||||||
append("L")
|
|
||||||
val classId = type.lookupTag.classId
|
|
||||||
append(classId.packageFqName.asString().replace(".", "/"))
|
|
||||||
append("/")
|
|
||||||
append(classId.relativeClassName)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (coneType is ConeClassErrorType) return
|
|
||||||
when (coneType) {
|
|
||||||
is ConeClassLikeType -> {
|
|
||||||
appendClassLikeType(coneType)
|
|
||||||
}
|
|
||||||
is ConeTypeParameterType -> {
|
|
||||||
val representative = coneType.lookupTag.typeParameterSymbol.fir.bounds.firstOrNull {
|
|
||||||
(it as? FirResolvedTypeRef)?.type is ConeClassLikeType
|
|
||||||
}
|
|
||||||
if (representative == null) {
|
|
||||||
append("Ljava/lang/Object")
|
|
||||||
} else {
|
|
||||||
appendClassLikeType(representative.coneTypeUnsafe())
|
|
||||||
}
|
|
||||||
append(coneType.lookupTag.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
append(";")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun FirJavaTypeRef.isVoid(): Boolean {
|
|
||||||
return type is JavaPrimitiveType && type.type == null
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.fir.FirSourceElement
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirSimpleFunctionImpl
|
||||||
import org.jetbrains.kotlin.fir.java.types.FirJavaTypeRef
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.fir.FirSession
|
|||||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
|
||||||
import org.jetbrains.kotlin.fir.java.types.FirJavaTypeRef
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
|
|||||||
import org.jetbrains.kotlin.fir.java.toConeKotlinTypeWithNullability
|
import org.jetbrains.kotlin.fir.java.toConeKotlinTypeWithNullability
|
||||||
import org.jetbrains.kotlin.fir.java.toFirJavaTypeRef
|
import org.jetbrains.kotlin.fir.java.toFirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.fir.java.toNotNullConeKotlinType
|
import org.jetbrains.kotlin.fir.java.toNotNullConeKotlinType
|
||||||
import org.jetbrains.kotlin.fir.java.types.FirJavaTypeRef
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.load.java.AnnotationTypeQualifierResolver
|
import org.jetbrains.kotlin.load.java.AnnotationTypeQualifierResolver
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
|||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaField
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaField
|
||||||
import org.jetbrains.kotlin.fir.java.toConeProjection
|
import org.jetbrains.kotlin.fir.java.toConeProjection
|
||||||
import org.jetbrains.kotlin.fir.java.toNotNullConeKotlinType
|
import org.jetbrains.kotlin.fir.java.toNotNullConeKotlinType
|
||||||
import org.jetbrains.kotlin.fir.java.types.FirJavaTypeRef
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.fir.references.impl.FirResolvedNamedReferenceImpl
|
import org.jetbrains.kotlin.fir.references.impl.FirResolvedNamedReferenceImpl
|
||||||
import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference
|
import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference
|
||||||
import org.jetbrains.kotlin.fir.resolve.*
|
import org.jetbrains.kotlin.fir.resolve.*
|
||||||
|
|||||||
+2
-2
@@ -13,13 +13,13 @@ import org.jetbrains.kotlin.fir.declarations.impl.*
|
|||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirConstExpressionImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirConstExpressionImpl
|
||||||
import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
|
import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
|
||||||
import org.jetbrains.kotlin.fir.java.computeJvmDescriptor
|
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.*
|
import org.jetbrains.kotlin.fir.java.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.java.enhancement.*
|
import org.jetbrains.kotlin.fir.java.enhancement.*
|
||||||
import org.jetbrains.kotlin.fir.java.types.FirJavaTypeRef
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.fir.render
|
import org.jetbrains.kotlin.fir.render
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||||
|
import org.jetbrains.kotlin.fir.scopes.jvm.computeJvmDescriptor
|
||||||
import org.jetbrains.kotlin.fir.symbols.CallableId
|
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
|
|||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod
|
||||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaValueParameter
|
import org.jetbrains.kotlin.fir.java.declarations.FirJavaValueParameter
|
||||||
import org.jetbrains.kotlin.fir.java.types.FirJavaTypeRef
|
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction.NEXT
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction.NEXT
|
||||||
@@ -23,6 +22,7 @@ import org.jetbrains.kotlin.fir.scopes.impl.AbstractFirUseSiteMemberScope
|
|||||||
import org.jetbrains.kotlin.fir.scopes.impl.FirSuperTypeScope
|
import org.jetbrains.kotlin.fir.scopes.impl.FirSuperTypeScope
|
||||||
import org.jetbrains.kotlin.fir.symbols.CallableId
|
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
class JavaClassUseSiteMemberScope(
|
class JavaClassUseSiteMemberScope(
|
||||||
|
|||||||
@@ -5,10 +5,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.resolve
|
package org.jetbrains.kotlin.fir.resolve
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.FirSessionComponent
|
import org.jetbrains.kotlin.fir.FirSessionComponent
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||||
|
import org.jetbrains.kotlin.fir.scopes.jvm.JvmMappedScope
|
||||||
import org.jetbrains.kotlin.fir.symbols.*
|
import org.jetbrains.kotlin.fir.symbols.*
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||||
@@ -62,6 +65,27 @@ abstract class FirSymbolProvider : FirSessionComponent {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getInstance(session: FirSession) = session.firSymbolProvider
|
fun getInstance(session: FirSession) = session.firSymbolProvider
|
||||||
|
|
||||||
|
fun wrapScopeWithJvmMapped(
|
||||||
|
classId: ClassId,
|
||||||
|
declaredMemberScope: FirScope,
|
||||||
|
useSiteSession: FirSession,
|
||||||
|
scopeSession: ScopeSession
|
||||||
|
): FirScope {
|
||||||
|
val javaClassId = JavaToKotlinClassMap.mapKotlinToJava(classId.asSingleFqName().toUnsafe())
|
||||||
|
?: return declaredMemberScope
|
||||||
|
val symbolProvider = useSiteSession.firSymbolProvider
|
||||||
|
val javaClass = symbolProvider.getClassLikeSymbolByFqName(javaClassId)?.fir as? FirRegularClass
|
||||||
|
?: return declaredMemberScope
|
||||||
|
val preparedSignatures = JvmMappedScope.prepareSignatures(javaClass)
|
||||||
|
return if (preparedSignatures.isNotEmpty()) {
|
||||||
|
symbolProvider.getClassUseSiteMemberScope(javaClassId, useSiteSession, scopeSession)?.let {
|
||||||
|
JvmMappedScope(declaredMemberScope, it, preparedSignatures)
|
||||||
|
} ?: declaredMemberScope
|
||||||
|
} else {
|
||||||
|
declaredMemberScope
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,17 +73,20 @@ fun FirClass<*>.buildUseSiteMemberScope(useSiteSession: FirSession, builder: Sco
|
|||||||
return symbolProvider.getClassUseSiteMemberScope(classId, useSiteSession, builder)
|
return symbolProvider.getClassUseSiteMemberScope(classId, useSiteSession, builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun FirClass<*>.buildDefaultUseSiteMemberScope(useSiteSession: FirSession, builder: ScopeSession): FirScope {
|
fun FirClass<*>.buildDefaultUseSiteMemberScope(useSiteSession: FirSession, scopeSession: ScopeSession): FirScope {
|
||||||
return builder.getOrBuild(symbol, USE_SITE) {
|
return scopeSession.getOrBuild(symbol, USE_SITE) {
|
||||||
|
|
||||||
val declaredScope = declaredMemberScope(this)
|
val declaredScope = declaredMemberScope(this)
|
||||||
|
val wrappedDeclaredScope = FirSymbolProvider.wrapScopeWithJvmMapped(
|
||||||
|
classId, declaredScope, useSiteSession, scopeSession
|
||||||
|
)
|
||||||
val scopes = lookupSuperTypes(this, lookupInterfaces = true, deep = false, useSiteSession = useSiteSession)
|
val scopes = lookupSuperTypes(this, lookupInterfaces = true, deep = false, useSiteSession = useSiteSession)
|
||||||
.mapNotNull { useSiteSuperType ->
|
.mapNotNull { useSiteSuperType ->
|
||||||
if (useSiteSuperType is ConeClassErrorType) return@mapNotNull null
|
if (useSiteSuperType is ConeClassErrorType) return@mapNotNull null
|
||||||
val symbol = useSiteSuperType.lookupTag.toSymbol(useSiteSession)
|
val symbol = useSiteSuperType.lookupTag.toSymbol(useSiteSession)
|
||||||
if (symbol is FirRegularClassSymbol) {
|
if (symbol is FirRegularClassSymbol) {
|
||||||
val useSiteMemberScope = symbol.fir.buildUseSiteMemberScope(useSiteSession, builder)!!
|
val useSiteMemberScope = symbol.fir.buildUseSiteMemberScope(useSiteSession, scopeSession)!!
|
||||||
useSiteSuperType.wrapSubstitutionScopeIfNeed(useSiteSession, useSiteMemberScope, symbol.fir, builder)
|
useSiteSuperType.wrapSubstitutionScopeIfNeed(useSiteSession, useSiteMemberScope, symbol.fir, scopeSession)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
@@ -91,7 +94,7 @@ fun FirClass<*>.buildDefaultUseSiteMemberScope(useSiteSession: FirSession, build
|
|||||||
FirClassUseSiteMemberScope(
|
FirClassUseSiteMemberScope(
|
||||||
useSiteSession,
|
useSiteSession,
|
||||||
FirSuperTypeScope(useSiteSession, FirStandardOverrideChecker(useSiteSession), scopes),
|
FirSuperTypeScope(useSiteSession, FirStandardOverrideChecker(useSiteSession), scopes),
|
||||||
declaredScope
|
wrappedDeclaredScope
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -9,13 +9,14 @@ import org.jetbrains.kotlin.fir.FirSession
|
|||||||
import org.jetbrains.kotlin.fir.FirSessionComponent
|
import org.jetbrains.kotlin.fir.FirSessionComponent
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||||
import org.jetbrains.kotlin.fir.resolve.memberScopeProvider
|
import org.jetbrains.kotlin.fir.resolve.memberScopeProvider
|
||||||
|
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
class FirMemberScopeProvider : FirSessionComponent {
|
class FirMemberScopeProvider : FirSessionComponent {
|
||||||
|
|
||||||
private val declaredMemberCache = mutableMapOf<FirClass<*>, FirClassDeclaredMemberScope>()
|
private val declaredMemberCache = mutableMapOf<FirClass<*>, FirScope>()
|
||||||
private val nestedClassifierCache = mutableMapOf<FirClass<*>, FirNestedClassifierScope>()
|
private val nestedClassifierCache = mutableMapOf<FirClass<*>, FirNestedClassifierScope>()
|
||||||
private val selfImportingCache = mutableMapOf<FqName, FirSelfImportingScope>()
|
private val selfImportingCache = mutableMapOf<FqName, FirSelfImportingScope>()
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ class FirMemberScopeProvider : FirSessionComponent {
|
|||||||
klass: FirClass<*>,
|
klass: FirClass<*>,
|
||||||
useLazyNestedClassifierScope: Boolean,
|
useLazyNestedClassifierScope: Boolean,
|
||||||
existingNames: List<Name>?
|
existingNames: List<Name>?
|
||||||
): FirClassDeclaredMemberScope {
|
): FirScope {
|
||||||
return declaredMemberCache.getOrPut(klass) {
|
return declaredMemberCache.getOrPut(klass) {
|
||||||
FirClassDeclaredMemberScope(klass, useLazyNestedClassifierScope, existingNames)
|
FirClassDeclaredMemberScope(klass, useLazyNestedClassifierScope, existingNames)
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ fun declaredMemberScope(
|
|||||||
klass: FirClass<*>,
|
klass: FirClass<*>,
|
||||||
useLazyNestedClassifierScope: Boolean = false,
|
useLazyNestedClassifierScope: Boolean = false,
|
||||||
existingNames: List<Name>? = null
|
existingNames: List<Name>? = null
|
||||||
): FirClassDeclaredMemberScope {
|
): FirScope {
|
||||||
return klass
|
return klass
|
||||||
.session
|
.session
|
||||||
.memberScopeProvider
|
.memberScopeProvider
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 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.scopes.jvm
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirFunction
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||||
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
|
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
|
||||||
|
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||||
|
import org.jetbrains.kotlin.load.java.structure.JavaClassifierType
|
||||||
|
import org.jetbrains.kotlin.load.java.structure.JavaPrimitiveType
|
||||||
|
import org.jetbrains.kotlin.load.java.structure.JavaTypeParameter
|
||||||
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
|
||||||
|
fun FirFunction<*>.computeJvmDescriptor(): String = buildString {
|
||||||
|
if (this@computeJvmDescriptor is FirSimpleFunction) {
|
||||||
|
append(name.asString())
|
||||||
|
} else {
|
||||||
|
append("<init>")
|
||||||
|
}
|
||||||
|
|
||||||
|
append("(")
|
||||||
|
for (parameter in valueParameters) {
|
||||||
|
appendErasedType(parameter.returnTypeRef)
|
||||||
|
}
|
||||||
|
append(")")
|
||||||
|
|
||||||
|
if (this@computeJvmDescriptor !is FirSimpleFunction || returnTypeRef.isVoid()) {
|
||||||
|
append("V")
|
||||||
|
} else {
|
||||||
|
appendErasedType(returnTypeRef)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: primitive types, arrays, etc.
|
||||||
|
private fun StringBuilder.appendErasedType(typeRef: FirTypeRef) {
|
||||||
|
fun appendClass(klass: JavaClass) {
|
||||||
|
klass.fqName?.let {
|
||||||
|
append("L")
|
||||||
|
append(it.asString().replace(".", "/"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when (typeRef) {
|
||||||
|
is FirResolvedTypeRef -> appendConeType(typeRef.type)
|
||||||
|
is FirJavaTypeRef -> {
|
||||||
|
when (val javaType = typeRef.type) {
|
||||||
|
is JavaClassifierType -> {
|
||||||
|
when (val classifier = javaType.classifier) {
|
||||||
|
is JavaClass -> appendClass(classifier)
|
||||||
|
is JavaTypeParameter -> {
|
||||||
|
val representative = classifier.upperBounds.firstOrNull { it.classifier is JavaClass }
|
||||||
|
if (representative == null) {
|
||||||
|
append("Ljava/lang/Object")
|
||||||
|
} else {
|
||||||
|
appendClass(representative.classifier as JavaClass)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> return
|
||||||
|
}
|
||||||
|
append(";")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun StringBuilder.appendConeType(coneType: ConeKotlinType) {
|
||||||
|
fun appendClassLikeType(type: ConeClassLikeType) {
|
||||||
|
append("L")
|
||||||
|
val classId = type.lookupTag.classId
|
||||||
|
append(classId.packageFqName.asString().replace(".", "/"))
|
||||||
|
append("/")
|
||||||
|
append(classId.relativeClassName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (coneType is ConeClassErrorType) return
|
||||||
|
when (coneType) {
|
||||||
|
is ConeClassLikeType -> {
|
||||||
|
appendClassLikeType(coneType)
|
||||||
|
}
|
||||||
|
is ConeTypeParameterType -> {
|
||||||
|
val representative = coneType.lookupTag.typeParameterSymbol.fir.bounds.firstOrNull {
|
||||||
|
(it as? FirResolvedTypeRef)?.type is ConeClassLikeType
|
||||||
|
}
|
||||||
|
if (representative == null) {
|
||||||
|
append("Ljava/lang/Object")
|
||||||
|
} else {
|
||||||
|
appendClassLikeType(representative.coneTypeUnsafe())
|
||||||
|
}
|
||||||
|
append(coneType.lookupTag.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
append(";")
|
||||||
|
}
|
||||||
|
|
||||||
|
private val unitClassId = ClassId.topLevel(FqName("kotlin.Unit"))
|
||||||
|
|
||||||
|
private fun FirTypeRef.isVoid(): Boolean {
|
||||||
|
return when (this) {
|
||||||
|
is FirJavaTypeRef -> {
|
||||||
|
type is JavaPrimitiveType && type.type == null
|
||||||
|
}
|
||||||
|
is FirResolvedTypeRef -> {
|
||||||
|
val type = type
|
||||||
|
type is ConeClassLikeType && type.lookupTag.classId == unitClassId
|
||||||
|
}
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 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.scopes.jvm
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltInsSettings
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
|
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||||
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
|
||||||
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
|
class JvmMappedScope(
|
||||||
|
private val declaredMemberScope: FirScope,
|
||||||
|
private val javaMappedScope: FirScope,
|
||||||
|
private val whiteListSignaturesByName: Map<Name, List<String>>
|
||||||
|
) : FirScope() {
|
||||||
|
|
||||||
|
override fun processFunctionsByName(name: Name, processor: (FirFunctionSymbol<*>) -> ProcessorAction): ProcessorAction {
|
||||||
|
val whiteListSignatures = whiteListSignaturesByName[name]
|
||||||
|
?: return declaredMemberScope.processFunctionsByName(name, processor)
|
||||||
|
if (!javaMappedScope.processFunctionsByName(name) { symbol ->
|
||||||
|
val jvmSignature = symbol.fir.computeJvmDescriptor()
|
||||||
|
if (jvmSignature !in whiteListSignatures) {
|
||||||
|
ProcessorAction.NEXT
|
||||||
|
} else {
|
||||||
|
processor(symbol)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) return ProcessorAction.STOP
|
||||||
|
|
||||||
|
return declaredMemberScope.processFunctionsByName(name, processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun processPropertiesByName(name: Name, processor: (FirCallableSymbol<*>) -> ProcessorAction): ProcessorAction {
|
||||||
|
return declaredMemberScope.processPropertiesByName(name, processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun prepareSignatures(klass: FirRegularClass): Map<Name, List<String>> {
|
||||||
|
val signaturePrefix = klass.symbol.classId.toString()
|
||||||
|
val filteredSignatures = JvmBuiltInsSettings.WHITE_LIST_METHOD_SIGNATURES.filter { signature ->
|
||||||
|
signature.startsWith(signaturePrefix)
|
||||||
|
}.map { signature ->
|
||||||
|
// +1 to delete dot before function name
|
||||||
|
signature.substring(signaturePrefix.length + 1)
|
||||||
|
}
|
||||||
|
return filteredSignatures.groupBy { Name.identifier(it.substringBefore("(")) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* 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.java.types
|
package org.jetbrains.kotlin.fir.types.jvm
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||||
import org.jetbrains.kotlin.fir.types.impl.FirUserTypeRefImpl
|
import org.jetbrains.kotlin.fir.types.impl.FirUserTypeRefImpl
|
||||||
@@ -6,17 +6,17 @@ FILE: test.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
public final fun test(e: R|MyException|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
public final fun test(e: R|MyException|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
||||||
R|<local>/e|.R|kotlin/printStackTrace|()
|
R|<local>/e|.R|java/lang/Throwable.printStackTrace|()
|
||||||
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
||||||
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
||||||
}
|
}
|
||||||
public final fun test(e: R|YourException|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
public final fun test(e: R|YourException|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
||||||
R|<local>/e|.R|kotlin/printStackTrace|()
|
R|<local>/e|.R|java/lang/Throwable.printStackTrace|()
|
||||||
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
||||||
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
||||||
}
|
}
|
||||||
public final fun test(e: R|kotlin/Exception|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
public final fun test(e: R|kotlin/Exception|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
||||||
R|<local>/e|.R|kotlin/printStackTrace|()
|
R|<local>/e|.R|java/lang/Throwable.printStackTrace|()
|
||||||
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
||||||
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ public interface MyIterable<T> extends Iterable<T>
|
|||||||
interface UseIterable : MyIterable<String> {
|
interface UseIterable : MyIterable<String> {
|
||||||
fun test() {
|
fun test() {
|
||||||
val it = iterator()
|
val it = iterator()
|
||||||
val split = <!UNRESOLVED_REFERENCE!>spliterator<!>()
|
val split = spliterator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test(some: Iterable<String>) {
|
fun test(some: Iterable<String>) {
|
||||||
val it = some.iterator()
|
val it = some.iterator()
|
||||||
val split = some.<!UNRESOLVED_REFERENCE!>spliterator<!>()
|
val split = some.spliterator()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ FILE: test.kt
|
|||||||
public abstract interface UseIterable : R|MyIterable<kotlin/String>| {
|
public abstract interface UseIterable : R|MyIterable<kotlin/String>| {
|
||||||
public open fun test(): R|kotlin/Unit| {
|
public open fun test(): R|kotlin/Unit| {
|
||||||
lval it: R|kotlin/collections/MutableIterator<kotlin/String>| = this@R|kotlin/collections/MutableIterable|.R|FakeOverride<kotlin/collections/MutableIterable.iterator: R|kotlin/collections/MutableIterator<kotlin/String>|>|()
|
lval it: R|kotlin/collections/MutableIterator<kotlin/String>| = this@R|kotlin/collections/MutableIterable|.R|FakeOverride<kotlin/collections/MutableIterable.iterator: R|kotlin/collections/MutableIterator<kotlin/String>|>|()
|
||||||
lval split: <ERROR TYPE REF: Unresolved name: spliterator> = <Unresolved name: spliterator>#()
|
lval split: R|java/util/Spliterator<T!>| = this@R|java/lang/Iterable|.R|FakeOverride<java/lang/Iterable.spliterator: R|java/util/Spliterator<T!>|>|()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun test(some: R|kotlin/collections/Iterable<kotlin/String>|): R|kotlin/Unit| {
|
public final fun test(some: R|kotlin/collections/Iterable<kotlin/String>|): R|kotlin/Unit| {
|
||||||
lval it: R|kotlin/collections/Iterator<kotlin/String>| = R|<local>/some|.R|FakeOverride<kotlin/collections/Iterable.iterator: R|kotlin/collections/Iterator<kotlin/String>|>|()
|
lval it: R|kotlin/collections/Iterator<kotlin/String>| = R|<local>/some|.R|FakeOverride<kotlin/collections/Iterable.iterator: R|kotlin/collections/Iterator<kotlin/String>|>|()
|
||||||
lval split: <ERROR TYPE REF: Unresolved name: spliterator> = R|<local>/some|.<Unresolved name: spliterator>#()
|
lval split: R|java/util/Spliterator<T!>| = R|<local>/some|.R|FakeOverride<java/lang/Iterable.spliterator: R|java/util/Spliterator<T!>|>|()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ fun test(map: MyMap) {
|
|||||||
val otherResult = map.getOrDefault("key", "value")
|
val otherResult = map.getOrDefault("key", "value")
|
||||||
val anotherResult = map.<!UNRESOLVED_REFERENCE!>replace<!>("key", "value")
|
val anotherResult = map.<!UNRESOLVED_REFERENCE!>replace<!>("key", "value")
|
||||||
// Java forEach
|
// Java forEach
|
||||||
map.<!INAPPLICABLE_CANDIDATE!>forEach<!> { key, value ->
|
map.forEach { key, value ->
|
||||||
println("$key: $value")
|
println("$key: $value")
|
||||||
}
|
}
|
||||||
// Kotlin forEach
|
// Kotlin forEach
|
||||||
@@ -25,7 +25,7 @@ fun test(map: MutableMap<String, String>) {
|
|||||||
val otherResult = map.getOrDefault("key", "value")
|
val otherResult = map.getOrDefault("key", "value")
|
||||||
val anotherResult = map.<!UNRESOLVED_REFERENCE!>replace<!>("key", "value")
|
val anotherResult = map.<!UNRESOLVED_REFERENCE!>replace<!>("key", "value")
|
||||||
// Java forEach
|
// Java forEach
|
||||||
map.<!INAPPLICABLE_CANDIDATE!>forEach<!> { key, value ->
|
map.forEach { key, value ->
|
||||||
println("$key: $value")
|
println("$key: $value")
|
||||||
}
|
}
|
||||||
// Kotlin forEach
|
// Kotlin forEach
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ FILE: test.kt
|
|||||||
)
|
)
|
||||||
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
|
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
|
||||||
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
|
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
|
||||||
R|<local>/map|.<Inapplicable(INAPPLICABLE): [kotlin/collections/forEach]>#(<L> = forEach@fun <anonymous>(key: R|class error: No type for parameter|, value: R|class error: No type for parameter|): R|kotlin/Unit| {
|
R|<local>/map|.R|java/util/Map.forEach|(<L> = forEach@fun <anonymous>(key: R|K!|, value: R|V!|): R|kotlin/Unit| {
|
||||||
R|kotlin/io/println|(<strcat>(R|<local>/key|.R|kotlin/toString|(), String(: ), R|<local>/value|.R|kotlin/toString|()))
|
R|kotlin/io/println|(<strcat>(R|<local>/key|.R|kotlin/Any.toString|(), String(: ), R|<local>/value|.R|kotlin/Any.toString|()))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(<destruct>: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|): R|kotlin/Unit| <kind=UNKNOWN> {
|
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(<destruct>: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||||
@@ -24,8 +24,8 @@ FILE: test.kt
|
|||||||
)
|
)
|
||||||
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
|
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
|
||||||
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
|
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
|
||||||
R|<local>/map|.<Inapplicable(INAPPLICABLE): [kotlin/collections/forEach]>#(<L> = forEach@fun <anonymous>(key: R|class error: No type for parameter|, value: R|class error: No type for parameter|): R|kotlin/Unit| {
|
R|<local>/map|.R|java/util/Map.forEach|(<L> = forEach@fun <anonymous>(key: R|K!|, value: R|V!|): R|kotlin/Unit| {
|
||||||
R|kotlin/io/println|(<strcat>(R|<local>/key|.R|kotlin/toString|(), String(: ), R|<local>/value|.R|kotlin/toString|()))
|
R|kotlin/io/println|(<strcat>(R|<local>/key|.R|kotlin/Any.toString|(), String(: ), R|<local>/value|.R|kotlin/Any.toString|()))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(<destruct>: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|): R|kotlin/Unit| <kind=UNKNOWN> {
|
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(<destruct>: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||||
|
|||||||
Reference in New Issue
Block a user