[NI] Use alternative to intersection type in public declarations
The new inference uses inferred intersection types normally, unlike the old inference.
However, intersection types in public declarations are approximated to supertype, which
potentially may give a less presice type, then it would be with the OI.
For non-related T1, T2 the NI approximates {T1 & T2} to Any in public declarations,
and if the OI was inferring T1 instead of the intersection type, it may lead to
less precise declaration type and related errors.
The solution is to remember an alternative for an intersection type when present.
Before approximation the alternative replaces the intersection type.
^KT-36249 Fixed
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
interface Bound {
|
||||
fun foo() {}
|
||||
}
|
||||
interface Bound1 : Bound
|
||||
interface Bound2 : Bound
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
class Out<out O>(val param: O)
|
||||
|
||||
fun <S : Any> anyBound(vararg elements: S): Out<S> = TODO()
|
||||
fun topLevel() = anyBound(First, Second)
|
||||
|
||||
fun test() {
|
||||
topLevel().param.foo()
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : kotlin.Any> anyBound(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): Out<S>
|
||||
public fun test(): kotlin.Unit
|
||||
public fun topLevel(): Out<Bound>
|
||||
|
||||
public interface Bound {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Bound1 : Bound {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Bound2 : Bound {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out O> {
|
||||
public constructor Out</*0*/ out O>(/*0*/ param: O)
|
||||
public final val param: O
|
||||
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 object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface First {
|
||||
fun first() {}
|
||||
}
|
||||
interface Second
|
||||
interface Third
|
||||
interface Fourth
|
||||
|
||||
fun chained1(arg: First) = run {
|
||||
if (arg !is Second) throw Exception()
|
||||
arg
|
||||
}.let { third ->
|
||||
if (third !is Third) throw Exception()
|
||||
third
|
||||
}
|
||||
|
||||
fun chained2(arg: First) = run {
|
||||
if (arg !is Second) throw Exception()
|
||||
arg
|
||||
}.let { third ->
|
||||
if (third !is Third) throw Exception()
|
||||
third
|
||||
}.let { fourth ->
|
||||
if (fourth !is Fourth) throw Exception()
|
||||
fourth
|
||||
}
|
||||
|
||||
fun test(arg: First) {
|
||||
chained1(arg).first()
|
||||
chained2(arg).first()
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface First {
|
||||
fun first() {}
|
||||
}
|
||||
interface Second
|
||||
interface Third
|
||||
interface Fourth
|
||||
|
||||
fun chained1(arg: First) = run {
|
||||
if (arg !is Second) throw Exception()
|
||||
arg
|
||||
}.let { third ->
|
||||
if (third !is Third) throw Exception()
|
||||
third
|
||||
}
|
||||
|
||||
fun chained2(arg: First) = run {
|
||||
if (arg !is Second) throw Exception()
|
||||
arg
|
||||
}.let { third ->
|
||||
if (third !is Third) throw Exception()
|
||||
third
|
||||
}.let { fourth ->
|
||||
if (fourth !is Fourth) throw Exception()
|
||||
fourth
|
||||
}
|
||||
|
||||
fun test(arg: First) {
|
||||
chained1(arg).<!NI;UNRESOLVED_REFERENCE!>first<!>()
|
||||
chained2(arg).<!NI;UNRESOLVED_REFERENCE!>first<!>()
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package
|
||||
|
||||
public fun chained1(/*0*/ arg: First): kotlin.Any
|
||||
public fun chained2(/*0*/ arg: First): kotlin.Any
|
||||
public fun test(/*0*/ arg: First): kotlin.Unit
|
||||
|
||||
public interface First {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun first(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Fourth {
|
||||
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 interface Second {
|
||||
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 interface Third {
|
||||
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
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package
|
||||
|
||||
public fun chained1(/*0*/ arg: First): First
|
||||
public fun chained2(/*0*/ arg: First): First
|
||||
public fun test(/*0*/ arg: First): kotlin.Unit
|
||||
|
||||
public interface First {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun first(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Fourth {
|
||||
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 interface Second {
|
||||
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 interface Third {
|
||||
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
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun topLevelFunction() = intersect(First, Second)
|
||||
val Any.extensionProperty
|
||||
get() = intersect(First, Second)
|
||||
|
||||
fun Any.extensionFunction() = intersect(First, Second)
|
||||
|
||||
class Cls {
|
||||
val publicProperty = intersect(First, Second)
|
||||
private val privateProperty = intersect(First, Second)
|
||||
|
||||
fun publicMemberFunction() = intersect(First, Second)
|
||||
private fun privateMemberFunction() = intersect(First, Second)
|
||||
|
||||
fun testLocalDeclarations() {
|
||||
val localVariable = intersect(First, Second)
|
||||
fun localFunction() = intersect(First, Second)
|
||||
localVariable
|
||||
privateProperty
|
||||
localFunction()
|
||||
privateMemberFunction()
|
||||
}
|
||||
}
|
||||
|
||||
object Obj {
|
||||
val publicProperty = intersect(First, Second)
|
||||
private val privateProperty = intersect(First, Second)
|
||||
|
||||
fun publicMemberFunction() = intersect(First, Second)
|
||||
private fun privateMemberFunction() = intersect(First, Second)
|
||||
|
||||
fun testLocalDeclarations() {
|
||||
val localVariable = intersect(First, Second)
|
||||
fun localFunction() = intersect(First, Second)
|
||||
localVariable
|
||||
localFunction()
|
||||
privateProperty
|
||||
privateMemberFunction()
|
||||
}
|
||||
}
|
||||
|
||||
fun test(cls: Cls, obj: Obj) {
|
||||
topLevelFunction()
|
||||
Unit.extensionProperty
|
||||
Unit.extensionFunction()
|
||||
cls.publicProperty
|
||||
cls.publicMemberFunction()
|
||||
obj.publicProperty
|
||||
obj.publicMemberFunction()
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun topLevelFunction() = intersect(First, Second)
|
||||
val Any.extensionProperty
|
||||
get() = intersect(First, Second)
|
||||
|
||||
fun Any.extensionFunction() = intersect(First, Second)
|
||||
|
||||
class Cls {
|
||||
val publicProperty = intersect(First, Second)
|
||||
private val privateProperty = intersect(First, Second)
|
||||
|
||||
fun publicMemberFunction() = intersect(First, Second)
|
||||
private fun privateMemberFunction() = intersect(First, Second)
|
||||
|
||||
fun testLocalDeclarations() {
|
||||
val localVariable = intersect(First, Second)
|
||||
fun localFunction() = intersect(First, Second)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Bound1 & Bound2}")!>localVariable<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>privateProperty<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>localFunction()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>privateMemberFunction()<!>
|
||||
}
|
||||
}
|
||||
|
||||
object Obj {
|
||||
val publicProperty = intersect(First, Second)
|
||||
private val privateProperty = intersect(First, Second)
|
||||
|
||||
fun publicMemberFunction() = intersect(First, Second)
|
||||
private fun privateMemberFunction() = intersect(First, Second)
|
||||
|
||||
fun testLocalDeclarations() {
|
||||
val localVariable = intersect(First, Second)
|
||||
fun localFunction() = intersect(First, Second)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Bound1 & Bound2}")!>localVariable<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>localFunction()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>privateProperty<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>privateMemberFunction()<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun test(cls: Cls, obj: Obj) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>topLevelFunction()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>Unit.extensionProperty<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>Unit.extensionFunction()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>cls.publicProperty<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>cls.publicMemberFunction()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>obj.publicProperty<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>obj.publicMemberFunction()<!>
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package
|
||||
|
||||
public val kotlin.Any.extensionProperty: Bound1
|
||||
public fun </*0*/ S : Bound1> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun test(/*0*/ cls: Cls, /*1*/ obj: Obj): kotlin.Unit
|
||||
public fun topLevelFunction(): Bound1
|
||||
public fun kotlin.Any.extensionFunction(): Bound1
|
||||
|
||||
public interface Bound1 {
|
||||
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 interface Bound2 {
|
||||
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 Cls {
|
||||
public constructor Cls()
|
||||
private final val privateProperty: Bound1
|
||||
public final val publicProperty: Bound1
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
private final fun privateMemberFunction(): Bound1
|
||||
public final fun publicMemberFunction(): Bound1
|
||||
public final fun testLocalDeclarations(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Obj {
|
||||
private constructor Obj()
|
||||
private final val privateProperty: Bound1
|
||||
public final val publicProperty: Bound1
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
private final fun privateMemberFunction(): Bound1
|
||||
public final fun publicMemberFunction(): Bound1
|
||||
public final fun testLocalDeclarations(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface Base {
|
||||
fun base() {}
|
||||
}
|
||||
interface Base2
|
||||
interface One : Base, Base2
|
||||
interface Two : Base, Base2
|
||||
|
||||
object O1 : One
|
||||
object O2 : Two
|
||||
|
||||
fun <S> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun intersectAfterSmartCast(arg: Base, arg2: Base) = intersect(
|
||||
run {
|
||||
if (arg !is One) throw Exception()
|
||||
arg
|
||||
},
|
||||
run {
|
||||
if (arg2 !is Two) throw Exception()
|
||||
arg2
|
||||
}
|
||||
)
|
||||
|
||||
fun <S> argOrFn(arg: S, fn: () -> S): S = TODO()
|
||||
|
||||
fun intersectArgWithSmartCastFromLambda(arg: One, arg2: Base) = argOrFn(arg) {
|
||||
if (arg2 !is Two) throw Exception()
|
||||
arg2
|
||||
}
|
||||
|
||||
fun test() {
|
||||
intersectAfterSmartCast(O1, O2).base()
|
||||
intersectArgWithSmartCastFromLambda(O1, O2).base()
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface Base {
|
||||
fun base() {}
|
||||
}
|
||||
interface Base2
|
||||
interface One : Base, Base2
|
||||
interface Two : Base, Base2
|
||||
|
||||
object O1 : One
|
||||
object O2 : Two
|
||||
|
||||
fun <S> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun intersectAfterSmartCast(arg: Base, arg2: Base) = intersect(
|
||||
run {
|
||||
if (arg !is One) throw Exception()
|
||||
<!NI;DEBUG_INFO_SMARTCAST!>arg<!>
|
||||
},
|
||||
run {
|
||||
if (arg2 !is Two) throw Exception()
|
||||
<!NI;DEBUG_INFO_SMARTCAST!>arg2<!>
|
||||
}
|
||||
)
|
||||
|
||||
fun <S> argOrFn(arg: S, fn: () -> S): S = TODO()
|
||||
|
||||
fun intersectArgWithSmartCastFromLambda(arg: One, arg2: Base) = argOrFn(arg) {
|
||||
if (arg2 !is Two) throw Exception()
|
||||
arg2
|
||||
}
|
||||
|
||||
fun test() {
|
||||
intersectAfterSmartCast(O1, O2).<!NI;UNRESOLVED_REFERENCE!>base<!>()
|
||||
intersectArgWithSmartCastFromLambda(O1, O2).<!NI;UNRESOLVED_REFERENCE!>base<!>()
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S> argOrFn(/*0*/ arg: S, /*1*/ fn: () -> S): S
|
||||
public fun </*0*/ S> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun intersectAfterSmartCast(/*0*/ arg: Base, /*1*/ arg2: Base): kotlin.Any
|
||||
public fun intersectArgWithSmartCastFromLambda(/*0*/ arg: One, /*1*/ arg2: Base): kotlin.Any
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public interface Base {
|
||||
public open fun base(): kotlin.Unit
|
||||
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 interface Base2 {
|
||||
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 object O1 : One {
|
||||
private constructor O1()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 object O2 : Two {
|
||||
private constructor O2()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 interface One : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Two : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S> argOrFn(/*0*/ arg: S, /*1*/ fn: () -> S): S
|
||||
public fun </*0*/ S> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun intersectAfterSmartCast(/*0*/ arg: Base, /*1*/ arg2: Base): Base
|
||||
public fun intersectArgWithSmartCastFromLambda(/*0*/ arg: One, /*1*/ arg2: Base): Base
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public interface Base {
|
||||
public open fun base(): kotlin.Unit
|
||||
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 interface Base2 {
|
||||
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 object O1 : One {
|
||||
private constructor O1()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 object O2 : Two {
|
||||
private constructor O2()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 interface One : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Two : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound
|
||||
interface Bound1 : Bound
|
||||
interface Bound2 : Bound
|
||||
interface Bound3
|
||||
object First : Bound1, Bound2, Bound3
|
||||
object Second : Bound1, Bound2, Bound3
|
||||
|
||||
fun <S> intersect(vararg elements: S): S where S : Bound1, S : Bound2 = TODO()
|
||||
|
||||
fun testIntersectionAlternative() = intersect(First, Second)
|
||||
|
||||
fun test() {
|
||||
testIntersectionAlternative()
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound
|
||||
interface Bound1 : Bound
|
||||
interface Bound2 : Bound
|
||||
interface Bound3
|
||||
object First : Bound1, Bound2, Bound3
|
||||
object Second : Bound1, Bound2, Bound3
|
||||
|
||||
fun <S> intersect(vararg elements: S): S where S : Bound1, S : Bound2 = TODO()
|
||||
|
||||
fun testIntersectionAlternative() = intersect(First, Second)
|
||||
|
||||
fun test() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound")!>testIntersectionAlternative()<!>
|
||||
}
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Bound1> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S where S : Bound2
|
||||
public fun test(): kotlin.Unit
|
||||
public fun testIntersectionAlternative(): Bound
|
||||
|
||||
public interface Bound {
|
||||
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 interface Bound1 : Bound {
|
||||
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 interface Bound2 : Bound {
|
||||
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 interface Bound3 {
|
||||
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 object First : Bound1, Bound2, Bound3 {
|
||||
private constructor First()
|
||||
public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Second : Bound1, Bound2, Bound3 {
|
||||
private constructor Second()
|
||||
public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun test() {
|
||||
testInv()
|
||||
testIn()
|
||||
testOut()
|
||||
testStarProjection()
|
||||
testErrorType()
|
||||
testInProjection()
|
||||
testOutProjection()
|
||||
testDeeplyNested()
|
||||
}
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
class Inv<T>(val prop: T)
|
||||
class Out<out O>(val prop: O)
|
||||
class In<in I>(arg: I)
|
||||
class BiParam<F, S>(first: F, second: S)
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun makeStarProjection(): Inv<*> = TODO()
|
||||
fun <I> makeInProjection(arg: I): Inv<in I> = TODO()
|
||||
fun <O> makeOutProjection(arg: O): Inv<out O> = TODO()
|
||||
fun testInv() = Inv(intersect(First, Second))
|
||||
fun testOut() = Out(intersect(First, Second))
|
||||
fun testIn() = In(intersect(First, Second))
|
||||
fun testInProjection() = makeInProjection(intersect(First, Second))
|
||||
fun testOutProjection() = makeOutProjection(intersect(First, Second))
|
||||
fun testDeeplyNested() = Inv(Inv(Inv(intersect(First, Second))))
|
||||
|
||||
fun testStarProjection() = BiParam(
|
||||
intersect(First, Second),
|
||||
makeStarProjection()
|
||||
)
|
||||
fun testErrorType() = <!INAPPLICABLE_CANDIDATE!>BiParam<!>(
|
||||
intersect(First, Second),
|
||||
<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
)
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun test() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<Bound1>")!>testInv()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("In<Bound1>")!>testIn()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<Bound1>")!>testOut()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("BiParam<Bound1, Inv<*>>")!>testStarProjection()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("[ERROR : Error function type]")!>testErrorType()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<in Bound1>")!>testInProjection()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<out Bound1>")!>testOutProjection()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<Inv<Inv<Bound1>>>")!>testDeeplyNested()<!>
|
||||
}
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
class Inv<T>(val prop: T)
|
||||
class Out<out O>(val prop: O)
|
||||
class In<in I>(arg: I)
|
||||
class BiParam<F, S>(first: F, second: S)
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun makeStarProjection(): Inv<*> = TODO()
|
||||
fun <I> makeInProjection(arg: I): Inv<in I> = TODO()
|
||||
fun <O> makeOutProjection(arg: O): Inv<out O> = TODO()
|
||||
fun testInv() = Inv(intersect(First, Second))
|
||||
fun testOut() = Out(intersect(First, Second))
|
||||
fun testIn() = In(intersect(First, Second))
|
||||
fun testInProjection() = makeInProjection(intersect(First, Second))
|
||||
fun testOutProjection() = makeOutProjection(intersect(First, Second))
|
||||
fun testDeeplyNested() = Inv(Inv(Inv(intersect(First, Second))))
|
||||
|
||||
fun testStarProjection() = BiParam(
|
||||
intersect(First, Second),
|
||||
makeStarProjection()
|
||||
)
|
||||
fun testErrorType() = BiParam(
|
||||
intersect(First, Second),
|
||||
<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
)
|
||||
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Bound1> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun </*0*/ I> makeInProjection(/*0*/ arg: I): Inv<in I>
|
||||
public fun </*0*/ O> makeOutProjection(/*0*/ arg: O): Inv<out O>
|
||||
public fun makeStarProjection(): Inv<*>
|
||||
public fun test(): kotlin.Unit
|
||||
public fun testDeeplyNested(): Inv<Inv<Inv<Bound1>>>
|
||||
public fun testErrorType(): [ERROR : Error function type]
|
||||
public fun testIn(): In<Bound1>
|
||||
public fun testInProjection(): Inv<in Bound1>
|
||||
public fun testInv(): Inv<Bound1>
|
||||
public fun testOut(): Out<Bound1>
|
||||
public fun testOutProjection(): Inv<out Bound1>
|
||||
public fun testStarProjection(): BiParam<Bound1, Inv<*>>
|
||||
|
||||
public final class BiParam</*0*/ F, /*1*/ S> {
|
||||
public constructor BiParam</*0*/ F, /*1*/ S>(/*0*/ first: F, /*1*/ second: S)
|
||||
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 interface Bound1 {
|
||||
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 interface Bound2 {
|
||||
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 object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class In</*0*/ in I> {
|
||||
public constructor In</*0*/ in I>(/*0*/ arg: I)
|
||||
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 Inv</*0*/ T> {
|
||||
public constructor Inv</*0*/ T>(/*0*/ prop: T)
|
||||
public final val prop: 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 Out</*0*/ out O> {
|
||||
public constructor Out</*0*/ out O>(/*0*/ prop: O)
|
||||
public final val prop: O
|
||||
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 object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface First
|
||||
interface Second
|
||||
|
||||
interface A : First, Second
|
||||
interface B : First, Second
|
||||
|
||||
fun <S> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun runIntersect(arg: A, arg2: A) = run {
|
||||
if (arg !is B) throw Exception()
|
||||
if (arg2 !is B) throw Exception()
|
||||
intersect(arg, arg2)
|
||||
}
|
||||
|
||||
fun test(arg: A) {
|
||||
runIntersect(arg, arg)
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface First
|
||||
interface Second
|
||||
|
||||
interface A : First, Second
|
||||
interface B : First, Second
|
||||
|
||||
fun <S> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun runIntersect(arg: A, arg2: A) = run {
|
||||
if (arg !is B) throw Exception()
|
||||
if (arg2 !is B) throw Exception()
|
||||
intersect(arg, arg2)
|
||||
}
|
||||
|
||||
fun test(arg: A) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>runIntersect(arg, arg)<!>
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun runIntersect(/*0*/ arg: A, /*1*/ arg2: A): kotlin.Any
|
||||
public fun test(/*0*/ arg: A): kotlin.Unit
|
||||
|
||||
public interface A : First, Second {
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface B : First, Second {
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface First {
|
||||
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 interface Second {
|
||||
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
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun <R> run(fn: () -> R): R = TODO()
|
||||
|
||||
fun topLevel() = run {
|
||||
val local = intersect(First, Second)
|
||||
local
|
||||
}
|
||||
|
||||
fun test() {
|
||||
topLevel()
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
fun <R> run(fn: () -> R): R = TODO()
|
||||
|
||||
fun topLevel() = run {
|
||||
val local = intersect(First, Second)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("{Bound1 & Bound2}")!>local<!>
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>topLevel()<!>
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Bound1> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun </*0*/ R> run(/*0*/ fn: () -> R): R
|
||||
public fun test(): kotlin.Unit
|
||||
public fun topLevel(): Bound1
|
||||
|
||||
public interface Bound1 {
|
||||
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 interface Bound2 {
|
||||
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 object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+54
@@ -0,0 +1,54 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun test(first: First, second: Second) {
|
||||
test1(first, second)
|
||||
test2(first, second)
|
||||
test3(first, second)
|
||||
test4(first, second)
|
||||
test5(first, second)
|
||||
test6(first, second)
|
||||
test7(first, second)
|
||||
test8(first, second)
|
||||
test9(first, second)
|
||||
|
||||
test10(first, second)
|
||||
test11(first, second)
|
||||
test12(first, second)
|
||||
test13(first, second)
|
||||
test14(first, second)
|
||||
test15(first, second)
|
||||
test16(first, second)
|
||||
test17(first, second)
|
||||
test18(first, second)
|
||||
}
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
class Inv<T>(val prop: T)
|
||||
class In<in I>(arg: I)
|
||||
class Out<out O>(val arg: O)
|
||||
|
||||
fun test1(first: First, second: Second) = Inv(Inv(intersect(first, second)))
|
||||
fun test2(first: First, second: Second) = Inv(In(intersect(first, second)))
|
||||
fun test3(first: First, second: Second) = Inv(Out(intersect(first, second)))
|
||||
fun test4(first: First, second: Second) = In(Inv(intersect(first, second)))
|
||||
fun test5(first: First, second: Second) = In(In(intersect(first, second)))
|
||||
fun test6(first: First, second: Second) = In(Out(intersect(first, second)))
|
||||
fun test7(first: First, second: Second) = Out(Inv(intersect(first, second)))
|
||||
fun test8(first: First, second: Second) = Out(In(intersect(first, second)))
|
||||
fun test9(first: First, second: Second) = Out(Out(intersect(first, second)))
|
||||
|
||||
fun test10(first: First, second: Second) = Out(Out(Out(intersect(first, second))))
|
||||
fun test11(first: First, second: Second) = Inv(Out(Out(intersect(first, second))))
|
||||
fun test12(first: First, second: Second) = Inv(Out(In(intersect(first, second))))
|
||||
fun test13(first: First, second: Second) = Inv(In(Out(intersect(first, second))))
|
||||
fun test14(first: First, second: Second) = Inv(In(In(intersect(first, second))))
|
||||
fun test15(first: First, second: Second) = Out(Inv(Out(intersect(first, second))))
|
||||
fun test16(first: First, second: Second) = Out(Out(In(intersect(first, second))))
|
||||
fun test17(first: First, second: Second) = Out(In(Out(intersect(first, second))))
|
||||
fun test18(first: First, second: Second) = In(Out(Out(intersect(first, second))))
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun test(first: First, second: Second) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<Inv<Bound1>>")!>test1(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<In<Bound1>>")!>test2(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<Out<Bound1>>")!>test3(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("In<Inv<Bound1>>")!>test4(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("In<In<Bound1>>")!>test5(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("In<Out<Bound1>>")!>test6(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<Inv<Bound1>>")!>test7(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<In<Bound1>>")!>test8(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<Out<Bound1>>")!>test9(first, second)<!>
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<Out<Out<Bound1>>>")!>test10(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<Out<Out<Bound1>>>")!>test11(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<Out<In<Bound1>>>")!>test12(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<In<Out<Bound1>>>")!>test13(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<In<In<Bound1>>>")!>test14(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<Inv<Out<Bound1>>>")!>test15(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<Out<In<Bound1>>>")!>test16(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Out<In<Out<Bound1>>>")!>test17(first, second)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("In<Out<Out<Bound1>>>")!>test18(first, second)<!>
|
||||
}
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
|
||||
class Inv<T>(val prop: T)
|
||||
class In<in I>(arg: I)
|
||||
class Out<out O>(val arg: O)
|
||||
|
||||
fun test1(first: First, second: Second) = Inv(Inv(intersect(first, second)))
|
||||
fun test2(first: First, second: Second) = Inv(In(intersect(first, second)))
|
||||
fun test3(first: First, second: Second) = Inv(Out(intersect(first, second)))
|
||||
fun test4(first: First, second: Second) = In(Inv(intersect(first, second)))
|
||||
fun test5(first: First, second: Second) = In(In(intersect(first, second)))
|
||||
fun test6(first: First, second: Second) = In(Out(intersect(first, second)))
|
||||
fun test7(first: First, second: Second) = Out(Inv(intersect(first, second)))
|
||||
fun test8(first: First, second: Second) = Out(In(intersect(first, second)))
|
||||
fun test9(first: First, second: Second) = Out(Out(intersect(first, second)))
|
||||
|
||||
fun test10(first: First, second: Second) = Out(Out(Out(intersect(first, second))))
|
||||
fun test11(first: First, second: Second) = Inv(Out(Out(intersect(first, second))))
|
||||
fun test12(first: First, second: Second) = Inv(Out(In(intersect(first, second))))
|
||||
fun test13(first: First, second: Second) = Inv(In(Out(intersect(first, second))))
|
||||
fun test14(first: First, second: Second) = Inv(In(In(intersect(first, second))))
|
||||
fun test15(first: First, second: Second) = Out(Inv(Out(intersect(first, second))))
|
||||
fun test16(first: First, second: Second) = Out(Out(In(intersect(first, second))))
|
||||
fun test17(first: First, second: Second) = Out(In(Out(intersect(first, second))))
|
||||
fun test18(first: First, second: Second) = In(Out(Out(intersect(first, second))))
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Bound1> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun test(/*0*/ first: First, /*1*/ second: Second): kotlin.Unit
|
||||
public fun test1(/*0*/ first: First, /*1*/ second: Second): Inv<Inv<Bound1>>
|
||||
public fun test10(/*0*/ first: First, /*1*/ second: Second): Out<Out<Out<Bound1>>>
|
||||
public fun test11(/*0*/ first: First, /*1*/ second: Second): Inv<Out<Out<Bound1>>>
|
||||
public fun test12(/*0*/ first: First, /*1*/ second: Second): Inv<Out<In<Bound1>>>
|
||||
public fun test13(/*0*/ first: First, /*1*/ second: Second): Inv<In<Out<Bound1>>>
|
||||
public fun test14(/*0*/ first: First, /*1*/ second: Second): Inv<In<In<Bound1>>>
|
||||
public fun test15(/*0*/ first: First, /*1*/ second: Second): Out<Inv<Out<Bound1>>>
|
||||
public fun test16(/*0*/ first: First, /*1*/ second: Second): Out<Out<In<Bound1>>>
|
||||
public fun test17(/*0*/ first: First, /*1*/ second: Second): Out<In<Out<Bound1>>>
|
||||
public fun test18(/*0*/ first: First, /*1*/ second: Second): In<Out<Out<Bound1>>>
|
||||
public fun test2(/*0*/ first: First, /*1*/ second: Second): Inv<In<Bound1>>
|
||||
public fun test3(/*0*/ first: First, /*1*/ second: Second): Inv<Out<Bound1>>
|
||||
public fun test4(/*0*/ first: First, /*1*/ second: Second): In<Inv<Bound1>>
|
||||
public fun test5(/*0*/ first: First, /*1*/ second: Second): In<In<Bound1>>
|
||||
public fun test6(/*0*/ first: First, /*1*/ second: Second): In<Out<Bound1>>
|
||||
public fun test7(/*0*/ first: First, /*1*/ second: Second): Out<Inv<Bound1>>
|
||||
public fun test8(/*0*/ first: First, /*1*/ second: Second): Out<In<Bound1>>
|
||||
public fun test9(/*0*/ first: First, /*1*/ second: Second): Out<Out<Bound1>>
|
||||
|
||||
public interface Bound1 {
|
||||
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 interface Bound2 {
|
||||
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 object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class In</*0*/ in I> {
|
||||
public constructor In</*0*/ in I>(/*0*/ arg: I)
|
||||
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 Inv</*0*/ T> {
|
||||
public constructor Inv</*0*/ T>(/*0*/ prop: T)
|
||||
public final val prop: 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 Out</*0*/ out O> {
|
||||
public constructor Out</*0*/ out O>(/*0*/ arg: O)
|
||||
public final val arg: O
|
||||
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 object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
interface WithParam1<out T>
|
||||
interface WithParam2<out T>
|
||||
class ClsWithParam1<out T> : WithParam1<T>, WithParam2<T>
|
||||
class ClsWithParam2<out T> : WithParam1<T>, WithParam2<T>
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
fun <T: Bound1, P : WithParam1<T>> combineParams(first: T, vararg args: P): P = TODO()
|
||||
|
||||
fun topLevel() = combineParams(
|
||||
intersect(First, Second),
|
||||
ClsWithParam1<First>(),
|
||||
ClsWithParam2<Second>()
|
||||
)
|
||||
|
||||
fun test() {
|
||||
topLevel()
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
interface WithParam1<out T>
|
||||
interface WithParam2<out T>
|
||||
class ClsWithParam1<out T> : WithParam1<T>, WithParam2<T>
|
||||
class ClsWithParam2<out T> : WithParam1<T>, WithParam2<T>
|
||||
|
||||
fun <S : Bound1> intersect(vararg elements: S): S = TODO()
|
||||
fun <T: Bound1, P : WithParam1<T>> combineParams(first: T, vararg args: P): P = TODO()
|
||||
|
||||
fun topLevel() = <!DEBUG_INFO_EXPRESSION_TYPE("{WithParam1<{Bound1 & Bound2}> & WithParam2<{Bound1 & Bound2}>}")!>combineParams(
|
||||
intersect(First, Second),
|
||||
ClsWithParam1<First>(),
|
||||
ClsWithParam2<Second>()
|
||||
)<!>
|
||||
|
||||
fun test() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("WithParam1<Bound1>")!>topLevel()<!>
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T : Bound1, /*1*/ P : WithParam1<T>> combineParams(/*0*/ first: T, /*1*/ vararg args: P /*kotlin.Array<out P>*/): P
|
||||
public fun </*0*/ S : Bound1> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun test(): kotlin.Unit
|
||||
public fun topLevel(): WithParam1<Bound1>
|
||||
|
||||
public interface Bound1 {
|
||||
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 interface Bound2 {
|
||||
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 ClsWithParam1</*0*/ out T> : WithParam1<T>, WithParam2<T> {
|
||||
public constructor ClsWithParam1</*0*/ out T>()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class ClsWithParam2</*0*/ out T> : WithParam1<T>, WithParam2<T> {
|
||||
public constructor ClsWithParam2</*0*/ out T>()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface WithParam1</*0*/ out 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 interface WithParam2</*0*/ out 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
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
class Inv<T>
|
||||
|
||||
fun <O: Bound1> makeOut(vararg args: O): Inv<out O> = TODO()
|
||||
fun <I: Bound1> makeIn(vararg args: I): Inv<in I> = TODO()
|
||||
|
||||
fun testOut() = makeOut(First, Second)
|
||||
fun testIn() = makeIn(First, Second)
|
||||
|
||||
fun test() {
|
||||
testOut()
|
||||
testIn()
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
class Inv<T>
|
||||
|
||||
fun <O: Bound1> makeOut(vararg args: O): Inv<out O> = TODO()
|
||||
fun <I: Bound1> makeIn(vararg args: I): Inv<in I> = TODO()
|
||||
|
||||
fun testOut() = makeOut(First, Second)
|
||||
fun testIn() = makeIn(First, Second)
|
||||
|
||||
fun test() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<out Bound1>")!>testOut()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<in Bound1>")!>testIn()<!>
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ I : Bound1> makeIn(/*0*/ vararg args: I /*kotlin.Array<out I>*/): Inv<in I>
|
||||
public fun </*0*/ O : Bound1> makeOut(/*0*/ vararg args: O /*kotlin.Array<out O>*/): Inv<out O>
|
||||
public fun test(): kotlin.Unit
|
||||
public fun testIn(): Inv<in Bound1>
|
||||
public fun testOut(): Inv<out Bound1>
|
||||
|
||||
public interface Bound1 {
|
||||
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 interface Bound2 {
|
||||
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 object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Inv</*0*/ T> {
|
||||
public constructor Inv</*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 object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface Base {
|
||||
fun base() {}
|
||||
}
|
||||
interface Base2
|
||||
interface One : Base, Base2
|
||||
interface Two : Base, Base2
|
||||
|
||||
fun <S: Base> intersectNullable(vararg elements: S): S? = TODO()
|
||||
|
||||
fun smartCastAfterIntersection(a: One, b: Two) = run {
|
||||
val v = intersectNullable(a, b)
|
||||
if (v == null) throw Exception()
|
||||
v
|
||||
}
|
||||
|
||||
fun test(one: One, two: Two) {
|
||||
smartCastAfterIntersection(one, two)?.base()
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface Base {
|
||||
fun base() {}
|
||||
}
|
||||
interface Base2
|
||||
interface One : Base, Base2
|
||||
interface Two : Base, Base2
|
||||
|
||||
fun <S: Base> intersectNullable(vararg elements: S): S? = TODO()
|
||||
|
||||
fun smartCastAfterIntersection(a: One, b: Two) = run {
|
||||
val v = intersectNullable(a, b)
|
||||
if (v == null) throw Exception()
|
||||
v
|
||||
}
|
||||
|
||||
fun test(one: One, two: Two) {
|
||||
smartCastAfterIntersection(one, two)<!NI;UNNECESSARY_SAFE_CALL!>?.<!><!NI;UNRESOLVED_REFERENCE!>base<!>()
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Base> intersectNullable(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S?
|
||||
public fun smartCastAfterIntersection(/*0*/ a: One, /*1*/ b: Two): kotlin.Any
|
||||
public fun test(/*0*/ one: One, /*1*/ two: Two): kotlin.Unit
|
||||
|
||||
public interface Base {
|
||||
public open fun base(): kotlin.Unit
|
||||
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 interface Base2 {
|
||||
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 interface One : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Two : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Base> intersectNullable(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S?
|
||||
public fun smartCastAfterIntersection(/*0*/ a: One, /*1*/ b: Two): Base?
|
||||
public fun test(/*0*/ one: One, /*1*/ two: Two): kotlin.Unit
|
||||
|
||||
public interface Base {
|
||||
public open fun base(): kotlin.Unit
|
||||
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 interface Base2 {
|
||||
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 interface One : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Two : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface Base {
|
||||
fun base() {}
|
||||
}
|
||||
interface Base2 : Base3
|
||||
interface Base3
|
||||
interface One : Base, Base2
|
||||
interface Two : Base, Base2
|
||||
interface Three : Base, Base3
|
||||
|
||||
object O1 : One
|
||||
object O2 : Two
|
||||
object O3 : Three
|
||||
|
||||
fun <S: Base> intersect(vararg elements: S): S = TODO()
|
||||
fun <S> intersectNoBound(vararg elements: S): S = TODO()
|
||||
|
||||
fun some(a: One, b: Two, c: Three) = intersectNoBound(intersect(a, b), c)
|
||||
|
||||
fun test(arg: Base, arg2: Base) {
|
||||
some(O1, O2, O3).base()
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface Base {
|
||||
fun base() {}
|
||||
}
|
||||
interface Base2 : Base3
|
||||
interface Base3
|
||||
interface One : Base, Base2
|
||||
interface Two : Base, Base2
|
||||
interface Three : Base, Base3
|
||||
|
||||
object O1 : One
|
||||
object O2 : Two
|
||||
object O3 : Three
|
||||
|
||||
fun <S: Base> intersect(vararg elements: S): S = TODO()
|
||||
fun <S> intersectNoBound(vararg elements: S): S = TODO()
|
||||
|
||||
fun some(a: One, b: Two, c: Three) = intersectNoBound(intersect(a, b), c)
|
||||
|
||||
fun test(arg: Base, arg2: Base) {
|
||||
some(O1, O2, O3).<!NI;UNRESOLVED_REFERENCE!>base<!>()
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Base> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun </*0*/ S> intersectNoBound(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun some(/*0*/ a: One, /*1*/ b: Two, /*2*/ c: Three): kotlin.Any
|
||||
public fun test(/*0*/ arg: Base, /*1*/ arg2: Base): kotlin.Unit
|
||||
|
||||
public interface Base {
|
||||
public open fun base(): kotlin.Unit
|
||||
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 interface Base2 : Base3 {
|
||||
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 interface Base3 {
|
||||
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 object O1 : One {
|
||||
private constructor O1()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 object O2 : Two {
|
||||
private constructor O2()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 object O3 : Three {
|
||||
private constructor O3()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 interface One : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Three : Base, Base3 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Two : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Base> intersect(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun </*0*/ S> intersectNoBound(/*0*/ vararg elements: S /*kotlin.Array<out S>*/): S
|
||||
public fun some(/*0*/ a: One, /*1*/ b: Two, /*2*/ c: Three): Base
|
||||
public fun test(/*0*/ arg: Base, /*1*/ arg2: Base): kotlin.Unit
|
||||
|
||||
public interface Base {
|
||||
public open fun base(): kotlin.Unit
|
||||
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 interface Base2 : Base3 {
|
||||
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 interface Base3 {
|
||||
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 object O1 : One {
|
||||
private constructor O1()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 object O2 : Two {
|
||||
private constructor O2()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 object O3 : Three {
|
||||
private constructor O3()
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
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 interface One : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Three : Base, Base3 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Two : Base, Base2 {
|
||||
public open override /*1*/ /*fake_override*/ fun base(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> select(vararg args: S): S = TODO()
|
||||
|
||||
class Cls {
|
||||
val property = select(First, Second)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val v = Cls().property
|
||||
v
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION
|
||||
|
||||
interface Bound1
|
||||
interface Bound2
|
||||
object First : Bound1, Bound2
|
||||
object Second : Bound1, Bound2
|
||||
|
||||
fun <S : Bound1> select(vararg args: S): S = TODO()
|
||||
|
||||
class Cls {
|
||||
val property = select(First, Second)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val v = Cls().property
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Bound1")!>v<!>
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ S : Bound1> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public interface Bound1 {
|
||||
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 interface Bound2 {
|
||||
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 Cls {
|
||||
public constructor Cls()
|
||||
public final val property: Bound1
|
||||
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 object First : Bound1, Bound2 {
|
||||
private constructor First()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Second : Bound1, Bound2 {
|
||||
private constructor Second()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user