[Spec tests] Add tests for Algorithm of MSC selection
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-366
|
||||
* MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) <:Widen(Y_k) is built
|
||||
*/
|
||||
|
||||
var flag = false
|
||||
fun box(): String {
|
||||
Case(1, 1)
|
||||
if (flag) {
|
||||
return "OK"
|
||||
}else
|
||||
return "NOK"
|
||||
}
|
||||
class Case {
|
||||
constructor(y: Int, x: Number){
|
||||
flag = false
|
||||
}
|
||||
constructor(vararg x: Int){
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-366
|
||||
* MAIN LINK: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) <:Widen(Y_k) is built
|
||||
*/
|
||||
|
||||
var flag = false
|
||||
fun box(): String {
|
||||
Case(1, 1)
|
||||
if (flag) {
|
||||
return "OK"
|
||||
}else
|
||||
return "NOK"
|
||||
}
|
||||
class Case (val y: Int, val x: Number) {
|
||||
|
||||
constructor(vararg x: Int) : this(1, 1 as Number){
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"3": {
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-366",
|
||||
"casesNumber": 0,
|
||||
"description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built",
|
||||
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.2.kt",
|
||||
"unexpectedBehaviour": false,
|
||||
"linkType": "main"
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-366",
|
||||
"casesNumber": 0,
|
||||
"description": "If both X_k and Y_k are built-in integer types, a type constraint Widen(X_k) \u003c:Widen(Y_k) is built",
|
||||
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/choosing-the-most-specific-candidate-from-the-overload-candidate-set/algorithm-of-msc-selection/p-3/pos/1.1.kt",
|
||||
"unexpectedBehaviour": false,
|
||||
"linkType": "main"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user