Don't add LHS type constraint for callable references too early, before the resolution
The constraint depends on a resolution candidate, because it can be Java static or companion object's member (don't need add constraint in this case) ^KT-41978 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
fd2929d2c5
commit
43a83dd07a
+54
@@ -2752,6 +2752,60 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionConst.kt")
|
||||
public void testCallableReferenceOfCompanionConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionMethod.kt")
|
||||
public void testCallableReferenceOfCompanionMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionProperty.kt")
|
||||
public void testCallableReferenceOfCompanionProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfJavaNestedClass.kt")
|
||||
public void testCallableReferenceOfJavaNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfJavaNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfKotlinNestedClass.kt")
|
||||
public void testCallableReferenceOfKotlinNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfKotlinNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfNestedClass.kt")
|
||||
public void testCallableReferenceOfNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfObjectMethod.kt")
|
||||
public void testCallableReferenceOfObjectMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfObjectMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfStaticField.kt")
|
||||
public void testCallableReferenceOfStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfStaticMethod.kt")
|
||||
public void testCallableReferenceOfStaticMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charArrayOf.kt")
|
||||
public void testCharArrayOf() throws Exception {
|
||||
|
||||
-1
@@ -379,7 +379,6 @@ class DiagnosticReporterByTrackingStrategy(
|
||||
when (position) {
|
||||
is ArgumentConstraintPositionImpl -> position.argument
|
||||
is ReceiverConstraintPositionImpl -> position.argument
|
||||
is LHSArgumentConstraintPositionImpl -> position.argument
|
||||
is LambdaArgumentConstraintPositionImpl -> position.lambda.atom
|
||||
else -> null
|
||||
}
|
||||
|
||||
+36
@@ -7,16 +7,20 @@ package org.jetbrains.kotlin.resolve.calls.components
|
||||
|
||||
import org.jetbrains.kotlin.builtins.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.calls.components.candidate.CallableReferenceResolutionCandidate
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemOperation
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.FreshVariableNewTypeSubstitutor
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.*
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isCompanionObject
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.captureFromExpression
|
||||
import org.jetbrains.kotlin.types.expressions.CoercionStrategy
|
||||
import org.jetbrains.kotlin.types.model.TypeVariance
|
||||
import org.jetbrains.kotlin.types.model.convertVariance
|
||||
import org.jetbrains.kotlin.types.typeUtil.immediateSupertypes
|
||||
import org.jetbrains.kotlin.types.typeUtil.supertypes
|
||||
|
||||
@@ -78,11 +82,21 @@ fun CallableReferenceResolutionCandidate.addConstraints(
|
||||
substitutor: FreshVariableNewTypeSubstitutor,
|
||||
callableReference: CallableReferenceResolutionAtom
|
||||
) {
|
||||
val lhsResult = callableReference.lhsResult
|
||||
val position = when (callableReference) {
|
||||
is CallableReferenceKotlinCallArgument -> ArgumentConstraintPositionImpl(callableReference)
|
||||
is CallableReferenceKotlinCall -> CallableReferenceConstraintPositionImpl(callableReference)
|
||||
}
|
||||
|
||||
if (lhsResult is LHSResult.Type && expectedType != null && !TypeUtils.noExpectedType(expectedType)) {
|
||||
// NB: regular objects have lhsResult of `LHSResult.Object` type and won't be proceeded here
|
||||
val isStaticOrCompanionMember =
|
||||
DescriptorUtils.isStaticDeclaration(candidate) || candidate.containingDeclaration.isCompanionObject()
|
||||
if (!isStaticOrCompanionMember) {
|
||||
constraintSystem.addLhsTypeConstraint(lhsResult.unboundDetailedReceiver.stableType, expectedType, position)
|
||||
}
|
||||
}
|
||||
|
||||
if (!ErrorUtils.isError(candidate)) {
|
||||
constraintSystem.addReceiverConstraint(substitutor, dispatchReceiver, candidate.dispatchReceiverParameter, position)
|
||||
constraintSystem.addReceiverConstraint(substitutor, extensionReceiver, candidate.extensionReceiverParameter, position)
|
||||
@@ -93,6 +107,28 @@ fun CallableReferenceResolutionCandidate.addConstraints(
|
||||
}
|
||||
}
|
||||
|
||||
private fun ConstraintSystemOperation.addLhsTypeConstraint(
|
||||
lhsType: KotlinType,
|
||||
expectedType: UnwrappedType,
|
||||
position: ConstraintPosition
|
||||
) {
|
||||
if (!ReflectionTypes.isNumberedTypeWithOneOrMoreNumber(expectedType)) return
|
||||
|
||||
val expectedTypeProjectionForLHS = expectedType.arguments.first()
|
||||
val expectedTypeForLHS = expectedTypeProjectionForLHS.type
|
||||
val expectedTypeVariance = expectedTypeProjectionForLHS.projectionKind.convertVariance()
|
||||
val effectiveVariance = AbstractTypeChecker.effectiveVariance(
|
||||
expectedType.constructor.parameters.first().variance.convertVariance(),
|
||||
expectedTypeVariance
|
||||
) ?: expectedTypeVariance
|
||||
|
||||
when (effectiveVariance) {
|
||||
TypeVariance.INV -> addEqualityConstraint(lhsType, expectedTypeForLHS, position)
|
||||
TypeVariance.IN -> addSubtypeConstraint(expectedTypeForLHS, lhsType, position)
|
||||
TypeVariance.OUT -> addSubtypeConstraint(lhsType, expectedTypeForLHS, position)
|
||||
}
|
||||
}
|
||||
|
||||
private fun ConstraintSystemOperation.addReceiverConstraint(
|
||||
toFreshSubstitutor: FreshVariableNewTypeSubstitutor,
|
||||
receiverArgument: CallableReceiver?,
|
||||
|
||||
-29
@@ -250,11 +250,6 @@ private fun preprocessCallableReference(
|
||||
|
||||
if (expectedType == null) return result
|
||||
|
||||
val lhsResult = argument.lhsResult
|
||||
if (lhsResult is LHSResult.Type) {
|
||||
csBuilder.addConstraintFromLHS(argument, lhsResult, expectedType)
|
||||
}
|
||||
|
||||
val notCallableTypeConstructor =
|
||||
csBuilder.getProperSuperTypeConstructors(expectedType)
|
||||
.firstOrNull { !ReflectionTypes.isPossibleExpectedCallableType(it.requireIs()) }
|
||||
@@ -271,30 +266,6 @@ private fun preprocessCallableReference(
|
||||
return result
|
||||
}
|
||||
|
||||
private fun ConstraintSystemBuilder.addConstraintFromLHS(
|
||||
argument: CallableReferenceKotlinCallArgument,
|
||||
lhsResult: LHSResult.Type,
|
||||
expectedType: UnwrappedType
|
||||
) {
|
||||
if (!ReflectionTypes.isNumberedTypeWithOneOrMoreNumber(expectedType)) return
|
||||
|
||||
val lhsType = lhsResult.unboundDetailedReceiver.stableType
|
||||
val expectedTypeProjectionForLHS = expectedType.arguments.first()
|
||||
val expectedTypeForLHS = expectedTypeProjectionForLHS.type
|
||||
val constraintPosition = LHSArgumentConstraintPositionImpl(argument, lhsResult.qualifier ?: lhsResult.unboundDetailedReceiver)
|
||||
val expectedTypeVariance = expectedTypeProjectionForLHS.projectionKind.convertVariance()
|
||||
val effectiveVariance = AbstractTypeChecker.effectiveVariance(
|
||||
expectedType.constructor.parameters.first().variance.convertVariance(),
|
||||
expectedTypeVariance
|
||||
) ?: expectedTypeVariance
|
||||
|
||||
when (effectiveVariance) {
|
||||
TypeVariance.INV -> addEqualityConstraint(lhsType, expectedTypeForLHS, constraintPosition)
|
||||
TypeVariance.IN -> addSubtypeConstraint(expectedTypeForLHS, lhsType, constraintPosition)
|
||||
TypeVariance.OUT -> addSubtypeConstraint(lhsType, expectedTypeForLHS, constraintPosition)
|
||||
}
|
||||
}
|
||||
|
||||
private fun preprocessCollectionLiteralArgument(
|
||||
collectionLiteralArgument: CollectionLiteralKotlinCallArgument,
|
||||
expectedType: UnwrappedType?
|
||||
|
||||
-5
@@ -46,11 +46,6 @@ class FixVariableConstraintPositionImpl(
|
||||
|
||||
class KnownTypeParameterConstraintPositionImpl(typeArgument: KotlinType) : KnownTypeParameterConstraintPosition<KotlinType>(typeArgument)
|
||||
|
||||
class LHSArgumentConstraintPositionImpl(
|
||||
argument: CallableReferenceKotlinCallArgument,
|
||||
receiver: DetailedReceiver
|
||||
) : LHSArgumentConstraintPosition<CallableReferenceKotlinCallArgument, DetailedReceiver>(argument, receiver)
|
||||
|
||||
class LambdaArgumentConstraintPositionImpl(lambda: ResolvedLambdaAtom) : LambdaArgumentConstraintPosition<ResolvedLambdaAtom>(lambda)
|
||||
|
||||
class DelegatedPropertyConstraintPositionImpl(topLevelCall: KotlinCall) : DelegatedPropertyConstraintPosition<KotlinCall>(topLevelCall)
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
|
||||
import kotlin.reflect.KProperty0
|
||||
|
||||
class Sample {
|
||||
companion object {
|
||||
const val maxValue = 1
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::maxValue,
|
||||
{ x -> x == 1 }
|
||||
)
|
||||
}
|
||||
abstract fun <T1> run(method: KProperty0<T1>, fn: (T1) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1> run(method: KProperty0<T1>, fn: (T1) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.reflect.KFunction2
|
||||
|
||||
class Sample {
|
||||
companion object {
|
||||
fun max(x: Int, y: Int): Int {
|
||||
return if (x > y) {
|
||||
x
|
||||
} else {
|
||||
y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::max,
|
||||
{ x, y -> x > y }
|
||||
)
|
||||
}
|
||||
abstract fun <T1, T2, R> run(method: KFunction2<T1, T2, R>, fn: (T1, T2) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1, T2, R> run(method: KFunction2<T1, T2, R>, fn: (T1, T2) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
import kotlin.reflect.KProperty0
|
||||
|
||||
class Sample {
|
||||
companion object {
|
||||
val maxValue = 1
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::maxValue,
|
||||
{ x -> x == 1 }
|
||||
)
|
||||
}
|
||||
abstract fun <T1> run(method: KProperty0<T1>, fn: (T1) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1> run(method: KProperty0<T1>, fn: (T1) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: Sample.java
|
||||
public class Sample {
|
||||
static class SS {}
|
||||
}
|
||||
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::SS,
|
||||
{ x -> x == Any() }
|
||||
)
|
||||
}
|
||||
abstract fun <T1> run(method: KFunction0<T1>, fn: (T1) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1> run(method: KFunction0<T1>, fn: (T1) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
class Sample {
|
||||
inner class SS
|
||||
}
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::SS,
|
||||
{ x, y -> x == Any() && y == Any() }
|
||||
)
|
||||
}
|
||||
abstract fun <T1, T2> run(method: KFunction1<T1, T2>, fn: (T1, T2) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1, T2> run(method: KFunction1<T1, T2>, fn: (T1, T2) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: Sample.java
|
||||
public class Sample {
|
||||
static class SS {}
|
||||
}
|
||||
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::SS,
|
||||
{ x -> x == Any() }
|
||||
)
|
||||
}
|
||||
abstract fun <T1> run(method: KFunction0<T1>, fn: (T1) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1> run(method: KFunction0<T1>, fn: (T1) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.reflect.KFunction2
|
||||
|
||||
class Sample {
|
||||
object A {
|
||||
fun max(x: Int, y: Int): Int {
|
||||
return if (x > y) {
|
||||
x
|
||||
} else {
|
||||
y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object A2 {
|
||||
fun max(x: Int, y: Int): Int {
|
||||
return if (x > y) {
|
||||
x
|
||||
} else {
|
||||
y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample.A::max,
|
||||
{ x, y -> x > y }
|
||||
)
|
||||
}
|
||||
fun check2(): String {
|
||||
return run(
|
||||
A2::max,
|
||||
{ x, y -> x > y }
|
||||
)
|
||||
}
|
||||
abstract fun <T1, T2, R> run(method: KFunction2<T1, T2, R>, fn: (T1, T2) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1, T2, R> run(method: KFunction2<T1, T2, R>, fn: (T1, T2) -> Boolean): String {
|
||||
return "O"
|
||||
}
|
||||
} ).check()
|
||||
result += ( object : Checker() {
|
||||
override fun <T1, T2, R> run(method: KFunction2<T1, T2, R>, fn: (T1, T2) -> Boolean): String {
|
||||
return "K"
|
||||
}
|
||||
} ).check2()
|
||||
|
||||
return result
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: Sample.java
|
||||
public class Sample {
|
||||
public static int max = 1;
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.reflect.KProperty0
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::max,
|
||||
{ x -> x == Any() }
|
||||
)
|
||||
}
|
||||
abstract fun <T1> run(method: KProperty0<T1>, fn: (T1) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1> run(method: KProperty0<T1>, fn: (T1) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: Sample.java
|
||||
public class Sample {
|
||||
public static int max(int x, int y) {
|
||||
if (x > y) {
|
||||
return x;
|
||||
} else {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import kotlin.reflect.KFunction2
|
||||
|
||||
abstract class Checker {
|
||||
fun check(): String {
|
||||
return run(
|
||||
Sample::max,
|
||||
{ x, y -> x > y }
|
||||
)
|
||||
}
|
||||
abstract fun <T1, T2, R> run(method: KFunction2<T1, T2, R>, fn: (T1, T2) -> Boolean): String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ( object : Checker() {
|
||||
override fun <T1, T2, R> run(method: KFunction2<T1, T2, R>, fn: (T1, T2) -> Boolean): String {
|
||||
return "OK"
|
||||
}
|
||||
} ).check()
|
||||
|
||||
return result
|
||||
}
|
||||
+10
-10
@@ -27,22 +27,22 @@ interface Foo {
|
||||
// CR on property with to receivers are forbidden
|
||||
fun <T: Foo> test() {
|
||||
// with LHS and property
|
||||
bar8<T>(<!TYPE_MISMATCH!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x1<!><!>)
|
||||
bar8<T>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x1<!>)
|
||||
bar8<Foo>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x1<!>)
|
||||
bar8(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x1<!>)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar8<!>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x1<!>)
|
||||
|
||||
// with LHS and mutable property
|
||||
bar8<T>(<!TYPE_MISMATCH!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x2<!><!>)
|
||||
bar8<T>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x2<!>)
|
||||
bar8<Foo>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x2<!>)
|
||||
bar8(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x2<!>)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar8<!>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x2<!>)
|
||||
|
||||
// with LHS and propery + mutable property (mixed)
|
||||
bar8<T>(<!TYPE_MISMATCH!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!><!>)
|
||||
bar8<T>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
bar8<Foo>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
bar8(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
bar9<T>(<!TYPE_MISMATCH!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!><!>)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar8<!>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
bar9<T>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
bar9<Foo>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
bar9(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar9<!>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>x3<!>)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,9 @@ fun <T : Foo, R: Number, D: Int> main() {
|
||||
bar1(::resolve) // OK
|
||||
|
||||
// with LHS and conflicting projection
|
||||
bar2<T>(<!TYPE_MISMATCH!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>resolve<!><!>)
|
||||
bar2<T>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>resolve<!>)
|
||||
bar2<Foo>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>resolve<!>)
|
||||
bar2(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>resolve<!>)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar2<!>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>resolve<!>)
|
||||
|
||||
// with LHS and Any? expected type
|
||||
bar3<T>(Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>resolve<!>)
|
||||
|
||||
+54
@@ -2680,6 +2680,60 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionConst.kt")
|
||||
public void testCallableReferenceOfCompanionConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionMethod.kt")
|
||||
public void testCallableReferenceOfCompanionMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionProperty.kt")
|
||||
public void testCallableReferenceOfCompanionProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfJavaNestedClass.kt")
|
||||
public void testCallableReferenceOfJavaNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfJavaNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfKotlinNestedClass.kt")
|
||||
public void testCallableReferenceOfKotlinNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfKotlinNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfNestedClass.kt")
|
||||
public void testCallableReferenceOfNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfObjectMethod.kt")
|
||||
public void testCallableReferenceOfObjectMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfObjectMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfStaticField.kt")
|
||||
public void testCallableReferenceOfStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfStaticMethod.kt")
|
||||
public void testCallableReferenceOfStaticMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charArrayOf.kt")
|
||||
public void testCharArrayOf() throws Exception {
|
||||
|
||||
+54
@@ -2752,6 +2752,60 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionConst.kt")
|
||||
public void testCallableReferenceOfCompanionConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionConst.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionMethod.kt")
|
||||
public void testCallableReferenceOfCompanionMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfCompanionProperty.kt")
|
||||
public void testCallableReferenceOfCompanionProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfJavaNestedClass.kt")
|
||||
public void testCallableReferenceOfJavaNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfJavaNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfKotlinNestedClass.kt")
|
||||
public void testCallableReferenceOfKotlinNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfKotlinNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfNestedClass.kt")
|
||||
public void testCallableReferenceOfNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfObjectMethod.kt")
|
||||
public void testCallableReferenceOfObjectMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfObjectMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfStaticField.kt")
|
||||
public void testCallableReferenceOfStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callableReferenceOfStaticMethod.kt")
|
||||
public void testCallableReferenceOfStaticMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("charArrayOf.kt")
|
||||
public void testCharArrayOf() throws Exception {
|
||||
|
||||
+45
@@ -2379,6 +2379,51 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionConst.kt")
|
||||
public void testCallableReferenceOfCompanionConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionConst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionMethod.kt")
|
||||
public void testCallableReferenceOfCompanionMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionProperty.kt")
|
||||
public void testCallableReferenceOfCompanionProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfJavaNestedClass.kt")
|
||||
public void testCallableReferenceOfJavaNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfJavaNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfKotlinNestedClass.kt")
|
||||
public void testCallableReferenceOfKotlinNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfKotlinNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfNestedClass.kt")
|
||||
public void testCallableReferenceOfNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfObjectMethod.kt")
|
||||
public void testCallableReferenceOfObjectMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfObjectMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfStaticField.kt")
|
||||
public void testCallableReferenceOfStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfStaticMethod.kt")
|
||||
public void testCallableReferenceOfStaticMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfStaticMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("charArrayOf.kt")
|
||||
public void testCharArrayOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/charArrayOf.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+25
@@ -1644,6 +1644,31 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionConst.kt")
|
||||
public void testCallableReferenceOfCompanionConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionConst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionMethod.kt")
|
||||
public void testCallableReferenceOfCompanionMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionProperty.kt")
|
||||
public void testCallableReferenceOfCompanionProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfKotlinNestedClass.kt")
|
||||
public void testCallableReferenceOfKotlinNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfKotlinNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfObjectMethod.kt")
|
||||
public void testCallableReferenceOfObjectMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfObjectMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("charArrayOf.kt")
|
||||
public void testCharArrayOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/charArrayOf.kt");
|
||||
|
||||
Generated
+25
@@ -1644,6 +1644,31 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionConst.kt")
|
||||
public void testCallableReferenceOfCompanionConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionConst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionMethod.kt")
|
||||
public void testCallableReferenceOfCompanionMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionProperty.kt")
|
||||
public void testCallableReferenceOfCompanionProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfKotlinNestedClass.kt")
|
||||
public void testCallableReferenceOfKotlinNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfKotlinNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfObjectMethod.kt")
|
||||
public void testCallableReferenceOfObjectMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfObjectMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("charArrayOf.kt")
|
||||
public void testCharArrayOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/charArrayOf.kt");
|
||||
|
||||
Generated
+25
@@ -1609,6 +1609,31 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/arrayOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionConst.kt")
|
||||
public void testCallableReferenceOfCompanionConst() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionConst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionMethod.kt")
|
||||
public void testCallableReferenceOfCompanionMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfCompanionProperty.kt")
|
||||
public void testCallableReferenceOfCompanionProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfCompanionProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfKotlinNestedClass.kt")
|
||||
public void testCallableReferenceOfKotlinNestedClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfKotlinNestedClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callableReferenceOfObjectMethod.kt")
|
||||
public void testCallableReferenceOfObjectMethod() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/callableReferenceOfObjectMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("charArrayOf.kt")
|
||||
public void testCharArrayOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/charArrayOf.kt");
|
||||
|
||||
Reference in New Issue
Block a user