Report error about uninferred type parameter for some special call' subcalls
This commit is contained in:
Generated
+5
@@ -13459,6 +13459,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
||||||
|
|||||||
+104
-20
@@ -31,13 +31,21 @@ import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluat
|
|||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor
|
||||||
|
import org.jetbrains.kotlin.types.ErrorUtils
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import org.jetbrains.kotlin.types.checker.intersectWrappedTypes
|
import org.jetbrains.kotlin.types.checker.intersectWrappedTypes
|
||||||
import org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils
|
import org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils
|
||||||
|
import org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContextDelegate
|
||||||
|
import org.jetbrains.kotlin.types.model.TypeVariableMarker
|
||||||
|
import org.jetbrains.kotlin.types.model.freshTypeConstructor
|
||||||
|
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||||
import org.jetbrains.kotlin.types.typeUtil.isNullableNothing
|
import org.jetbrains.kotlin.types.typeUtil.isNullableNothing
|
||||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||||
|
import kotlin.contracts.ExperimentalContracts
|
||||||
|
import kotlin.contracts.contract
|
||||||
|
|
||||||
class DiagnosticReporterByTrackingStrategy(
|
class DiagnosticReporterByTrackingStrategy(
|
||||||
val constantExpressionEvaluator: ConstantExpressionEvaluator,
|
val constantExpressionEvaluator: ConstantExpressionEvaluator,
|
||||||
@@ -45,7 +53,8 @@ class DiagnosticReporterByTrackingStrategy(
|
|||||||
val psiKotlinCall: PSIKotlinCall,
|
val psiKotlinCall: PSIKotlinCall,
|
||||||
val dataFlowValueFactory: DataFlowValueFactory,
|
val dataFlowValueFactory: DataFlowValueFactory,
|
||||||
val allDiagnostics: List<KotlinCallDiagnostic>,
|
val allDiagnostics: List<KotlinCallDiagnostic>,
|
||||||
private val smartCastManager: SmartCastManager
|
private val smartCastManager: SmartCastManager,
|
||||||
|
private val typeSystemContext: TypeSystemInferenceExtensionContextDelegate
|
||||||
) : DiagnosticReporter {
|
) : DiagnosticReporter {
|
||||||
private val trace = context.trace as TrackingBindingTrace
|
private val trace = context.trace as TrackingBindingTrace
|
||||||
private val tracingStrategy: TracingStrategy get() = psiKotlinCall.tracingStrategy
|
private val tracingStrategy: TracingStrategy get() = psiKotlinCall.tracingStrategy
|
||||||
@@ -421,21 +430,21 @@ class DiagnosticReporterByTrackingStrategy(
|
|||||||
|
|
||||||
NotEnoughInformationForTypeParameterImpl::class.java -> {
|
NotEnoughInformationForTypeParameterImpl::class.java -> {
|
||||||
error as NotEnoughInformationForTypeParameterImpl
|
error as NotEnoughInformationForTypeParameterImpl
|
||||||
if (allDiagnostics.any {
|
|
||||||
when (it) {
|
|
||||||
is WrongCountOfTypeArguments -> true
|
|
||||||
is KotlinConstraintSystemDiagnostic -> {
|
|
||||||
val otherError = it.error
|
|
||||||
(otherError is ConstrainingTypeIsError && otherError.typeVariable == error.typeVariable)
|
|
||||||
|| otherError is NewConstraintError
|
|
||||||
}
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) return
|
|
||||||
|
|
||||||
if (isSpecialFunction(error.resolvedAtom))
|
val resolvedAtom = error.resolvedAtom
|
||||||
return
|
val isDiagnosticRedundant = !isSpecialFunction(resolvedAtom) && allDiagnostics.any {
|
||||||
|
when (it) {
|
||||||
|
is WrongCountOfTypeArguments -> true
|
||||||
|
is KotlinConstraintSystemDiagnostic -> {
|
||||||
|
val otherError = it.error
|
||||||
|
(otherError is ConstrainingTypeIsError && otherError.typeVariable == error.typeVariable)
|
||||||
|
|| otherError is NewConstraintError
|
||||||
|
}
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDiagnosticRedundant) return
|
||||||
val expression = when (val atom = error.resolvedAtom.atom) {
|
val expression = when (val atom = error.resolvedAtom.atom) {
|
||||||
is PSIKotlinCallForInvoke -> (atom.psiCall as? CallTransformer.CallForImplicitInvoke)?.outerCall?.calleeExpression
|
is PSIKotlinCallForInvoke -> (atom.psiCall as? CallTransformer.CallForImplicitInvoke)?.outerCall?.calleeExpression
|
||||||
is PSIKotlinCall -> atom.psiCall.calleeExpression
|
is PSIKotlinCall -> atom.psiCall.calleeExpression
|
||||||
@@ -443,12 +452,17 @@ class DiagnosticReporterByTrackingStrategy(
|
|||||||
else -> call.calleeExpression
|
else -> call.calleeExpression
|
||||||
} ?: return
|
} ?: return
|
||||||
|
|
||||||
val typeVariableName = when (val typeVariable = error.typeVariable) {
|
if (isSpecialFunction(resolvedAtom)) {
|
||||||
is TypeVariableFromCallableDescriptor -> typeVariable.originalTypeParameter.name.asString()
|
// We locally report errors on some arguments of special calls, on which the error may not be reported directly
|
||||||
is TypeVariableForLambdaReturnType -> "return type of lambda"
|
reportNotEnoughInformationForTypeParameterForSpecialCall(resolvedAtom, error)
|
||||||
else -> error("Unsupported type variable: $typeVariable")
|
} else {
|
||||||
|
val typeVariableName = when (val typeVariable = error.typeVariable) {
|
||||||
|
is TypeVariableFromCallableDescriptor -> typeVariable.originalTypeParameter.name.asString()
|
||||||
|
is TypeVariableForLambdaReturnType -> "return type of lambda"
|
||||||
|
else -> error("Unsupported type variable: $typeVariable")
|
||||||
|
}
|
||||||
|
trace.reportDiagnosticOnce(NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER.on(expression, typeVariableName))
|
||||||
}
|
}
|
||||||
trace.reportDiagnosticOnce(NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER.on(expression, typeVariableName))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OnlyInputTypesDiagnostic::class.java -> {
|
OnlyInputTypesDiagnostic::class.java -> {
|
||||||
@@ -463,7 +477,77 @@ class DiagnosticReporterByTrackingStrategy(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun reportNotEnoughInformationForTypeParameterForSpecialCall(
|
||||||
|
resolvedAtom: ResolvedCallAtom,
|
||||||
|
error: NotEnoughInformationForTypeParameterImpl
|
||||||
|
) {
|
||||||
|
val subResolvedAtomsToReportError =
|
||||||
|
getSubResolvedAtomsOfSpecialCallToReportUninferredTypeParameter(resolvedAtom, error.typeVariable)
|
||||||
|
|
||||||
|
if (subResolvedAtomsToReportError.isEmpty()) return
|
||||||
|
|
||||||
|
for (subResolvedAtom in subResolvedAtomsToReportError) {
|
||||||
|
val atom = subResolvedAtom.atom as? PSIKotlinCallArgument ?: continue
|
||||||
|
val argumentsExpression = getArgumentsExpressionOrLastExpressionInBlock(atom)
|
||||||
|
|
||||||
|
if (argumentsExpression != null) {
|
||||||
|
val specialFunctionName = requireNotNull(
|
||||||
|
ControlStructureTypingUtils.ResolveConstruct.values().find { specialFunction ->
|
||||||
|
specialFunction.specialFunctionName == resolvedAtom.candidateDescriptor.name
|
||||||
|
}
|
||||||
|
) { "Unsupported special construct: ${resolvedAtom.candidateDescriptor.name} not found in special construct names" }
|
||||||
|
|
||||||
|
trace.reportDiagnosticOnce(
|
||||||
|
NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER.on(
|
||||||
|
argumentsExpression, " for subcalls of ${specialFunctionName.getName()} expression"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getArgumentsExpressionOrLastExpressionInBlock(atom: PSIKotlinCallArgument): KtExpression? {
|
||||||
|
val valueArgumentExpression = atom.valueArgument.getArgumentExpression()
|
||||||
|
|
||||||
|
return if (valueArgumentExpression is KtBlockExpression) valueArgumentExpression.statements.lastOrNull() else valueArgumentExpression
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun KotlinType.containsUninferredTypeParameter(uninferredTypeVariable: TypeVariableMarker) = contains {
|
||||||
|
ErrorUtils.isUninferredParameter(it) || it == TypeUtils.DONT_CARE
|
||||||
|
|| it.constructor == uninferredTypeVariable.freshTypeConstructor(typeSystemContext)
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
|
private fun getSubResolvedAtomsOfSpecialCallToReportUninferredTypeParameter(
|
||||||
|
resolvedAtom: ResolvedAtom,
|
||||||
|
uninferredTypeVariable: TypeVariableMarker
|
||||||
|
): Set<ResolvedAtom> =
|
||||||
|
buildSet {
|
||||||
|
for (subResolvedAtom in resolvedAtom.subResolvedAtoms ?: return@buildSet) {
|
||||||
|
val atom = subResolvedAtom.atom
|
||||||
|
val typeToCheck = when {
|
||||||
|
subResolvedAtom is PostponedResolvedAtom -> subResolvedAtom.expectedType ?: return@buildSet
|
||||||
|
atom is SimpleKotlinCallArgument -> atom.receiver.receiverValue.type
|
||||||
|
else -> return@buildSet
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeToCheck.containsUninferredTypeParameter(uninferredTypeVariable)) {
|
||||||
|
add(subResolvedAtom)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!subResolvedAtom.subResolvedAtoms.isNullOrEmpty()) {
|
||||||
|
addAll(
|
||||||
|
getSubResolvedAtomsOfSpecialCallToReportUninferredTypeParameter(subResolvedAtom, uninferredTypeVariable)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalContracts::class)
|
||||||
private fun isSpecialFunction(atom: ResolvedAtom): Boolean {
|
private fun isSpecialFunction(atom: ResolvedAtom): Boolean {
|
||||||
|
contract {
|
||||||
|
returns(true) implies (atom is ResolvedCallAtom)
|
||||||
|
}
|
||||||
if (atom !is ResolvedCallAtom) return false
|
if (atom !is ResolvedCallAtom) return false
|
||||||
|
|
||||||
return ControlStructureTypingUtils.ResolveConstruct.values().any { specialFunction ->
|
return ControlStructureTypingUtils.ResolveConstruct.values().any { specialFunction ->
|
||||||
|
|||||||
+1
@@ -519,6 +519,7 @@ class KotlinToResolvedCallTransformer(
|
|||||||
context.dataFlowValueFactory,
|
context.dataFlowValueFactory,
|
||||||
allDiagnostics,
|
allDiagnostics,
|
||||||
smartCastManager,
|
smartCastManager,
|
||||||
|
typeSystemContext
|
||||||
)
|
)
|
||||||
|
|
||||||
for (diagnostic in allDiagnostics) {
|
for (diagnostic in allDiagnostics) {
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ inline fun TypeSystemInferenceExtensionContext.isProperTypeForFixation(
|
|||||||
type: KotlinTypeMarker,
|
type: KotlinTypeMarker,
|
||||||
isProper: (KotlinTypeMarker) -> Boolean
|
isProper: (KotlinTypeMarker) -> Boolean
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (!isProper(type)) return false
|
if (!isProper(type) || type.contains { it.isUninferredParameter() }) return false
|
||||||
if (type.isCapturedType()) {
|
if (type.isCapturedType()) {
|
||||||
val projection = (type as? SimpleTypeMarker)?.asCapturedType()?.typeConstructorProjection() ?: return true
|
val projection = (type as? SimpleTypeMarker)?.asCapturedType()?.typeConstructorProjection() ?: return true
|
||||||
if (projection.isStarProjection()) return true
|
if (projection.isStarProjection()) return true
|
||||||
|
|||||||
+154
@@ -0,0 +1,154 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// SKIP_TXT
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
fun <K> K.bar3(): K = null as K
|
||||||
|
fun <K> K.foo3(): K = null as K
|
||||||
|
|
||||||
|
fun bar2(): Int = 1
|
||||||
|
fun foo2(): Float = 1f
|
||||||
|
|
||||||
|
fun <K> bar4(): K = null as K
|
||||||
|
fun <K> foo4(): K = null as K
|
||||||
|
|
||||||
|
class Foo6
|
||||||
|
|
||||||
|
class Foo7<T>
|
||||||
|
fun foo7() = null as Foo7<Int>
|
||||||
|
|
||||||
|
fun poll1(flag: Boolean): Any? {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::foo2 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll11(flag: Boolean): Any? {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::foo2 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll16(flag: Boolean): Any? {
|
||||||
|
val inv = if (flag) { ::Foo6 } else { ::Foo6 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//fun poll17(flag: Boolean): Any? {
|
||||||
|
// val inv = if (flag) { foo7() } else { ::Foo7 }
|
||||||
|
// return inv
|
||||||
|
//}
|
||||||
|
|
||||||
|
fun poll21(flag: Boolean): Any? {
|
||||||
|
val inv = when (flag) { true -> ::bar2 else -> ::foo2 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll25(flag: Boolean): Any? {
|
||||||
|
val inv = when (flag) { true -> ::Foo6 else -> ::Foo6 }
|
||||||
|
return inv
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//fun poll26(flag: Boolean): Any? {
|
||||||
|
// val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }
|
||||||
|
// return inv
|
||||||
|
//}
|
||||||
|
|
||||||
|
fun poll31(flag: Boolean): Any? {
|
||||||
|
val inv = when (flag) { true -> ::bar2 false -> ::foo2 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll35(flag: Boolean): Any? {
|
||||||
|
val inv = when (flag) { true -> ::Foo6 false -> ::Foo6 }
|
||||||
|
return inv
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//fun poll36(flag: Boolean): Any? {
|
||||||
|
// val inv = when (flag) { true -> ::Foo7 false -> foo7() }
|
||||||
|
// return inv
|
||||||
|
//}
|
||||||
|
|
||||||
|
fun poll41(): Any? {
|
||||||
|
val inv = try { ::bar2 } finally { ::foo2 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll45(): Any? {
|
||||||
|
val inv = try { ::Foo6 } finally { ::Foo6 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll51(): Any? {
|
||||||
|
val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll55(): Any? {
|
||||||
|
val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 }
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//fun poll56(): Any? {
|
||||||
|
// val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
|
||||||
|
// return inv
|
||||||
|
//}
|
||||||
|
|
||||||
|
fun poll61(): Any? {
|
||||||
|
val inv = ::bar2
|
||||||
|
return inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll65(): Any? {
|
||||||
|
val inv = ::Foo6
|
||||||
|
return inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll71(): Any? {
|
||||||
|
val inv = ::bar2!!
|
||||||
|
return inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll75(): Any? {
|
||||||
|
val inv = ::Foo6!!
|
||||||
|
return inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll81(): Any? {
|
||||||
|
val inv = ::bar2 in setOf(::foo2)
|
||||||
|
return inv
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun poll85(): Any? {
|
||||||
|
val inv = ::Foo6 in setOf(::Foo6)
|
||||||
|
return inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
poll1(true)
|
||||||
|
poll11(true)
|
||||||
|
poll16(true)
|
||||||
|
// poll17(true)
|
||||||
|
poll21(true)
|
||||||
|
poll25(true)
|
||||||
|
// poll26(true)
|
||||||
|
poll31(true)
|
||||||
|
poll35(true)
|
||||||
|
// poll36(true)
|
||||||
|
poll41()
|
||||||
|
poll45()
|
||||||
|
poll51()
|
||||||
|
poll55()
|
||||||
|
// poll56()
|
||||||
|
poll61()
|
||||||
|
poll65()
|
||||||
|
poll71()
|
||||||
|
poll75()
|
||||||
|
poll81()
|
||||||
|
poll85()
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
@@ -10,18 +10,18 @@ fun main() {
|
|||||||
val x4 = <!UNRESOLVED_REFERENCE!>logger<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x4 = <!UNRESOLVED_REFERENCE!>logger<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x5 = <!UNRESOLVED_REFERENCE!>logger<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x5 = <!UNRESOLVED_REFERENCE!>logger<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x6 = <!UNRESOLVED_REFERENCE!>logger<!>!!::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x6 = <!UNRESOLVED_REFERENCE!>logger<!>!!::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x7 = <!UNRESOLVED_REFERENCE!>logger<!>::<!UNRESOLVED_REFERENCE!>info<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x7 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNRESOLVED_REFERENCE!>logger<!>::<!UNRESOLVED_REFERENCE!>info<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x8 = <!UNRESOLVED_REFERENCE!>logger<!>?::<!UNRESOLVED_REFERENCE!>info<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x8 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>logger<!>?::<!UNRESOLVED_REFERENCE!>info<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x9 = <!UNRESOLVED_REFERENCE!>logger<!>!!::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x9 = <!UNRESOLVED_REFERENCE!>logger<!>!!::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x10 = <!UNRESOLVED_REFERENCE!>logger<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!UNRESOLVED_REFERENCE!>print<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>print<!>
|
val x10 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNRESOLVED_REFERENCE!>logger<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!UNRESOLVED_REFERENCE!>print<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x11 = <!UNRESOLVED_REFERENCE!>logger<!>!!::<!UNRESOLVED_REFERENCE!>info<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>print<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>print<!>
|
val x11 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNRESOLVED_REFERENCE!>logger<!>!!::<!UNRESOLVED_REFERENCE!>info<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!UNRESOLVED_REFERENCE!>print<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x12 = <!UNRESOLVED_REFERENCE!>logger<!>?::<!UNRESOLVED_REFERENCE!>info<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>print<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!OVERLOAD_RESOLUTION_AMBIGUITY!>print<!>
|
val x12 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>logger<!>?::<!UNRESOLVED_REFERENCE!>info<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!UNRESOLVED_REFERENCE!>print<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x13 = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>42<!>?::<!UNRESOLVED_REFERENCE!>unresolved<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x13 = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>42<!>?::<!UNRESOLVED_REFERENCE!>unresolved<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
|
|
||||||
val x14 = <!UNRESOLVED_REFERENCE!>logger<!><!SYNTAX!>?!!::info?::print?::print<!>
|
val x14 = <!UNRESOLVED_REFERENCE!>logger<!><!SYNTAX!>?!!::info?::print?::print<!>
|
||||||
val x15 = <!UNRESOLVED_REFERENCE!>logger<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!><!SYNTAX!>?!!::print?::print<!>
|
val x15 = <!UNRESOLVED_REFERENCE!>logger<!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!><!SYNTAX!>?!!::print?::print<!>
|
||||||
val x16 = <!UNRESOLVED_REFERENCE!>logger<!>!!?::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x16 = <!UNRESOLVED_REFERENCE!>logger<!>!!?::<!DEBUG_INFO_MISSING_UNRESOLVED!>info<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
val x17 = <!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!><!UNRESOLVED_REFERENCE!>logger<!>::<!UNRESOLVED_REFERENCE!>info<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!><!>?::<!OVERLOAD_RESOLUTION_AMBIGUITY!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
val x17 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!><!UNRESOLVED_REFERENCE!>logger<!>::<!UNRESOLVED_REFERENCE!>info<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>?::<!DEBUG_INFO_MISSING_UNRESOLVED!>print<!>
|
||||||
|
|
||||||
// It must be OK
|
// It must be OK
|
||||||
val x18 = String?::hashCode <!USELESS_ELVIS!>?: ::foo<!>
|
val x18 = String?::hashCode <!USELESS_ELVIS!>?: ::foo<!>
|
||||||
|
|||||||
+1
-1
@@ -12,4 +12,4 @@ fun main3() = if (true) { Foo::<!UNRESOLVED_REFERENCE!>minus<!> } else { Foo::<!
|
|||||||
|
|
||||||
fun main4() = try { Foo::<!UNRESOLVED_REFERENCE!>minus<!> } finally { <!UNUSED_EXPRESSION!>Foo::<!UNRESOLVED_REFERENCE!>times<!><!> }
|
fun main4() = try { Foo::<!UNRESOLVED_REFERENCE!>minus<!> } finally { <!UNUSED_EXPRESSION!>Foo::<!UNRESOLVED_REFERENCE!>times<!><!> }
|
||||||
|
|
||||||
fun main5() = Foo::<!UNRESOLVED_REFERENCE!>minus<!> ?: Foo::<!UNRESOLVED_REFERENCE!>times<!>
|
fun main5() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo::<!UNRESOLVED_REFERENCE!>minus<!><!> ?: <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo::<!UNRESOLVED_REFERENCE!>times<!><!>
|
||||||
|
|||||||
+318
@@ -0,0 +1,318 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// SKIP_TXT
|
||||||
|
// !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS -UNCHECKED_CAST -UNUSED_PARAMETER -UNUSED_VARIABLE -EXPERIMENTAL_API_USAGE_ERROR -UNUSED_EXPRESSION
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
fun <K> K.bar3(): K = null as K
|
||||||
|
fun <K> K.foo3(): K = null as K
|
||||||
|
|
||||||
|
fun bar2(): Int = 1
|
||||||
|
fun foo2(): Float = 1f
|
||||||
|
|
||||||
|
val bar4: Int
|
||||||
|
get() = 1
|
||||||
|
|
||||||
|
var foo4: Float
|
||||||
|
get() = 1f
|
||||||
|
set(value) {}
|
||||||
|
|
||||||
|
class Foo6
|
||||||
|
|
||||||
|
class Foo7<T>
|
||||||
|
fun foo7() = null as Foo7<Int>
|
||||||
|
|
||||||
|
fun poll1(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll11(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll12(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar3 } else { ::foo3 }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll13(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::foo3 }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll14(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar4 } else { ::foo4 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll15(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar5 } else { ::foo5 }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll16(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::Foo6 } else { ::Foo6 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll17(flag: Boolean) {
|
||||||
|
val inv = if (flag) { foo7() } else { ::Foo7 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll2(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar else -> ::foo }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll21(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar2 else -> ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll22(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar3 else -> ::foo3 }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll23(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar4 else -> ::foo4 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll24(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar5 else -> ::foo5 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll25(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::Foo6 else -> ::Foo6 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll26(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll3(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar false -> ::foo }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll31(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar2 false -> ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll32(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar3 false -> ::foo3 }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll33(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar4 false -> ::foo4 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll34(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar5 false -> ::foo5 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll35(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::Foo6 false -> ::Foo6 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll36(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::Foo7 false -> foo7() }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll4() {
|
||||||
|
val inv = try { ::bar } finally { <!UNRESOLVED_REFERENCE!>::foo<!> }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll41() {
|
||||||
|
val inv = try { ::bar2 } finally { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll42() {
|
||||||
|
val inv = try { ::bar3 } finally { <!UNRESOLVED_REFERENCE!>::foo3<!> }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll43() {
|
||||||
|
val inv = try { ::bar4 } finally { ::foo4 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll44() {
|
||||||
|
val inv = try { ::bar5 } finally { <!UNRESOLVED_REFERENCE!>::foo5<!> }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll45() {
|
||||||
|
val inv = try { ::Foo6 } finally { ::Foo6 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll46() {
|
||||||
|
val inv = try { foo7() } finally { ::Foo7 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll5() {
|
||||||
|
val inv = try { ::bar } catch (e: Exception) { ::foo } finally { <!UNRESOLVED_REFERENCE!>::foo<!> }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll51() {
|
||||||
|
val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll52() {
|
||||||
|
val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { <!UNRESOLVED_REFERENCE!>::foo3<!> }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll53() {
|
||||||
|
val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll54() {
|
||||||
|
val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { <!UNRESOLVED_REFERENCE!>::foo5<!> }
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll55() {
|
||||||
|
val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll56() {
|
||||||
|
val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll6() {
|
||||||
|
val inv = <!UNRESOLVED_REFERENCE!>::bar<!>
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll61() {
|
||||||
|
val inv = ::bar2
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll62() {
|
||||||
|
val inv = <!UNRESOLVED_REFERENCE!>::bar3<!>
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll63() {
|
||||||
|
val inv = ::bar4
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll64() {
|
||||||
|
val inv = <!UNRESOLVED_REFERENCE!>::bar5<!>
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll65() {
|
||||||
|
val inv = ::Foo6
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll66() {
|
||||||
|
val inv = ::Foo7
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll7() {
|
||||||
|
val inv = ::bar!!
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll71() {
|
||||||
|
val inv = ::bar2!!
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll72() {
|
||||||
|
val inv = ::bar3!!
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll73() {
|
||||||
|
val inv = ::bar4!!
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll74() {
|
||||||
|
val inv = ::bar5!!
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll75() {
|
||||||
|
val inv = ::Foo6!!
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll76() {
|
||||||
|
val inv = ::Foo7!!
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll8() {
|
||||||
|
val inv = <!UNRESOLVED_REFERENCE!>::bar<!> <!NONE_APPLICABLE!>in<!> <!NONE_APPLICABLE!>setOf<!>(<!UNRESOLVED_REFERENCE!>::foo<!>)
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll81() {
|
||||||
|
val inv = ::bar2 in setOf(::foo2)
|
||||||
|
<!UNRESOLVED_REFERENCE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll82() {
|
||||||
|
val inv = <!UNRESOLVED_REFERENCE!>::bar3<!> <!NONE_APPLICABLE!>in<!> <!NONE_APPLICABLE!>setOf<!>(<!UNRESOLVED_REFERENCE!>::foo3<!>)
|
||||||
|
<!INAPPLICABLE_CANDIDATE!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll83() {
|
||||||
|
val inv = ::bar4 in setOf(::foo4)
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll84() {
|
||||||
|
val inv = <!UNRESOLVED_REFERENCE!>::bar5<!> <!NONE_APPLICABLE!>in<!> <!NONE_APPLICABLE!>setOf<!>(<!UNRESOLVED_REFERENCE!>::foo5<!>)
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll85() {
|
||||||
|
val inv = ::Foo6 in setOf(::Foo6)
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll86() {
|
||||||
|
val inv = ::Foo7 in setOf(::Foo7)
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll87() {
|
||||||
|
val inv = ::Foo7 in setOf(foo7())
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll88() {
|
||||||
|
val inv = foo7() in setOf(::Foo7)
|
||||||
|
inv
|
||||||
|
}
|
||||||
+314
@@ -0,0 +1,314 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// SKIP_TXT
|
||||||
|
// !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS -UNCHECKED_CAST -UNUSED_PARAMETER -UNUSED_VARIABLE -EXPERIMENTAL_API_USAGE_ERROR -UNUSED_EXPRESSION
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
fun <K> K.bar3(): K = null as K
|
||||||
|
fun <K> K.foo3(): K = null as K
|
||||||
|
|
||||||
|
fun bar2(): Int = 1
|
||||||
|
fun foo2(): Float = 1f
|
||||||
|
|
||||||
|
fun <K> bar4(): K = null as K
|
||||||
|
fun <K> foo4(): K = null as K
|
||||||
|
|
||||||
|
class Foo6
|
||||||
|
|
||||||
|
class Foo7<T>
|
||||||
|
fun foo7() = null as Foo7<Int>
|
||||||
|
|
||||||
|
fun poll1(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll11(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll12(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::<!UNRESOLVED_REFERENCE!>bar3<!> } else { ::<!UNRESOLVED_REFERENCE!>foo3<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll13(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::bar2 } else { ::<!UNRESOLVED_REFERENCE!>foo3<!> }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll14(flag: Boolean) {
|
||||||
|
val inv = if (flag) { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::bar4<!> } else { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::foo4<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll15(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::<!UNRESOLVED_REFERENCE!>bar5<!> } else { ::<!UNRESOLVED_REFERENCE!>foo5<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll16(flag: Boolean) {
|
||||||
|
val inv = if (flag) { ::Foo6 } else { ::Foo6 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll17(flag: Boolean) {
|
||||||
|
val inv = if (flag) { <!IMPLICIT_CAST_TO_ANY!>foo7()<!> } else { <!IMPLICIT_CAST_TO_ANY!>::Foo7<!> }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll2(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>bar<!><!> else -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>foo<!><!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll21(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar2 else -> ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll22(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>bar3<!><!> else -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>foo3<!><!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll23(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::bar4<!> else -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::foo4<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll24(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>bar5<!><!> else -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>foo5<!><!> }
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll25(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::Foo6 else -> ::Foo6 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll26(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!IMPLICIT_CAST_TO_ANY!>::Foo7<!> false -> <!IMPLICIT_CAST_TO_ANY!>foo7()<!> <!REDUNDANT_ELSE_IN_WHEN!>else<!> -> <!IMPLICIT_CAST_TO_ANY!>::Foo7<!> }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll3(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>bar<!><!> false -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>foo<!><!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll31(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::bar2 false -> ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll32(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>bar3<!><!> false -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>foo3<!><!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll33(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::bar4<!> false -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::foo4<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll34(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>bar5<!><!> false -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE!>foo5<!><!> }
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll35(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> ::Foo6 false -> ::Foo6 }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll36(flag: Boolean) {
|
||||||
|
val inv = when (flag) { true -> <!IMPLICIT_CAST_TO_ANY!>::Foo7<!> false -> <!IMPLICIT_CAST_TO_ANY!>foo7()<!> }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll4() {
|
||||||
|
val inv = try { ::<!UNRESOLVED_REFERENCE!>bar<!> } finally { ::<!UNRESOLVED_REFERENCE!>foo<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll41() {
|
||||||
|
val inv = try { ::bar2 } finally { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll42() {
|
||||||
|
val inv = try { ::<!UNRESOLVED_REFERENCE!>bar3<!> } finally { ::<!UNRESOLVED_REFERENCE!>foo3<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll43() {
|
||||||
|
val inv = try { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::bar4<!> } finally { ::<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo4<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll44() {
|
||||||
|
val inv = try { ::<!UNRESOLVED_REFERENCE!>bar5<!> } finally { ::<!UNRESOLVED_REFERENCE!>foo5<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll45() {
|
||||||
|
val inv = try { ::Foo6 } finally { ::Foo6 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll46() {
|
||||||
|
val inv = try { foo7() } finally { ::<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo7<!> }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll5() {
|
||||||
|
val inv = try { ::<!UNRESOLVED_REFERENCE!>bar<!> } catch (e: Exception) { ::<!UNRESOLVED_REFERENCE!>foo<!> } finally { ::<!UNRESOLVED_REFERENCE!>foo<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll51() {
|
||||||
|
val inv = try { ::bar2 } catch (e: Exception) { ::foo2 } finally { ::foo2 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll52() {
|
||||||
|
val inv = try { ::<!UNRESOLVED_REFERENCE!>bar3<!> } catch (e: Exception) { ::<!UNRESOLVED_REFERENCE!>foo3<!> } finally { ::<!UNRESOLVED_REFERENCE!>foo3<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll53() {
|
||||||
|
val inv = try { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::bar4<!> } catch (e: Exception) { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::foo4<!> } finally { ::<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo4<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll54() {
|
||||||
|
val inv = try { ::<!UNRESOLVED_REFERENCE!>bar5<!> } catch (e: Exception) { ::<!UNRESOLVED_REFERENCE!>foo5<!> } finally { ::<!UNRESOLVED_REFERENCE!>foo5<!> }
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll55() {
|
||||||
|
val inv = try { ::Foo6 } catch (e: Exception) { ::Foo6 } finally { ::Foo6 }
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll56() {
|
||||||
|
val inv = try { ::Foo7 } catch (e: Exception) { foo7() } finally { foo7() }
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll6() {
|
||||||
|
val inv = ::<!UNRESOLVED_REFERENCE!>bar<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll61() {
|
||||||
|
val inv = ::bar2
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll62() {
|
||||||
|
val inv = ::<!UNRESOLVED_REFERENCE!>bar3<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll63() {
|
||||||
|
val inv = ::<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar4<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll64() {
|
||||||
|
val inv = ::<!UNRESOLVED_REFERENCE!>bar5<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll65() {
|
||||||
|
val inv = ::Foo6
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll66() {
|
||||||
|
val inv = ::<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo7<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll7() {
|
||||||
|
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>bar<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll71() {
|
||||||
|
val inv = ::bar2<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
|
inv()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll72() {
|
||||||
|
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>bar3<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll73() {
|
||||||
|
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::bar4<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll74() {
|
||||||
|
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>bar5<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll75() {
|
||||||
|
val inv = ::Foo6<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll76() {
|
||||||
|
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll8() {
|
||||||
|
val inv = ::<!UNRESOLVED_REFERENCE!>bar<!> in <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>setOf<!>(::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll81() {
|
||||||
|
val inv = ::bar2 <!TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING!>in<!> setOf(::foo2)
|
||||||
|
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll82() {
|
||||||
|
val inv = ::<!UNRESOLVED_REFERENCE!>bar3<!> in <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>setOf<!>(::<!UNRESOLVED_REFERENCE!>foo3<!>)
|
||||||
|
<!DEBUG_INFO_MISSING_UNRESOLVED!>inv<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll83() {
|
||||||
|
val inv = ::bar4 in <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>setOf<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::foo4<!>)
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll84() {
|
||||||
|
val inv = ::<!UNRESOLVED_REFERENCE!>bar5<!> in <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>setOf<!>(::<!UNRESOLVED_REFERENCE!>foo5<!>)
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll85() {
|
||||||
|
val inv = ::Foo6 in setOf(::Foo6)
|
||||||
|
inv
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll86() {
|
||||||
|
val inv = ::Foo7 in <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>setOf<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!>)
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll87() {
|
||||||
|
val inv = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!> <!TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING!>in<!> setOf(foo7())
|
||||||
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>inv<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun poll88() {
|
||||||
|
val inv = foo7() in <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>setOf<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>::Foo7<!>)
|
||||||
|
inv
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
// !WITH_NEW_INFERENCE
|
// !WITH_NEW_INFERENCE
|
||||||
// NI_EXPECTED_FILE
|
// NI_EXPECTED_FILE
|
||||||
// See EA-76890 / KT-10843: NPE during analysis
|
// See EA-76890 / KT-10843: NPE during analysis
|
||||||
fun lambda(x : Int?) = x?.<!FUNCTION_CALL_EXPECTED, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, NO_VALUE_FOR_PARAMETER, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>let<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}, DEBUG_INFO_MISSING_UNRESOLVED{NI}!>l<!> {
|
fun lambda(x : Int?) = x?.<!FUNCTION_CALL_EXPECTED, NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>let<!> <!NI;DEBUG_INFO_MISSING_UNRESOLVED, OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>l<!> {
|
||||||
<!CANNOT_INFER_PARAMETER_TYPE{OI}!>y<!> ->
|
<!CANNOT_INFER_PARAMETER_TYPE!>y<!> ->
|
||||||
if (<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>y<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}, DEBUG_INFO_MISSING_UNRESOLVED{NI}!>><!> 0) return<!UNRESOLVED_REFERENCE!>@l<!> x
|
if (<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>y<!> <!NI;DEBUG_INFO_MISSING_UNRESOLVED, OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>><!> 0) return<!UNRESOLVED_REFERENCE!>@l<!> x
|
||||||
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>y<!>
|
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>y<!>
|
||||||
}<!NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION!>!!<!>
|
}<!NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION!>!!<!>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ fun testElvis(x: Any?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testExclExcl() {
|
fun testExclExcl() {
|
||||||
val y = :: <!UNRESOLVED_REFERENCE!>unresolved<!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
val y = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>:: <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved<!><!><!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testTry() {
|
fun testTry() {
|
||||||
|
|||||||
+8
-8
@@ -10,25 +10,25 @@ class Controller<T> {
|
|||||||
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
fun <S> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||||
|
|
||||||
val test1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
val test1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
||||||
apply {
|
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>apply<!> {
|
||||||
yield(4)
|
<!NI;DEBUG_INFO_MISSING_UNRESOLVED!>yield<!>(4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val test2 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
val test2 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
||||||
yield(B)
|
yield(B)
|
||||||
apply {
|
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>apply<!> {
|
||||||
yield(C)
|
<!NI;DEBUG_INFO_MISSING_UNRESOLVED!>yield<!>(<!NI;DEBUG_INFO_MISSING_UNRESOLVED!>C<!>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val test3 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
val test3 = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||||
this.<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>let<!> {
|
this.<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>let<!> {
|
||||||
yield(B)
|
yield(B)
|
||||||
}
|
}
|
||||||
|
|
||||||
apply {
|
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>apply<!> {
|
||||||
yield(C)
|
<!NI;DEBUG_INFO_MISSING_UNRESOLVED!>yield<!>(<!NI;DEBUG_INFO_MISSING_UNRESOLVED!>C<!>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit):
|
|||||||
@BuilderInference
|
@BuilderInference
|
||||||
suspend fun <S> GenericController<List<S>>.yieldGenerate(g: suspend GenericController<S>.() -> Unit): Unit = TODO()
|
suspend fun <S> GenericController<List<S>>.yieldGenerate(g: suspend GenericController<S>.() -> Unit): Unit = TODO()
|
||||||
|
|
||||||
val test1 = generate {
|
val test1 = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||||
// TODO: KT-15185
|
// TODO: KT-15185
|
||||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR{OI}, TYPE_MISMATCH{OI}!>yieldGenerate<!> {
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR{OI}, TYPE_MISMATCH{OI}!>yieldGenerate<!> {
|
||||||
yield(4)
|
yield(4)
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
class Foo
|
class Foo
|
||||||
|
|
||||||
fun main1() = when {
|
fun main1() = when {
|
||||||
else -> Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>plus<!>
|
else -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>plus<!><!>
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main2() = if (true) Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>minus<!> else Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>times<!>
|
fun main2() = if (true) <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>minus<!><!> else <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>times<!><!>
|
||||||
|
|
||||||
fun main3() = if (true) { Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>minus<!> } else { Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>times<!> }
|
fun main3() = if (true) { Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>minus<!> } else { Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>times<!> }
|
||||||
|
|
||||||
fun main4() = try { Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>minus<!> } finally { <!UNUSED_EXPRESSION!>Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>times<!><!> }
|
fun main4() = try { Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>minus<!> } finally { <!UNUSED_EXPRESSION!>Foo::<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>times<!><!> }
|
||||||
|
|
||||||
fun main5() = Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>minus<!> ?: Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>times<!>
|
fun main5() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>minus<!><!> ?: <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Foo::<!CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY!>times<!><!>
|
||||||
|
|||||||
+5
@@ -13459,6 +13459,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
||||||
|
|||||||
+5
@@ -13459,6 +13459,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
||||||
|
|||||||
+5
@@ -13459,6 +13459,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
@TestMetadata("subtypingOfIntersectionIltInsideFlexible.kt")
|
||||||
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
public void testSubtypingOfIntersectionIltInsideFlexible() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
runTest("compiler/testData/codegen/box/inference/subtypingOfIntersectionIltInsideFlexible.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -11519,6 +11519,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("suspendExtensionRecevierFromConstraint.kt")
|
@TestMetadata("suspendExtensionRecevierFromConstraint.kt")
|
||||||
public void testSuspendExtensionRecevierFromConstraint() throws Exception {
|
public void testSuspendExtensionRecevierFromConstraint() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/suspendExtensionRecevierFromConstraint.kt");
|
runTest("compiler/testData/codegen/box/inference/suspendExtensionRecevierFromConstraint.kt");
|
||||||
|
|||||||
Generated
+5
@@ -11519,6 +11519,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("suspendExtensionRecevierFromConstraint.kt")
|
@TestMetadata("suspendExtensionRecevierFromConstraint.kt")
|
||||||
public void testSuspendExtensionRecevierFromConstraint() throws Exception {
|
public void testSuspendExtensionRecevierFromConstraint() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/suspendExtensionRecevierFromConstraint.kt");
|
runTest("compiler/testData/codegen/box/inference/suspendExtensionRecevierFromConstraint.kt");
|
||||||
|
|||||||
Generated
+5
@@ -11584,6 +11584,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("suspendExtensionRecevierFromConstraint.kt")
|
@TestMetadata("suspendExtensionRecevierFromConstraint.kt")
|
||||||
public void testSuspendExtensionRecevierFromConstraint() throws Exception {
|
public void testSuspendExtensionRecevierFromConstraint() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/suspendExtensionRecevierFromConstraint.kt");
|
runTest("compiler/testData/codegen/box/inference/suspendExtensionRecevierFromConstraint.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -6170,6 +6170,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/inference/recursiveConstraintInsideTypeArgumentWithStarProjection.kt");
|
runTest("compiler/testData/codegen/box/inference/recursiveConstraintInsideTypeArgumentWithStarProjection.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("specialCallsWithCallableReferences.kt")
|
||||||
|
public void testSpecialCallsWithCallableReferences() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/specialCallsWithCallableReferences.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user