From 48fb2797216211b223700acfeac7ff0707f2046c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 25 Mar 2020 18:04:19 +0300 Subject: [PATCH] [FIR] Add constraint to flexible type for declared argument for java parameter --- .../resolve/arguments/lambdaInLambda2.kt | 3 +- .../resolve/arguments/lambdaInLambda2.txt | 2 +- .../resolve/defaultJavaImportHiding.txt | 4 +-- .../expresssions/genericDiagnostic.txt | 4 +-- .../problems/flexibleTypeVarAgainstNull.kt | 7 +---- .../problems/flexibleTypeVarAgainstNull.txt | 2 +- .../resolve/samConstructors/genericSam.txt | 2 +- .../concurrentMapOfAliases.txt | 4 +-- .../j+k/flexibleTypeAliases.txt | 2 +- .../resolveWithStdlib/javaLangComparator.txt | 2 +- .../kotlinComparatorAlias.txt | 2 +- .../problems/weakHashMap.txt | 4 +-- .../typeAliasWithForEach.txt | 2 +- ...CreateFreshTypeVariableSubstitutorStage.kt | 30 ++++++++++++++++++- .../functionLiterals/lambdaInLambda2.fir.kt | 3 +- .../methodTypeParameter.fir.kt | 2 +- .../platformTypes/nullableTypeArgument.fir.kt | 2 +- ...nstructorWithOwnTypeParametersCall.fir.txt | 6 ++-- .../expressions/sam/samConstructors.fir.txt | 8 ++--- .../sam/samConversionToGeneric.fir.txt | 8 ++--- .../javaConstructorWithTypeParameters.fir.txt | 28 ++++++++--------- .../extraDump.java.txt | 4 +-- .../extraDump.java.txt | 4 +-- .../intersectionTypesProblem/jvm/test.txt | 2 +- 24 files changed, 79 insertions(+), 58 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.kt index 75db95d516d..eb13dc322f5 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.kt @@ -22,8 +22,7 @@ interface PsiMethod { 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( + val processor = AdapterProcessor( Function { method: PsiMethod? -> method?.containingClass } ) } \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.txt b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.txt index 6aee71ec3f7..343b25ef0f1 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.txt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambdaInLambda2.txt @@ -7,7 +7,7 @@ FILE: main.kt public abstract interface PsiClass : R|kotlin/Any| { } public final fun test(): R|kotlin/Unit| { - lval processor: = #(R|/Function|( = Function@fun (method: R|PsiMethod?|): R|PsiClass?| { + lval processor: R|AdapterProcessor!, ft!>| = R|/AdapterProcessor.AdapterProcessor|!|, R|ft!|>(R|/Function|!|, R|PsiClass?|>( = Function@fun (method: R|PsiMethod?|): R|PsiClass?| { ^ R|/method|?.R|/PsiMethod.containingClass| } )) diff --git a/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt b/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt index 72b89777f4b..5b27f60e8a7 100644 --- a/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt +++ b/compiler/fir/analysis-tests/testData/resolve/defaultJavaImportHiding.txt @@ -20,13 +20,13 @@ FILE: main.kt } public final fun test_1(): R|kotlin/Unit| { - lval map: R|util/HashMap| = R|util/HashMap.HashMap|() + lval map: R|util/HashMap!, ft!>| = R|util/HashMap.HashMap|!|, R|ft!|>() } public final fun test_2(): R|kotlin/Unit| { lval set: R|util/HashSet| = R|util/HashSet.HashSet|() } public final fun test_3(): R|kotlin/Unit| { - lval list: R|foo/ArrayList| = R|foo/ArrayList.ArrayList|() + lval list: R|foo/ArrayList!>| = R|foo/ArrayList.ArrayList|!|>() } public final fun test_4(): R|kotlin/Unit| { lval list: R|foo/LinkedList| = R|foo/LinkedList.LinkedList|() diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.txt index ad1b07ac01e..ec1726a5346 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/genericDiagnostic.txt @@ -13,8 +13,8 @@ FILE: test.kt lval element: R|DE| = R|/d|.R|/Diagnostic.element| R|/Fix.Fix|(R|/element|) } - private final val DERIVED_FACTORY: R|DiagnosticFactory0| = R|/DiagnosticFactory0.DiagnosticFactory0|() - private get(): R|DiagnosticFactory0| + private final val DERIVED_FACTORY: R|DiagnosticFactory0!>| = R|/DiagnosticFactory0.DiagnosticFactory0|!|>() + private get(): R|DiagnosticFactory0!>| public final fun createViaFactory(d: R|EmptyDiagnostic|): R|kotlin/Unit| { lval casted: R|Diagnostic!>| = R|/DERIVED_FACTORY|.R|FakeOverride!>|>|(R|/d|) lval element: R|DerivedElement| = R|/casted|.R|/Diagnostic.element| diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.kt b/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.kt index 37b6a1c3d6b..da1f9ead2e3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.kt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.kt @@ -7,10 +7,5 @@ public class JavaClass { // FILE: main.kt fun main() { - // See https://github.com/JetBrains/kotlin/commit/437a26684d3529ee2cfdbe54e59d50f4a6f0a611#diff-ba68311bbe28b71196c36a6246000382L176 - // In simplifyLowerConstraint, we add constraint Nothing? <: T!, approximating it with Nothing? <: T - // But before it we already had T <: String from the explicit types - // That lead us to constraint contradiction: Nothing? !<: String - // We need to discuss the commit above at some point - JavaClass(null).foo().length + JavaClass(null).foo().length } diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.txt b/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.txt index b7ae6a0886d..550b1164784 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.txt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/flexibleTypeVarAgainstNull.txt @@ -1,4 +1,4 @@ FILE: main.kt public final fun main(): R|kotlin/Unit| { - #(Null(null)).#().# + R|/JavaClass.JavaClass|!|>(Null(null)).R|FakeOverride!|>|().R|kotlin/String.length| } diff --git a/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt b/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt index 303583bb3ba..29cae7f7e3c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt +++ b/compiler/fir/analysis-tests/testData/resolve/samConstructors/genericSam.txt @@ -1,6 +1,6 @@ FILE: main.kt public final fun main(): R|kotlin/Unit| { - R|/MyFunction|( = MyFunction@fun (x: R|ft!|): R|kotlin/String| { + R|/MyFunction|!|, R|ft!|>( = MyFunction@fun (x: R|ft!|): R|kotlin/String| { ^ R|/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|() } ) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/concurrentMapOfAliases.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/concurrentMapOfAliases.txt index 9463d1b9e58..582aaa83eed 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/concurrentMapOfAliases.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/concurrentMapOfAliases.txt @@ -5,8 +5,8 @@ FILE: concurrentMapOfAliases.kt super() } - private final val foo: R|java/util/concurrent/ConcurrentHashMap| = Q|java/util/concurrent|.R|java/util/concurrent/ConcurrentHashMap.ConcurrentHashMap|() - private get(): R|java/util/concurrent/ConcurrentHashMap| + private final val foo: R|java/util/concurrent/ConcurrentHashMap!, ft!>| = Q|java/util/concurrent|.R|java/util/concurrent/ConcurrentHashMap.ConcurrentHashMap|!|, R|ft!|>() + private get(): R|java/util/concurrent/ConcurrentHashMap!, ft!>| private final fun bar(): R|kotlin/Unit| { (this@R|/A|, this@R|/A|.R|/A.foo|.R|FakeOverride|(String(dd)))?.R|/A.baz|() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/flexibleTypeAliases.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/flexibleTypeAliases.txt index 7fed31c5335..a7273d97f81 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/flexibleTypeAliases.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/flexibleTypeAliases.txt @@ -4,5 +4,5 @@ FILE: main.kt public final typealias ImmutableLinkedHashSet = R|imm/LinkedHashSet| private final typealias ImmutableMultimap = R|ImmutableMap>| private final fun R|ImmutableMultimap|.put(key: R|K|, value: R|V|): R|kotlin/Unit| { - this@R|/put|.R|FakeOverride, ImmutableSet?>!>, imm/Option, ImmutableSet?>!>?>!|>|(R|/key|).R|FakeOverride, ImmutableSet?>!|>|(Q|ImmutableLinkedHashSet|.R|imm/LinkedHashSet.empty|()) + this@R|/put|.R|FakeOverride, ImmutableSet?>!>, imm/Option, ImmutableSet?>!>?>!|>|(R|/key|).R|FakeOverride, ImmutableSet?>!|>|(Q|ImmutableLinkedHashSet|.R|imm/LinkedHashSet.empty|!|>()) } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/javaLangComparator.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/javaLangComparator.txt index 71c47b33f06..4fb6ca78632 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/javaLangComparator.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/javaLangComparator.txt @@ -1,6 +1,6 @@ FILE: javaLangComparator.kt public final fun test_2(list: R|kotlin/collections/List|): R|kotlin/Unit| { - lval comp: R|java/util/Comparator| = Q|java/util|.R|java/util/Comparator|( = Comparator@fun (x: R|ft!|, y: R|ft!|): R|kotlin/Int| { + lval comp: R|java/util/Comparator!>| = Q|java/util|.R|java/util/Comparator|!|>( = Comparator@fun (x: R|ft!|, y: R|ft!|): R|kotlin/Int| { ^ Int(1) } ) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/kotlinComparatorAlias.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/kotlinComparatorAlias.txt index 6fd1c9eda35..5c4dfee8732 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/kotlinComparatorAlias.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/kotlinComparatorAlias.txt @@ -1,6 +1,6 @@ FILE: kotlinComparatorAlias.kt public final fun test_1(): R|kotlin/Unit| { - lval comp: R|java/util/Comparator| = R|java/util/Comparator|( = Comparator@fun (x: R|ft!|, y: R|ft!|): R|kotlin/Int| { + lval comp: R|java/util/Comparator!>| = R|java/util/Comparator|!|>( = Comparator@fun (x: R|ft!|, y: R|ft!|): R|kotlin/Int| { ^ Int(1) } ) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/weakHashMap.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/weakHashMap.txt index 2126aea0844..48fa23a8b7f 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/weakHashMap.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/weakHashMap.txt @@ -1,6 +1,6 @@ FILE: weakHashMap.kt - public final val someMap: R|java/util/WeakHashMap| = R|java/util/WeakHashMap.WeakHashMap|() - public get(): R|java/util/WeakHashMap| + public final val someMap: R|java/util/WeakHashMap!, ft!>| = R|java/util/WeakHashMap.WeakHashMap|!|, R|ft!|>() + public get(): R|java/util/WeakHashMap!, ft!>| public final fun foo(): R|kotlin/Unit| { R|/someMap|.R|FakeOverride|(String()) } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/typeAliasWithForEach.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/typeAliasWithForEach.txt index bebd6f0d54f..d5c484c787e 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/typeAliasWithForEach.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/typeAliasWithForEach.txt @@ -9,7 +9,7 @@ FILE: typeAliasWithForEach.kt } public final typealias Arguments = R|kotlin/collections/Map| public final fun R|Arguments|.deepCopy(): R|Arguments| { - lval result: R|java/util/HashMap| = R|java/util/HashMap.HashMap|() + lval result: R|java/util/HashMap!, ft!>| = R|java/util/HashMap.HashMap|!|, R|ft!|>() this@R|/deepCopy|.R|FakeOverride|( = forEach@fun (key: R|ft!|, value: R|ft!|): R|kotlin/Unit| { R|/result|.R|kotlin/collections/set|!|, R|ft!|>(R|/key|, R|/ArgsInfoImpl.ArgsInfoImpl|(R|/value|)) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CreateFreshTypeVariableSubstitutorStage.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CreateFreshTypeVariableSubstitutorStage.kt index 093085fdf60..ebae411e0e8 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CreateFreshTypeVariableSubstitutorStage.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CreateFreshTypeVariableSubstitutorStage.kt @@ -5,11 +5,13 @@ package org.jetbrains.kotlin.fir.resolve.calls +import org.jetbrains.kotlin.fir.declarations.FirTypeParameter import org.jetbrains.kotlin.fir.declarations.FirTypeParametersOwner import org.jetbrains.kotlin.fir.renderWithType import org.jetbrains.kotlin.fir.resolve.inference.TypeParameterBasedTypeVariable import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap +import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.impl.FirTypePlaceholderProjection import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemOperation @@ -62,7 +64,11 @@ internal object CreateFreshTypeVariableSubstitutorStage : ResolutionStage() { when (val typeArgument = candidate.typeArgumentMapping[index]) { is FirTypeProjectionWithVariance -> csBuilder.addEqualityConstraint( freshVariable.defaultType, - typeArgument.typeRef.coneTypeUnsafe(), + getTypePreservingFlexibilityWrtTypeVariable( + typeArgument.typeRef.coneTypeUnsafe(), + typeParameter, + candidate.bodyResolveComponents.inferenceComponents.ctx + ), SimpleConstraintSystemConstraintPosition // TODO ) is FirStarProjection -> csBuilder.addEqualityConstraint( @@ -78,6 +84,28 @@ internal object CreateFreshTypeVariableSubstitutorStage : ResolutionStage() { } } + private fun getTypePreservingFlexibilityWrtTypeVariable( + type: ConeKotlinType, + typeParameter: FirTypeParameter, + context: ConeTypeContext + ): ConeKotlinType { + return if (typeParameter.shouldBeFlexible(context)) { + val notNullType = type.withNullability(ConeNullability.NOT_NULL) + ConeFlexibleType(notNullType, notNullType.withNullability(ConeNullability.NULLABLE)) + } else { + type + } + } + + private fun FirTypeParameter.shouldBeFlexible(context: ConeTypeContext): Boolean { + return bounds.any { + val type = it.coneTypeUnsafe() + type is ConeFlexibleType || with(context) { + (type.typeConstructor() as? FirTypeParameterSymbol)?.fir?.shouldBeFlexible(context) ?: false + } + } + } + } fun createToFreshVariableSubstitutorAndAddInitialConstraints( diff --git a/compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.fir.kt index b8c30aeac8a..cda5ee1c466 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.fir.kt @@ -22,8 +22,7 @@ interface PsiMethod { 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( + val processor = AdapterProcessor( Function { method: PsiMethod? -> method?.containingClass } ) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.fir.kt index 81e9a73bf91..689e6e31ab5 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/notNullTypeParameter/methodTypeParameter.fir.kt @@ -13,7 +13,7 @@ public class A { fun test() { A.bar(null, "") - A.bar(null, "") + A.bar(null, "") A.bar(null, "") A.bar(null, A.platformString()) } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.fir.kt index a1b02c34276..56780f13fc7 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullableTypeArgument.fir.kt @@ -4,6 +4,6 @@ fun foo() { val list = ArrayList() for (s in list) { - s.length + s.length } } \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.txt b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.txt index 51c34d6845c..59d4d8e71f3 100644 --- a/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.txt +++ b/compiler/testData/ir/irText/expressions/constructorWithOwnTypeParametersCall.fir.txt @@ -4,10 +4,10 @@ FILE fqName: fileName:/constructorWithOwnTypeParametersCall.kt RETURN type=kotlin.Nothing from='public final fun testKotlin (): .K1.K2 declared in ' CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K1.K2' type=.K1.K2 origin=null : kotlin.String - FUN name:testJava visibility:public modality:FINAL <> () returnType:.J1.J2 + FUN name:testJava visibility:public modality:FINAL <> () returnType:.J1.J2 BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun testJava (): .J1.J2 declared in ' - ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=.J1.J2 + RETURN type=kotlin.Nothing from='public final fun testJava (): .J1.J2 declared in ' + ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=.J1.J2 CLASS CLASS name:K1 modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.K1.K1> TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Number] diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt index 5fa6c8181bf..3d23852d4f0 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt @@ -20,11 +20,11 @@ FILE fqName: fileName:/samConstructors.kt RETURN type=kotlin.Nothing from='public final fun test3 (): java.lang.Runnable declared in ' CALL 'public final fun Runnable (block: kotlin.Function0): java.lang.Runnable declared in java.lang' type=java.lang.Runnable origin=null block: FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= - FUN name:test4 visibility:public modality:FINAL <> () returnType:java.util.Comparator + FUN name:test4 visibility:public modality:FINAL <> () returnType:java.util.Comparator BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test4 (): java.util.Comparator declared in ' - CALL 'public final fun Comparator (block: kotlin.Function2): java.util.Comparator declared in java.util' type=java.util.Comparator origin=null - : kotlin.Int + RETURN type=kotlin.Nothing from='public final fun test4 (): java.util.Comparator declared in ' + CALL 'public final fun Comparator (block: kotlin.Function2): java.util.Comparator declared in java.util' type=java.util.Comparator origin=null + : kotlin.Int? block: FUN_EXPR type=kotlin.Function2 origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (a:kotlin.Int?, b:kotlin.Int?) returnType:kotlin.Int VALUE_PARAMETER name:a index:0 type:kotlin.Int? diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt index aa03b1c864d..97463d5c167 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionToGeneric.fir.txt @@ -1,9 +1,9 @@ FILE fqName: fileName:/samConversionToGeneric.kt - FUN name:test1 visibility:public modality:FINAL <> () returnType:.J + FUN name:test1 visibility:public modality:FINAL <> () returnType:.J BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test1 (): .J declared in ' - CALL 'public final fun J (block: kotlin.Function1.J?, T of .J?>): .J.J> declared in ' type=.J origin=null - : kotlin.String + RETURN type=kotlin.Nothing from='public final fun test1 (): .J declared in ' + CALL 'public final fun J (block: kotlin.Function1.J?, T of .J?>): .J.J> declared in ' type=.J origin=null + : kotlin.String? block: FUN_EXPR type=kotlin.Function1 origin=LAMBDA FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (x:kotlin.String?) returnType:kotlin.String? VALUE_PARAMETER name:x index:0 type:kotlin.String? diff --git a/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.txt b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.txt index 1ec86b7f1f0..7bd21e7c5c6 100644 --- a/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.txt +++ b/compiler/testData/ir/irText/stubs/javaConstructorWithTypeParameters.fir.txt @@ -1,21 +1,21 @@ FILE fqName: fileName:/javaConstructorWithTypeParameters.kt - FUN name:test1 visibility:public modality:FINAL <> () returnType:.J1 + FUN name:test1 visibility:public modality:FINAL <> () returnType:.J1 BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test1 (): .J1 declared in ' - CONSTRUCTOR_CALL 'public constructor () declared in .J1' type=.J1 origin=null - : kotlin.Int - FUN name:test2 visibility:public modality:FINAL <> () returnType:.J1 + RETURN type=kotlin.Nothing from='public final fun test1 (): .J1 declared in ' + CONSTRUCTOR_CALL 'public constructor () declared in .J1' type=.J1 origin=null + : kotlin.Int? + FUN name:test2 visibility:public modality:FINAL <> () returnType:.J1 BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test2 (): .J1 declared in ' - ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=.J1 - FUN name:test3 visibility:public modality:FINAL <> (j1:.J1) returnType:.J1.J2 + RETURN type=kotlin.Nothing from='public final fun test2 (): .J1 declared in ' + ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=.J1 + FUN name:test3 visibility:public modality:FINAL <> (j1:.J1) returnType:.J1.J2 VALUE_PARAMETER name:j1 index:0 type:.J1 BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test3 (j1: .J1): .J1.J2 declared in ' - CONSTRUCTOR_CALL 'public constructor () declared in .J1.J2' type=.J1.J2 origin=null - : kotlin.Int - FUN name:test4 visibility:public modality:FINAL <> (j1:.J1) returnType:.J1.J2 + RETURN type=kotlin.Nothing from='public final fun test3 (j1: .J1): .J1.J2 declared in ' + CONSTRUCTOR_CALL 'public constructor () declared in .J1.J2' type=.J1.J2 origin=null + : kotlin.Int? + FUN name:test4 visibility:public modality:FINAL <> (j1:.J1) returnType:.J1.J2 VALUE_PARAMETER name:j1 index:0 type:.J1 BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test4 (j1: .J1): .J1.J2 declared in ' - ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=.J1.J2 + RETURN type=kotlin.Nothing from='public final fun test4 (j1: .J1): .J1.J2 declared in ' + ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=.J1.J2 diff --git a/idea/testData/fir/multiModule/basicWithJavaFakeOverride/extraDump.java.txt b/idea/testData/fir/multiModule/basicWithJavaFakeOverride/extraDump.java.txt index a5910a4ed2d..c3677cd7bbd 100644 --- a/idea/testData/fir/multiModule/basicWithJavaFakeOverride/extraDump.java.txt +++ b/idea/testData/fir/multiModule/basicWithJavaFakeOverride/extraDump.java.txt @@ -1,6 +1,6 @@ -public open class A : R|kotlin/Any| { +public open class A!|> : R|kotlin/Any| { public open fun foo(t: R|ft!|): R|ft!| - public constructor(): R|A| + public constructor!|>(): R|A| } diff --git a/idea/testData/fir/multiModule/intersectionTypesProblem/extraDump.java.txt b/idea/testData/fir/multiModule/intersectionTypesProblem/extraDump.java.txt index 253ba1510bf..87df11f8aa0 100644 --- a/idea/testData/fir/multiModule/intersectionTypesProblem/extraDump.java.txt +++ b/idea/testData/fir/multiModule/intersectionTypesProblem/extraDump.java.txt @@ -1,10 +1,10 @@ public abstract interface Diagnostic : R|kotlin/Any| { } -public abstract interface DiagnosticWithParameters1 : R|jvm/Diagnostic| { +public abstract interface DiagnosticWithParameters1!|, A : R|ft!|> : R|jvm/Diagnostic| { public abstract fun getA(): R|ft!| } -public abstract interface DiagnosticWithParameters2 : R|jvm/Diagnostic| { +public abstract interface DiagnosticWithParameters2!|, A : R|ft!|, B : R|ft!|> : R|jvm/Diagnostic| { public abstract fun getA(): R|ft!| public abstract fun getB(): R|ft!| diff --git a/idea/testData/fir/multiModule/intersectionTypesProblem/jvm/test.txt b/idea/testData/fir/multiModule/intersectionTypesProblem/jvm/test.txt index b82a652a330..d7408754177 100644 --- a/idea/testData/fir/multiModule/intersectionTypesProblem/jvm/test.txt +++ b/idea/testData/fir/multiModule/intersectionTypesProblem/jvm/test.txt @@ -3,5 +3,5 @@ FILE: test.kt ^select R|/x| } public final fun test(d1: R|jvm/DiagnosticWithParameters1<*, *>|, d2: R|jvm/DiagnosticWithParameters2<*, *, *>|): R|kotlin/Unit| { - lval res: R|ft?| = R|jvm/select|?|>(R|/d1|.R|jvm/DiagnosticWithParameters1.a|, R|/d2|.R|jvm/DiagnosticWithParameters2.b|) + lval res: R|ft!| = R|jvm/select|!|>(R|/d1|.R|jvm/DiagnosticWithParameters1.a|, R|/d2|.R|jvm/DiagnosticWithParameters2.b|) }