Rethink constraints incorporation
Namely, remove incorporation “otherInsideMyConstraint” to eliminate constraint system redundancy and produce a potentially very large number of constructs. Instead, introduce not so “spreadable” incorporation during variable fixation (equality constraint with result type into other constraints). ^KT-41644 Fixed ^KT-42195 Fixed ^KT-42920 Fixed ^KT-42791 Fixed ^KT-41741 Fixed
This commit is contained in:
+3
-3
@@ -19,7 +19,7 @@ fun main() {
|
||||
val x1: suspend (Int) -> Unit = takeSuspend(<!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit")!>id { it }<!>, <!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit")!>{ x -> x }<!>)
|
||||
|
||||
// Here, the error should be
|
||||
val x2: (Int) -> Unit = <!TYPE_MISMATCH!>takeSuspend(<!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit")!>id <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ it }<!><!>, <!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }<!>)<!>
|
||||
val x3: suspend (Int) -> Unit = takeSimpleFunction(<!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit")!>id <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ it }<!><!>, <!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }<!>)
|
||||
val x4: (Int) -> Unit = <!TYPE_MISMATCH, TYPE_MISMATCH!>takeSimpleFunction(<!TYPE_MISMATCH!>id<suspend (Int) -> Unit> {}<!>, <!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{}<!>)<!>
|
||||
val x2: (Int) -> Unit = <!TYPE_MISMATCH!>takeSuspend(<!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit")!>id <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ it }<!><!>, <!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }<!>)<!>
|
||||
val x3: suspend (Int) -> Unit = takeSimpleFunction(<!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit")!>id <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ it }<!><!>, <!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }<!>)
|
||||
val x4: (Int) -> Unit = <!TYPE_MISMATCH, TYPE_MISMATCH!>takeSimpleFunction(<!TYPE_MISMATCH!>id<suspend (Int) -> Unit> {}<!>, <!DEBUG_INFO_EXPRESSION_TYPE("suspend (kotlin.Int) -> kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{}<!>)<!>
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// FIR_IDENTICAL
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS
|
||||
|
||||
sealed class DataType<T> {
|
||||
sealed class NotNull<T> : DataType<T>() {
|
||||
abstract class Partial<T> : NotNull<T>()
|
||||
}
|
||||
}
|
||||
|
||||
class Tuple8<A, DA : DataType<A>, B, DB : DataType<B>, C, DC : DataType<C>, D, DD : DataType<D>, E, DE : DataType<E>, F, DF : DataType<F>, G, DG : DataType<G>, H, DH : DataType<H>>(
|
||||
firstName: String, firstType: DA,
|
||||
secondName: String, secondType: DB,
|
||||
thirdName: String, thirdType: DC,
|
||||
fourthName: String, fourthType: DD,
|
||||
fifthName: String, fifthType: DE,
|
||||
sixthName: String, sixthType: DF,
|
||||
seventhName: String, seventhType: DG,
|
||||
eighthName: String, eighthType: DH
|
||||
) : Schema<Tuple8<A, DA, B, DB, C, DC, D, DD, E, DE, F, DF, G, DG, H, DH>>()
|
||||
|
||||
class EitherType<SCH : Schema<SCH>>(
|
||||
schema: SCH
|
||||
)
|
||||
|
||||
open class Schema<T>
|
||||
|
||||
fun <A, DA : DataType<A>, B, DB : DataType<B>, C, DC : DataType<C>, D, DD : DataType<D>, E, DE : DataType<E>, F, DF : DataType<F>, G, DG : DataType<G>, H, DH : DataType<H>> either8(
|
||||
firstName: String, firstType: DA,
|
||||
secondName: String, secondType: DB,
|
||||
thirdName: String, thirdType: DC,
|
||||
fourthName: String, fourthType: DD,
|
||||
fifthName: String, fifthType: DE,
|
||||
sixthName: String, sixthType: DF,
|
||||
seventhName: String, seventhType: DG,
|
||||
eighthName: String, eighthType: DH
|
||||
): DataType.NotNull.Partial<Either8<A, B, C, D, E, F, G, H>> =
|
||||
EitherType(
|
||||
Tuple8(
|
||||
firstName, firstType, secondName, secondType, thirdName, thirdType, fourthName, fourthType,
|
||||
fifthName, fifthType, sixthName, sixthType, seventhName, seventhType, eighthName, eighthType
|
||||
)
|
||||
) as DataType.NotNull.Partial<Either8<A, B, C, D, E, F, G, H>>
|
||||
|
||||
class Either8<T, U, V, W, X, Y, Z, T1>
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ A, /*1*/ DA : DataType<A>, /*2*/ B, /*3*/ DB : DataType<B>, /*4*/ C, /*5*/ DC : DataType<C>, /*6*/ D, /*7*/ DD : DataType<D>, /*8*/ E, /*9*/ DE : DataType<E>, /*10*/ F, /*11*/ DF : DataType<F>, /*12*/ G, /*13*/ DG : DataType<G>, /*14*/ H, /*15*/ DH : DataType<H>> either8(/*0*/ firstName: kotlin.String, /*1*/ firstType: DA, /*2*/ secondName: kotlin.String, /*3*/ secondType: DB, /*4*/ thirdName: kotlin.String, /*5*/ thirdType: DC, /*6*/ fourthName: kotlin.String, /*7*/ fourthType: DD, /*8*/ fifthName: kotlin.String, /*9*/ fifthType: DE, /*10*/ sixthName: kotlin.String, /*11*/ sixthType: DF, /*12*/ seventhName: kotlin.String, /*13*/ seventhType: DG, /*14*/ eighthName: kotlin.String, /*15*/ eighthType: DH): DataType.NotNull.Partial<Either8<A, B, C, D, E, F, G, H>>
|
||||
|
||||
public sealed class DataType</*0*/ T> {
|
||||
private constructor DataType</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public sealed class NotNull</*0*/ T> : DataType<T> {
|
||||
private constructor NotNull</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public abstract class Partial</*0*/ T> : DataType.NotNull<T> {
|
||||
public constructor Partial</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class Either8</*0*/ T, /*1*/ U, /*2*/ V, /*3*/ W, /*4*/ X, /*5*/ Y, /*6*/ Z, /*7*/ T1> {
|
||||
public constructor Either8</*0*/ T, /*1*/ U, /*2*/ V, /*3*/ W, /*4*/ X, /*5*/ Y, /*6*/ Z, /*7*/ T1>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class EitherType</*0*/ SCH : Schema<SCH>> {
|
||||
public constructor EitherType</*0*/ SCH : Schema<SCH>>(/*0*/ schema: SCH)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class Schema</*0*/ T> {
|
||||
public constructor Schema</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Tuple8</*0*/ A, /*1*/ DA : DataType<A>, /*2*/ B, /*3*/ DB : DataType<B>, /*4*/ C, /*5*/ DC : DataType<C>, /*6*/ D, /*7*/ DD : DataType<D>, /*8*/ E, /*9*/ DE : DataType<E>, /*10*/ F, /*11*/ DF : DataType<F>, /*12*/ G, /*13*/ DG : DataType<G>, /*14*/ H, /*15*/ DH : DataType<H>> : Schema<Tuple8<A, DA, B, DB, C, DC, D, DD, E, DE, F, DF, G, DG, H, DH>> {
|
||||
public constructor Tuple8</*0*/ A, /*1*/ DA : DataType<A>, /*2*/ B, /*3*/ DB : DataType<B>, /*4*/ C, /*5*/ DC : DataType<C>, /*6*/ D, /*7*/ DD : DataType<D>, /*8*/ E, /*9*/ DE : DataType<E>, /*10*/ F, /*11*/ DF : DataType<F>, /*12*/ G, /*13*/ DG : DataType<G>, /*14*/ H, /*15*/ DH : DataType<H>>(/*0*/ firstName: kotlin.String, /*1*/ firstType: DA, /*2*/ secondName: kotlin.String, /*3*/ secondType: DB, /*4*/ thirdName: kotlin.String, /*5*/ thirdType: DC, /*6*/ fourthName: kotlin.String, /*7*/ fourthType: DD, /*8*/ fifthName: kotlin.String, /*9*/ fifthType: DE, /*10*/ sixthName: kotlin.String, /*11*/ sixthType: DF, /*12*/ seventhName: kotlin.String, /*13*/ seventhType: DG, /*14*/ eighthName: kotlin.String, /*15*/ eighthType: DH)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user