Alphabetical sort wrapped intersection types for rendered diagnostics
This commit is contained in:
+23
-24
@@ -1,5 +1,3 @@
|
||||
// !WITH_ENUM_CLASSES
|
||||
// !WITH_SEALED_CLASSES
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
@@ -8,23 +6,24 @@
|
||||
* PLACE: when-expression -> paragraph 11 -> sentence 1
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: Check when exhaustive via else entry (when with bound value, redundant else).
|
||||
* HELPERS: enumClasses, sealedClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _EnumClass): String = when (value_1) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
_EnumClass.SOUTH -> ""
|
||||
_EnumClass.WEST -> ""
|
||||
fun case_1(value_1: EnumClass): String = when (value_1) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.WEST -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _EnumClass?): String = when (value_1) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
_EnumClass.SOUTH -> ""
|
||||
_EnumClass.WEST -> ""
|
||||
fun case_2(value_1: EnumClass?): String = when (value_1) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.WEST -> ""
|
||||
null -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
@@ -45,31 +44,31 @@ fun case_4(value_1: Boolean?): String = when (value_1) {
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: _SealedClass): String = when (value_1) {
|
||||
is _SealedChild1 -> ""
|
||||
is _SealedChild2 -> ""
|
||||
is _SealedChild3 -> ""
|
||||
fun case_5(value_1: SealedClass): String = when (value_1) {
|
||||
is SealedChild1 -> ""
|
||||
is SealedChild2 -> ""
|
||||
is SealedChild3 -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: _SealedClass?): String = when (value_1) {
|
||||
is _SealedChild1 -> ""
|
||||
is _SealedChild2 -> ""
|
||||
is _SealedChild3 -> ""
|
||||
fun case_6(value_1: SealedClass?): String = when (value_1) {
|
||||
is SealedChild1 -> ""
|
||||
is SealedChild2 -> ""
|
||||
is SealedChild3 -> ""
|
||||
null -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: _SealedClassSingle): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is _SealedClassSingle<!> -> ""
|
||||
fun case_7(value_1: SealedClassSingle): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is SealedClassSingle<!> -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 8
|
||||
fun case_8(value_1: _SealedClassSingle?): String = when (value_1) {
|
||||
is _SealedClassSingle -> ""
|
||||
fun case_8(value_1: SealedClassSingle?): String = when (value_1) {
|
||||
is SealedClassSingle -> ""
|
||||
null -> ""
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
|
||||
}
|
||||
+35
-35
@@ -1,5 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// !WITH_SEALED_CLASSES
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
@@ -8,59 +7,60 @@
|
||||
* PLACE: when-expression -> paragraph 11 -> sentence 6
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered.
|
||||
* HELPERS: sealedClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _SealedClass): Int = when (value_1) {
|
||||
is _SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
|
||||
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
|
||||
is _SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2
|
||||
fun case_1(value_1: SealedClass): Int = when (value_1) {
|
||||
is SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
|
||||
is SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
|
||||
is SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _SealedClass): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is _SealedClass<!> -> ""
|
||||
fun case_2(value_1: SealedClass): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is SealedClass<!> -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: _SealedClassWithMethods): String = when (value_1) {
|
||||
is _SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
|
||||
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
|
||||
is _SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m3()
|
||||
fun case_3(value_1: SealedClassWithMethods): String = when (value_1) {
|
||||
is SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
|
||||
is SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
|
||||
is SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m3()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: _SealedClassWithObjects): String = when (value_1) {
|
||||
_SealedWithObjectsChild1 -> ""
|
||||
_SealedWithObjectsChild2 -> ""
|
||||
_SealedWithObjectsChild3 -> ""
|
||||
fun case_4(value_1: SealedClassWithObjects): String = when (value_1) {
|
||||
SealedWithObjectsChild1 -> ""
|
||||
SealedWithObjectsChild2 -> ""
|
||||
SealedWithObjectsChild3 -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: _SealedClassMixed): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
is _SealedMixedChild2 -> ""
|
||||
is _SealedMixedChild3 -> ""
|
||||
_SealedMixedChildObject1 -> ""
|
||||
_SealedMixedChildObject2 -> ""
|
||||
_SealedMixedChildObject3 -> ""
|
||||
fun case_5(value_1: SealedClassMixed): String = when (value_1) {
|
||||
is SealedMixedChild1 -> ""
|
||||
is SealedMixedChild2 -> ""
|
||||
is SealedMixedChild3 -> ""
|
||||
SealedMixedChildObject1 -> ""
|
||||
SealedMixedChildObject2 -> ""
|
||||
SealedMixedChildObject3 -> ""
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTCASE NUMBER: 6
|
||||
* DISCUSSION: is it correct that objects can be checked using the type checking operator?
|
||||
*/
|
||||
fun case_6(value_1: _SealedClassMixed): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
is _SealedMixedChild2 -> ""
|
||||
is _SealedMixedChild3 -> ""
|
||||
is _SealedMixedChildObject1 -> ""
|
||||
is _SealedMixedChildObject2 -> ""
|
||||
is _SealedMixedChildObject3 -> ""
|
||||
fun case_6(value_1: SealedClassMixed): String = when (value_1) {
|
||||
is SealedMixedChild1 -> ""
|
||||
is SealedMixedChild2 -> ""
|
||||
is SealedMixedChild3 -> ""
|
||||
is SealedMixedChildObject1 -> ""
|
||||
is SealedMixedChildObject2 -> ""
|
||||
is SealedMixedChildObject3 -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: _SealedClassEmpty): String = when (value_1) {
|
||||
fun case_7(value_1: SealedClassEmpty): String = when (value_1) {
|
||||
else -> ""
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ fun case_7(value_1: _SealedClassEmpty): String = when (value_1) {
|
||||
* UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
* ISSUES: KT-22996
|
||||
*/
|
||||
fun case_8(value: _SealedClass?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
is _SealedChild1, !is _SealedChild3?, <!USELESS_IS_CHECK!>is _SealedChild3?<!> -> ""
|
||||
fun case_8(value: SealedClass?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
is SealedChild1, !is SealedChild3?, <!USELESS_IS_CHECK!>is SealedChild3?<!> -> ""
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -78,7 +78,7 @@ fun case_8(value: _SealedClass?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
* UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
* ISSUES: KT-22996
|
||||
*/
|
||||
fun case_9(value: _SealedClass?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
is _SealedChild1, !is _SealedChild3 -> ""
|
||||
<!USELESS_IS_CHECK!>is _SealedChild3?<!> -> ""
|
||||
fun case_9(value: SealedClass?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
is SealedChild1, !is SealedChild3 -> ""
|
||||
<!USELESS_IS_CHECK!>is SealedChild3?<!> -> ""
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,4 +1,3 @@
|
||||
// !WITH_ENUM_CLASSES
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
@@ -7,17 +6,18 @@
|
||||
* PLACE: when-expression -> paragraph 11 -> sentence 7
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Check when exhaustive when all enumerated values are checked.
|
||||
* HELPERS: enumClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(dir: _EnumClass): String = when (dir) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
_EnumClass.SOUTH -> ""
|
||||
_EnumClass.WEST -> ""
|
||||
fun case_1(dir: EnumClass): String = when (dir) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.WEST -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _EnumClassSingle): String = when (value_1) {
|
||||
_EnumClassSingle.EVERYTHING -> ""
|
||||
fun case_2(value_1: EnumClassSingle): String = when (value_1) {
|
||||
EnumClassSingle.EVERYTHING -> ""
|
||||
}
|
||||
|
||||
+9
-9
@@ -1,4 +1,3 @@
|
||||
// !WITH_ENUM_CLASSES
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
@@ -7,20 +6,21 @@
|
||||
* PLACE: when-expression -> paragraph 11 -> sentence 8
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Check when exhaustive when enumerated values are checked and contains a null check.
|
||||
* HELPERS: enumClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _EnumClass?): String = when (value_1) {
|
||||
_EnumClass.EAST -> ""
|
||||
_EnumClass.NORTH -> ""
|
||||
_EnumClass.SOUTH -> ""
|
||||
_EnumClass.WEST -> ""
|
||||
fun case_1(value_1: EnumClass?): String = when (value_1) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.WEST -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _EnumClassSingle?): String = when (value_1) {
|
||||
_EnumClassSingle.EVERYTHING -> ""
|
||||
fun case_2(value_1: EnumClassSingle?): String = when (value_1) {
|
||||
EnumClassSingle.EVERYTHING -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ fun case_2(value_1: _EnumClassSingle?): String = when (value_1) {
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-26044
|
||||
*/
|
||||
fun case_3(value_1: _EnumClassEmpty?): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) {
|
||||
fun case_3(value_1: EnumClassEmpty?): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) {
|
||||
null -> ""
|
||||
}
|
||||
|
||||
+30
-30
@@ -1,4 +1,3 @@
|
||||
// !WITH_SEALED_CLASSES
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
@@ -7,46 +6,47 @@
|
||||
* PLACE: when-expression -> paragraph 11 -> sentence 8
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered and contains a null check.
|
||||
* HELPERS: sealedClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: _SealedClass?): Int = when (value_1) {
|
||||
is _SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
|
||||
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
|
||||
is _SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2
|
||||
fun case_1(value_1: SealedClass?): Int = when (value_1) {
|
||||
is SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
|
||||
is SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
|
||||
is SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2
|
||||
null -> 0
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: _SealedClass?): String = when (value_1) {
|
||||
is _SealedClass -> ""
|
||||
fun case_2(value_1: SealedClass?): String = when (value_1) {
|
||||
is SealedClass -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: _SealedClassWithMethods?): String = when (value_1) {
|
||||
is _SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
|
||||
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
|
||||
is _SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m3()
|
||||
fun case_3(value_1: SealedClassWithMethods?): String = when (value_1) {
|
||||
is SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
|
||||
is SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
|
||||
is SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m3()
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: _SealedClassWithObjects?): String = when (value_1) {
|
||||
_SealedWithObjectsChild1 -> ""
|
||||
_SealedWithObjectsChild2 -> ""
|
||||
_SealedWithObjectsChild3 -> ""
|
||||
fun case_4(value_1: SealedClassWithObjects?): String = when (value_1) {
|
||||
SealedWithObjectsChild1 -> ""
|
||||
SealedWithObjectsChild2 -> ""
|
||||
SealedWithObjectsChild3 -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
is _SealedMixedChild2 -> ""
|
||||
is _SealedMixedChild3 -> ""
|
||||
_SealedMixedChildObject1 -> ""
|
||||
_SealedMixedChildObject2 -> ""
|
||||
_SealedMixedChildObject3 -> ""
|
||||
fun case_5(value_1: SealedClassMixed?): String = when (value_1) {
|
||||
is SealedMixedChild1 -> ""
|
||||
is SealedMixedChild2 -> ""
|
||||
is SealedMixedChild3 -> ""
|
||||
SealedMixedChildObject1 -> ""
|
||||
SealedMixedChildObject2 -> ""
|
||||
SealedMixedChildObject3 -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ fun case_5(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
* TESTCASE NUMBER: 6
|
||||
* DISCUSSION: is it correct that objects can be checked using the type checking operator?
|
||||
*/
|
||||
fun case_6(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
is _SealedMixedChild1 -> ""
|
||||
is _SealedMixedChild2 -> ""
|
||||
is _SealedMixedChild3 -> ""
|
||||
is _SealedMixedChildObject1 -> ""
|
||||
is _SealedMixedChildObject2 -> ""
|
||||
is _SealedMixedChildObject3 -> ""
|
||||
fun case_6(value_1: SealedClassMixed?): String = when (value_1) {
|
||||
is SealedMixedChild1 -> ""
|
||||
is SealedMixedChild2 -> ""
|
||||
is SealedMixedChild3 -> ""
|
||||
is SealedMixedChildObject1 -> ""
|
||||
is SealedMixedChildObject2 -> ""
|
||||
is SealedMixedChildObject3 -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
@@ -69,6 +69,6 @@ fun case_6(value_1: _SealedClassMixed?): String = when (value_1) {
|
||||
* UNEXPECTED BEHAVIOUR: must be exhaustive
|
||||
* ISSUES: KT-26044
|
||||
*/
|
||||
fun case_7(value: _SealedClassEmpty?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
fun case_7(value: SealedClassEmpty?): String = <!NO_ELSE_IN_WHEN!>when<!> (value) {
|
||||
null -> ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user