Use separate constraint position during call substitution as part of inferring postponed type variables
^KT-47052 Fixed ^KT-47082 Fixed
This commit is contained in:
+6
@@ -17665,6 +17665,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47052.kt")
|
||||||
|
public void testKt47052() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
|
|||||||
Generated
+6
@@ -1400,6 +1400,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
|||||||
runTest("compiler/testData/ir/irText/expressions/kt45022.kt");
|
runTest("compiler/testData/ir/irText/expressions/kt45022.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47082.kt")
|
||||||
|
public void testKt47082() throws Exception {
|
||||||
|
runTest("compiler/testData/ir/irText/expressions/kt47082.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lambdaInCAO.kt")
|
@TestMetadata("lambdaInCAO.kt")
|
||||||
public void testLambdaInCAO() throws Exception {
|
public void testLambdaInCAO() throws Exception {
|
||||||
|
|||||||
+81
-74
@@ -344,84 +344,91 @@ class DiagnosticReporterByTrackingStrategy(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun reportConstraintErrorByPosition(error: NewConstraintError, position: ConstraintPosition) {
|
||||||
|
val argument = when (position) {
|
||||||
|
is ArgumentConstraintPositionImpl -> position.argument
|
||||||
|
is ReceiverConstraintPositionImpl -> position.argument
|
||||||
|
is LHSArgumentConstraintPositionImpl -> position.argument
|
||||||
|
is LambdaArgumentConstraintPositionImpl -> position.lambda.atom
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
val typeMismatchDiagnostic = if (error.isWarning) TYPE_MISMATCH_WARNING else TYPE_MISMATCH
|
||||||
|
val report = if (error.isWarning) trace::reportDiagnosticOnce else trace::report
|
||||||
|
|
||||||
|
argument?.let {
|
||||||
|
it.safeAs<LambdaKotlinCallArgument>()?.let lambda@{ lambda ->
|
||||||
|
val parameterTypes = lambda.parametersTypes?.toList() ?: return@lambda
|
||||||
|
val index = parameterTypes.indexOf(error.upperKotlinType.unwrap())
|
||||||
|
val lambdaExpression = lambda.psiExpression as? KtLambdaExpression ?: return@lambda
|
||||||
|
val parameter = lambdaExpression.valueParameters.getOrNull(index) ?: return@lambda
|
||||||
|
val diagnosticFactory =
|
||||||
|
if (error.isWarning) EXPECTED_PARAMETER_TYPE_MISMATCH_WARNING else EXPECTED_PARAMETER_TYPE_MISMATCH
|
||||||
|
report(diagnosticFactory.on(parameter, error.upperKotlinType))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val expression = it.psiExpression ?: return
|
||||||
|
val deparenthesized = KtPsiUtil.safeDeparenthesize(expression)
|
||||||
|
if (reportConstantTypeMismatch(error, deparenthesized)) return
|
||||||
|
|
||||||
|
val compileTimeConstant = trace[BindingContext.COMPILE_TIME_VALUE, deparenthesized] as? TypedCompileTimeConstant
|
||||||
|
if (compileTimeConstant != null) {
|
||||||
|
val expressionType = trace[BindingContext.EXPRESSION_TYPE_INFO, expression]?.type
|
||||||
|
if (expressionType != null &&
|
||||||
|
!UnsignedTypes.isUnsignedType(compileTimeConstant.type) && UnsignedTypes.isUnsignedType(expressionType)
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
report(typeMismatchDiagnostic.on(deparenthesized, error.upperKotlinType, error.lowerKotlinType))
|
||||||
|
}
|
||||||
|
|
||||||
|
(position as? ExpectedTypeConstraintPositionImpl)?.let {
|
||||||
|
val call = it.topLevelCall.psiKotlinCall.psiCall.callElement.safeAs<KtExpression>()
|
||||||
|
val inferredType =
|
||||||
|
if (!error.lowerKotlinType.isNullableNothing()) error.lowerKotlinType
|
||||||
|
else error.upperKotlinType.makeNullable()
|
||||||
|
if (call != null) {
|
||||||
|
report(typeMismatchDiagnostic.on(call, error.upperKotlinType, inferredType))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(position as? BuilderInferenceExpectedTypeConstraintPosition)?.let {
|
||||||
|
val inferredType =
|
||||||
|
if (!error.lowerKotlinType.isNullableNothing()) error.lowerKotlinType
|
||||||
|
else error.upperKotlinType.makeNullable()
|
||||||
|
trace.report(TYPE_MISMATCH.on(it.topLevelCall, error.upperKotlinType, inferredType))
|
||||||
|
}
|
||||||
|
|
||||||
|
(position as? BuilderInferenceSubstitutionConstraintPositionImpl)?.let {
|
||||||
|
reportConstraintErrorByPosition(error, it.initialConstraint.position)
|
||||||
|
}
|
||||||
|
|
||||||
|
(position as? ExplicitTypeParameterConstraintPositionImpl)?.let {
|
||||||
|
val typeArgumentReference = (it.typeArgument as SimpleTypeArgumentImpl).typeReference
|
||||||
|
val diagnosticFactory = if (error.isWarning) UPPER_BOUND_VIOLATED_WARNING else UPPER_BOUND_VIOLATED
|
||||||
|
report(diagnosticFactory.on(typeArgumentReference, error.upperKotlinType, error.lowerKotlinType))
|
||||||
|
}
|
||||||
|
|
||||||
|
(position as? FixVariableConstraintPositionImpl)?.let {
|
||||||
|
val morePreciseDiagnosticExists = allDiagnostics.any { other ->
|
||||||
|
val otherError = other.constraintSystemError ?: return@any false
|
||||||
|
otherError is NewConstraintError && otherError.position.from !is FixVariableConstraintPositionImpl
|
||||||
|
}
|
||||||
|
if (morePreciseDiagnosticExists) return
|
||||||
|
|
||||||
|
val call = it.resolvedAtom?.atom?.safeAs<PSIKotlinCall>()?.psiCall ?: call
|
||||||
|
val expression = call.calleeExpression ?: return
|
||||||
|
|
||||||
|
trace.reportDiagnosticOnce(typeMismatchDiagnostic.on(expression, error.upperKotlinType, error.lowerKotlinType))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun constraintError(error: ConstraintSystemError) {
|
override fun constraintError(error: ConstraintSystemError) {
|
||||||
when (error.javaClass) {
|
when (error.javaClass) {
|
||||||
NewConstraintError::class.java -> {
|
NewConstraintError::class.java -> {
|
||||||
error as NewConstraintError
|
error as NewConstraintError
|
||||||
val position = error.position.from
|
reportConstraintErrorByPosition(error, error.position.from)
|
||||||
val argument =
|
|
||||||
when (position) {
|
|
||||||
is ArgumentConstraintPositionImpl -> position.argument
|
|
||||||
is ReceiverConstraintPositionImpl -> position.argument
|
|
||||||
is LHSArgumentConstraintPositionImpl -> position.argument
|
|
||||||
is LambdaArgumentConstraintPositionImpl -> position.lambda.atom
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
val typeMismatchDiagnostic = if (error.isWarning) TYPE_MISMATCH_WARNING else TYPE_MISMATCH
|
|
||||||
val report = if (error.isWarning) trace::reportDiagnosticOnce else trace::report
|
|
||||||
argument?.let {
|
|
||||||
it.safeAs<LambdaKotlinCallArgument>()?.let lambda@{ lambda ->
|
|
||||||
val parameterTypes = lambda.parametersTypes?.toList() ?: return@lambda
|
|
||||||
val index = parameterTypes.indexOf(error.upperKotlinType.unwrap())
|
|
||||||
val lambdaExpression = lambda.psiExpression as? KtLambdaExpression ?: return@lambda
|
|
||||||
val parameter = lambdaExpression.valueParameters.getOrNull(index) ?: return@lambda
|
|
||||||
val diagnosticFactory =
|
|
||||||
if (error.isWarning) EXPECTED_PARAMETER_TYPE_MISMATCH_WARNING else EXPECTED_PARAMETER_TYPE_MISMATCH
|
|
||||||
report(diagnosticFactory.on(parameter, error.upperKotlinType))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val expression = it.psiExpression ?: return
|
|
||||||
val deparenthesized = KtPsiUtil.safeDeparenthesize(expression)
|
|
||||||
if (reportConstantTypeMismatch(error, deparenthesized)) return
|
|
||||||
|
|
||||||
val compileTimeConstant = trace[BindingContext.COMPILE_TIME_VALUE, deparenthesized] as? TypedCompileTimeConstant
|
|
||||||
if (compileTimeConstant != null) {
|
|
||||||
val expressionType = trace[BindingContext.EXPRESSION_TYPE_INFO, expression]?.type
|
|
||||||
if (expressionType != null &&
|
|
||||||
!UnsignedTypes.isUnsignedType(compileTimeConstant.type) && UnsignedTypes.isUnsignedType(expressionType)
|
|
||||||
) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
report(typeMismatchDiagnostic.on(deparenthesized, error.upperKotlinType, error.lowerKotlinType))
|
|
||||||
}
|
|
||||||
|
|
||||||
(position as? ExpectedTypeConstraintPositionImpl)?.let {
|
|
||||||
val call = it.topLevelCall.psiKotlinCall.psiCall.callElement.safeAs<KtExpression>()
|
|
||||||
val inferredType =
|
|
||||||
if (!error.lowerKotlinType.isNullableNothing()) error.lowerKotlinType
|
|
||||||
else error.upperKotlinType.makeNullable()
|
|
||||||
if (call != null) {
|
|
||||||
report(typeMismatchDiagnostic.on(call, error.upperKotlinType, inferredType))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
(position as? BuilderInferenceExpectedTypeConstraintPosition)?.let {
|
|
||||||
val inferredType =
|
|
||||||
if (!error.lowerKotlinType.isNullableNothing()) error.lowerKotlinType
|
|
||||||
else error.upperKotlinType.makeNullable()
|
|
||||||
trace.report(TYPE_MISMATCH.on(it.topLevelCall, error.upperKotlinType, inferredType))
|
|
||||||
}
|
|
||||||
|
|
||||||
(position as? ExplicitTypeParameterConstraintPositionImpl)?.let {
|
|
||||||
val typeArgumentReference = (it.typeArgument as SimpleTypeArgumentImpl).typeReference
|
|
||||||
val diagnosticFactory = if (error.isWarning) UPPER_BOUND_VIOLATED_WARNING else UPPER_BOUND_VIOLATED
|
|
||||||
report(diagnosticFactory.on(typeArgumentReference, error.upperKotlinType, error.lowerKotlinType))
|
|
||||||
}
|
|
||||||
|
|
||||||
(position as? FixVariableConstraintPositionImpl)?.let {
|
|
||||||
val morePreciseDiagnosticExists = allDiagnostics.any { other ->
|
|
||||||
val otherError = other.constraintSystemError ?: return@any false
|
|
||||||
otherError is NewConstraintError && otherError.position.from !is FixVariableConstraintPositionImpl
|
|
||||||
}
|
|
||||||
if (morePreciseDiagnosticExists) return
|
|
||||||
|
|
||||||
val call = it.resolvedAtom?.atom?.safeAs<PSIKotlinCall>()?.psiCall ?: call
|
|
||||||
val expression = call.calleeExpression ?: return
|
|
||||||
|
|
||||||
trace.reportDiagnosticOnce(typeMismatchDiagnostic.on(expression, error.upperKotlinType, error.lowerKotlinType))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CapturedTypeFromSubtyping::class.java -> {
|
CapturedTypeFromSubtyping::class.java -> {
|
||||||
|
|||||||
+23
-7
@@ -329,22 +329,24 @@ class BuilderInferenceSession(
|
|||||||
val callSubstitutor = storage.buildResultingSubstitutor(commonSystem, transformTypeVariablesToErrorTypes = false)
|
val callSubstitutor = storage.buildResultingSubstitutor(commonSystem, transformTypeVariablesToErrorTypes = false)
|
||||||
|
|
||||||
for (initialConstraint in storage.initialConstraints) {
|
for (initialConstraint in storage.initialConstraints) {
|
||||||
val lowerCallSubstituted = callSubstitutor.safeSubstitute(initialConstraint.a as UnwrappedType)
|
val substitutedConstraint = initialConstraint.substitute(callSubstitutor)
|
||||||
val upperCallSubstituted = callSubstitutor.safeSubstitute(initialConstraint.b as UnwrappedType)
|
val (lower, upper) = substituteNotFixedVariables(
|
||||||
|
substitutedConstraint.a as KotlinType,
|
||||||
val (lower, upper) = substituteNotFixedVariables(lowerCallSubstituted, upperCallSubstituted, nonFixedToVariablesSubstitutor)
|
substitutedConstraint.b as KotlinType,
|
||||||
|
nonFixedToVariablesSubstitutor
|
||||||
|
)
|
||||||
|
|
||||||
if (commonSystem.isProperType(lower) && commonSystem.isProperType(upper)) continue
|
if (commonSystem.isProperType(lower) && commonSystem.isProperType(upper)) continue
|
||||||
|
|
||||||
when (initialConstraint.constraintKind) {
|
when (initialConstraint.constraintKind) {
|
||||||
ConstraintKind.LOWER -> error("LOWER constraint shouldn't be used, please use UPPER")
|
ConstraintKind.LOWER -> error("LOWER constraint shouldn't be used, please use UPPER")
|
||||||
|
|
||||||
ConstraintKind.UPPER -> commonSystem.addSubtypeConstraint(lower, upper, initialConstraint.position)
|
ConstraintKind.UPPER -> commonSystem.addSubtypeConstraint(lower, upper, substitutedConstraint.position)
|
||||||
|
|
||||||
ConstraintKind.EQUALITY ->
|
ConstraintKind.EQUALITY ->
|
||||||
with(commonSystem) {
|
with(commonSystem) {
|
||||||
addSubtypeConstraint(lower, upper, initialConstraint.position)
|
addSubtypeConstraint(lower, upper, substitutedConstraint.position)
|
||||||
addSubtypeConstraint(upper, lower, initialConstraint.position)
|
addSubtypeConstraint(upper, lower, substitutedConstraint.position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -542,6 +544,20 @@ class BuilderInferenceSession(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun InitialConstraint.substitute(substitutor: NewTypeSubstitutor): InitialConstraint {
|
||||||
|
val lowerSubstituted = substitutor.safeSubstitute(a as UnwrappedType)
|
||||||
|
val upperSubstituted = substitutor.safeSubstitute(b as UnwrappedType)
|
||||||
|
|
||||||
|
if (lowerSubstituted == a && upperSubstituted == b) return this
|
||||||
|
|
||||||
|
return InitialConstraint(
|
||||||
|
lowerSubstituted,
|
||||||
|
upperSubstituted,
|
||||||
|
constraintKind,
|
||||||
|
BuilderInferenceSubstitutionConstraintPositionImpl(lambdaArgument, this)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private fun BuilderInferenceSession.updateCalls(
|
private fun BuilderInferenceSession.updateCalls(
|
||||||
lambda: ResolvedLambdaAtom,
|
lambda: ResolvedLambdaAtom,
|
||||||
|
|||||||
+6
@@ -23,6 +23,12 @@ abstract class InjectedAnotherStubTypeConstraintPosition<T>(private val builderI
|
|||||||
override fun toString(): String = "Injected from $builderInferenceLambdaOfInjectedStubType builder inference call"
|
override fun toString(): String = "Injected from $builderInferenceLambdaOfInjectedStubType builder inference call"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class BuilderInferenceSubstitutionConstraintPosition<L, I>(private val builderInferenceLambda: L, val initialConstraint: I) :
|
||||||
|
ConstraintPosition(), OnlyInputTypeConstraintPosition {
|
||||||
|
override fun toString(): String = "Incorporated builder inference constraint $initialConstraint " +
|
||||||
|
"into $builderInferenceLambda call"
|
||||||
|
}
|
||||||
|
|
||||||
abstract class ExpectedTypeConstraintPosition<T>(val topLevelCall: T) : ConstraintPosition(), OnlyInputTypeConstraintPosition {
|
abstract class ExpectedTypeConstraintPosition<T>(val topLevelCall: T) : ConstraintPosition(), OnlyInputTypeConstraintPosition {
|
||||||
override fun toString(): String = "ExpectedType for call $topLevelCall"
|
override fun toString(): String = "ExpectedType for call $topLevelCall"
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -18,6 +18,12 @@ class ExplicitTypeParameterConstraintPositionImpl(
|
|||||||
class InjectedAnotherStubTypeConstraintPositionImpl(builderInferenceLambdaOfInjectedStubType: LambdaKotlinCallArgument) :
|
class InjectedAnotherStubTypeConstraintPositionImpl(builderInferenceLambdaOfInjectedStubType: LambdaKotlinCallArgument) :
|
||||||
InjectedAnotherStubTypeConstraintPosition<LambdaKotlinCallArgument>(builderInferenceLambdaOfInjectedStubType)
|
InjectedAnotherStubTypeConstraintPosition<LambdaKotlinCallArgument>(builderInferenceLambdaOfInjectedStubType)
|
||||||
|
|
||||||
|
class BuilderInferenceSubstitutionConstraintPositionImpl(
|
||||||
|
builderInferenceLambda: LambdaKotlinCallArgument, initialConstraint: InitialConstraint
|
||||||
|
) : BuilderInferenceSubstitutionConstraintPosition<LambdaKotlinCallArgument, InitialConstraint>(
|
||||||
|
builderInferenceLambda, initialConstraint
|
||||||
|
)
|
||||||
|
|
||||||
class ExpectedTypeConstraintPositionImpl(topLevelCall: KotlinCall) : ExpectedTypeConstraintPosition<KotlinCall>(topLevelCall)
|
class ExpectedTypeConstraintPositionImpl(topLevelCall: KotlinCall) : ExpectedTypeConstraintPosition<KotlinCall>(topLevelCall)
|
||||||
|
|
||||||
class DeclaredUpperBoundConstraintPositionImpl(
|
class DeclaredUpperBoundConstraintPositionImpl(
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
public inline fun <R, C : MutableCollection<in R>> flatMapTo1(destination: C, transform: (List<String>) -> Iterable<R>) {}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
|
fun box(): String {
|
||||||
|
buildSet { // NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER is reported
|
||||||
|
flatMapTo1(this) { it }
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// !USE_EXPERIMENTAL: kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
import kotlin.experimental.ExperimentalTypeInference
|
||||||
|
|
||||||
|
fun <E> produce(@BuilderInference block: Derived<E>.() -> Unit): E = null as E
|
||||||
|
|
||||||
|
interface Derived<in E> : Base<E>
|
||||||
|
|
||||||
|
interface Base<in E>
|
||||||
|
|
||||||
|
interface Receiver<out E>
|
||||||
|
|
||||||
|
fun <E, C : Base<E>> Receiver<E>.toChannel(destination: C): C = null as C
|
||||||
|
|
||||||
|
fun <R> foo(r: Receiver<R>): R = produce { r.toChannel(this) }
|
||||||
|
|
||||||
|
fun box() = "OK"
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
fun <E : Any?> produce(@BuilderInference block: @ExtensionFunctionType Function1<Derived<E>, Unit>): E {
|
||||||
|
return null as E
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Derived<in E : Any?> : Base<E> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Base<in E : Any?> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Receiver<out E : Any?> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <E : Any?, C : Base<E>> Receiver<E>.toChannel(destination: C): C {
|
||||||
|
return null as C
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <R : Any?> foo(r: Receiver<R>): R {
|
||||||
|
return produce<R>(block = local fun Derived<R>.<anonymous>() {
|
||||||
|
r.toChannel<R, Derived<R>>(destination = $this$produce) /*~> Unit */
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
FILE fqName:<root> fileName:/kt47082.kt
|
||||||
|
FUN name:produce visibility:public modality:FINAL <E> (block:@[ExtensionFunctionType] kotlin.Function1<<root>.Derived<E of <root>.produce>, kotlin.Unit>) returnType:E of <root>.produce
|
||||||
|
TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?]
|
||||||
|
VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.Function1<<root>.Derived<E of <root>.produce>, kotlin.Unit>
|
||||||
|
annotations:
|
||||||
|
BuilderInference
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun produce <E> (block: @[ExtensionFunctionType] kotlin.Function1<<root>.Derived<E of <root>.produce>, kotlin.Unit>): E of <root>.produce declared in <root>'
|
||||||
|
TYPE_OP type=E of <root>.produce origin=CAST typeOperand=E of <root>.produce
|
||||||
|
CONST Null type=kotlin.Nothing? value=null
|
||||||
|
CLASS INTERFACE name:Derived modality:ABSTRACT visibility:public superTypes:[<root>.Base<E of <root>.Derived>]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Derived<E of <root>.Derived>
|
||||||
|
TYPE_PARAMETER name:E index:0 variance:in superTypes:[kotlin.Any?]
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.Base
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.Base
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String [fake_override] declared in <root>.Base
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
CLASS INTERFACE name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base<E of <root>.Base>
|
||||||
|
TYPE_PARAMETER name:E index:0 variance:in superTypes:[kotlin.Any?]
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
CLASS INTERFACE name:Receiver modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||||
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Receiver<E of <root>.Receiver>
|
||||||
|
TYPE_PARAMETER name:E index:0 variance:out superTypes:[kotlin.Any?]
|
||||||
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
|
overridden:
|
||||||
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||||
|
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||||
|
overridden:
|
||||||
|
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||||
|
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||||
|
FUN name:toChannel visibility:public modality:FINAL <E, C> ($receiver:<root>.Receiver<E of <root>.toChannel>, destination:C of <root>.toChannel) returnType:C of <root>.toChannel
|
||||||
|
TYPE_PARAMETER name:E index:0 variance: superTypes:[kotlin.Any?]
|
||||||
|
TYPE_PARAMETER name:C index:1 variance: superTypes:[<root>.Base<E of <root>.toChannel>]
|
||||||
|
$receiver: VALUE_PARAMETER name:<this> type:<root>.Receiver<E of <root>.toChannel>
|
||||||
|
VALUE_PARAMETER name:destination index:0 type:C of <root>.toChannel
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun toChannel <E, C> (destination: C of <root>.toChannel): C of <root>.toChannel declared in <root>'
|
||||||
|
TYPE_OP type=C of <root>.toChannel origin=CAST typeOperand=C of <root>.toChannel
|
||||||
|
CONST Null type=kotlin.Nothing? value=null
|
||||||
|
FUN name:foo visibility:public modality:FINAL <R> (r:<root>.Receiver<R of <root>.foo>) returnType:R of <root>.foo
|
||||||
|
TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?]
|
||||||
|
VALUE_PARAMETER name:r index:0 type:<root>.Receiver<R of <root>.foo>
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun foo <R> (r: <root>.Receiver<R of <root>.foo>): R of <root>.foo declared in <root>'
|
||||||
|
CALL 'public final fun produce <E> (block: @[ExtensionFunctionType] kotlin.Function1<<root>.Derived<E of <root>.produce>, kotlin.Unit>): E of <root>.produce declared in <root>' type=R of <root>.foo origin=null
|
||||||
|
<E>: R of <root>.foo
|
||||||
|
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.Derived<R of <root>.foo>, kotlin.Unit> origin=LAMBDA
|
||||||
|
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.Derived<R of <root>.foo>) returnType:kotlin.Unit
|
||||||
|
$receiver: VALUE_PARAMETER name:$this$produce type:<root>.Derived<R of <root>.foo>
|
||||||
|
BLOCK_BODY
|
||||||
|
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||||
|
CALL 'public final fun toChannel <E, C> (destination: C of <root>.toChannel): C of <root>.toChannel declared in <root>' type=<root>.Derived<R of <root>.foo> origin=null
|
||||||
|
<E>: R of <root>.foo
|
||||||
|
<C>: <root>.Derived<R of <root>.foo>
|
||||||
|
$receiver: GET_VAR 'r: <root>.Receiver<R of <root>.foo> declared in <root>.foo' type=<root>.Receiver<R of <root>.foo> origin=null
|
||||||
|
destination: GET_VAR '$this$produce: <root>.Derived<R of <root>.foo> declared in <root>.foo.<anonymous>' type=<root>.Derived<R of <root>.foo> origin=null
|
||||||
|
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||||
|
BLOCK_BODY
|
||||||
|
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||||
|
CONST String type=kotlin.String value="OK"
|
||||||
+6
@@ -17635,6 +17635,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47052.kt")
|
||||||
|
public void testKt47052() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
|
|||||||
+6
@@ -17665,6 +17665,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47052.kt")
|
||||||
|
public void testKt47052() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
|
|||||||
Generated
+6
@@ -1400,6 +1400,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
|||||||
runTest("compiler/testData/ir/irText/expressions/kt45022.kt");
|
runTest("compiler/testData/ir/irText/expressions/kt45022.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt47082.kt")
|
||||||
|
public void testKt47082() throws Exception {
|
||||||
|
runTest("compiler/testData/ir/irText/expressions/kt47082.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lambdaInCAO.kt")
|
@TestMetadata("lambdaInCAO.kt")
|
||||||
public void testLambdaInCAO() throws Exception {
|
public void testLambdaInCAO() throws Exception {
|
||||||
|
|||||||
+5
@@ -14606,6 +14606,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47052.kt")
|
||||||
|
public void testKt47052() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -12765,6 +12765,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47052.kt")
|
||||||
|
public void testKt47052() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12171,6 +12171,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47052.kt")
|
||||||
|
public void testKt47052() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12236,6 +12236,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt41164.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt47052.kt")
|
||||||
|
public void testKt47052() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/builderInference/kt47052.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("labaledCall.kt")
|
@TestMetadata("labaledCall.kt")
|
||||||
public void testLabaledCall() throws Exception {
|
public void testLabaledCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
runTest("compiler/testData/codegen/box/inference/builderInference/labaledCall.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user