NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed and remember flexibility of type parameters based on flexibility of its upper bounds
^KT-32435 Fixed
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// FILE: Function.java
|
||||
|
||||
public interface Function<Param, Result> {
|
||||
@@ -20,7 +22,8 @@ interface PsiMethod {
|
||||
interface PsiClass
|
||||
|
||||
fun test() {
|
||||
val processor = AdapterProcessor<PsiMethod, PsiClass>(
|
||||
// TODO: don't forget to implement preservation flexibility of java type parameters in FIR (this is the reason of error here)
|
||||
val processor = <!INAPPLICABLE_CANDIDATE!>AdapterProcessor<!><PsiMethod, PsiClass>(
|
||||
Function { method: PsiMethod? -> method?.containingClass }
|
||||
)
|
||||
}
|
||||
@@ -7,7 +7,7 @@ FILE: main.kt
|
||||
public abstract interface PsiClass : R|kotlin/Any| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval processor: R|AdapterProcessor<PsiMethod, PsiClass>| = R|/AdapterProcessor.AdapterProcessor|<R|PsiMethod|, R|PsiClass|>(R|/Function|<R|PsiMethod|, R|ft<PsiClass, PsiClass?>!|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
|
||||
lval processor: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/AdapterProcessor.AdapterProcessor]> = <Inapplicable(INAPPLICABLE): [/AdapterProcessor.AdapterProcessor]>#<R|PsiMethod|, R|PsiClass|>(R|/Function|<R|PsiMethod?|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
|
||||
R|<local>/method|?.R|/PsiMethod.containingClass|
|
||||
}
|
||||
))
|
||||
|
||||
@@ -4,11 +4,11 @@ FILE: main.kt
|
||||
R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
R|/MyFunction|<R|kotlin/Any?|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Any?|): R|kotlin/String| {
|
||||
R|/MyFunction|<R|kotlin/Any?|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Any?|): R|kotlin/String| {
|
||||
String()
|
||||
}
|
||||
)
|
||||
|
||||
Vendored
+4
-4
@@ -10,19 +10,19 @@ FILE: main.kt
|
||||
R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
))
|
||||
R|/foo2|(R|/MyFunction|<R|kotlin/Number|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
|
||||
R|/foo2|(R|/MyFunction|<R|kotlin/Number|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
))
|
||||
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Any.toString|()
|
||||
}
|
||||
))
|
||||
R|/foo3|<R|kotlin/Int|, R|kotlin/String|>(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|()
|
||||
}
|
||||
), Int(1))
|
||||
R|/foo3|<R|kotlin/Int|, R|kotlin/String|>(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
|
||||
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
), Int(2))
|
||||
|
||||
@@ -12,11 +12,11 @@ FILE: main.kt
|
||||
R|<local>/x|.R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|kotlin/String|>(foo3@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|()
|
||||
}
|
||||
, Int(1))
|
||||
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|kotlin/String|>(foo3@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/Unit| {
|
||||
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
|
||||
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
, Int(2))
|
||||
|
||||
@@ -13,7 +13,7 @@ FILE: User.kt
|
||||
protected abstract fun createSettings(): R|T|
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
this@R|/User|.R|FakeOverride</User.settings: R|T|>| = Q|StaticOwner|.R|/StaticOwner.newInstance|<R|T|>(this@R|/User|.R|FakeOverride</User.settings: R|T|>|.R|kotlin/jvm/javaClass|)
|
||||
this@R|/User|.R|FakeOverride</User.settings: R|T|>| = Q|StaticOwner|.R|/StaticOwner.newInstance|<R|ft<T, T?>!|>(this@R|/User|.R|FakeOverride</User.settings: R|T|>|.R|kotlin/jvm/javaClass|)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Generated
+25
@@ -8092,6 +8092,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInLambda2.kt")
|
||||
public void testLambdaInLambda2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt")
|
||||
public void testPrematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt");
|
||||
@@ -14893,6 +14898,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/elvisOnUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/nullAssertOnTypeWithNullableUpperBound.kt");
|
||||
@@ -14938,6 +14948,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/safeCallWithInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt")
|
||||
public void testTakingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("uselessElvis.kt")
|
||||
public void testUselessElvis() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt");
|
||||
@@ -18918,6 +18933,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samConversionToGeneric.kt")
|
||||
public void testSamConversionToGeneric() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samConversionsWithSmartCasts.kt")
|
||||
public void testSamConversionsWithSmartCasts() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
|
||||
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
|
||||
|
||||
+35
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.resolve.calls.tower
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
@@ -26,6 +27,7 @@ import org.jetbrains.kotlin.resolve.calls.context.CallPosition
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.buildResultingSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.FreshVariableNewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutorByConstructorMap
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.composeWith
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.substitute
|
||||
@@ -53,6 +55,8 @@ import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils
|
||||
import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContextDelegate
|
||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import java.util.*
|
||||
@@ -711,8 +715,39 @@ class NewResolvedCallImpl<D : CallableDescriptor>(
|
||||
calculateExpectedTypeForSamConvertedArgumentMap(substitutor)
|
||||
}
|
||||
|
||||
private fun KotlinType.withNullabilityFromExplicitTypeArgument(typeArgument: SimpleTypeArgument) =
|
||||
(if (typeArgument.type.isMarkedNullable) makeNullable() else makeNotNullable()).unwrap()
|
||||
|
||||
private fun getSubstitutorWithoutFlexibleTypes(
|
||||
currentSubstitutor: NewTypeSubstitutor?,
|
||||
explicitTypeArguments: List<SimpleTypeArgument>
|
||||
): NewTypeSubstitutor? {
|
||||
if (currentSubstitutor !is NewTypeSubstitutorByConstructorMap || explicitTypeArguments.isEmpty()) return currentSubstitutor
|
||||
if (!currentSubstitutor.map.any { (_, value) -> value.isFlexible() }) return currentSubstitutor
|
||||
|
||||
val typeVariables = resolvedCallAtom.freshVariablesSubstitutor.freshVariables
|
||||
val newSubstitutorMap = currentSubstitutor.map.toMutableMap()
|
||||
|
||||
explicitTypeArguments.forEachIndexed { index, typeArgument ->
|
||||
val typeVariableConstructor = typeVariables.getOrNull(index)?.freshTypeConstructor ?: return@forEachIndexed
|
||||
|
||||
newSubstitutorMap[typeVariableConstructor] =
|
||||
newSubstitutorMap[typeVariableConstructor]?.withNullabilityFromExplicitTypeArgument(typeArgument)
|
||||
?: return@forEachIndexed
|
||||
}
|
||||
|
||||
return NewTypeSubstitutorByConstructorMap(newSubstitutorMap)
|
||||
}
|
||||
|
||||
private fun substitutedResultingDescriptor(substitutor: NewTypeSubstitutor?) =
|
||||
when (val candidateDescriptor = resolvedCallAtom.candidateDescriptor) {
|
||||
is ClassConstructorDescriptor, is SyntheticMemberDescriptor<*> -> {
|
||||
val explicitTypeArguments = resolvedCallAtom.atom.typeArguments.filterIsInstance<SimpleTypeArgument>()
|
||||
|
||||
candidateDescriptor.substituteInferredVariablesAndApproximate(
|
||||
getSubstitutorWithoutFlexibleTypes(substitutor, explicitTypeArguments)
|
||||
)
|
||||
}
|
||||
is FunctionDescriptor -> candidateDescriptor.substituteInferredVariablesAndApproximate(substitutor)
|
||||
is PropertyDescriptor -> {
|
||||
val shouldRunApproximation = candidateDescriptor.returnType?.let { type ->
|
||||
|
||||
+18
-6
@@ -21,11 +21,10 @@ import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind.*
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.InfixCallNoInfixModifier
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.InvokeConventionCallNoOperatorModifier
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.VisibilityError
|
||||
import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
internal object CheckInstantiationOfAbstractClass : ResolutionPart() {
|
||||
@@ -151,7 +150,7 @@ internal object CreateFreshVariablesSubstitutor : ResolutionPart() {
|
||||
if (knownTypeArgument != null) {
|
||||
csBuilder.addEqualityConstraint(
|
||||
freshVariable.defaultType,
|
||||
knownTypeArgument.unwrap(),
|
||||
getTypePreservingFlexibilityWrtTypeVariable(knownTypeArgument.unwrap(), freshVariable),
|
||||
KnownTypeParameterConstraintPosition(knownTypeArgument)
|
||||
)
|
||||
continue
|
||||
@@ -162,7 +161,7 @@ internal object CreateFreshVariablesSubstitutor : ResolutionPart() {
|
||||
if (typeArgument is SimpleTypeArgument) {
|
||||
csBuilder.addEqualityConstraint(
|
||||
freshVariable.defaultType,
|
||||
typeArgument.type,
|
||||
getTypePreservingFlexibilityWrtTypeVariable(typeArgument.type, freshVariable),
|
||||
ExplicitTypeParameterConstraintPosition(typeArgument)
|
||||
)
|
||||
} else {
|
||||
@@ -173,6 +172,19 @@ internal object CreateFreshVariablesSubstitutor : ResolutionPart() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun TypeParameterDescriptor.shouldBeFlexible(): Boolean {
|
||||
return upperBounds.any {
|
||||
it.isFlexible() || ((it.constructor.declarationDescriptor as? TypeParameterDescriptor)?.run { shouldBeFlexible() } ?: false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTypePreservingFlexibilityWrtTypeVariable(
|
||||
type: KotlinType,
|
||||
typeVariable: TypeVariableFromCallableDescriptor
|
||||
) = if (typeVariable.originalTypeParameter.shouldBeFlexible()) {
|
||||
KotlinTypeFactory.flexibleType(type.makeNotNullable().lowerIfFlexible(), type.makeNullable().upperIfFlexible())
|
||||
} else type
|
||||
|
||||
fun createToFreshVariableSubstitutorAndAddInitialConstraints(
|
||||
candidateDescriptor: CallableDescriptor,
|
||||
csBuilder: ConstraintSystemOperation
|
||||
|
||||
+17
-12
@@ -146,7 +146,7 @@ abstract class AbstractTypeCheckerContextForConstraintSystem : AbstractTypeCheck
|
||||
*
|
||||
* => Foo <: T! -- (Foo!! .. Foo) <: T
|
||||
*
|
||||
* Foo? <: T! -- (Foo!! .. Foo?) <: T
|
||||
* Foo? <: T! -- Foo? <: T
|
||||
*
|
||||
*
|
||||
* (Foo..Bar) <: T! --
|
||||
@@ -173,7 +173,11 @@ abstract class AbstractTypeCheckerContextForConstraintSystem : AbstractTypeCheck
|
||||
when (subType) {
|
||||
is SimpleTypeMarker ->
|
||||
// Foo <: T! -- (Foo!! .. Foo) <: T
|
||||
createFlexibleType(subType.makeSimpleTypeDefinitelyNotNullOrNotNull(), subType)
|
||||
if (subType.isMarkedNullable()) {
|
||||
subType // prefer nullable type to flexible one: `Foo? <: (T..T?)` => lowerConstraint = `Foo?`
|
||||
} else {
|
||||
createFlexibleType(subType, subType.withNullability(true))
|
||||
}
|
||||
|
||||
is FlexibleTypeMarker ->
|
||||
// (Foo..Bar) <: T! -- (Foo!! .. Bar) <: T
|
||||
@@ -197,23 +201,24 @@ abstract class AbstractTypeCheckerContextForConstraintSystem : AbstractTypeCheck
|
||||
}
|
||||
|
||||
/**
|
||||
* T! <: Foo <=> T <: Foo
|
||||
* T! <: Foo <=> T <: Foo..Foo?
|
||||
* T? <: Foo <=> T <: Foo && Nothing? <: Foo
|
||||
* T <: Foo -- leave as is
|
||||
*/
|
||||
private fun simplifyUpperConstraint(typeVariable: KotlinTypeMarker, superType: KotlinTypeMarker): Boolean {
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val typeVariable = typeVariable.lowerBoundIfFlexible()
|
||||
val typeVariableLowerBound = typeVariable.lowerBoundIfFlexible()
|
||||
val simplifiedSuperType = if (typeVariableLowerBound.isDefinitelyNotNullType()) {
|
||||
superType.withNullability(true)
|
||||
} else if (typeVariable.isFlexible() && superType is SimpleTypeMarker) {
|
||||
createFlexibleType(superType, superType.withNullability(true))
|
||||
} else superType
|
||||
|
||||
@Suppress("NAME_SHADOWING")
|
||||
val superType = if (typeVariable.isDefinitelyNotNullType()) superType.withNullability(true) else superType
|
||||
addUpperConstraint(typeVariableLowerBound.typeConstructor(), simplifiedSuperType)
|
||||
|
||||
addUpperConstraint(typeVariable.typeConstructor(), superType)
|
||||
|
||||
if (typeVariable.isMarkedNullable()) {
|
||||
if (typeVariableLowerBound.isMarkedNullable()) {
|
||||
// here is important that superType is singleClassifierType
|
||||
return superType.anyBound(this::isMyTypeVariable) ||
|
||||
isSubtypeOfByTypeChecker(nullableNothingType(), superType)
|
||||
return simplifiedSuperType.anyBound(this::isMyTypeVariable) ||
|
||||
isSubtypeOfByTypeChecker(nullableNothingType(), simplifiedSuperType)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS, JS_IR
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// FILE: Foo.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Foo<T> {
|
||||
T x;
|
||||
|
||||
public Foo(T x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public static Number bar() { return null; }
|
||||
|
||||
public static <K> K simpleId(K k) {
|
||||
return k;
|
||||
}
|
||||
|
||||
public T produceT() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public T produceNotNullT() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void consumeT(T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun <T> bar(n: Number?, d: T, e: T) {
|
||||
val b: Number? = Foo.simpleId(n)
|
||||
b?.toInt()
|
||||
val c = Foo.simpleId(n)
|
||||
c?.toInt()
|
||||
|
||||
val x4 = Foo(if (true) 10 else null)
|
||||
val x6: Number? = x4.produceT()
|
||||
x6?.toInt()
|
||||
val x7 = x4.produceT()
|
||||
x7?.toInt()
|
||||
val x8 = x4.produceNotNullT()
|
||||
x8.toInt()
|
||||
|
||||
x4.consumeT(x7)
|
||||
|
||||
val x9: T = Foo.simpleId(d)
|
||||
val x10: T? = Foo.simpleId(d)
|
||||
|
||||
if (e != null) {
|
||||
var x11 = e
|
||||
x11 = Foo.simpleId(d) // assign to definitely not-null T, the lack an error is consistent with old inference
|
||||
}
|
||||
|
||||
var x11 = Foo<T>(e).x
|
||||
x11 = Foo.simpleId(d) // assign to flexible T
|
||||
|
||||
var x12 = Foo.bar()
|
||||
x12 = Foo.simpleId(n) // assign to flexible Number
|
||||
x12.toInt()
|
||||
|
||||
var x13 = e
|
||||
x13 = Foo.simpleId(d)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
bar(10, "", "")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// FILE: Function.java
|
||||
|
||||
public interface Function<Param, Result> {
|
||||
Result fun(Param param);
|
||||
}
|
||||
|
||||
// FILE: AdapterProcessor.java
|
||||
|
||||
public class AdapterProcessor<T, S> {
|
||||
public AdapterProcessor(Function<? super T, ? extends S> conversion) {}
|
||||
}
|
||||
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface PsiMethod {
|
||||
val containingClass: PsiClass?
|
||||
}
|
||||
|
||||
interface PsiClass
|
||||
|
||||
fun test() {
|
||||
// TODO: don't forget to implement preservation flexibility of java type parameters in FIR (this is the reason of error here)
|
||||
val processor = <!INAPPLICABLE_CANDIDATE!>AdapterProcessor<!><PsiMethod, PsiClass>(
|
||||
Function { method: PsiMethod? -> method?.containingClass }
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// FILE: Function.java
|
||||
|
||||
public interface Function<Param, Result> {
|
||||
Result fun(Param param);
|
||||
}
|
||||
|
||||
// FILE: AdapterProcessor.java
|
||||
|
||||
public class AdapterProcessor<T, S> {
|
||||
public AdapterProcessor(Function<? super T, ? extends S> conversion) {}
|
||||
}
|
||||
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface PsiMethod {
|
||||
val containingClass: PsiClass?
|
||||
}
|
||||
|
||||
interface PsiClass
|
||||
|
||||
fun test() {
|
||||
// TODO: don't forget to implement preservation flexibility of java type parameters in FIR (this is the reason of error here)
|
||||
val processor = AdapterProcessor<PsiMethod, PsiClass>(
|
||||
Function { method: PsiMethod? -> method?.containingClass }
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public open class AdapterProcessor</*0*/ T : kotlin.Any!, /*1*/ S : kotlin.Any!> {
|
||||
public constructor AdapterProcessor</*0*/ T : kotlin.Any!, /*1*/ S : kotlin.Any!>(/*0*/ conversion: Function<in T!, out S!>!)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Function</*0*/ Param : kotlin.Any!, /*1*/ Result : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun `fun`(/*0*/ param: Param!): Result!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface PsiClass {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface PsiMethod {
|
||||
public abstract val containingClass: PsiClass?
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+1
-1
@@ -14,5 +14,5 @@ public class Matcher<T> {
|
||||
|
||||
// FILE: main.kt
|
||||
fun test(x: List<String>) {
|
||||
Assert.assertThat(x, Matcher.hasItem("abc"))
|
||||
Assert.<!INAPPLICABLE_CANDIDATE!>assertThat<!>(x, Matcher.hasItem("abc"))
|
||||
}
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNCHECKED_CAST -UNUSED_VALUE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
// !LANGUAGE: +NewInference
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: Foo.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Foo<T> {
|
||||
T x;
|
||||
|
||||
public Foo(T x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public static Number bar() { return null; }
|
||||
|
||||
public static <K> K simpleId(K k) {
|
||||
return k;
|
||||
}
|
||||
|
||||
public T produceT() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public T produceNotNullT() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void consumeT(T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun <T> bar(n: Number?, d: T, e: T) {
|
||||
val a: Number = Foo.simpleId(n)
|
||||
val b: Number? = Foo.simpleId(n)
|
||||
val c = Foo.simpleId(n)
|
||||
|
||||
val x4 = Foo(if (true) 10 else null)
|
||||
val x5: Number = x4.produceT()
|
||||
val x6: Number? = x4.produceT()
|
||||
val x7 = x4.produceT()
|
||||
val x8 = x4.produceNotNullT()
|
||||
|
||||
x4.consumeT(x7)
|
||||
|
||||
val x9: T = Foo.simpleId(d)
|
||||
val x10: T? = Foo.simpleId(d)
|
||||
|
||||
if (e != null) {
|
||||
var x11 = e
|
||||
x11 = Foo.simpleId(d) // assign to definitely not-null T, the lack an error is consistent with old inference
|
||||
}
|
||||
|
||||
var x11 = Foo<T>(null as T).x
|
||||
x11 = Foo.simpleId(d) // assign to flexible T
|
||||
|
||||
var x12 = Foo.bar()
|
||||
x12 = Foo.simpleId(n) // assign to flexible Number
|
||||
|
||||
var x13 = e
|
||||
x13 = Foo.simpleId(d)
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNCHECKED_CAST -UNUSED_VALUE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
// !LANGUAGE: +NewInference
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: Foo.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Foo<T> {
|
||||
T x;
|
||||
|
||||
public Foo(T x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public static Number bar() { return null; }
|
||||
|
||||
public static <K> K simpleId(K k) {
|
||||
return k;
|
||||
}
|
||||
|
||||
public T produceT() {
|
||||
return x;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public T produceNotNullT() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void consumeT(T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun <T> bar(n: Number?, d: T, e: T) {
|
||||
val a: Number = <!TYPE_MISMATCH!>Foo.simpleId(n)<!>
|
||||
val b: Number? = Foo.simpleId(n)
|
||||
val c = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>Foo.simpleId(n)<!>
|
||||
|
||||
val x4 = Foo(if (true) 10 else null)
|
||||
val x5: Number = <!TYPE_MISMATCH!>x4.produceT()<!>
|
||||
val x6: Number? = x4.produceT()
|
||||
val x7 = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x4.produceT()<!>
|
||||
val x8 = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>x4.produceNotNullT()<!>
|
||||
|
||||
x4.consumeT(x7)
|
||||
|
||||
val x9: T = Foo.simpleId(d)
|
||||
val x10: T? = Foo.simpleId(d)
|
||||
|
||||
if (e != null) {
|
||||
var x11 = e
|
||||
x11 = Foo.simpleId(d) // assign to definitely not-null T, the lack an error is consistent with old inference
|
||||
}
|
||||
|
||||
var x11 = Foo<T>(null as T).x
|
||||
x11 = Foo.simpleId(d) // assign to flexible T
|
||||
|
||||
var x12 = Foo.bar()
|
||||
x12 = Foo.simpleId(n) // assign to flexible Number
|
||||
|
||||
var x13 = e
|
||||
x13 = Foo.simpleId(d)
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// It's relevant only for Java constructor calls
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
public class J<T extends Integer> {}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo(val attributes: Map<String, String>)
|
||||
|
||||
class A<R>
|
||||
|
||||
class Bar<T, K: Any> {
|
||||
val foos1 = ArrayList<Foo>()
|
||||
val foos2 = ArrayList<Foo?>()
|
||||
val foos3 = ArrayList<A<Foo>>()
|
||||
val foos4 = ArrayList<A<Foo>?>()
|
||||
val foos5 = ArrayList<A<Foo?>?>()
|
||||
val foos6 = ArrayList<A<Foo?>>()
|
||||
val foos7 = ArrayList<T>()
|
||||
val foos8 = ArrayList<T?>()
|
||||
val foos9 = ArrayList<K>()
|
||||
val foos10 = ArrayList<K?>()
|
||||
val foos11 = ArrayList<A<K?>>()
|
||||
val foos12 = ArrayList<A<K>>()
|
||||
val foos13 = ArrayList<A<T>>()
|
||||
val foos14 = ArrayList<A<T>?>()
|
||||
val foos15 = ArrayList<A<T?>>()
|
||||
|
||||
val foos16 = J<Foo>()
|
||||
val foos17 = J<Foo?>()
|
||||
val foos18 = J<T>()
|
||||
val foos19 = J<T?>()
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// It's relevant only for Java constructor calls
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
public class J<T extends Integer> {}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class Foo(val attributes: Map<String, String>)
|
||||
|
||||
class A<R>
|
||||
|
||||
class Bar<T, K: Any> {
|
||||
val foos1 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<Foo>")!>ArrayList<Foo>()<!>
|
||||
val foos2 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<Foo?>")!>ArrayList<Foo?>()<!>
|
||||
val foos3 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<Foo>>")!>ArrayList<A<Foo>>()<!>
|
||||
val foos4 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<Foo>?>")!>ArrayList<A<Foo>?>()<!>
|
||||
val foos5 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<Foo?>?>")!>ArrayList<A<Foo?>?>()<!>
|
||||
val foos6 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<Foo?>>")!>ArrayList<A<Foo?>>()<!>
|
||||
val foos7 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<T>")!>ArrayList<T>()<!>
|
||||
val foos8 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<T?>")!>ArrayList<T?>()<!>
|
||||
val foos9 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<K>")!>ArrayList<K>()<!>
|
||||
val foos10 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<K?>")!>ArrayList<K?>()<!>
|
||||
val foos11 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<K?>>")!>ArrayList<A<K?>>()<!>
|
||||
val foos12 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<K>>")!>ArrayList<A<K>>()<!>
|
||||
val foos13 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<T>>")!>ArrayList<A<T>>()<!>
|
||||
val foos14 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<T>?>")!>ArrayList<A<T>?>()<!>
|
||||
val foos15 = <!DEBUG_INFO_EXPRESSION_TYPE("java.util.ArrayList<A<T?>>")!>ArrayList<A<T?>>()<!>
|
||||
|
||||
val foos16 = <!DEBUG_INFO_EXPRESSION_TYPE("J<Foo>")!>J<<!UPPER_BOUND_VIOLATED!>Foo<!>>()<!>
|
||||
val foos17 = <!DEBUG_INFO_EXPRESSION_TYPE("J<Foo?>")!>J<<!UPPER_BOUND_VIOLATED!>Foo?<!>>()<!>
|
||||
val foos18 = <!DEBUG_INFO_EXPRESSION_TYPE("J<T>")!>J<<!UPPER_BOUND_VIOLATED!>T<!>>()<!>
|
||||
val foos19 = <!DEBUG_INFO_EXPRESSION_TYPE("J<T?>")!>J<<!UPPER_BOUND_VIOLATED!>T?<!>>()<!>
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package
|
||||
|
||||
public final class A</*0*/ R> {
|
||||
public constructor A</*0*/ R>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Bar</*0*/ T, /*1*/ K : kotlin.Any> {
|
||||
public constructor Bar</*0*/ T, /*1*/ K : kotlin.Any>()
|
||||
public final val foos1: java.util.ArrayList<Foo>
|
||||
public final val foos10: java.util.ArrayList<K?>
|
||||
public final val foos11: java.util.ArrayList<A<K?>>
|
||||
public final val foos12: java.util.ArrayList<A<K>>
|
||||
public final val foos13: java.util.ArrayList<A<T>>
|
||||
public final val foos14: java.util.ArrayList<A<T>?>
|
||||
public final val foos15: java.util.ArrayList<A<T?>>
|
||||
public final val foos16: J<Foo>
|
||||
public final val foos17: J<Foo?>
|
||||
public final val foos18: J<T>
|
||||
public final val foos19: J<T?>
|
||||
public final val foos2: java.util.ArrayList<Foo?>
|
||||
public final val foos3: java.util.ArrayList<A<Foo>>
|
||||
public final val foos4: java.util.ArrayList<A<Foo>?>
|
||||
public final val foos5: java.util.ArrayList<A<Foo?>?>
|
||||
public final val foos6: java.util.ArrayList<A<Foo?>>
|
||||
public final val foos7: java.util.ArrayList<T>
|
||||
public final val foos8: java.util.ArrayList<T?>
|
||||
public final val foos9: java.util.ArrayList<K>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo {
|
||||
public constructor Foo(/*0*/ attributes: kotlin.collections.Map<kotlin.String, kotlin.String>)
|
||||
public final val attributes: kotlin.collections.Map<kotlin.String, kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class J</*0*/ T : kotlin.Int!> {
|
||||
public constructor J</*0*/ T : kotlin.Int!>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -5,6 +5,6 @@ interface Foo
|
||||
|
||||
fun test() {
|
||||
var nullable: Foo? = null
|
||||
val foo: Collection<Foo> = java.util.Collections.<!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>singleton(nullable)<!>
|
||||
val foo: Collection<Foo> = <!NI;TYPE_MISMATCH!>java.util.Collections.<!OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>singleton(nullable)<!><!>
|
||||
val foo1: Collection<Foo> = java.util.Collections.singleton(nullable!!)
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// FILE: samConversionToGeneric.kt
|
||||
|
||||
fun test1() = J<String> { x -> x }
|
||||
|
||||
fun test2() = J { x: String -> x }
|
||||
|
||||
fun test3() = H.bar { x: String -> x }
|
||||
|
||||
fun test4(a: Any) {
|
||||
a as J<String>
|
||||
H.bar(a)
|
||||
}
|
||||
|
||||
fun test5(a: Any) {
|
||||
a as (String) -> String
|
||||
H.bar(a)
|
||||
}
|
||||
|
||||
fun <T> test6(a: (T) -> T) {
|
||||
H.bar(a)
|
||||
}
|
||||
|
||||
fun <T> test7(a: Any) {
|
||||
a as (T) -> T
|
||||
H.bar(a)
|
||||
}
|
||||
|
||||
fun test8(efn: String.() -> String) = J(efn)
|
||||
|
||||
fun test9(efn: String.() -> String) {
|
||||
H.bar(efn)
|
||||
}
|
||||
|
||||
fun test10(fn: (Int) -> String) {
|
||||
H.bar2x(fn)
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public interface J<T> {
|
||||
T foo(T x);
|
||||
}
|
||||
|
||||
// FILE: J2.java
|
||||
public interface J2<T1, T2> {
|
||||
T1 foo(T2 x);
|
||||
}
|
||||
|
||||
// FILE: J2X.java
|
||||
public interface J2X<T3> extends J2<String, T3> {
|
||||
}
|
||||
|
||||
// FILE: H.java
|
||||
public class H {
|
||||
public static <X> void bar(J<X> j) {}
|
||||
public static <Y> void bar2x(J2X<Y> j2x) {}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// FILE: samConversionToGeneric.kt
|
||||
|
||||
fun test1() = J<String> { x -> x }
|
||||
|
||||
fun test2() = J { x: String -> x }
|
||||
|
||||
fun test3() = H.bar { x: String -> x }
|
||||
|
||||
fun test4(a: Any) {
|
||||
a <!UNCHECKED_CAST!>as J<String><!>
|
||||
H.bar(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
|
||||
fun test5(a: Any) {
|
||||
a <!UNCHECKED_CAST!>as (String) -> String<!>
|
||||
H.bar(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
|
||||
fun <T> test6(a: (T) -> T) {
|
||||
H.bar(a)
|
||||
}
|
||||
|
||||
fun <T> test7(a: Any) {
|
||||
a <!UNCHECKED_CAST!>as (T) -> T<!>
|
||||
H.bar(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
|
||||
fun test8(efn: String.() -> String) = J(efn)
|
||||
|
||||
fun test9(efn: String.() -> String) {
|
||||
H.bar(efn)
|
||||
}
|
||||
|
||||
fun test10(fn: (Int) -> String) {
|
||||
H.bar2x(fn)
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public interface J<T> {
|
||||
T foo(T x);
|
||||
}
|
||||
|
||||
// FILE: J2.java
|
||||
public interface J2<T1, T2> {
|
||||
T1 foo(T2 x);
|
||||
}
|
||||
|
||||
// FILE: J2X.java
|
||||
public interface J2X<T3> extends J2<String, T3> {
|
||||
}
|
||||
|
||||
// FILE: H.java
|
||||
public class H {
|
||||
public static <X> void bar(J<X> j) {}
|
||||
public static <Y> void bar2x(J2X<Y> j2x) {}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package
|
||||
|
||||
public fun test1(): J<kotlin.String>
|
||||
public fun test10(/*0*/ fn: (kotlin.Int) -> kotlin.String): kotlin.Unit
|
||||
public fun test2(): J<kotlin.String!>
|
||||
public fun test3(): kotlin.Unit
|
||||
public fun test4(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun test5(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun </*0*/ T> test6(/*0*/ a: (T) -> T): kotlin.Unit
|
||||
public fun </*0*/ T> test7(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun test8(/*0*/ efn: kotlin.String.() -> kotlin.String): J<kotlin.String!>
|
||||
public fun test9(/*0*/ efn: kotlin.String.() -> kotlin.String): kotlin.Unit
|
||||
|
||||
public open class H {
|
||||
public constructor H()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public open fun </*0*/ X : kotlin.Any!> bar(/*0*/ j: J<X!>!): kotlin.Unit
|
||||
public open fun </*0*/ Y : kotlin.Any!> bar2x(/*0*/ j2x: J2X<Y!>!): kotlin.Unit
|
||||
}
|
||||
|
||||
public interface J</*0*/ T : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(/*0*/ x: T!): T!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface J2</*0*/ T1 : kotlin.Any!, /*1*/ T2 : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(/*0*/ x: T2!): T1!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface J2X</*0*/ T3 : kotlin.Any!> : J2<kotlin.String!, T3!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: T3!): kotlin.String!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// NB new inference doesn't really work with old JVM back-end.
|
||||
|
||||
// WITH_JDK
|
||||
// FILE: samConversionsWithSmartCasts.kt
|
||||
|
||||
fun test1(a: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J.runStatic(a)
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(a: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J().run1(a)
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(a: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J().run2(a, a)
|
||||
}
|
||||
}
|
||||
|
||||
fun test4(a: () -> Unit, b: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J().run2(a, b)
|
||||
}
|
||||
}
|
||||
|
||||
fun test5(a: Any) {
|
||||
if (a is Runnable) {
|
||||
J().run1(a)
|
||||
}
|
||||
}
|
||||
|
||||
fun test5x(a: Any) {
|
||||
if (a is Runnable) {
|
||||
a as () -> Unit
|
||||
J().run1(a)
|
||||
}
|
||||
}
|
||||
|
||||
fun test6(a: Any) {
|
||||
a as () -> Unit
|
||||
J().run1(a)
|
||||
}
|
||||
|
||||
fun test7(a: (Int) -> Int) {
|
||||
a as () -> Unit
|
||||
J().<!INAPPLICABLE_CANDIDATE!>run1<!>(a)
|
||||
}
|
||||
|
||||
fun test8(a: () -> Unit) {
|
||||
J().<!INAPPLICABLE_CANDIDATE!>run1<!>(J.id(a))
|
||||
}
|
||||
|
||||
fun test9() {
|
||||
J().run1(::test9)
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void runStatic(Runnable r) {}
|
||||
|
||||
public void run1(Runnable r) {}
|
||||
|
||||
public void run2(Runnable r1, Runnable r2) {}
|
||||
|
||||
public static <T> T id(T x) { return x; }
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// NB new inference doesn't really work with old JVM back-end.
|
||||
|
||||
// WITH_JDK
|
||||
// FILE: samConversionsWithSmartCasts.kt
|
||||
|
||||
fun test1(a: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J.runStatic(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(a: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J().run1(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(a: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J().run2(<!DEBUG_INFO_SMARTCAST!>a<!>, <!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun test4(a: () -> Unit, b: () -> Unit) {
|
||||
if (a is Runnable) {
|
||||
J().run2(a, b)
|
||||
}
|
||||
}
|
||||
|
||||
fun test5(a: Any) {
|
||||
if (a is Runnable) {
|
||||
J().run1(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun test5x(a: Any) {
|
||||
if (a is Runnable) {
|
||||
a <!UNCHECKED_CAST!>as () -> Unit<!>
|
||||
J().run1(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun test6(a: Any) {
|
||||
a <!UNCHECKED_CAST!>as () -> Unit<!>
|
||||
J().run1(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
|
||||
fun test7(a: (Int) -> Int) {
|
||||
a <!UNCHECKED_CAST!>as () -> Unit<!>
|
||||
J().run1(<!DEBUG_INFO_SMARTCAST!>a<!>)
|
||||
}
|
||||
|
||||
fun test8(a: () -> Unit) {
|
||||
J().run1(J.id(a))
|
||||
}
|
||||
|
||||
fun test9() {
|
||||
J().run1(::test9)
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
public static void runStatic(Runnable r) {}
|
||||
|
||||
public void run1(Runnable r) {}
|
||||
|
||||
public void run2(Runnable r1, Runnable r2) {}
|
||||
|
||||
public static <T> T id(T x) { return x; }
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun test1(/*0*/ a: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test2(/*0*/ a: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test3(/*0*/ a: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test4(/*0*/ a: () -> kotlin.Unit, /*1*/ b: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test5(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun test5x(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun test6(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun test7(/*0*/ a: (kotlin.Int) -> kotlin.Int): kotlin.Unit
|
||||
public fun test8(/*0*/ a: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test9(): kotlin.Unit
|
||||
|
||||
public open class J {
|
||||
public constructor J()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun run1(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||
public open fun run2(/*0*/ r1: java.lang.Runnable!, /*1*/ r2: java.lang.Runnable!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public open fun </*0*/ T : kotlin.Any!> id(/*0*/ x: T!): T!
|
||||
public open fun runStatic(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||
}
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
FILE fqName:<root> fileName:/samConversionInGenericConstructorCall.kt
|
||||
FUN name:test1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.String>) returnType:<root>.C<kotlin.String>
|
||||
FUN name:test1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.String>) returnType:<root>.C<kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (f: kotlin.Function1<kotlin.String, kotlin.String>): <root>.C<kotlin.String> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String> origin=null
|
||||
<class: X>: kotlin.String
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (f: kotlin.Function1<kotlin.String, kotlin.String>): <root>.C<kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String?> origin=null
|
||||
<class: X>: kotlin.String?
|
||||
jxx: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>?
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test1' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit
|
||||
@@ -14,8 +14,8 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall.kt
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.String> origin=CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.String>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String> origin=null
|
||||
<class: X>: kotlin.String
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String?> origin=null
|
||||
<class: X>: kotlin.String?
|
||||
jxx: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String?, kotlin.String?> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String?, kotlin.String?>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
||||
|
||||
+22
-22
@@ -1,13 +1,13 @@
|
||||
FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
FUN name:test3 visibility:public modality:FINAL <> (f1:kotlin.Function1<kotlin.String, kotlin.String>, f2:kotlin.Function1<kotlin.Int, kotlin.String>) returnType:<root>.C.D<kotlin.Int, kotlin.String>
|
||||
FUN name:test3 visibility:public modality:FINAL <> (f1:kotlin.Function1<kotlin.String, kotlin.String>, f2:kotlin.Function1<kotlin.Int, kotlin.String>) returnType:<root>.C.D<kotlin.Int?, kotlin.String?>
|
||||
VALUE_PARAMETER name:f1 index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
VALUE_PARAMETER name:f2 index:1 type:kotlin.Function1<kotlin.Int, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (f1: kotlin.Function1<kotlin.String, kotlin.String>, f2: kotlin.Function1<kotlin.Int, kotlin.String>): <root>.C.D<kotlin.Int, kotlin.String> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxy: <root>.J<X of <root>.C?, Y of <root>.C.D?>?) declared in <root>.C.D' type=<root>.C.D<kotlin.Int, kotlin.String> origin=null
|
||||
<class: Y>: kotlin.Int
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String> origin=null
|
||||
<class: X>: kotlin.String
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (f1: kotlin.Function1<kotlin.String, kotlin.String>, f2: kotlin.Function1<kotlin.Int, kotlin.String>): <root>.C.D<kotlin.Int?, kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxy: <root>.J<X of <root>.C?, Y of <root>.C.D?>?) declared in <root>.C.D' type=<root>.C.D<kotlin.Int?, kotlin.String?> origin=null
|
||||
<class: Y>: kotlin.Int?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (jxx: <root>.J<X of <root>.C?, X of <root>.C?>?) declared in <root>.C' type=<root>.C<kotlin.String?> origin=null
|
||||
<class: X>: kotlin.String?
|
||||
jxx: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>?
|
||||
GET_VAR 'f1: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test3' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
jxy: TYPE_OP type=<root>.J<kotlin.String?, kotlin.Int?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.Int?>?
|
||||
@@ -77,26 +77,26 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test4 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.String>, g:kotlin.Function1<kotlin.Any, kotlin.String>) returnType:<root>.Outer.Inner<kotlin.Any, kotlin.String>
|
||||
FUN name:test4 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.String>, g:kotlin.Function1<kotlin.Any, kotlin.String>) returnType:<root>.Outer.Inner<kotlin.Any?, kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
VALUE_PARAMETER name:g index:1 type:kotlin.Function1<kotlin.Any, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (f: kotlin.Function1<kotlin.String, kotlin.String>, g: kotlin.Function1<kotlin.Any, kotlin.String>): <root>.Outer.Inner<kotlin.Any, kotlin.String> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (j12: <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>) [primary] declared in <root>.Outer.Inner' type=<root>.Outer.Inner<kotlin.Any, kotlin.String> origin=null
|
||||
<class: T2>: kotlin.Any
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (j11: <root>.J<T1 of <root>.Outer, T1 of <root>.Outer>) [primary] declared in <root>.Outer' type=<root>.Outer<kotlin.String> origin=null
|
||||
<class: T1>: kotlin.String
|
||||
j11: TYPE_OP type=<root>.J<kotlin.String, kotlin.String> origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String, kotlin.String>
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (f: kotlin.Function1<kotlin.String, kotlin.String>, g: kotlin.Function1<kotlin.Any, kotlin.String>): <root>.Outer.Inner<kotlin.Any?, kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (j12: <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>) [primary] declared in <root>.Outer.Inner' type=<root>.Outer.Inner<kotlin.Any?, kotlin.String?> origin=null
|
||||
<class: T2>: kotlin.Any?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (j11: <root>.J<T1 of <root>.Outer, T1 of <root>.Outer>) [primary] declared in <root>.Outer' type=<root>.Outer<kotlin.String?> origin=null
|
||||
<class: T1>: kotlin.String?
|
||||
j11: TYPE_OP type=<root>.J<kotlin.String?, kotlin.String?> origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.String?>
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
j12: TYPE_OP type=<root>.J<kotlin.String, kotlin.Any> origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String, kotlin.Any>
|
||||
j12: TYPE_OP type=<root>.J<kotlin.String?, kotlin.Any?> origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.String?, kotlin.Any?>
|
||||
GET_VAR 'g: kotlin.Function1<kotlin.Any, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.Any, kotlin.String> origin=null
|
||||
FUN name:testGenericJavaCtor1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.Int>) returnType:<root>.G<kotlin.String>
|
||||
FUN name:testGenericJavaCtor1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.Int>) returnType:<root>.G<kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testGenericJavaCtor1 (f: kotlin.Function1<kotlin.String, kotlin.Int>): <root>.G<kotlin.String> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: <root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<kotlin.String> origin=null
|
||||
<class: TClass>: kotlin.String
|
||||
<TCtor>: kotlin.Int
|
||||
RETURN type=kotlin.Nothing from='public final fun testGenericJavaCtor1 (f: kotlin.Function1<kotlin.String, kotlin.Int>): <root>.G<kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: <root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<kotlin.String?> origin=null
|
||||
<class: TClass>: kotlin.String?
|
||||
<TCtor>: kotlin.Int?
|
||||
x: TYPE_OP type=<root>.J<kotlin.Int?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.Int?, kotlin.String?>?
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.Int> declared in <root>.testGenericJavaCtor1' type=kotlin.Function1<kotlin.String, kotlin.Int> origin=null
|
||||
FUN name:testGenericJavaCtor2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit
|
||||
@@ -106,9 +106,9 @@ FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.Int> origin=CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.testGenericJavaCtor2' type=kotlin.Any origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: <root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<kotlin.String> origin=null
|
||||
<class: TClass>: kotlin.String
|
||||
<TCtor>: kotlin.Int
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: <root>.J<TCtor of <root>.G.<init>?, TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<kotlin.String?> origin=null
|
||||
<class: TClass>: kotlin.String?
|
||||
<TCtor>: kotlin.Int?
|
||||
x: TYPE_OP type=<root>.J<kotlin.Int?, kotlin.String?>? origin=SAM_CONVERSION typeOperand=<root>.J<kotlin.Int?, kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String?, kotlin.Int?> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<@[ParameterName(name = 'x')] kotlin.String?, kotlin.Int?>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.testGenericJavaCtor2' type=kotlin.Any origin=null
|
||||
|
||||
+15
-15
@@ -9,11 +9,11 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
GET_VAR 'x: kotlin.String declared in <root>.test1.<anonymous>' type=kotlin.String origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:<root>.J<kotlin.String>
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:<root>.J<kotlin.String?>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 (): <root>.J<kotlin.String> declared in <root>'
|
||||
CALL 'public final fun J <T> (block: kotlin.Function1<T of <root>.J?, T of <root>.J?>): <root>.J<T of <root>.J> declared in <root>' type=<root>.J<kotlin.String> origin=null
|
||||
<T>: kotlin.String
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 (): <root>.J<kotlin.String?> declared in <root>'
|
||||
CALL 'public final fun J <T> (block: kotlin.Function1<T of <root>.J?, T of <root>.J?>): <root>.J<T of <root>.J> declared in <root>' type=<root>.J<kotlin.String?> origin=null
|
||||
<T>: kotlin.String?
|
||||
block: FUN_EXPR type=kotlin.Function1<kotlin.String, kotlin.String> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (x:kotlin.String) returnType:kotlin.String
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
@@ -23,7 +23,7 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (): kotlin.Unit declared in <root>'
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit [operator] declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: kotlin.String
|
||||
<X>: kotlin.String?
|
||||
j: FUN_EXPR type=kotlin.Function1<kotlin.String, kotlin.String> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (x:kotlin.String) returnType:kotlin.String
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
@@ -35,7 +35,7 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
TYPE_OP type=<root>.J<kotlin.String> origin=CAST typeOperand=<root>.J<kotlin.String>
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test4' type=kotlin.Any origin=null
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit [operator] declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: kotlin.String
|
||||
<X>: kotlin.String?
|
||||
j: GET_VAR 'a: kotlin.Any declared in <root>.test4' type=<root>.J<kotlin.String> origin=null
|
||||
FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Any
|
||||
@@ -43,14 +43,14 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.String> origin=CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.String>
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Any origin=null
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit [operator] declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: kotlin.String
|
||||
<X>: kotlin.String?
|
||||
j: GET_VAR 'a: kotlin.Any declared in <root>.test5' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
FUN name:test6 visibility:public modality:FINAL <T> (a:kotlin.Function1<T of <root>.test6, T of <root>.test6>) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Function1<T of <root>.test6, T of <root>.test6>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit [operator] declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: T of <root>.test6
|
||||
<X>: T of <root>.test6?
|
||||
j: GET_VAR 'a: kotlin.Function1<T of <root>.test6, T of <root>.test6> declared in <root>.test6' type=kotlin.Function1<T of <root>.test6, T of <root>.test6> origin=null
|
||||
FUN name:test7 visibility:public modality:FINAL <T> (a:kotlin.Any) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
@@ -59,24 +59,24 @@ FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
TYPE_OP type=kotlin.Function1<T of <root>.test7, T of <root>.test7> origin=CAST typeOperand=kotlin.Function1<T of <root>.test7, T of <root>.test7>
|
||||
GET_VAR 'a: kotlin.Any declared in <root>.test7' type=kotlin.Any origin=null
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit [operator] declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: T of <root>.test7
|
||||
<X>: T of <root>.test7?
|
||||
j: GET_VAR 'a: kotlin.Any declared in <root>.test7' type=kotlin.Function1<T of <root>.test7, T of <root>.test7> origin=null
|
||||
FUN name:test8 visibility:public modality:FINAL <> (efn:kotlin.Function1<kotlin.String, kotlin.String>) returnType:<root>.J<kotlin.String>
|
||||
FUN name:test8 visibility:public modality:FINAL <> (efn:kotlin.Function1<kotlin.String, kotlin.String>) returnType:<root>.J<kotlin.String?>
|
||||
VALUE_PARAMETER name:efn index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test8 (efn: kotlin.Function1<kotlin.String, kotlin.String>): <root>.J<kotlin.String> declared in <root>'
|
||||
CALL 'public final fun J <T> (block: kotlin.Function1<T of <root>.J?, T of <root>.J?>): <root>.J<T of <root>.J> declared in <root>' type=<root>.J<kotlin.String> origin=null
|
||||
<T>: kotlin.String
|
||||
RETURN type=kotlin.Nothing from='public final fun test8 (efn: kotlin.Function1<kotlin.String, kotlin.String>): <root>.J<kotlin.String?> declared in <root>'
|
||||
CALL 'public final fun J <T> (block: kotlin.Function1<T of <root>.J?, T of <root>.J?>): <root>.J<T of <root>.J> declared in <root>' type=<root>.J<kotlin.String?> origin=null
|
||||
<T>: kotlin.String?
|
||||
block: GET_VAR 'efn: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test8' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
FUN name:test9 visibility:public modality:FINAL <> (efn:kotlin.Function1<kotlin.String, kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:efn index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun bar <X> (j: <root>.J<X of <root>.H.bar?>?): kotlin.Unit [operator] declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<X>: kotlin.String
|
||||
<X>: kotlin.String?
|
||||
j: GET_VAR 'efn: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test9' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
FUN name:test10 visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.String>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun bar2x <Y> (j2x: <root>.J2X<Y of <root>.H.bar2x?>?): kotlin.Unit [operator] declared in <root>.H' type=kotlin.Unit origin=null
|
||||
<Y>: kotlin.Int
|
||||
<Y>: kotlin.Int?
|
||||
j2x: GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.test10' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=null
|
||||
|
||||
+3
-4
@@ -82,10 +82,9 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
FUN name:test8 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
CALL 'public open fun run1 (r: java.lang.Runnable?): kotlin.Unit [operator] declared in <root>.J' type=kotlin.Unit origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.J' type=<root>.J origin=null
|
||||
r: CALL 'public open fun id <T> (x: T of <root>.J.id?): T of <root>.J.id? [operator] declared in <root>.J' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
<T>: kotlin.Function0<kotlin.Unit>
|
||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/J.run1]>#' type=IrErrorType
|
||||
CALL 'public open fun id <T> (x: T of <root>.J.id?): T of <root>.J.id? [operator] declared in <root>.J' type=kotlin.Function0<kotlin.Unit>? origin=null
|
||||
<T>: kotlin.Function0<kotlin.Unit>?
|
||||
x: GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test8' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
FUN name:test9 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
|
||||
@@ -8099,6 +8099,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInLambda2.kt")
|
||||
public void testLambdaInLambda2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt")
|
||||
public void testPrematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt");
|
||||
@@ -14900,6 +14905,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/elvisOnUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/nullAssertOnTypeWithNullableUpperBound.kt");
|
||||
@@ -14945,6 +14955,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/safeCallWithInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt")
|
||||
public void testTakingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("uselessElvis.kt")
|
||||
public void testUselessElvis() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt");
|
||||
@@ -18930,6 +18945,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samConversionToGeneric.kt")
|
||||
public void testSamConversionToGeneric() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samConversionsWithSmartCasts.kt")
|
||||
public void testSamConversionsWithSmartCasts() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
|
||||
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
|
||||
|
||||
Generated
+25
@@ -8094,6 +8094,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInLambda2.kt")
|
||||
public void testLambdaInLambda2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt")
|
||||
public void testPrematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt");
|
||||
@@ -14895,6 +14900,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/elvisOnUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/nullAssertOnTypeWithNullableUpperBound.kt");
|
||||
@@ -14940,6 +14950,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/safeCallWithInvoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt")
|
||||
public void testTakingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("uselessElvis.kt")
|
||||
public void testUselessElvis() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt");
|
||||
@@ -18920,6 +18935,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samConversionToGeneric.kt")
|
||||
public void testSamConversionToGeneric() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("samConversionsWithSmartCasts.kt")
|
||||
public void testSamConversionsWithSmartCasts() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
|
||||
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
|
||||
|
||||
+5
@@ -18541,6 +18541,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsafeNullCheck.kt")
|
||||
public void testUnsafeNullCheck() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");
|
||||
|
||||
+5
@@ -18541,6 +18541,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsafeNullCheck.kt")
|
||||
public void testUnsafeNullCheck() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");
|
||||
|
||||
+5
@@ -17025,6 +17025,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsafeNullCheck.kt")
|
||||
public void testUnsafeNullCheck() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");
|
||||
|
||||
+5
@@ -17025,6 +17025,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unsafeNullCheck.kt")
|
||||
public void testUnsafeNullCheck() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/unsafeNullCheck.kt");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ERROR: Type mismatch: inferred type is (CapturedType(*)!!..Any?) but String was expected
|
||||
// ERROR: Type mismatch: inferred type is (CapturedType(*)!!..Any?) but String was expected
|
||||
// ERROR: Type mismatch: inferred type is HashMap<String, Any> but Map<String, String> was expected
|
||||
// ERROR: Type mismatch: inferred type is (Any?..Any?) but String was expected
|
||||
// ERROR: Type mismatch: inferred type is (Any?..Any?) but String was expected
|
||||
// ERROR: Type mismatch: inferred type is HashMap<String, Any?> but Map<String, String> was expected
|
||||
import java.util.*
|
||||
|
||||
internal object A {
|
||||
|
||||
Generated
+5
@@ -14256,6 +14256,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/platformTypes/primitives")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+5
@@ -15436,6 +15436,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/platformTypes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inferenceFlexibleTToNullable.kt")
|
||||
public void testInferenceFlexibleTToNullable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/platformTypes/inferenceFlexibleTToNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/platformTypes/primitives")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
// ERROR: Type mismatch: inferred type is Any? but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is (CapturedType(*)!!..Any?) but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is Any? but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is (CapturedType(*)!!..Any?) but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is Any! but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is (Any?..Any?) but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is Any! but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is (Any?..Any?) but String? was expected
|
||||
// ERROR: Type mismatch: inferred type is HashMap<Any?, Any?> but Map<String?, String?> was expected
|
||||
import java.util.HashMap
|
||||
import java.util.Properties
|
||||
|
||||
Reference in New Issue
Block a user