[FIR] Add constraint to flexible type for declared argument for java parameter
This commit is contained in:
@@ -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 = <!INAPPLICABLE_CANDIDATE!>AdapterProcessor<!><PsiMethod, PsiClass>(
|
||||
val processor = 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: <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?| {
|
||||
lval processor: R|AdapterProcessor<ft<PsiMethod, PsiMethod?>!, ft<PsiClass, PsiClass?>!>| = R|/AdapterProcessor.AdapterProcessor|<R|ft<PsiMethod, PsiMethod?>!|, R|ft<PsiClass, PsiClass?>!|>(R|/Function|<R|ft<PsiMethod, PsiMethod?>!|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
|
||||
^ R|<local>/method|?.R|/PsiMethod.containingClass|
|
||||
}
|
||||
))
|
||||
|
||||
@@ -20,13 +20,13 @@ FILE: main.kt
|
||||
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval map: R|util/HashMap<kotlin/Int, kotlin/Int>| = R|util/HashMap.HashMap|<R|kotlin/Int|, R|kotlin/Int|>()
|
||||
lval map: R|util/HashMap<ft<kotlin/Int, kotlin/Int?>!, ft<kotlin/Int, kotlin/Int?>!>| = R|util/HashMap.HashMap|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/Int, kotlin/Int?>!|>()
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval set: R|util/HashSet<kotlin/Int>| = R|util/HashSet.HashSet|<R|kotlin/Int|>()
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
lval list: R|foo/ArrayList<kotlin/Int>| = R|foo/ArrayList.ArrayList|<R|kotlin/Int|>()
|
||||
lval list: R|foo/ArrayList<ft<kotlin/Int, kotlin/Int?>!>| = R|foo/ArrayList.ArrayList|<R|ft<kotlin/Int, kotlin/Int?>!|>()
|
||||
}
|
||||
public final fun test_4(): R|kotlin/Unit| {
|
||||
lval list: R|foo/LinkedList<kotlin/Int>| = R|foo/LinkedList.LinkedList|<R|kotlin/Int|>()
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ FILE: test.kt
|
||||
lval element: R|DE| = R|<local>/d|.R|/Diagnostic.element|
|
||||
R|/Fix.Fix|(R|<local>/element|)
|
||||
}
|
||||
private final val DERIVED_FACTORY: R|DiagnosticFactory0<DerivedElement>| = R|/DiagnosticFactory0.DiagnosticFactory0|<R|DerivedElement|>()
|
||||
private get(): R|DiagnosticFactory0<DerivedElement>|
|
||||
private final val DERIVED_FACTORY: R|DiagnosticFactory0<ft<DerivedElement, DerivedElement?>!>| = R|/DiagnosticFactory0.DiagnosticFactory0|<R|ft<DerivedElement, DerivedElement?>!|>()
|
||||
private get(): R|DiagnosticFactory0<ft<DerivedElement, DerivedElement?>!>|
|
||||
public final fun createViaFactory(d: R|EmptyDiagnostic|): R|kotlin/Unit| {
|
||||
lval casted: R|Diagnostic<ft<DerivedElement, DerivedElement?>!>| = R|/DERIVED_FACTORY|.R|FakeOverride</DiagnosticFactory0.cast: R|Diagnostic<ft<DerivedElement, DerivedElement?>!>|>|(R|<local>/d|)
|
||||
lval element: R|DerivedElement| = R|<local>/casted|.R|/Diagnostic.element|
|
||||
|
||||
+1
-6
@@ -7,10 +7,5 @@ public class JavaClass<T> {
|
||||
|
||||
// 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
|
||||
<!INAPPLICABLE_CANDIDATE!>JavaClass<!><String>(null).<!UNRESOLVED_REFERENCE!>foo<!>().<!UNRESOLVED_REFERENCE!>length<!>
|
||||
JavaClass<String>(null).foo().length
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE: main.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
<Inapplicable(INAPPLICABLE): [/JavaClass.JavaClass]>#<R|kotlin/String|>(Null(null)).<Unresolved name: foo>#().<Unresolved name: length>#
|
||||
R|/JavaClass.JavaClass|<R|ft<kotlin/String, kotlin/String?>!|>(Null(null)).R|FakeOverride</JavaClass.foo: R|ft<kotlin/String, kotlin/String?>!|>|().R|kotlin/String.length|
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FILE: main.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Int, 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|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/String| {
|
||||
^ R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
|
||||
}
|
||||
)
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ FILE: concurrentMapOfAliases.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
private final val foo: R|java/util/concurrent/ConcurrentHashMap<kotlin/String, kotlin/CharSequence>| = Q|java/util/concurrent|.R|java/util/concurrent/ConcurrentHashMap.ConcurrentHashMap|<R|kotlin/String|, R|kotlin/CharSequence|>()
|
||||
private get(): R|java/util/concurrent/ConcurrentHashMap<kotlin/String, kotlin/CharSequence>|
|
||||
private final val foo: R|java/util/concurrent/ConcurrentHashMap<ft<kotlin/String, kotlin/String?>!, ft<kotlin/CharSequence, kotlin/CharSequence?>!>| = Q|java/util/concurrent|.R|java/util/concurrent/ConcurrentHashMap.ConcurrentHashMap|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|>()
|
||||
private get(): R|java/util/concurrent/ConcurrentHashMap<ft<kotlin/String, kotlin/String?>!, ft<kotlin/CharSequence, kotlin/CharSequence?>!>|
|
||||
|
||||
private final fun bar(): R|kotlin/Unit| {
|
||||
(this@R|/A|, this@R|/A|.R|/A.foo|.R|FakeOverride<java/util/concurrent/ConcurrentHashMap.get: R|kotlin/CharSequence?|>|(String(dd)))?.R|/A.baz|()
|
||||
|
||||
+1
-1
@@ -4,5 +4,5 @@ FILE: main.kt
|
||||
public final typealias ImmutableLinkedHashSet<E> = R|imm/LinkedHashSet<E>|
|
||||
private final typealias ImmutableMultimap<K, V> = R|ImmutableMap<K, ImmutableSet<V>>|
|
||||
private final fun <K, V> R|ImmutableMultimap<K, V>|.put(key: R|K|, value: R|V|): R|kotlin/Unit| {
|
||||
this@R|/put|.R|FakeOverride<imm/Map.get: R|ft<imm/Option<ft<ImmutableSet<V>, ImmutableSet<V>?>!>, imm/Option<ft<ImmutableSet<V>, ImmutableSet<V>?>!>?>!|>|(R|<local>/key|).R|FakeOverride<imm/Option.getOrElse: R|ft<ImmutableSet<V>, ImmutableSet<V>?>!|>|(Q|ImmutableLinkedHashSet|.R|imm/LinkedHashSet.empty|<R|V|>())
|
||||
this@R|/put|.R|FakeOverride<imm/Map.get: R|ft<imm/Option<ft<ImmutableSet<V>, ImmutableSet<V>?>!>, imm/Option<ft<ImmutableSet<V>, ImmutableSet<V>?>!>?>!|>|(R|<local>/key|).R|FakeOverride<imm/Option.getOrElse: R|ft<ImmutableSet<V>, ImmutableSet<V>?>!|>|(Q|ImmutableLinkedHashSet|.R|imm/LinkedHashSet.empty|<R|ft<V, V?>!|>())
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FILE: javaLangComparator.kt
|
||||
public final fun test_2(list: R|kotlin/collections/List<kotlin/Int>|): R|kotlin/Unit| {
|
||||
lval comp: R|java/util/Comparator<kotlin/Int>| = Q|java/util|.R|java/util/Comparator|<R|kotlin/Int|>(<L> = Comparator@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|, y: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/Int| {
|
||||
lval comp: R|java/util/Comparator<ft<kotlin/Int, kotlin/Int?>!>| = Q|java/util|.R|java/util/Comparator|<R|ft<kotlin/Int, kotlin/Int?>!|>(<L> = Comparator@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|, y: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/Int| {
|
||||
^ Int(1)
|
||||
}
|
||||
)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FILE: kotlinComparatorAlias.kt
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval comp: R|java/util/Comparator<kotlin/Int>| = R|java/util/Comparator|<R|kotlin/Int|>(<L> = Comparator@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|, y: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/Int| {
|
||||
lval comp: R|java/util/Comparator<ft<kotlin/Int, kotlin/Int?>!>| = R|java/util/Comparator|<R|ft<kotlin/Int, kotlin/Int?>!|>(<L> = Comparator@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|, y: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/Int| {
|
||||
^ Int(1)
|
||||
}
|
||||
)
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
FILE: weakHashMap.kt
|
||||
public final val someMap: R|java/util/WeakHashMap<kotlin/Any?, kotlin/Any?>| = R|java/util/WeakHashMap.WeakHashMap|<R|kotlin/Any?|, R|kotlin/Any?|>()
|
||||
public get(): R|java/util/WeakHashMap<kotlin/Any?, kotlin/Any?>|
|
||||
public final val someMap: R|java/util/WeakHashMap<ft<kotlin/Any, kotlin/Any?>!, ft<kotlin/Any, kotlin/Any?>!>| = R|java/util/WeakHashMap.WeakHashMap|<R|ft<kotlin/Any, kotlin/Any?>!|, R|ft<kotlin/Any, kotlin/Any?>!|>()
|
||||
public get(): R|java/util/WeakHashMap<ft<kotlin/Any, kotlin/Any?>!, ft<kotlin/Any, kotlin/Any?>!>|
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
R|/someMap|.R|FakeOverride<java/util/WeakHashMap.get: R|kotlin/Any?|>|(String())
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ FILE: typeAliasWithForEach.kt
|
||||
}
|
||||
public final typealias Arguments = R|kotlin/collections/Map<kotlin/String, ArgsInfo>|
|
||||
public final fun R|Arguments|.deepCopy(): R|Arguments| {
|
||||
lval result: R|java/util/HashMap<kotlin/String, ArgsInfo>| = R|java/util/HashMap.HashMap|<R|kotlin/String|, R|ArgsInfo|>()
|
||||
lval result: R|java/util/HashMap<ft<kotlin/String, kotlin/String?>!, ft<ArgsInfo, ArgsInfo?>!>| = R|java/util/HashMap.HashMap|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<ArgsInfo, ArgsInfo?>!|>()
|
||||
this@R|/deepCopy|.R|FakeOverride<java/util/Map.forEach: R|kotlin/Unit|>|(<L> = forEach@fun <anonymous>(key: R|ft<kotlin/String, kotlin/String?>!|, value: R|ft<ArgsInfo, ArgsInfo?>!|): R|kotlin/Unit| {
|
||||
R|<local>/result|.R|kotlin/collections/set|<R|ft<kotlin/String, kotlin/String?>!|, R|ft<ArgsInfo, ArgsInfo?>!|>(R|<local>/key|, R|/ArgsInfoImpl.ArgsInfoImpl|(R|<local>/value|))
|
||||
}
|
||||
|
||||
+29
-1
@@ -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<ConeKotlinType>()
|
||||
type is ConeFlexibleType || with(context) {
|
||||
(type.typeConstructor() as? FirTypeParameterSymbol)?.fir?.shouldBeFlexible(context) ?: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun createToFreshVariableSubstitutorAndAddInitialConstraints(
|
||||
|
||||
+1
-2
@@ -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 = <!INAPPLICABLE_CANDIDATE!>AdapterProcessor<!><PsiMethod, PsiClass>(
|
||||
val processor = AdapterProcessor<PsiMethod, PsiClass>(
|
||||
Function { method: PsiMethod? -> method?.containingClass }
|
||||
)
|
||||
}
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ public class A {
|
||||
fun test() {
|
||||
A.bar(null, "")
|
||||
|
||||
A.<!INAPPLICABLE_CANDIDATE!>bar<!><String>(null, "")
|
||||
A.bar<String>(null, "")
|
||||
A.bar<String?>(null, "")
|
||||
A.bar(null, A.platformString())
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ fun foo() {
|
||||
val list = ArrayList<String?>()
|
||||
|
||||
for (s in list) {
|
||||
s.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
s.length
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -4,10 +4,10 @@ FILE fqName:<root> fileName:/constructorWithOwnTypeParametersCall.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun testKotlin (): <root>.K1.K2<kotlin.String> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.K1.K2' type=<root>.K1.K2<kotlin.String> origin=null
|
||||
<class: T2>: kotlin.String
|
||||
FUN name:testJava visibility:public modality:FINAL <> () returnType:<root>.J1.J2<kotlin.Double>
|
||||
FUN name:testJava visibility:public modality:FINAL <> () returnType:<root>.J1.J2<kotlin.Double?>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testJava (): <root>.J1.J2<kotlin.Double> declared in <root>'
|
||||
ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=<root>.J1.J2<kotlin.Double>
|
||||
RETURN type=kotlin.Nothing from='public final fun testJava (): <root>.J1.J2<kotlin.Double?> declared in <root>'
|
||||
ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=<root>.J1.J2<kotlin.Double?>
|
||||
CLASS CLASS name:K1 modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.K1<T1 of <root>.K1>
|
||||
TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Number]
|
||||
|
||||
@@ -20,11 +20,11 @@ FILE fqName:<root> fileName:/samConstructors.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (): java.lang.Runnable declared in <root>'
|
||||
CALL 'public final fun Runnable (block: kotlin.Function0<kotlin.Unit>): java.lang.Runnable declared in java.lang' type=java.lang.Runnable origin=null
|
||||
block: FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
|
||||
FUN name:test4 visibility:public modality:FINAL <> () returnType:java.util.Comparator<kotlin.Int>
|
||||
FUN name:test4 visibility:public modality:FINAL <> () returnType:java.util.Comparator<kotlin.Int?>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (): java.util.Comparator<kotlin.Int> declared in <root>'
|
||||
CALL 'public final fun Comparator <T> (block: kotlin.Function2<T of java.util.Comparator?, T of java.util.Comparator?, kotlin.Int>): java.util.Comparator<T of java.util.Comparator> declared in java.util' type=java.util.Comparator<kotlin.Int> origin=null
|
||||
<T>: kotlin.Int
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (): java.util.Comparator<kotlin.Int?> declared in <root>'
|
||||
CALL 'public final fun Comparator <T> (block: kotlin.Function2<T of java.util.Comparator?, T of java.util.Comparator?, kotlin.Int>): java.util.Comparator<T of java.util.Comparator> declared in java.util' type=java.util.Comparator<kotlin.Int?> origin=null
|
||||
<T>: kotlin.Int?
|
||||
block: FUN_EXPR type=kotlin.Function2<kotlin.Int?, kotlin.Int?, kotlin.Int> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (a:kotlin.Int?, b:kotlin.Int?) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Int?
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
FILE fqName:<root> fileName:/samConversionToGeneric.kt
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:<root>.J<kotlin.String>
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:<root>.J<kotlin.String?>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (): <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 test1 (): <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?
|
||||
|
||||
+14
-14
@@ -1,21 +1,21 @@
|
||||
FILE fqName:<root> fileName:/javaConstructorWithTypeParameters.kt
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:<root>.J1<kotlin.Int>
|
||||
FUN name:test1 visibility:public modality:FINAL <> () returnType:<root>.J1<kotlin.Int?>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (): <root>.J1<kotlin.Int> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J1' type=<root>.J1<kotlin.Int> origin=null
|
||||
<class: T1>: kotlin.Int
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:<root>.J1<kotlin.Int>
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (): <root>.J1<kotlin.Int?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J1' type=<root>.J1<kotlin.Int?> origin=null
|
||||
<class: T1>: kotlin.Int?
|
||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:<root>.J1<kotlin.Int?>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 (): <root>.J1<kotlin.Int> declared in <root>'
|
||||
ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=<root>.J1<kotlin.Int>
|
||||
FUN name:test3 visibility:public modality:FINAL <> (j1:<root>.J1<kotlin.Any>) returnType:<root>.J1.J2<kotlin.Int>
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 (): <root>.J1<kotlin.Int?> declared in <root>'
|
||||
ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=<root>.J1<kotlin.Int?>
|
||||
FUN name:test3 visibility:public modality:FINAL <> (j1:<root>.J1<kotlin.Any>) returnType:<root>.J1.J2<kotlin.Int?>
|
||||
VALUE_PARAMETER name:j1 index:0 type:<root>.J1<kotlin.Any>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (j1: <root>.J1<kotlin.Any>): <root>.J1.J2<kotlin.Int> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J1.J2' type=<root>.J1.J2<kotlin.Int> origin=null
|
||||
<class: T2>: kotlin.Int
|
||||
FUN name:test4 visibility:public modality:FINAL <> (j1:<root>.J1<kotlin.Any>) returnType:<root>.J1.J2<kotlin.Int>
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (j1: <root>.J1<kotlin.Any>): <root>.J1.J2<kotlin.Int?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J1.J2' type=<root>.J1.J2<kotlin.Int?> origin=null
|
||||
<class: T2>: kotlin.Int?
|
||||
FUN name:test4 visibility:public modality:FINAL <> (j1:<root>.J1<kotlin.Any>) returnType:<root>.J1.J2<kotlin.Int?>
|
||||
VALUE_PARAMETER name:j1 index:0 type:<root>.J1<kotlin.Any>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (j1: <root>.J1<kotlin.Any>): <root>.J1.J2<kotlin.Int> declared in <root>'
|
||||
ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=<root>.J1.J2<kotlin.Int>
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (j1: <root>.J1<kotlin.Any>): <root>.J1.J2<kotlin.Int?> declared in <root>'
|
||||
ERROR_EXPR 'Cannot bind 2 type arguments to ??? call with 1 type parameters' type=<root>.J1.J2<kotlin.Int?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
public open class A<T> : R|kotlin/Any| {
|
||||
public open class A<T : R|ft<kotlin/Any, kotlin/Any?>!|> : R|kotlin/Any| {
|
||||
public open fun foo(t: R|ft<T, T?>!|): R|ft<T, T?>!|
|
||||
|
||||
public constructor<T>(): R|A<T>|
|
||||
public constructor<T : R|ft<kotlin/Any, kotlin/Any?>!|>(): R|A<T>|
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
public abstract interface Diagnostic : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface DiagnosticWithParameters1<E, A> : R|jvm/Diagnostic| {
|
||||
public abstract interface DiagnosticWithParameters1<E : R|ft<kotlin/Any, kotlin/Any?>!|, A : R|ft<kotlin/Any, kotlin/Any?>!|> : R|jvm/Diagnostic| {
|
||||
public abstract fun getA(): R|ft<A, A?>!|
|
||||
|
||||
}
|
||||
public abstract interface DiagnosticWithParameters2<E, A, B> : R|jvm/Diagnostic| {
|
||||
public abstract interface DiagnosticWithParameters2<E : R|ft<kotlin/Any, kotlin/Any?>!|, A : R|ft<kotlin/Any, kotlin/Any?>!|, B : R|ft<kotlin/Any, kotlin/Any?>!|> : R|jvm/Diagnostic| {
|
||||
public abstract fun getA(): R|ft<A, A?>!|
|
||||
|
||||
public abstract fun getB(): R|ft<B, B?>!|
|
||||
|
||||
@@ -3,5 +3,5 @@ FILE: test.kt
|
||||
^select R|<local>/x|
|
||||
}
|
||||
public final fun test(d1: R|jvm/DiagnosticWithParameters1<*, *>|, d2: R|jvm/DiagnosticWithParameters2<*, *, *>|): R|kotlin/Unit| {
|
||||
lval res: R|ft<kotlin/Any?, kotlin/Any?>?| = R|jvm/select|<R|ft<kotlin/Any?, kotlin/Any?>?|>(R|<local>/d1|.R|jvm/DiagnosticWithParameters1.a|, R|<local>/d2|.R|jvm/DiagnosticWithParameters2.b|)
|
||||
lval res: R|ft<kotlin/Any, kotlin/Any?>!| = R|jvm/select|<R|ft<kotlin/Any, kotlin/Any?>!|>(R|<local>/d1|.R|jvm/DiagnosticWithParameters1.a|, R|<local>/d2|.R|jvm/DiagnosticWithParameters2.b|)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user