[Spec tests] Add tests for additive-expression and Multiplicative expression
This commit is contained in:
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-218
|
||||
* PLACE: expressions, additive-expression -> paragraph 4 -> sentence 1
|
||||
* RELEVANT PLACES: expressions, additive-expression -> paragraph 4 -> sentence 2
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: The return type of these functions is not restricted.
|
||||
* HELPERS: checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
class Case1(var a: Int) {
|
||||
operator fun minus(o: Int): Case1 { TODO() }
|
||||
operator fun minus(o: Case1):Case1 { TODO() }
|
||||
operator fun plus(o: Int): Case1 { TODO() }
|
||||
operator fun plus(o: Case1): Case1 { TODO() }
|
||||
}
|
||||
|
||||
fun case1() {
|
||||
val a = Case1(1) + 1
|
||||
val b = Case1(1) + Case1( 1)
|
||||
val c = Case1(1) - 1
|
||||
val d = Case1(1) - Case1( 1)
|
||||
|
||||
a checkType { check<Case1>() }
|
||||
b checkType { check<Case1>() }
|
||||
c checkType { check<Case1>() }
|
||||
d checkType { check<Case1>() }
|
||||
}
|
||||
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
class Case2(var a: Int) {
|
||||
operator fun minus(o: Int): Nothing? { TODO() }
|
||||
operator fun minus(o: Case2):Nothing? { TODO() }
|
||||
operator fun plus(o: Int): Nothing? { TODO() }
|
||||
operator fun plus(o: Case2): Nothing? { TODO() }
|
||||
}
|
||||
|
||||
fun case2() {
|
||||
val a = Case2(1) + 1
|
||||
val b = Case2(1) + Case2( 1)
|
||||
val c = Case2(1) - 1
|
||||
val d = Case2(1) - Case2( 1)
|
||||
|
||||
<!DEBUG_INFO_CONSTANT!>a<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>b<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>c<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>d<!> checkType { check<Nothing?>() }
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
class Case3(var a: Int) {
|
||||
operator fun minus(o: Int): Any? { TODO() }
|
||||
operator fun minus(o: Case3):Any? { TODO() }
|
||||
operator fun plus(o: Int): Any? { TODO() }
|
||||
operator fun plus(o: Case3): Any? { TODO() }
|
||||
}
|
||||
|
||||
fun case3() {
|
||||
val a = Case3(1) + 1
|
||||
val b = Case3(1) + Case3( 1)
|
||||
val c = Case3(1) - 1
|
||||
val d = Case3(1) - Case3( 1)
|
||||
|
||||
a checkType { check<Any?>() }
|
||||
b checkType { check<Any?>() }
|
||||
c checkType { check<Any?>() }
|
||||
d checkType { check<Any?>() }
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"4": {
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 3,
|
||||
"description": "The return type of these functions is not restricted.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"2": [
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 3,
|
||||
"description": "The return type of these functions is not restricted.",
|
||||
"path": "compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.kt",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
compiler/tests-spec/testData/diagnostics/linked/expressions/multiplicative-expression/p-5/pos/1.1.kt
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-218
|
||||
* PLACE: expressions, multiplicative-expression -> paragraph 5 -> sentence 1
|
||||
* RELEVANT PLACES: expressions, multiplicative-expression -> paragraph 5 -> sentence 2
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: The return type of these functions is not restricted.
|
||||
* HELPERS: checkType
|
||||
*/
|
||||
// TESTCASE NUMBER: 1
|
||||
class Case1(var a: Int) {
|
||||
operator fun times(o: Int): Any? { TODO() }
|
||||
operator fun times(o: Case1):Any? { TODO() }
|
||||
operator fun div(o: Int): Any? { TODO() }
|
||||
operator fun div(o: Case1): Any? { TODO() }
|
||||
operator fun rem(o: Int): Any? { TODO() }
|
||||
operator fun rem(o: Case1): Any? { TODO() }
|
||||
}
|
||||
|
||||
fun case1() {
|
||||
val a = Case1(1) * 1
|
||||
val b = Case1(1) * Case1( 1)
|
||||
val c = Case1(1) / 1
|
||||
val d = Case1(1) / Case1( 1)
|
||||
val e = Case1(1) % 1
|
||||
val f = Case1(1) % Case1( 1)
|
||||
|
||||
a checkType { check<Any?>() }
|
||||
b checkType { check<Any?>() }
|
||||
c checkType { check<Any?>() }
|
||||
d checkType { check<Any?>() }
|
||||
e checkType { check<Any?>() }
|
||||
f checkType { check<Any?>() }
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
class Case2(var a: Int) {
|
||||
operator fun times(o: Int): Nothing? { TODO() }
|
||||
operator fun times(o: Case2):Nothing? { TODO() }
|
||||
operator fun div(o: Int): Nothing? { TODO() }
|
||||
operator fun div(o: Case2): Nothing? { TODO() }
|
||||
operator fun rem(o: Int): Nothing? { TODO() }
|
||||
operator fun rem(o: Case2): Nothing? { TODO() }
|
||||
}
|
||||
|
||||
fun case2() {
|
||||
val a = Case2(1) * 1
|
||||
val b = Case2(1) * Case2( 1)
|
||||
val c = Case2(1) / 1
|
||||
val d = Case2(1) / Case2( 1)
|
||||
val e = Case2(1) % 1
|
||||
val f = Case2(1) % Case2( 1)
|
||||
|
||||
<!DEBUG_INFO_CONSTANT!>a<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>b<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>c<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>d<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>e<!> checkType { check<Nothing?>() }
|
||||
<!DEBUG_INFO_CONSTANT!>f<!> checkType { check<Nothing?>() }
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"5": {
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 2,
|
||||
"description": "The return type of these functions is not restricted.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"2": [
|
||||
{
|
||||
"specVersion": "0.1-218",
|
||||
"casesNumber": 2,
|
||||
"description": "The return type of these functions is not restricted.",
|
||||
"path": "compiler/tests-spec/testData/diagnostics/linked/expressions/multiplicative-expression/p-5/pos/1.1.kt",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user