[Spec tests] Add tests for call-without-an-explicit-receiver, receivers
This commit is contained in:
committed by
Victor Petukhov
parent
35de6a3f6e
commit
bb1ee952ba
Vendored
+20
-20
@@ -3,31 +3,31 @@
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-268
|
||||
* PLACE:overload-resolution, receivers -> paragraph 5 -> sentence 3
|
||||
* SPEC VERSION: 0.1-278
|
||||
* PLACE: overload-resolution, receivers -> paragraph 5 -> sentence 3
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Current class companion object receiver has higher priority than any of the superclass companion objects;
|
||||
* DESCRIPTION: The phantom static implicit this receiver has higher priority than the current class companion object receiver;
|
||||
*/
|
||||
|
||||
class Case() : CaseBase() {
|
||||
|
||||
companion object foo{
|
||||
var isCaseCompanionCalled = false
|
||||
fun foo(){isCaseCompanionCalled = true}
|
||||
}
|
||||
}
|
||||
|
||||
open class CaseBase {
|
||||
companion object foo {
|
||||
var isCaseBaseReceiverCalled = false
|
||||
fun foo() { this.isCaseBaseReceiverCalled = true }
|
||||
// operator fun invoke() {}
|
||||
}
|
||||
}
|
||||
|
||||
var flag = false
|
||||
fun box(): String {
|
||||
Case.foo.foo()
|
||||
if (!CaseBase.isCaseBaseReceiverCalled && Case.isCaseCompanionCalled)
|
||||
Case1.A1.foo()
|
||||
if (!flag)
|
||||
return "OK"
|
||||
return "NOK"
|
||||
}
|
||||
|
||||
enum class Case1 {
|
||||
A1, A2;
|
||||
|
||||
companion object values {
|
||||
operator fun invoke() {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
values()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-268
|
||||
* PLACE:overload-resolution, receivers -> paragraph 5 -> sentence 3
|
||||
* SPEC VERSION: 0.1-278
|
||||
* PLACE:overload-resolution, receivers -> paragraph 5 -> sentence 4
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Current class companion object receiver has higher priority than any of the superclass companion objects;
|
||||
*/
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
/*
|
||||
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-268
|
||||
* PLACE: overload-resolution, receivers -> paragraph 5 -> sentence 4
|
||||
* RELEVANT PLACES: overload-resolution, receivers -> paragraph 5 -> sentence 3
|
||||
* SPEC VERSION: 0.1-278
|
||||
* PLACE: overload-resolution, receivers -> paragraph 5 -> sentence 5
|
||||
* RELEVANT PLACES: overload-resolution, receivers -> paragraph 5 -> sentence 4
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Superclass companion object receivers are prioritized according to the inheritance order
|
||||
*/
|
||||
Vendored
+14
-12
@@ -17,30 +17,32 @@
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"specVersion": "0.1-278",
|
||||
"casesNumber": 0,
|
||||
"description": "Current class companion object receiver has higher priority than any of the superclass companion objects;",
|
||||
"description": "The phantom static implicit this receiver has higher priority than the current class companion object receiver;",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
}
|
||||
],
|
||||
"5": [
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"specVersion": "0.1-278",
|
||||
"casesNumber": 0,
|
||||
"description": "Superclass companion object receivers are prioritized according to the inheritance order",
|
||||
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/receivers/p-5/pos/4.1.kt",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"casesNumber": 0,
|
||||
"description": "Current class companion object receiver has higher priority than any of the superclass companion objects;",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"4": [
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"specVersion": "0.1-278",
|
||||
"casesNumber": 0,
|
||||
"description": "Superclass companion object receivers are prioritized according to the inheritance order",
|
||||
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/receivers/p-5/pos/5.1.kt",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-278",
|
||||
"casesNumber": 0,
|
||||
"description": "Current class companion object receiver has higher priority than any of the superclass companion objects;",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user