Implement tests map generator and refactor folder structure to spec tests linking

This commit is contained in:
victor.petukhov
2019-08-19 11:26:12 +03:00
parent 28da325a11
commit cf692fb257
217 changed files with 2827 additions and 1787 deletions
@@ -0,0 +1,32 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: type-system, introduction -> paragraph 5 -> sentence 2
* NUMBER: 1
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-26947
*/
val map = mapOf("x" to null)
fun box(): String {
try {
val x: Int by mapOf("x" to null)
} catch (e: KotlinNullPointerException) {
return "OK"
} catch (e: NullPointerException) {
return "OK"
}
try {
val x: Any by map
} catch (e: KotlinNullPointerException) {
return "OK"
} catch (e: NullPointerException) {
return "OK"
}
return "Error"
}
@@ -0,0 +1,5 @@
fun <T> checkSubtype(t: T) = t
class CheckType<T>
fun <E> CheckType<E>.check() {}
infix fun <T> T.checkType(f: CheckType<T>.() -> Unit) {}
@@ -12,8 +12,8 @@ class Class {
val prop_11: Int = 10
var prop_12: String = ""
val prop_13: Any? = ""
val prop_14: Comparable<*>? = ""
val prop_15: Iterable<*>? = ""
val prop_14: Comparable<*>? = null
val prop_15: Iterable<*>? = null
fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }}
fun fun_2(value_1: Int): Int = value_1 * 2
@@ -25,7 +25,7 @@ class Class {
operator fun get(i1: Int) = 10
operator fun set(i1: Int, el: Int) {}
operator fun invoke() {}
operator fun invoke(x) = { x: Any -> x }
operator fun invoke(x: Any) = { x: Any -> x }
operator fun invoke(x: Any, y: Any) {}
operator fun contains(a: Int) = a > 30
operator fun contains(a: Long) = a > 30L
@@ -90,29 +90,29 @@ class ClassLevel6: ClassLevel5() {
class Inv<T>(val x: T = null as T) {
val prop_1: Inv<T>? = null
val prop_2: T? = null
val prop_3: T = null
val prop_3: T = null as T
val prop_4 = 10
fun test() {}
fun get() = x
fun put(x: T) {}
fun getNullable(): T? = select(x, null)
fun getNullable(): T? = if (true) x else null
}
class In<in T>() {
fun put(x: T) {}
fun <K : T> getWithUpperBoundT(): K = x <!UNCHECKED_CAST!>as K<!>
fun <K : T> getWithUpperBoundT(x: T): K = x as K
}
class Out<out T>(val x: T = null as T) {
val prop_1: Inv<T>? = null
val prop_1: Inv<out T>? = null
val prop_2: T? = null
fun get() = x
}
open class ClassWithTwoTypeParameters<K, L> {
fun test1(): T? { return null }
fun test1(): L? { return null }
fun test2(): K? { return null }
}
@@ -19,10 +19,10 @@ fun <K> expandOutWithRemoveNullable(vararg x: Out<K?>): K = x[0] as K
fun <K> removeNullable(vararg x: K?): K = x as K
fun <T> T.funT() = 10
fun <T> T?.funNullableT = 10
fun <T> T?.funNullableT() = 10
fun Any.funAny() = 10
fun Any?.funNullableAny = 10
fun Any?.funNullableAny() = 10
fun funNothingQuest() = null
@@ -12,7 +12,7 @@ sealed class SealedClassSingle
data class SealedSingleChild1(val number: Int) : SealedClassSingle()
sealed class SealedClassSingleWithObject
object SealedSingleWithObjectChild1: Expr3() {}
object SealedSingleWithObjectChild1: SealedClassSingleWithObject() {}
sealed class SealedClassEmpty
@@ -1,23 +0,0 @@
// !CHECK_TYPE
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, boolean-literals -> paragraph 1 -> sentence 3
* NUMBER: 1
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY
*/
// TESTCASE NUMBER: 1
fun case_1() {
true checkType { <!TYPE_MISMATCH!>_<!><Boolean?>() }
false checkType { <!TYPE_MISMATCH!>_<!><Boolean?>() }
true checkType { <!TYPE_MISMATCH!>_<!><Any?>() }
false checkType { <!TYPE_MISMATCH!>_<!><Any>() }
true checkType { <!TYPE_MISMATCH!>_<!><Nothing?>() }
false checkType { <!TYPE_MISMATCH!>_<!><Nothing>() }
}
@@ -1,3 +0,0 @@
package
public fun case_1(): kotlin.Unit
@@ -1,20 +0,0 @@
// !CHECK_TYPE
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, boolean-literals -> paragraph 1 -> sentence 3
* NUMBER: 1
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY
*/
// TESTCASE NUMBER: 1
fun case_1() {
true checkType { _<Boolean>() }
false checkType { _<Boolean>() }
checkSubtype<Boolean>(true)
checkSubtype<Boolean>(false)
}
@@ -1,3 +0,0 @@
package
public fun case_1(): kotlin.Unit
@@ -1,20 +0,0 @@
// !CHECK_TYPE
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, boolean-literals -> paragraph 1 -> sentence 3
* NUMBER: 2
* DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class.
* NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY
*/
// TESTCASE NUMBER: 1
fun case_1() {
checkSubtype<Boolean?>(true)
checkSubtype<Boolean?>(false)
checkSubtype<Any>(true)
checkSubtype<Any>(false)
}
@@ -1,3 +0,0 @@
package
public fun case_1(): kotlin.Unit
@@ -1,21 +0,0 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Various integer literals with not allowed long literal mark in lower case (type checking).
*/
// TESTCASE NUMBER: 1
fun case_1() {
0<!WRONG_LONG_SUFFIX!>l<!> checkType { _<Long>() }
10000000000000<!WRONG_LONG_SUFFIX!>l<!> checkType { _<Long>() }
0X000Af10cD<!WRONG_LONG_SUFFIX!>l<!> checkType { _<Long>() }
0x0_0<!WRONG_LONG_SUFFIX!>l<!> checkType { _<Long>() }
0b100_000_111_111<!WRONG_LONG_SUFFIX!>l<!> checkType { _<Long>() }
0b0<!WRONG_LONG_SUFFIX!>l<!> checkType { _<Long>() }
}
@@ -1,122 +0,0 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 3
* DESCRIPTION: Type checking (comparison with invalid types) of various integer literals.
*/
// TESTCASE NUMBER: 1
fun case_1() {
0 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
0 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
0 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
}
// TESTCASE NUMBER: 2
fun case_2() {
127 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
127 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
127 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>128<!>)
128 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
128 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
128 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
-128 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-128 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-128 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-129<!>)
-129 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-129 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-129 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
}
// TESTCASE NUMBER: 3
fun case_3() {
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>32767<!>)
32767 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
32767 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
32767 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>32768<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>32768<!>)
32768 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
32768 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
32768 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-32768<!>)
-32768 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-32768 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-32768 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-32769<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-32769<!>)
-32769 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-32769 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-32769 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
}
// TESTCASE NUMBER: 4
fun case_4() {
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483647<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483647<!>)
2147483647 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
2147483647 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
2147483647 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483648<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483648<!>)
checkSubtype<Int>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483648<!>)
2147483648 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
2147483648 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
2147483648 checkType { <!TYPE_MISMATCH!>_<!><Int>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-2147483648<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-2147483648<!>)
-2147483648 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-2147483648 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-2147483648 checkType { <!TYPE_MISMATCH!>_<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-2147483649<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-2147483649<!>)
checkSubtype<Int>(<!TYPE_MISMATCH!>-2147483649<!>)
-2147483649 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-2147483649 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-2147483649 checkType { <!TYPE_MISMATCH!>_<!><Int>() }
}
// TESTCASE NUMBER: 5
fun case_5() {
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>9223372036854775807<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>9223372036854775807<!>)
checkSubtype<Int>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>9223372036854775807<!>)
9223372036854775807 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
9223372036854775807 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
9223372036854775807 checkType { <!TYPE_MISMATCH!>_<!><Int>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-9223372036854775807<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-9223372036854775807<!>)
checkSubtype<Int>(<!TYPE_MISMATCH!>-9223372036854775807<!>)
-9223372036854775807 checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-9223372036854775807 checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-9223372036854775807 checkType { <!TYPE_MISMATCH!>_<!><Int>() }
}
// TESTCASE NUMBER: 6
fun case_6() {
checkSubtype<Byte>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
checkSubtype<Int>(-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
checkSubtype<Long>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { <!TYPE_MISMATCH!>_<!><Short>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { _<Int>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { <!TYPE_MISMATCH!>_<!><Long>() }
}
@@ -1,33 +0,0 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Type checking of various integer literals with long literal mark.
*/
// TESTCASE NUMBER: 1
fun case_1() {
0L checkType { _<Long>() }
10000000000000L checkType { _<Long>() }
0X000Af10cDL checkType { _<Long>() }
0x0_0L checkType { _<Long>() }
0b100_000_111_111L checkType { _<Long>() }
0b0L checkType { _<Long>() }
}
// TESTCASE NUMBER: 2
fun case_2() {
9223372036854775807L checkType { _<Long>() }
-9223372036854775807L checkType { _<Long>() }
0X7FFFFFFFFFFFFFFFL checkType { _<Long>() }
-0x7FFFFFFFFFFFFFFFL checkType { _<Long>() }
0b111111111111111111111111111111111111111111111111111111111111111L checkType { _<Long>() }
-0B111111111111111111111111111111111111111111111111111111111111111L checkType { _<Long>() }
}
@@ -1,16 +0,0 @@
package
public val value_1: kotlin.Unit
public val value_10: kotlin.Unit
public val value_11: kotlin.Unit
public val value_12: kotlin.Unit
public val value_13: kotlin.Unit
public val value_14: kotlin.Unit
public val value_2: kotlin.Unit
public val value_3: kotlin.Unit
public val value_4: kotlin.Unit
public val value_5: kotlin.Unit
public val value_6: kotlin.Unit
public val value_7: kotlin.Unit
public val value_8: kotlin.Unit
public val value_9: kotlin.Unit
@@ -0,0 +1,21 @@
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: expressions, constant-literals, boolean-literals -> paragraph 1 -> sentence 3
* NUMBER: 1
* DESCRIPTION: Checking of type for Boolean values
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
true checkType { <!TYPE_MISMATCH!>check<!><Boolean?>() }
false checkType { <!TYPE_MISMATCH!>check<!><Boolean?>() }
true checkType { <!TYPE_MISMATCH!>check<!><Any?>() }
false checkType { <!TYPE_MISMATCH!>check<!><Any>() }
true checkType { <!TYPE_MISMATCH!>check<!><Nothing?>() }
false checkType { <!TYPE_MISMATCH!>check<!><Nothing>() }
}
@@ -0,0 +1,13 @@
package
public fun case_1(): kotlin.Unit
public fun </*0*/ T> checkSubtype(/*0*/ t: T): T
public fun </*0*/ E> Inv<E>.check(): kotlin.Unit
public infix fun </*0*/ T> T.checkType(/*0*/ f: Inv<T>.() -> kotlin.Unit): kotlin.Unit
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
}
@@ -0,0 +1,18 @@
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: expressions, constant-literals, boolean-literals -> paragraph 1 -> sentence 3
* NUMBER: 1
* DESCRIPTION: Checking of type for Boolean values
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
true checkType { check<Boolean>() }
false checkType { check<Boolean>() }
checkSubtype<Boolean>(true)
checkSubtype<Boolean>(false)
}
@@ -0,0 +1,13 @@
package
public fun case_1(): kotlin.Unit
public fun </*0*/ T> checkSubtype(/*0*/ t: T): T
public fun </*0*/ E> Inv<E>.check(): kotlin.Unit
public infix fun </*0*/ T> T.checkType(/*0*/ f: Inv<T>.() -> kotlin.Unit): kotlin.Unit
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
}
@@ -0,0 +1,18 @@
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: expressions, constant-literals, boolean-literals -> paragraph 1 -> sentence 3
* NUMBER: 2
* DESCRIPTION: Checking of subtype for Boolean values
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
checkSubtype<Boolean?>(true)
checkSubtype<Boolean?>(false)
checkSubtype<Any>(true)
checkSubtype<Any>(false)
}
@@ -0,0 +1,13 @@
package
public fun case_1(): kotlin.Unit
public fun </*0*/ T> checkSubtype(/*0*/ t: T): T
public fun </*0*/ E> Inv<E>.check(): kotlin.Unit
public infix fun </*0*/ T> T.checkType(/*0*/ f: Inv<T>.() -> kotlin.Unit): kotlin.Unit
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
}
@@ -0,0 +1,13 @@
/*
* This file is generated by {@link org.jetbrains.kotlin.spec.tasks.generateTests}. DO NOT MODIFY MANUALLY.
* This file is used in the HTML version of the Kotlin Specification (https://kotlin.github.io/kotlin-spec) to show tests coverage for sentences.
*
* Content format:
*
* {paragraphNumber}
* {testType: neg|pos}: {sentenceNumber}-{numberOfTests|testPathToAnotherSection}, ...
*/
1
neg: 3-1
pos: 3-2
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Binary integer literals with the prefix only.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Binary integer literals with an underscore after the prefix.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 2
* DESCRIPTION: Binary integer literals with an underscore in the first position (it's considered as identifiers).
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, binary-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 3
* DESCRIPTION: Binary integer literals with an underscore in the last position.
*/
@@ -0,0 +1,12 @@
/*
* This file is generated by {@link org.jetbrains.kotlin.spec.tasks.generateTests}. DO NOT MODIFY MANUALLY.
* This file is used in the HTML version of the Kotlin Specification (https://kotlin.github.io/kotlin-spec) to show tests coverage for sentences.
*
* Content format:
*
* {paragraphNumber}
* {testType: neg|pos}: {sentenceNumber}-{numberOfTests|testPathToAnotherSection}, ...
*/
1
neg: 2-3, 1-1
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, decimal-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, decimal-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Integer literals with an underscore in the last position.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, decimal-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, decimal-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 2
* DESCRIPTION: Integer literals with an underscore in the first position (it's considered as identifiers).
*/
@@ -0,0 +1,12 @@
/*
* This file is generated by {@link org.jetbrains.kotlin.spec.tasks.generateTests}. DO NOT MODIFY MANUALLY.
* This file is used in the HTML version of the Kotlin Specification (https://kotlin.github.io/kotlin-spec) to show tests coverage for sentences.
*
* Content format:
*
* {paragraphNumber}
* {testType: neg|pos}: {sentenceNumber}-{numberOfTests|testPathToAnotherSection}, ...
*/
1
neg: 2-2
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Hexadecimal integer literals with the prefix only.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Hexadecimal integer literals with an underscore after the prefix.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 2
* DESCRIPTION: Hexadecimal integer literals with an underscore in the first position (it's considered as identifiers).
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, hexadecimal-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 3
* DESCRIPTION: Hexadecimal integer literals with an underscore in the last position.
*/
@@ -0,0 +1,12 @@
/*
* This file is generated by {@link org.jetbrains.kotlin.spec.tasks.generateTests}. DO NOT MODIFY MANUALLY.
* This file is used in the HTML version of the Kotlin Specification (https://kotlin.github.io/kotlin-spec) to show tests coverage for sentences.
*
* Content format:
*
* {paragraphNumber}
* {testType: neg|pos}: {sentenceNumber}-{numberOfTests|testPathToAnotherSection}, ...
*/
1
neg: 2-3, 1-1
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Binary and hexadecimal integer literals with a long literal mark only.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Various integer literals with a not allowed underscore before the long literal mark.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 1
* NUMBER: 3
* DESCRIPTION: Various integer literals with not allowed long literal mark in lower case.
*/
@@ -0,0 +1,21 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Various integer literals with not allowed long literal mark in lower case (type checking).
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
0<!WRONG_LONG_SUFFIX!>l<!> checkType { check<Long>() }
10000000000000<!WRONG_LONG_SUFFIX!>l<!> checkType { check<Long>() }
0X000Af10cD<!WRONG_LONG_SUFFIX!>l<!> checkType { check<Long>() }
0x0_0<!WRONG_LONG_SUFFIX!>l<!> checkType { check<Long>() }
0b100_000_111_111<!WRONG_LONG_SUFFIX!>l<!> checkType { check<Long>() }
0b0<!WRONG_LONG_SUFFIX!>l<!> checkType { check<Long>() }
}
@@ -1,23 +1,23 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 2
* DESCRIPTION: Type checking (comparison with invalid types) of various integer literals with long literal mark.
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
0L checkType { <!TYPE_MISMATCH!>_<!><Short>() }
1000000L checkType { <!TYPE_MISMATCH!>_<!><Int>() }
0XAf10cDL checkType { <!TYPE_MISMATCH!>_<!><Int>() }
0x0_0L checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
0b100_000_111_111L checkType { <!TYPE_MISMATCH!>_<!><Short>() }
0b0L checkType { <!TYPE_MISMATCH!>_<!><Byte>() }
0L checkType { <!TYPE_MISMATCH!>check<!><Short>() }
1000000L checkType { <!TYPE_MISMATCH!>check<!><Int>() }
0XAf10cDL checkType { <!TYPE_MISMATCH!>check<!><Int>() }
0x0_0L checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
0b100_000_111_111L checkType { <!TYPE_MISMATCH!>check<!><Short>() }
0b0L checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>0L<!>)
checkSubtype<Int>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1000000L<!>)
@@ -0,0 +1,122 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 3
* DESCRIPTION: Type checking (comparison with invalid types) of various integer literals.
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
0 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
0 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
0 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
}
// TESTCASE NUMBER: 2
fun case_2() {
127 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
127 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
127 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>128<!>)
128 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
128 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
128 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
-128 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-128 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-128 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-129<!>)
-129 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-129 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-129 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
}
// TESTCASE NUMBER: 3
fun case_3() {
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>32767<!>)
32767 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
32767 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
32767 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>32768<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>32768<!>)
32768 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
32768 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
32768 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-32768<!>)
-32768 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-32768 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-32768 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-32769<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-32769<!>)
-32769 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-32769 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-32769 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
}
// TESTCASE NUMBER: 4
fun case_4() {
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483647<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483647<!>)
2147483647 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
2147483647 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
2147483647 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483648<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483648<!>)
checkSubtype<Int>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>2147483648<!>)
2147483648 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
2147483648 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
2147483648 checkType { <!TYPE_MISMATCH!>check<!><Int>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-2147483648<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-2147483648<!>)
-2147483648 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-2147483648 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-2147483648 checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-2147483649<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-2147483649<!>)
checkSubtype<Int>(<!TYPE_MISMATCH!>-2147483649<!>)
-2147483649 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-2147483649 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-2147483649 checkType { <!TYPE_MISMATCH!>check<!><Int>() }
}
// TESTCASE NUMBER: 5
fun case_5() {
checkSubtype<Byte>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>9223372036854775807<!>)
checkSubtype<Short>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>9223372036854775807<!>)
checkSubtype<Int>(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>9223372036854775807<!>)
9223372036854775807 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
9223372036854775807 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
9223372036854775807 checkType { <!TYPE_MISMATCH!>check<!><Int>() }
checkSubtype<Byte>(<!TYPE_MISMATCH!>-9223372036854775807<!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-9223372036854775807<!>)
checkSubtype<Int>(<!TYPE_MISMATCH!>-9223372036854775807<!>)
-9223372036854775807 checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-9223372036854775807 checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-9223372036854775807 checkType { <!TYPE_MISMATCH!>check<!><Int>() }
}
// TESTCASE NUMBER: 6
fun case_6() {
checkSubtype<Byte>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
checkSubtype<Short>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
checkSubtype<Int>(-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
checkSubtype<Long>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { <!TYPE_MISMATCH!>check<!><Short>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { check<Int>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> checkType { <!TYPE_MISMATCH!>check<!><Long>() }
}
@@ -1,35 +1,35 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 4
* DESCRIPTION: Type checking (comparison with invalid types) of too a big integers.
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
checkSubtype<Long>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!><!>)
-<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> checkType { <!TYPE_MISMATCH!>_<!><Long>() }
-<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!>)
<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> checkType { <!TYPE_MISMATCH!>_<!><Long>() }
<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> checkType { <!TYPE_MISMATCH!>check<!><Long>() }
}
// TESTCASE NUMBER: 2
fun case_2() {
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!>)
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> checkType { <!TYPE_MISMATCH!>_<!><Long>() }
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!>)
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> checkType { <!TYPE_MISMATCH!>_<!><Long>() }
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Long>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!><!>)
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> checkType { <!TYPE_MISMATCH!>_<!><Long>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> checkType { <!TYPE_MISMATCH!>check<!><Long>() }
checkSubtype<Long>(<!TYPE_MISMATCH!>-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!><!>)
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> checkType { <!TYPE_MISMATCH!>_<!><Long>() }
-<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> checkType { <!TYPE_MISMATCH!>check<!><Long>() }
}
@@ -1,13 +1,13 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 5
* DESCRIPTION: Check of integer type selection depends on the context (incopatible types).
* HELPERS: checkType
*/
// FILE: functions.kt
@@ -0,0 +1,33 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Type checking of various integer literals with long literal mark.
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
0L checkType { check<Long>() }
10000000000000L checkType { check<Long>() }
0X000Af10cDL checkType { check<Long>() }
0x0_0L checkType { check<Long>() }
0b100_000_111_111L checkType { check<Long>() }
0b0L checkType { check<Long>() }
}
// TESTCASE NUMBER: 2
fun case_2() {
9223372036854775807L checkType { check<Long>() }
-9223372036854775807L checkType { check<Long>() }
0X7FFFFFFFFFFFFFFFL checkType { check<Long>() }
-0x7FFFFFFFFFFFFFFFL checkType { check<Long>() }
0b111111111111111111111111111111111111111111111111111111111111111L checkType { check<Long>() }
-0B111111111111111111111111111111111111111111111111111111111111111L checkType { check<Long>() }
}
@@ -1,18 +1,18 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 2
* DESCRIPTION: Type checking of decimal integer literals.
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
0 checkType { _<Int>() }
0 checkType { check<Int>() }
checkSubtype<Int>(0)
checkSubtype<Short>(0)
checkSubtype<Byte>(0)
@@ -21,24 +21,24 @@ fun case_1() {
// TESTCASE NUMBER: 2
fun case_2() {
127 checkType { _<Int>() }
127 checkType { check<Int>() }
checkSubtype<Int>(127)
checkSubtype<Short>(127)
checkSubtype<Byte>(127)
checkSubtype<Long>(127)
128 checkType { _<Int>() }
128 checkType { check<Int>() }
checkSubtype<Int>(128)
checkSubtype<Short>(128)
checkSubtype<Long>(128)
-128 checkType { _<Int>() }
-128 checkType { check<Int>() }
checkSubtype<Int>(-128)
checkSubtype<Short>(-128)
checkSubtype<Byte>(-128)
checkSubtype<Long>(-128)
-129 checkType { _<Int>() }
-129 checkType { check<Int>() }
checkSubtype<Int>(-129)
checkSubtype<Short>(-129)
checkSubtype<Long>(-129)
@@ -46,47 +46,47 @@ fun case_2() {
// TESTCASE NUMBER: 3
fun case_3() {
32767 checkType { _<Int>() }
32767 checkType { check<Int>() }
checkSubtype<Int>(32767)
checkSubtype<Short>(32767)
checkSubtype<Long>(32767)
32768 checkType { _<Int>() }
32768 checkType { check<Int>() }
checkSubtype<Int>(32768)
checkSubtype<Long>(32768)
-32768 checkType { _<Int>() }
-32768 checkType { check<Int>() }
checkSubtype<Int>(-32768)
checkSubtype<Short>(-32768)
checkSubtype<Long>(-32768)
-32769 checkType { _<Int>() }
-32769 checkType { check<Int>() }
checkSubtype<Int>(-32769)
checkSubtype<Long>(-32769)
}
// TESTCASE NUMBER: 4
fun case_4() {
2147483647 checkType { _<Int>() }
2147483647 checkType { check<Int>() }
checkSubtype<Int>(2147483647)
checkSubtype<Long>(2147483647)
2147483648 checkType { _<Long>() }
2147483648 checkType { check<Long>() }
checkSubtype<Long>(2147483648)
-2147483648 checkType { _<Int>() }
-2147483648 checkType { check<Int>() }
checkSubtype<Int>(-2147483648)
checkSubtype<Long>(-2147483648)
-2147483649 checkType { _<Long>() }
-2147483649 checkType { check<Long>() }
checkSubtype<Long>(-2147483649)
}
// TESTCASE NUMBER: 5
fun case_5() {
9223372036854775807 checkType { _<Long>() }
9223372036854775807 checkType { check<Long>() }
checkSubtype<Long>(9223372036854775807)
-9223372036854775807 checkType { _<Long>() }
-9223372036854775807 checkType { check<Long>() }
checkSubtype<Long>(-9223372036854775807)
}
@@ -1,18 +1,18 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 3
* DESCRIPTION: Type checking of hexadecimal integer literals.
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
0x0 checkType { _<Int>() }
0x0 checkType { check<Int>() }
checkSubtype<Int>(0x0)
checkSubtype<Short>(0x0)
checkSubtype<Byte>(0x0)
@@ -21,24 +21,24 @@ fun case_1() {
// TESTCASE NUMBER: 2
fun case_2() {
0x7F checkType { _<Int>() }
0x7F checkType { check<Int>() }
checkSubtype<Int>(0x7F)
checkSubtype<Short>(0x7F)
checkSubtype<Byte>(0x7F)
checkSubtype<Long>(0x7F)
0X80 checkType { _<Int>() }
0X80 checkType { check<Int>() }
checkSubtype<Int>(0X80)
checkSubtype<Short>(0X80)
checkSubtype<Long>(0X80)
-0X80 checkType { _<Int>() }
-0X80 checkType { check<Int>() }
checkSubtype<Int>(-0X80)
checkSubtype<Short>(-0X80)
checkSubtype<Byte>(-0X80)
checkSubtype<Long>(-0X80)
-0x81 checkType { _<Int>() }
-0x81 checkType { check<Int>() }
checkSubtype<Int>(-0x81)
checkSubtype<Short>(-0x81)
checkSubtype<Long>(-0x81)
@@ -46,47 +46,47 @@ fun case_2() {
// TESTCASE NUMBER: 3
fun case_3() {
0x7FFF checkType { _<Int>() }
0x7FFF checkType { check<Int>() }
checkSubtype<Int>(0x7FFF)
checkSubtype<Short>(0x7FFF)
checkSubtype<Long>(0x7FFF)
0x8000 checkType { _<Int>() }
0x8000 checkType { check<Int>() }
checkSubtype<Int>(0x8000)
checkSubtype<Long>(0x8000)
-0x8000 checkType { _<Int>() }
-0x8000 checkType { check<Int>() }
checkSubtype<Int>(-0x8000)
checkSubtype<Short>(-0x8000)
checkSubtype<Long>(-0x8000)
-0X8001 checkType { _<Int>() }
-0X8001 checkType { check<Int>() }
checkSubtype<Int>(-0X8001)
checkSubtype<Long>(-0X8001)
}
// TESTCASE NUMBER: 4
fun case_4() {
0x7FFFFFFF checkType { _<Int>() }
0x7FFFFFFF checkType { check<Int>() }
checkSubtype<Int>(0x7FFFFFFF)
checkSubtype<Long>(0x7FFFFFFF)
0x80000000 checkType { _<Long>() }
0x80000000 checkType { check<Long>() }
checkSubtype<Long>(0x80000000)
-0x80000000 checkType { _<Int>() }
-0x80000000 checkType { check<Int>() }
checkSubtype<Int>(-0x80000000)
checkSubtype<Long>(-0x80000000)
-0x80000001 checkType { _<Long>() }
-0x80000001 checkType { check<Long>() }
checkSubtype<Long>(-0x80000001)
}
// TESTCASE NUMBER: 5
fun case_5() {
0X7FFFFFFFFFFFFFFF checkType { _<Long>() }
0X7FFFFFFFFFFFFFFF checkType { check<Long>() }
checkSubtype<Long>(0X7FFFFFFFFFFFFFFF)
-0X7FFFFFFFFFFFFFFF checkType { _<Long>() }
-0X7FFFFFFFFFFFFFFF checkType { check<Long>() }
checkSubtype<Long>(-0X7FFFFFFFFFFFFFFF)
}
@@ -1,18 +1,18 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 4
* DESCRIPTION: Type checking of binary integer literals.
* HELPERS: checkType
*/
// TESTCASE NUMBER: 1
fun case_1() {
0b0 checkType { _<Int>() }
0b0 checkType { check<Int>() }
checkSubtype<Int>(0b0)
checkSubtype<Short>(0b0)
checkSubtype<Byte>(0b0)
@@ -21,24 +21,24 @@ fun case_1() {
// TESTCASE NUMBER: 2
fun case_2() {
0B1111111 checkType { _<Int>() }
0B1111111 checkType { check<Int>() }
checkSubtype<Int>(0B1111111)
checkSubtype<Short>(0B1111111)
checkSubtype<Byte>(0B1111111)
checkSubtype<Long>(0B1111111)
0b10000000 checkType { _<Int>() }
0b10000000 checkType { check<Int>() }
checkSubtype<Int>(0b10000000)
checkSubtype<Short>(0b10000000)
checkSubtype<Long>(0b10000000)
-0B10000000 checkType { _<Int>() }
-0B10000000 checkType { check<Int>() }
checkSubtype<Int>(-0B10000000)
checkSubtype<Short>(-0B10000000)
checkSubtype<Byte>(-0B10000000)
checkSubtype<Long>(-0B10000000)
-0b10000001 checkType { _<Int>() }
-0b10000001 checkType { check<Int>() }
checkSubtype<Int>(-0b10000001)
checkSubtype<Short>(-0b10000001)
checkSubtype<Long>(-0b10000001)
@@ -46,47 +46,47 @@ fun case_2() {
// TESTCASE NUMBER: 3
fun case_3() {
0B111111111111111 checkType { _<Int>() }
0B111111111111111 checkType { check<Int>() }
checkSubtype<Int>(0B111111111111111)
checkSubtype<Short>(0B111111111111111)
checkSubtype<Long>(0B111111111111111)
0b1000000000000000 checkType { _<Int>() }
0b1000000000000000 checkType { check<Int>() }
checkSubtype<Int>(0b1000000000000000)
checkSubtype<Long>(0b1000000000000000)
-0b1000000000000000 checkType { _<Int>() }
-0b1000000000000000 checkType { check<Int>() }
checkSubtype<Int>(-0b1000000000000000)
checkSubtype<Short>(-0b1000000000000000)
checkSubtype<Long>(-0b1000000000000000)
-0B1000000000000001 checkType { _<Int>() }
-0B1000000000000001 checkType { check<Int>() }
checkSubtype<Int>(-0B1000000000000001)
checkSubtype<Long>(-0B1000000000000001)
}
// TESTCASE NUMBER: 4
fun case_4() {
0b1111111111111111111111111111111 checkType { _<Int>() }
0b1111111111111111111111111111111 checkType { check<Int>() }
checkSubtype<Int>(0b1111111111111111111111111111111)
checkSubtype<Long>(0b1111111111111111111111111111111)
0B10000000000000000000000000000000 checkType { _<Long>() }
0B10000000000000000000000000000000 checkType { check<Long>() }
checkSubtype<Long>(0B10000000000000000000000000000000)
-0B10000000000000000000000000000000 checkType { _<Int>() }
-0B10000000000000000000000000000000 checkType { check<Int>() }
checkSubtype<Int>(-0B10000000000000000000000000000000)
checkSubtype<Long>(-0B10000000000000000000000000000000)
-0b10000000000000000000000000000001 checkType { _<Long>() }
-0b10000000000000000000000000000001 checkType { check<Long>() }
checkSubtype<Long>(-0b10000000000000000000000000000001)
}
// TESTCASE NUMBER: 5
fun case_5() {
0b111111111111111111111111111111111111111111111111111111111111111 checkType { _<Long>() }
0b111111111111111111111111111111111111111111111111111111111111111 checkType { check<Long>() }
checkSubtype<Long>(0b111111111111111111111111111111111111111111111111111111111111111)
-0B111111111111111111111111111111111111111111111111111111111111111 checkType { _<Long>() }
-0B111111111111111111111111111111111111111111111111111111111111111 checkType { check<Long>() }
checkSubtype<Long>(-0B111111111111111111111111111111111111111111111111111111111111111)
}
@@ -1,13 +1,13 @@
// !CHECK_TYPE
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* PLACE: expressions, constant-literals, integer-literals, long-integer-literals -> paragraph 1 -> sentence 2
* NUMBER: 5
* DESCRIPTION: Check of integer type selection depends on the context.
* HELPERS: checkType
*/
// FILE: functions.kt
@@ -0,0 +1,13 @@
/*
* This file is generated by {@link org.jetbrains.kotlin.spec.tasks.generateTests}. DO NOT MODIFY MANUALLY.
* This file is used in the HTML version of the Kotlin Specification (https://kotlin.github.io/kotlin-spec) to show tests coverage for sentences.
*
* Content format:
*
* {paragraphNumber}
* {testType: neg|pos}: {sentenceNumber}-{numberOfTests|testPathToAnotherSection}, ...
*/
1
neg: 2-5, 1-3
pos: 2-5
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Real literals separeted by comments.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 1 -> sentence 3
* PLACE: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 3
* NUMBER: 1
* DESCRIPTION: Real literals suffixed by f/F (float suffix) separeted by comments.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Simple real literals with a different whole-number part and fraction part.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 1 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Real literals with a many digits in a whole-number part and a fraction part (including conforms).
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 1 -> sentence 3
* PLACE: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 3
* NUMBER: 1
* DESCRIPTION: Simple real literals suffixed by f/F (the float suffix) with a different whole-number part and fraction part.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 1 -> sentence 3
* PLACE: expressions, constant-literals, real-literals -> paragraph 1 -> sentence 3
* NUMBER: 2
* DESCRIPTION: Real literals suffixed by f/F (the float suffix) with a many digits in a whole-number part and a fraction part (including conforms).
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 2 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Real literals without digits after an exponent mark.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 2 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Real literals with a not allowed exponent mark at the beginning.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 2 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1
* NUMBER: 3
* DESCRIPTION: Real literals suffixed by f/F (float suffix) with a not allowed exponent mark at the beginning.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 2 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1
* NUMBER: 4
* DESCRIPTION: Real literals suffixed by f/F (float suffix) with an exponent mark without digits after it.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 2 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Simple real literals with an exponent mark.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 2 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 2 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Real literals suffixed by f/F (float suffix) with an exponent mark.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 3 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Real literals with omitted a whole-number part and an exponent mark without digits after it.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 3 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Real literals with omitted a whole-number part, suffixed by f/F (float suffix) followed by an exponent mark without digits.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 3 -> sentence 2
* PLACE: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 2
* NUMBER: 1
* DESCRIPTION: Real literals with omitted a fraction part and an exponent mark without digits after it.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 3 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1
* NUMBER: 1
* DESCRIPTION: Simple real literals with omitted a whole-number part.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 3 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1
* NUMBER: 2
* DESCRIPTION: Real literals with omitted a whole-number part and an exponent mark.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 3 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1
* NUMBER: 3
* DESCRIPTION: Real literals separeted by comments with omitted a whole-number part.
*/
@@ -2,7 +2,7 @@
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-draft
* PLACE: constant-literals, real-literals -> paragraph 3 -> sentence 1
* PLACE: expressions, constant-literals, real-literals -> paragraph 3 -> sentence 1
* NUMBER: 4
* DESCRIPTION: Real literals suffixed by f/F (float suffix) with omitted a whole-number part.
*/

Some files were not shown because too many files have changed in this diff Show More