[FIR] Java super-type arguments are now handled as flexible
This commit is contained in:
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.*
|
||||
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeNullability
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirResolvedTypeRefImpl
|
||||
import org.jetbrains.kotlin.load.java.JavaClassFinder
|
||||
@@ -95,7 +96,7 @@ class JavaSymbolProvider(
|
||||
) {
|
||||
require(this is FirTypeParameterImpl)
|
||||
for (upperBound in javaTypeParameter.upperBounds) {
|
||||
bounds += upperBound.toFirResolvedTypeRef(this@JavaSymbolProvider.session, stack, isNullable = true)
|
||||
bounds += upperBound.toFirResolvedTypeRef(this@JavaSymbolProvider.session, stack, nullability = ConeNullability.NULLABLE)
|
||||
}
|
||||
addDefaultBoundIfNecessary()
|
||||
}
|
||||
@@ -155,7 +156,9 @@ class JavaSymbolProvider(
|
||||
this.typeParameters += foundClass.typeParameters.convertTypeParameters(javaTypeParameterStack)
|
||||
addAnnotationsFrom(this@JavaSymbolProvider.session, javaClass, javaTypeParameterStack)
|
||||
for (supertype in javaClass.supertypes) {
|
||||
superTypeRefs += supertype.toFirResolvedTypeRef(this@JavaSymbolProvider.session, javaTypeParameterStack)
|
||||
superTypeRefs += supertype.toFirResolvedTypeRef(
|
||||
this@JavaSymbolProvider.session, javaTypeParameterStack, typeParametersNullability = ConeNullability.UNKNOWN
|
||||
)
|
||||
}
|
||||
// TODO: may be we can process fields & methods later.
|
||||
// However, they should be built up to override resolve stage
|
||||
|
||||
@@ -78,8 +78,8 @@ internal fun FirTypeRef.toNotNullConeKotlinType(
|
||||
|
||||
internal fun JavaType?.toNotNullConeKotlinType(
|
||||
session: FirSession, javaTypeParameterStack: JavaTypeParameterStack
|
||||
): ConeLookupTagBasedType {
|
||||
return toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = false)
|
||||
): ConeKotlinType {
|
||||
return toConeKotlinTypeWithNullability(session, javaTypeParameterStack, ConeNullability.NOT_NULL)
|
||||
}
|
||||
|
||||
internal fun JavaType.toFirJavaTypeRef(session: FirSession, javaTypeParameterStack: JavaTypeParameterStack): FirJavaTypeRef {
|
||||
@@ -91,9 +91,12 @@ internal fun JavaType.toFirJavaTypeRef(session: FirSession, javaTypeParameterSta
|
||||
}
|
||||
|
||||
internal fun JavaClassifierType.toFirResolvedTypeRef(
|
||||
session: FirSession, javaTypeParameterStack: JavaTypeParameterStack, isNullable: Boolean = false
|
||||
session: FirSession,
|
||||
javaTypeParameterStack: JavaTypeParameterStack,
|
||||
nullability: ConeNullability = ConeNullability.NOT_NULL,
|
||||
typeParametersNullability: ConeNullability = ConeNullability.NOT_NULL
|
||||
): FirResolvedTypeRef {
|
||||
val coneType = this.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable)
|
||||
val coneType = this.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, nullability, typeParametersNullability)
|
||||
return FirResolvedTypeRefImpl(
|
||||
source = null, type = coneType
|
||||
).apply {
|
||||
@@ -102,11 +105,14 @@ internal fun JavaClassifierType.toFirResolvedTypeRef(
|
||||
}
|
||||
|
||||
internal fun JavaType?.toConeKotlinTypeWithNullability(
|
||||
session: FirSession, javaTypeParameterStack: JavaTypeParameterStack, isNullable: Boolean
|
||||
): ConeLookupTagBasedType {
|
||||
session: FirSession,
|
||||
javaTypeParameterStack: JavaTypeParameterStack,
|
||||
nullability: ConeNullability,
|
||||
typeParametersNullability: ConeNullability = ConeNullability.NOT_NULL
|
||||
): ConeKotlinType {
|
||||
return when (this) {
|
||||
is JavaClassifierType -> {
|
||||
toConeKotlinTypeWithNullability(session, isNullable, javaTypeParameterStack)
|
||||
toConeKotlinTypeWithNullability(session, nullability, typeParametersNullability, javaTypeParameterStack)
|
||||
}
|
||||
is JavaPrimitiveType -> {
|
||||
val primitiveType = type
|
||||
@@ -115,38 +121,47 @@ internal fun JavaType?.toConeKotlinTypeWithNullability(
|
||||
else -> javaName.capitalize()
|
||||
}
|
||||
val classId = StandardClassIds.byName(kotlinPrimitiveName)
|
||||
classId.toConeKotlinType(emptyArray(), isNullable)
|
||||
classId.toConeKotlinType(emptyArray(), nullability.isNullable)
|
||||
}
|
||||
is JavaArrayType -> {
|
||||
val componentType = componentType
|
||||
if (componentType !is JavaPrimitiveType) {
|
||||
val classId = StandardClassIds.Array
|
||||
val argumentType = ConeFlexibleType(
|
||||
componentType.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = false),
|
||||
componentType.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = true)
|
||||
componentType.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, ConeNullability.NOT_NULL),
|
||||
componentType.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, ConeNullability.NULLABLE)
|
||||
)
|
||||
classId.toConeKotlinType(arrayOf(argumentType), isNullable)
|
||||
classId.toConeKotlinType(arrayOf(argumentType), nullability.isNullable)
|
||||
} else {
|
||||
val javaComponentName = componentType.type?.typeName?.asString()?.capitalize() ?: error("Array of voids")
|
||||
val classId = StandardClassIds.byName(javaComponentName + "Array")
|
||||
classId.toConeKotlinType(emptyArray(), isNullable)
|
||||
classId.toConeKotlinType(emptyArray(), nullability.isNullable)
|
||||
}
|
||||
}
|
||||
is JavaWildcardType -> bound?.toNotNullConeKotlinType(session, javaTypeParameterStack) ?: run {
|
||||
val classId = StandardClassIds.Any
|
||||
classId.toConeKotlinType(emptyArray(), isNullable)
|
||||
classId.toConeKotlinType(emptyArray(), nullability.isNullable)
|
||||
}
|
||||
null -> {
|
||||
val classId = StandardClassIds.Any
|
||||
classId.toConeKotlinType(emptyArray(), isNullable)
|
||||
classId.toConeKotlinType(emptyArray(), nullability.isNullable)
|
||||
}
|
||||
else -> error("Strange JavaType: ${this::class.java}")
|
||||
}
|
||||
}
|
||||
|
||||
internal fun JavaClassifierType.toConeKotlinTypeWithNullability(
|
||||
session: FirSession, isNullable: Boolean, javaTypeParameterStack: JavaTypeParameterStack
|
||||
): ConeLookupTagBasedType {
|
||||
session: FirSession,
|
||||
nullability: ConeNullability,
|
||||
typeParametersNullability: ConeNullability,
|
||||
javaTypeParameterStack: JavaTypeParameterStack
|
||||
): ConeKotlinType {
|
||||
if (nullability == ConeNullability.UNKNOWN) {
|
||||
return ConeFlexibleType(
|
||||
toConeKotlinTypeWithNullability(session, ConeNullability.NOT_NULL, typeParametersNullability, javaTypeParameterStack),
|
||||
toConeKotlinTypeWithNullability(session, ConeNullability.NULLABLE, typeParametersNullability, javaTypeParameterStack)
|
||||
)
|
||||
}
|
||||
return when (val classifier = classifier) {
|
||||
is JavaClass -> {
|
||||
//val classId = classifier.classId!!
|
||||
@@ -155,17 +170,16 @@ internal fun JavaClassifierType.toConeKotlinTypeWithNullability(
|
||||
|
||||
val lookupTag = ConeClassLikeLookupTagImpl(classId)
|
||||
lookupTag.constructClassType(
|
||||
typeArguments.mapIndexed { index, argument ->
|
||||
typeArguments.map { argument ->
|
||||
argument.toConeProjection(
|
||||
session, javaTypeParameterStack, null
|
||||
//symbol.fir.typeParameters.getOrNull(index)
|
||||
session, javaTypeParameterStack, boundTypeParameter = null, nullability = typeParametersNullability
|
||||
)
|
||||
}.toTypedArray(), isNullable
|
||||
}.toTypedArray(), nullability.isNullable
|
||||
)
|
||||
}
|
||||
is JavaTypeParameter -> {
|
||||
val symbol = javaTypeParameterStack[classifier]
|
||||
ConeTypeParameterTypeImpl(symbol.toLookupTag(), isNullable)
|
||||
ConeTypeParameterTypeImpl(symbol.toLookupTag(), nullability.isNullable)
|
||||
}
|
||||
else -> ConeClassErrorType(reason = "Unexpected classifier: $classifier")
|
||||
}
|
||||
@@ -208,7 +222,10 @@ internal fun JavaValueParameter.toFirValueParameter(
|
||||
}
|
||||
|
||||
internal fun JavaType?.toConeProjection(
|
||||
session: FirSession, javaTypeParameterStack: JavaTypeParameterStack, boundTypeParameter: FirTypeParameter?
|
||||
session: FirSession,
|
||||
javaTypeParameterStack: JavaTypeParameterStack,
|
||||
boundTypeParameter: FirTypeParameter?,
|
||||
nullability: ConeNullability = ConeNullability.NOT_NULL
|
||||
): ConeKotlinTypeProjection {
|
||||
return when (this) {
|
||||
null -> ConeStarProjection
|
||||
@@ -219,7 +236,7 @@ internal fun JavaType?.toConeProjection(
|
||||
if (bound == null || parameterVariance != INVARIANT && parameterVariance != argumentVariance) {
|
||||
ConeStarProjection
|
||||
} else {
|
||||
val boundType = bound.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = false)
|
||||
val boundType = bound.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, nullability)
|
||||
if (argumentVariance == OUT_VARIANCE) {
|
||||
ConeKotlinTypeProjectionOut(boundType)
|
||||
} else {
|
||||
@@ -227,7 +244,7 @@ internal fun JavaType?.toConeProjection(
|
||||
}
|
||||
}
|
||||
}
|
||||
is JavaClassifierType -> toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = false)
|
||||
is JavaClassifierType -> toConeKotlinTypeWithNullability(session, javaTypeParameterStack, nullability)
|
||||
else -> ConeClassErrorType("Unexpected type argument: $this")
|
||||
}
|
||||
}
|
||||
@@ -260,7 +277,9 @@ private fun JavaAnnotationArgument.toFirExpression(
|
||||
null
|
||||
}
|
||||
this.calleeReference = calleeReference
|
||||
?: FirErrorNamedReferenceImpl(null, FirSimpleDiagnostic("Strange Java enum value: $classId.$entryName", DiagnosticKind.Java))
|
||||
?: FirErrorNamedReferenceImpl(
|
||||
null, FirSimpleDiagnostic("Strange Java enum value: $classId.$entryName", DiagnosticKind.Java)
|
||||
)
|
||||
}
|
||||
}
|
||||
is JavaClassObjectAnnotationArgument -> FirGetClassCallImpl(null).apply {
|
||||
@@ -270,7 +289,9 @@ private fun JavaAnnotationArgument.toFirExpression(
|
||||
)
|
||||
}
|
||||
is JavaAnnotationAsAnnotationArgument -> getAnnotation().toFirAnnotationCall(session, javaTypeParameterStack)
|
||||
else -> FirErrorExpressionImpl(null, FirSimpleDiagnostic("Unknown JavaAnnotationArgument: ${this::class.java}", DiagnosticKind.Java))
|
||||
else -> FirErrorExpressionImpl(
|
||||
null, FirSimpleDiagnostic("Unknown JavaAnnotationArgument: ${this::class.java}", DiagnosticKind.Java)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +325,9 @@ internal fun Any?.createConstant(session: FirSession): FirExpression {
|
||||
is BooleanArray -> toList().createArrayOfCall(session, FirConstKind.Boolean)
|
||||
null -> FirConstExpressionImpl(null, FirConstKind.Null, null)
|
||||
|
||||
else -> FirErrorExpressionImpl(null, FirSimpleDiagnostic("Unknown value in JavaLiteralAnnotationArgument: $this", DiagnosticKind.Java))
|
||||
else -> FirErrorExpressionImpl(
|
||||
null, FirSimpleDiagnostic("Unknown value in JavaLiteralAnnotationArgument: $this", DiagnosticKind.Java)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -152,8 +152,8 @@ internal class EnhancementSignatureParts(
|
||||
is FirJavaTypeRef -> {
|
||||
Pair(
|
||||
// TODO: optimize
|
||||
type.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = false),
|
||||
type.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, isNullable = true)
|
||||
type.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, nullability = ConeNullability.NOT_NULL),
|
||||
type.toConeKotlinTypeWithNullability(session, javaTypeParameterStack, nullability = ConeNullability.NULLABLE)
|
||||
)
|
||||
}
|
||||
else -> return JavaTypeQualifiers.NONE
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.jetbrains.kotlin.fir.java.declarations.FirJavaField
|
||||
import org.jetbrains.kotlin.fir.java.toConeProjection
|
||||
import org.jetbrains.kotlin.fir.java.toNotNullConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirResolvedNamedReferenceImpl
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference
|
||||
import org.jetbrains.kotlin.fir.resolve.*
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.firUnsafe
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
|
||||
@@ -124,12 +123,12 @@ private fun JavaType?.subtreeSize(): Int {
|
||||
|
||||
private fun coneFlexibleOrSimpleType(
|
||||
session: FirSession,
|
||||
lowerBound: ConeLookupTagBasedType,
|
||||
upperBound: ConeLookupTagBasedType,
|
||||
lowerBound: ConeKotlinType,
|
||||
upperBound: ConeKotlinType,
|
||||
isNotNullTypeParameter: Boolean
|
||||
): ConeKotlinType {
|
||||
if (AbstractStrictEqualityTypeChecker.strictEqualTypes(session.typeContext, lowerBound, upperBound)) {
|
||||
val lookupTag = lowerBound.lookupTag
|
||||
val lookupTag = (lowerBound as? ConeLookupTagBasedType)?.lookupTag
|
||||
if (isNotNullTypeParameter && lookupTag is ConeTypeParameterLookupTag && !lowerBound.isMarkedNullable) {
|
||||
// TODO: we need enhancement for type parameter bounds for this code to work properly
|
||||
// At this moment, this condition is always true
|
||||
@@ -164,8 +163,6 @@ private fun ClassId.mutableToReadOnly(): ClassId? {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Definition:
|
||||
// ErasedUpperBound(T : G<t>) = G<*> // UpperBound(T) is a type G<t> with arguments
|
||||
// ErasedUpperBound(T : A) = A // UpperBound(T) is a type A without arguments
|
||||
@@ -181,8 +178,7 @@ private fun FirTypeParameter.getErasedUpperBound(
|
||||
|
||||
val firstUpperBound = this.bounds.first().coneTypeUnsafe<ConeKotlinType>()
|
||||
|
||||
val firstUpperBoundClassifier = firstUpperBound
|
||||
if (firstUpperBoundClassifier is ConeClassLikeType) {
|
||||
if (firstUpperBound is ConeClassLikeType) {
|
||||
return firstUpperBound.withArguments(firstUpperBound.typeArguments.map { ConeStarProjection }.toTypedArray())
|
||||
}
|
||||
|
||||
@@ -225,7 +221,8 @@ fun computeProjection(
|
||||
// in T -> Comparable<Nothing>
|
||||
session.builtinTypes.nothingType.type
|
||||
else if (erasedUpperBound is ConeClassLikeType &&
|
||||
erasedUpperBound.lookupTag.toSymbol(session)!!.firUnsafe<FirRegularClass>().typeParameters.isNotEmpty())
|
||||
erasedUpperBound.lookupTag.toSymbol(session)!!.firUnsafe<FirRegularClass>().typeParameters.isNotEmpty()
|
||||
)
|
||||
// T : Enum<E> -> out Enum<*>
|
||||
ConeKotlinTypeProjectionOut(erasedUpperBound)
|
||||
else
|
||||
@@ -234,8 +231,6 @@ fun computeProjection(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun JavaClassifierType.enhanceInflexibleType(
|
||||
session: FirSession,
|
||||
javaTypeParameterStack: JavaTypeParameterStack,
|
||||
@@ -244,9 +239,8 @@ private fun JavaClassifierType.enhanceInflexibleType(
|
||||
position: TypeComponentPosition,
|
||||
qualifiers: IndexedJavaTypeQualifiers,
|
||||
index: Int
|
||||
): ConeLookupTagBasedType {
|
||||
val classifier = classifier
|
||||
val originalTag = when (classifier) {
|
||||
): ConeKotlinType {
|
||||
val originalTag = when (val classifier = classifier) {
|
||||
is JavaClass -> {
|
||||
val classId = classifier.classId!!
|
||||
var mappedId = JavaToKotlinClassMap.mapJavaToKotlin(classId.asSingleFqName())
|
||||
|
||||
@@ -217,10 +217,17 @@ fun coneFlexibleOrSimpleType(
|
||||
if (upperBound is ConeFlexibleType) {
|
||||
return coneFlexibleOrSimpleType(typeContext, lowerBound, upperBound.upperBound)
|
||||
}
|
||||
if (typeContext != null && AbstractStrictEqualityTypeChecker.strictEqualTypes(typeContext, lowerBound, upperBound)) {
|
||||
return lowerBound
|
||||
return when {
|
||||
typeContext != null && AbstractStrictEqualityTypeChecker.strictEqualTypes(typeContext, lowerBound, upperBound) -> {
|
||||
lowerBound
|
||||
}
|
||||
typeContext == null && lowerBound == upperBound -> {
|
||||
lowerBound
|
||||
}
|
||||
else -> {
|
||||
ConeFlexibleType(lowerBound, upperBound)
|
||||
}
|
||||
}
|
||||
return ConeFlexibleType(lowerBound, upperBound)
|
||||
}
|
||||
|
||||
fun <T : ConeKotlinType> T.withNullability(nullability: ConeNullability, typeContext: ConeInferenceContext? = null): T {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public abstract class AbstractMap : R|kotlin/Any|, R|kotlin/collections/MutableMap<kotlin/String, kotlin/String>| {
|
||||
public abstract class AbstractMap : R|kotlin/Any|, R|kotlin/collections/MutableMap<ft<kotlin/String, kotlin/String?>!, ft<kotlin/String, kotlin/String?>!>| {
|
||||
public constructor(): R|AbstractMap|
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ public/*package*/ open class A : R|kotlin/Any| {
|
||||
public/*package*/ constructor(): R|A|
|
||||
|
||||
}
|
||||
public final enum class Mixed : R|kotlin/Enum<Mixed>| {
|
||||
public final enum class Mixed : R|kotlin/Enum<ft<Mixed, Mixed?>!>| {
|
||||
public final static field NOT_ENTRY_EITHER: R|ft<Mixed, Mixed?>!|
|
||||
|
||||
public final static fun values(): R|kotlin/Array<Mixed>| {
|
||||
@@ -20,7 +20,7 @@ public final enum class Mixed : R|kotlin/Enum<Mixed>| {
|
||||
}
|
||||
|
||||
}
|
||||
public final enum class Signs : R|kotlin/Enum<Signs>| {
|
||||
public final enum class Signs : R|kotlin/Enum<ft<Signs, Signs?>!>| {
|
||||
public final static field HELLO: R|ft<Signs, Signs?>!|
|
||||
|
||||
public final static field WORLD: R|ft<Signs, Signs?>!|
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
FILE: hashSet.kt
|
||||
public final val a: R|kotlin/collections/MutableSet<kotlin/String>?| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
||||
public final val a: R|kotlin/collections/MutableSet<kotlin/String>?| = R|java/util/HashSet.HashSet|<R|ft<kotlin/String, kotlin/String?>!|>()
|
||||
public get(): R|kotlin/collections/MutableSet<kotlin/String>?|
|
||||
public final var b: R|kotlin/collections/MutableSet<kotlin/String>?| = Null(null)
|
||||
public get(): R|kotlin/collections/MutableSet<kotlin/String>?|
|
||||
public set(_: R|kotlin/collections/MutableSet<kotlin/String>?|): R|kotlin/Unit| {
|
||||
F|/b| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
||||
F|/b| = R|java/util/HashSet.HashSet|<R|ft<kotlin/String, kotlin/String?>!|>()
|
||||
}
|
||||
public final var <T> R|kotlin/collections/MutableSet<T>|.d: R|T?|
|
||||
public get(): R|T?| {
|
||||
@@ -17,6 +17,6 @@ FILE: hashSet.kt
|
||||
}
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lvar c: R|kotlin/collections/MutableSet<kotlin/String>?| = Null(null)
|
||||
R|<local>/c| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
|
||||
R|<local>/c| = R|java/util/HashSet.HashSet|<R|ft<kotlin/String, kotlin/String?>!|>()
|
||||
R|<local>/c|!!.R|/d| = R|/produce|<R|T?|>()
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ FILE: K2.kt
|
||||
}
|
||||
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
this@R|/K2|.R|FakeOverride</KFirst.foo: R|kotlin/Int|>|(Int(1))
|
||||
this@R|/K2|.R|FakeOverride</KFirst.foo: R|ft<kotlin/Int, kotlin/Int?>!|>|(Int(1))
|
||||
this@R|/K2|.R|/J1.baz|()
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class MyMapEntry : Test.MapEntryImpl()
|
||||
|
||||
fun test() {
|
||||
val b = MyMapEntry()
|
||||
b.key
|
||||
b.value
|
||||
val key = b.key
|
||||
val value = b.value
|
||||
b.setValue(null)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ FILE: main.kt
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval b: R|MyMapEntry| = R|/MyMapEntry.MyMapEntry|()
|
||||
R|<local>/b|.R|/Test.MapEntryImpl.key|
|
||||
R|<local>/b|.R|/Test.MapEntryImpl.value|
|
||||
lval key: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/b|.R|/Test.MapEntryImpl.key|
|
||||
lval value: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/b|.R|/Test.MapEntryImpl.value|
|
||||
R|<local>/b|.R|/Test.MapEntryImpl.setValue|(Null(null))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
FILE: test.kt
|
||||
public abstract interface UseIterable : R|MyIterable<kotlin/String>| {
|
||||
public open fun test(): R|kotlin/Unit| {
|
||||
lval it: R|kotlin/collections/MutableIterator<kotlin/String>| = this@R|/UseIterable|.R|FakeOverride<kotlin/collections/MutableIterable.iterator: R|kotlin/collections/MutableIterator<kotlin/String>|>|()
|
||||
lval split: R|java/util/Spliterator<kotlin/String>| = this@R|/UseIterable|.R|FakeOverride<java/lang/Iterable.spliterator: R|java/util/Spliterator<kotlin/String>|>|()
|
||||
lval it: R|kotlin/collections/MutableIterator<ft<kotlin/String, kotlin/String?>!>| = this@R|/UseIterable|.R|FakeOverride<kotlin/collections/MutableIterable.iterator: R|kotlin/collections/MutableIterator<ft<kotlin/String, kotlin/String?>!>|>|()
|
||||
lval split: R|java/util/Spliterator<ft<kotlin/String, kotlin/String?>!>| = this@R|/UseIterable|.R|FakeOverride<java/lang/Iterable.spliterator: R|java/util/Spliterator<ft<kotlin/String, kotlin/String?>!>|>|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
FILE: test.kt
|
||||
public final fun test(map: R|MyMap|): R|kotlin/Unit| {
|
||||
lval result: R|kotlin/String| = R|<local>/map|.R|kotlin/collections/getOrPut|<R|kotlin/String|, R|kotlin/String|>(String(key), <L> = getOrPut@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
|
||||
lval result: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/map|.R|kotlin/collections/getOrPut|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<kotlin/String, kotlin/String?>!|>(String(key), <L> = getOrPut@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
|
||||
String(value)
|
||||
}
|
||||
)
|
||||
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
|
||||
lval otherResult: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|ft<kotlin/String, kotlin/String?>!|>|(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|.R|FakeOverride<java/util/Map.forEach: R|kotlin/Unit|>|(<L> = forEach@fun <anonymous>(key: R|kotlin/String|, value: R|kotlin/String|): R|kotlin/Unit| {
|
||||
R|<local>/map|.R|FakeOverride<java/util/Map.forEach: R|kotlin/Unit|>|(<L> = forEach@fun <anonymous>(key: R|ft<kotlin/String, kotlin/String?>!|, value: R|ft<kotlin/String, kotlin/String?>!|): R|kotlin/Unit| {
|
||||
R|kotlin/io/println|(<strcat>(R|<local>/key|.R|kotlin/Any.toString|(), String(: ), R|<local>/value|.R|kotlin/Any.toString|()))
|
||||
R|<local>/key|.R|kotlin/String.length|
|
||||
R|<local>/value|.R|kotlin/String.length|
|
||||
}
|
||||
)
|
||||
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> {
|
||||
lval key: R|kotlin/String| = R|<local>/<destruct>|.R|kotlin/collections/component1|<R|kotlin/String|, R|kotlin/String|>()
|
||||
lval value: R|kotlin/String| = R|<local>/<destruct>|.R|kotlin/collections/component2|<R|kotlin/String|, R|kotlin/String|>()
|
||||
R|<local>/map|.R|kotlin/collections/forEach|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = forEach@fun <anonymous>(<destruct>: R|kotlin/collections/Map.Entry<ft<kotlin/String, kotlin/String?>!, ft<kotlin/String, kotlin/String?>!>|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
lval key: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/<destruct>|.R|kotlin/collections/component1|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<kotlin/String, kotlin/String?>!|>()
|
||||
lval value: R|ft<kotlin/String, kotlin/String?>!| = R|<local>/<destruct>|.R|kotlin/collections/component2|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<kotlin/String, kotlin/String?>!|>()
|
||||
R|kotlin/io/println|(<strcat>(R|<local>/key|.R|kotlin/Any.toString|(), String(: ), R|<local>/value|.R|kotlin/Any.toString|()))
|
||||
R|<local>/key|.R|kotlin/String.length|
|
||||
R|<local>/value|.R|kotlin/String.length|
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
fun test(map: java.util.AbstractMap<String, Int>) {
|
||||
map.<!INAPPLICABLE_CANDIDATE!>remove<!>("", null)
|
||||
map.remove("", null)
|
||||
map.remove(null)
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
FILE: removeOnAbstractMap.kt
|
||||
public final fun test(map: R|java/util/AbstractMap<kotlin/String, kotlin/Int>|): R|kotlin/Unit| {
|
||||
R|<local>/map|.<Inapplicable(INAPPLICABLE): [kotlin/collections/MutableMap.remove]>#(String(), Null(null))
|
||||
R|<local>/map|.R|FakeOverride<kotlin/collections/MutableMap.remove: R|kotlin/Boolean|>|(String(), Null(null))
|
||||
R|<local>/map|.R|FakeOverride<kotlin/collections/MutableMap.remove: R|kotlin/Int?|>|(Null(null))
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ FILE: typeAliasWithForEach.kt
|
||||
public final fun R|Arguments|.deepCopy(): R|Arguments| {
|
||||
lval result: R|java/util/HashMap<kotlin/String, ArgsInfo>| = R|java/util/HashMap.HashMap|<R|kotlin/String|, R|ArgsInfo|>()
|
||||
this@R|/deepCopy|.R|FakeOverride<java/util/Map.forEach: R|kotlin/Unit|>|(<L> = forEach@fun <anonymous>(key: R|kotlin/String|, value: R|ArgsInfo|): R|kotlin/Unit| {
|
||||
R|<local>/result|.R|kotlin/collections/set|<R|kotlin/String|, R|ArgsInfo|>(R|<local>/key|, R|/ArgsInfoImpl.ArgsInfoImpl|(R|<local>/value|))
|
||||
R|<local>/result|.R|kotlin/collections/set|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<ArgsInfo, ArgsInfo?>!|>(R|<local>/key|, R|/ArgsInfoImpl.ArgsInfoImpl|(R|<local>/value|))
|
||||
}
|
||||
)
|
||||
^deepCopy R|<local>/result|
|
||||
|
||||
Vendored
+4
-4
@@ -28,11 +28,11 @@ interface WithFoo {
|
||||
|
||||
fun <M2: WithFoo> foo(delegateResolver: ResolverForProject<M2?>): ResolverForProject<M2?> {
|
||||
val descriptorByModule = MyMap<M2, String>()
|
||||
val result = <!INAPPLICABLE_CANDIDATE!>ResolverForProjectImpl<!>(descriptorByModule, delegateResolver)
|
||||
result.<!UNRESOLVED_REFERENCE!>exposeM<!>.<!UNRESOLVED_REFERENCE!>foo<!>() // M is not M2?
|
||||
result.<!UNRESOLVED_REFERENCE!>exposeM<!>?.<!UNRESOLVED_REFERENCE!>foo<!>() // no warning, M is not M2, hense M is M2!
|
||||
val result = ResolverForProjectImpl(descriptorByModule, delegateResolver)
|
||||
result.exposeM.foo() // M is not M2?
|
||||
result.exposeM?.foo() // no warning, M is not M2, hense M is M2!
|
||||
|
||||
return <!INAPPLICABLE_CANDIDATE!>ResolverForProjectImpl<!>(descriptorByModule, delegateResolver) // another bound check
|
||||
return ResolverForProjectImpl(descriptorByModule, delegateResolver) // another bound check
|
||||
}
|
||||
|
||||
// MyMap<M2, String> :< Map<M, String> => M = M2!
|
||||
|
||||
+4
-4
@@ -22,10 +22,10 @@ fun test(b: B, c: C, d: D, e: E) {
|
||||
eatAString(d)
|
||||
eatAString(e)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(b)
|
||||
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(c)
|
||||
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(d)
|
||||
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(e)
|
||||
eatAStringN(b)
|
||||
eatAStringN(c)
|
||||
eatAStringN(d)
|
||||
eatAStringN(e)
|
||||
}
|
||||
|
||||
// FILE: 3.kt
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ FILE fqName:<root> fileName:/builtinMap.kt
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:java.util.LinkedHashMap<K1 of <root>.plus, V1 of <root>.plus>) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:<this> type:java.util.LinkedHashMap<K1 of <root>.plus, V1 of <root>.plus>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun put (p0: K1 of <root>.plus, p1: V1 of <root>.plus): V1 of <root>.plus? [operator] declared in java.util.HashMap' type=V1 of <root>.plus? origin=null
|
||||
CALL 'public open fun put (p0: K1 of <root>.plus?, p1: V1 of <root>.plus?): V1 of <root>.plus? [operator] declared in java.util.HashMap' type=V1 of <root>.plus? origin=null
|
||||
$this: GET_VAR '<this>: java.util.LinkedHashMap<K1 of <root>.plus, V1 of <root>.plus> declared in special.<anonymous>' type=java.util.LinkedHashMap<K1 of <root>.plus, V1 of <root>.plus> origin=null
|
||||
p0: CALL 'public final fun <get-first> (): K1 of <root>.plus declared in kotlin.Pair' type=K1 of <root>.plus origin=null
|
||||
$this: GET_VAR 'pair: kotlin.Pair<K1 of <root>.plus, V1 of <root>.plus> declared in <root>.plus' type=kotlin.Pair<K1 of <root>.plus, V1 of <root>.plus> origin=null
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public abstract class ClassWithTypePExtendsIterableP<P> : R|kotlin/Any|, R|kotlin/collections/MutableIterable<P>| {
|
||||
public abstract class ClassWithTypePExtendsIterableP<P> : R|kotlin/Any|, R|kotlin/collections/MutableIterable<ft<P, P?>!>| {
|
||||
public constructor<P>(): R|test/ClassWithTypePExtendsIterableP<P>|
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public final enum class AnnotatedEnumEntry : R|kotlin/Enum<test/AnnotatedEnumEntry>| {
|
||||
public final enum class AnnotatedEnumEntry : R|kotlin/Enum<ft<test/AnnotatedEnumEntry, test/AnnotatedEnumEntry?>!>| {
|
||||
@R|test/AnnotatedEnumEntry.Anno|(String(a)) public final static field E1: R|ft<test/AnnotatedEnumEntry, test/AnnotatedEnumEntry?>!|
|
||||
|
||||
@R|test/AnnotatedEnumEntry.Anno|(String(b)) @R|test/AnnotatedEnumEntry.Anno2|() public final static field E2: R|ft<test/AnnotatedEnumEntry, test/AnnotatedEnumEntry?>!|
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public final enum class EnumConstructorParameter : R|kotlin/Enum<test/EnumConstructorParameter>| {
|
||||
public final enum class EnumConstructorParameter : R|kotlin/Enum<ft<test/EnumConstructorParameter, test/EnumConstructorParameter?>!>| {
|
||||
public final static field INSTANCE: R|ft<test/EnumConstructorParameter, test/EnumConstructorParameter?>!|
|
||||
|
||||
private constructor(@R|test/EnumConstructorParameter.Anno|(String(string)) s: R|ft<kotlin/String, kotlin/String?>!|): R|test/EnumConstructorParameter|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public final enum class EnumMembers : R|kotlin/Enum<test/EnumMembers>| {
|
||||
public final enum class EnumMembers : R|kotlin/Enum<ft<test/EnumMembers, test/EnumMembers?>!>| {
|
||||
public final static field FIRST: R|ft<test/EnumMembers, test/EnumMembers?>!|
|
||||
|
||||
public final static field SECOND: R|ft<test/EnumMembers, test/EnumMembers?>!|
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public open enum class EnumWithSpecializedEntry : R|kotlin/Enum<test/EnumWithSpecializedEntry>| {
|
||||
public open enum class EnumWithSpecializedEntry : R|kotlin/Enum<ft<test/EnumWithSpecializedEntry, test/EnumWithSpecializedEntry?>!>| {
|
||||
public final static field E1: R|ft<test/EnumWithSpecializedEntry, test/EnumWithSpecializedEntry?>!|
|
||||
|
||||
public final static field E2: R|ft<test/EnumWithSpecializedEntry, test/EnumWithSpecializedEntry?>!|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public final enum class JavaEnum : R|kotlin/Enum<test/JavaEnum>| {
|
||||
public final enum class JavaEnum : R|kotlin/Enum<ft<test/JavaEnum, test/JavaEnum?>!>| {
|
||||
public final static field ENTRY: R|ft<test/JavaEnum, test/JavaEnum?>!|
|
||||
|
||||
public final static field ANOTHER: R|ft<test/JavaEnum, test/JavaEnum?>!|
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public abstract interface SubclassOfCollection<E> : R|kotlin/collections/MutableCollection<E>| {
|
||||
public abstract interface SubclassOfCollection<E> : R|kotlin/collections/MutableCollection<ft<E, E?>!>| {
|
||||
public abstract operator fun iterator(): R|kotlin/collections/MutableIterator<ft<E, E?>!>|
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
public abstract interface SubclassOfMapEntry<K, V> : R|kotlin/collections/MutableMap.MutableEntry<K, V>| {
|
||||
public abstract operator fun setValue(value: R|V|): R|V|
|
||||
public abstract interface SubclassOfMapEntry<K, V> : R|kotlin/collections/MutableMap.MutableEntry<ft<K, K?>!, ft<V, V?>!>| {
|
||||
public abstract operator fun setValue(value: R|ft<V, V?>!|): R|ft<V, V?>!|
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public open class ModalityOfFakeOverrides : R|java/util/AbstractList<kotlin/String>| {
|
||||
public open class ModalityOfFakeOverrides : R|java/util/AbstractList<ft<kotlin/String, kotlin/String?>!>| {
|
||||
@R|java/lang/Override|() @R|org/jetbrains/annotations/NotNull|() public open operator fun get(index: R|kotlin/Int|): R|kotlin/String|
|
||||
|
||||
@R|java/lang/Override|() public open operator fun size(): R|kotlin/Int|
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
public abstract interface SubstitutedSamInterface : R|java/util/Comparator<kotlin/String>| {
|
||||
public abstract interface SubstitutedSamInterface : R|java/util/Comparator<ft<kotlin/String, kotlin/String?>!>| {
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
public abstract interface SubstitutedSamInterfaceSubclassOfBuiltin : R|kotlin/Comparable<test/SubstitutedSamInterfaceSubclassOfBuiltin>| {
|
||||
public abstract interface SubstitutedSamInterfaceSubclassOfBuiltin : R|kotlin/Comparable<ft<test/SubstitutedSamInterfaceSubclassOfBuiltin, test/SubstitutedSamInterfaceSubclassOfBuiltin?>!>| {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public final enum class Enum : R|kotlin/Enum<test/Enum>| {
|
||||
public final enum class Enum : R|kotlin/Enum<ft<test/Enum, test/Enum?>!>| {
|
||||
public final static field A: R|ft<test/Enum, test/Enum?>!|
|
||||
|
||||
public final static field B: R|ft<test/Enum, test/Enum?>!|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public final enum class StaticMembersInEnum : R|kotlin/Enum<test/StaticMembersInEnum>| {
|
||||
public final enum class StaticMembersInEnum : R|kotlin/Enum<ft<test/StaticMembersInEnum, test/StaticMembersInEnum?>!>| {
|
||||
public final static field ENTRY: R|ft<test/StaticMembersInEnum, test/StaticMembersInEnum?>!|
|
||||
|
||||
public open static field STATIC_FIELD: R|kotlin/Int|
|
||||
|
||||
Reference in New Issue
Block a user