Alphabetical sort wrapped intersection types for rendered diagnostics
This commit is contained in:
Vendored
+11
-11
@@ -1,5 +1,4 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
||||
// !WITH_CLASSES
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE)
|
||||
@@ -8,6 +7,7 @@
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Check report about use contracts in literal functions, lambdas or not top-level functions.
|
||||
* ISSUES: KT-26149
|
||||
* HELPERS: classes
|
||||
*/
|
||||
|
||||
import kotlin.contracts.*
|
||||
@@ -46,10 +46,10 @@ object case_3 {
|
||||
* TESTCASE NUMBER: 4
|
||||
* ISSUES: KT-26244
|
||||
*/
|
||||
class case_4 : _ClassLevel3() {
|
||||
class case_4 : ClassLevel3() {
|
||||
|
||||
fun <T : Number?>T.case_4_1(): Boolean {
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns(false) implies (<!USELESS_IS_CHECK!>this@case_4 !is _ClassLevel1<!>) }
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns(false) implies (<!USELESS_IS_CHECK!>this@case_4 !is ClassLevel1<!>) }
|
||||
return this == null
|
||||
}
|
||||
|
||||
@@ -70,30 +70,30 @@ class case_4 : _ClassLevel3() {
|
||||
|
||||
fun <T>T.case_4_5_wrap() {
|
||||
fun case_4_5_contract() {
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns() implies (this@case_4_5_wrap is _ClassLevel1) }
|
||||
if (this@case_4_5_wrap !is _ClassLevel1) throw Exception()
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns() implies (this@case_4_5_wrap is ClassLevel1) }
|
||||
if (this@case_4_5_wrap !is ClassLevel1) throw Exception()
|
||||
}
|
||||
case_4_5_contract()
|
||||
println("!")
|
||||
}
|
||||
|
||||
fun case_4_5() = _ClassLevel3().case_4_5_wrap()
|
||||
fun case_4_5() = ClassLevel3().case_4_5_wrap()
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTCASE NUMBER: 5
|
||||
* ISSUES: KT-26244
|
||||
*/
|
||||
class case_5<T> : _ClassLevel5() {
|
||||
class case_5<T> : ClassLevel5() {
|
||||
inner class case_5_1 {
|
||||
fun <K : Number?>K.case_5_1_1() {
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns() implies (this@case_5_1 !is _ClassLevel1 && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is _ClassLevel1<!> && this@case_5_1_1 is Float) }
|
||||
if (!(this@case_5_1 !is _ClassLevel1 && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is _ClassLevel1<!> && this is Float)) throw Exception()
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns() implies (this@case_5_1 !is ClassLevel1 && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> && this@case_5_1_1 is Float) }
|
||||
if (!(this@case_5_1 !is ClassLevel1 && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> && this is Float)) throw Exception()
|
||||
}
|
||||
|
||||
fun case_5_1_2() {
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns() implies (this@case_5_1 !is _ClassLevel1 || <!USELESS_IS_CHECK!>this@case_5 is _ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>) }
|
||||
if (!(this@case_5_1 !is _ClassLevel1 || <!USELESS_IS_CHECK!>this@case_5 is _ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>)) throw Exception()
|
||||
<!CONTRACT_NOT_ALLOWED!>contract<!> { returns() implies (this@case_5_1 !is ClassLevel1 || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>) }
|
||||
if (!(this@case_5_1 !is ClassLevel1 || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>)) throw Exception()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt
Vendored
+112
-23
@@ -3,11 +3,15 @@ package
|
||||
public fun case_1(): kotlin.Unit
|
||||
public fun case_2(): kotlin.Unit
|
||||
|
||||
public final class _Class {
|
||||
public constructor _Class()
|
||||
public final class Class {
|
||||
public constructor Class()
|
||||
public final val prop_1: kotlin.Int = 1
|
||||
public final val prop_2: kotlin.Int = 2
|
||||
public final val prop_3: kotlin.Int = 3
|
||||
public final val prop_4: kotlin.Float? = 3.0.toFloat()
|
||||
public final val prop_5: kotlin.Float = 3.0.toFloat()
|
||||
public final val prop_6: kotlin.String = "..."
|
||||
public final val prop_7: kotlin.Nothing? = "..."
|
||||
public final operator fun contains(/*0*/ a: kotlin.Char): kotlin.Boolean
|
||||
public final operator fun contains(/*0*/ a: kotlin.Int): kotlin.Boolean
|
||||
public final operator fun contains(/*0*/ a: kotlin.Long): kotlin.Boolean
|
||||
@@ -15,9 +19,9 @@ public final class _Class {
|
||||
public final fun fun_1(): (kotlin.Int) -> (kotlin.Int) -> kotlin.Int
|
||||
public final fun fun_2(/*0*/ value_1: kotlin.Int): kotlin.Int
|
||||
public final fun fun_3(/*0*/ value_1: kotlin.Int): (kotlin.Int) -> kotlin.Int
|
||||
public final fun getCharArray(/*0*/ value_1: kotlin.Char): kotlin.CharArray
|
||||
public final fun getIntArray(/*0*/ value_1: kotlin.Int): kotlin.IntArray
|
||||
public final fun getLongArray(/*0*/ value_1: kotlin.Long): kotlin.LongArray
|
||||
public final fun getCharArray(): kotlin.CharArray
|
||||
public final fun getIntArray(): kotlin.IntArray
|
||||
public final fun getLongArray(): kotlin.LongArray
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
@@ -31,50 +35,71 @@ public final class _Class {
|
||||
}
|
||||
}
|
||||
|
||||
public open class _ClassLevel1 {
|
||||
public constructor _ClassLevel1()
|
||||
public open class ClassLevel1 {
|
||||
public constructor ClassLevel1()
|
||||
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 final fun test1(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class _ClassLevel2 : _ClassLevel1 {
|
||||
public constructor _ClassLevel2()
|
||||
public open class ClassLevel2 : ClassLevel1 {
|
||||
public constructor ClassLevel2()
|
||||
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 final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||
public final fun test2(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class _ClassLevel3 : _ClassLevel2 {
|
||||
public constructor _ClassLevel3()
|
||||
public open class ClassLevel3 : ClassLevel2 {
|
||||
public constructor ClassLevel3()
|
||||
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 final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit
|
||||
public final fun test3(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class _ClassLevel4 : _ClassLevel3 {
|
||||
public constructor _ClassLevel4()
|
||||
public open class ClassLevel4 : ClassLevel3 {
|
||||
public constructor ClassLevel4()
|
||||
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 final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit
|
||||
public final fun test4(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class _ClassLevel5 : _ClassLevel4 {
|
||||
public constructor _ClassLevel5()
|
||||
public open class ClassLevel5 : ClassLevel4 {
|
||||
public constructor ClassLevel5()
|
||||
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 final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit
|
||||
public final fun test5(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class _ClassLevel6 : _ClassLevel5 {
|
||||
public constructor _ClassLevel6()
|
||||
public final class ClassLevel6 : ClassLevel5 {
|
||||
public constructor ClassLevel6()
|
||||
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 final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test5(): kotlin.Unit
|
||||
public final fun test6(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class _ClassWithCompanionObject {
|
||||
public constructor _ClassWithCompanionObject()
|
||||
public final class ClassWithCompanionObject {
|
||||
public constructor ClassWithCompanionObject()
|
||||
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
|
||||
@@ -87,13 +112,69 @@ public final class _ClassWithCompanionObject {
|
||||
}
|
||||
}
|
||||
|
||||
public final class _EmptyClass {
|
||||
public constructor _EmptyClass()
|
||||
public final class ClassWithSixTypeParameters</*0*/ K, /*1*/ in L, /*2*/ out M, /*3*/ O, /*4*/ in P, /*5*/ out R> {
|
||||
public constructor ClassWithSixTypeParameters</*0*/ K, /*1*/ in L, /*2*/ out M, /*3*/ O, /*4*/ in P, /*5*/ out R>()
|
||||
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 ClassWithThreeTypeParameters</*0*/ K, /*1*/ L, /*2*/ M> {
|
||||
public constructor ClassWithThreeTypeParameters</*0*/ K, /*1*/ L, /*2*/ M>(/*0*/ x: K, /*1*/ y: L, /*2*/ z: M)
|
||||
public final val x: K
|
||||
public final val y: L
|
||||
public final val z: M
|
||||
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 ClassWithTwoTypeParameters</*0*/ K, /*1*/ L> {
|
||||
public constructor ClassWithTwoTypeParameters</*0*/ K, /*1*/ L>()
|
||||
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 final fun test1(): [ERROR : T]?
|
||||
public final fun test2(): K?
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class EmptyClass {
|
||||
public constructor EmptyClass()
|
||||
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 In</*0*/ in T> {
|
||||
public constructor In</*0*/ in T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun </*0*/ K : T> getWithUpperBoundT(): K
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun put(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Inv</*0*/ T> {
|
||||
public constructor Inv</*0*/ T>(/*0*/ x: T = ...)
|
||||
public final val x: T
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun get(): T
|
||||
public final fun getNullable(): T?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun put(/*0*/ x: T): kotlin.Unit
|
||||
public final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out T> {
|
||||
public constructor Out</*0*/ out T>(/*0*/ x: T = ...)
|
||||
public final val x: T
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun get(): T
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object case_3 {
|
||||
private constructor case_3()
|
||||
public final fun case_3(/*0*/ block: () -> kotlin.Unit): kotlin.Unit
|
||||
@@ -102,12 +183,15 @@ public object case_3 {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class case_4 : _ClassLevel3 {
|
||||
public final class case_4 : ClassLevel3 {
|
||||
public constructor case_4()
|
||||
public final fun case_4_2(/*0*/ number: kotlin.Int?): kotlin.Boolean
|
||||
public final fun case_4_5(): 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 final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final fun </*0*/ T : kotlin.Number?> T.case_4_1(): kotlin.Boolean
|
||||
public final fun </*0*/ T> T?.case_4_3(): kotlin.Boolean
|
||||
@@ -115,10 +199,15 @@ public final class case_4 : _ClassLevel3 {
|
||||
public final fun </*0*/ T> T.case_4_5_wrap(): kotlin.Unit
|
||||
}
|
||||
|
||||
public final class case_5</*0*/ T> : _ClassLevel5 {
|
||||
public final class case_5</*0*/ T> : ClassLevel5 {
|
||||
public constructor case_5</*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 final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ fun test5(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final inner class case_5_1 /*captured type parameters: /*0*/ T*/ {
|
||||
|
||||
Reference in New Issue
Block a user