[Spec tests] Add tests for property-like callables prioritization
This commit is contained in:
committed by
Victor Petukhov
parent
157e33d08b
commit
9711fda353
+57
@@ -0,0 +1,57 @@
|
||||
// !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-268
|
||||
* PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: An enum entry named foo at its declaration site prio
|
||||
*/
|
||||
|
||||
// FILE: LibCase1.kt
|
||||
// TESTCASE NUMBER: 1, 2
|
||||
|
||||
package libPackage
|
||||
|
||||
fun foo() {}
|
||||
|
||||
|
||||
// FILE: TestCase1.kt
|
||||
// TESTCASE NUMBER: 1
|
||||
|
||||
package testPackage
|
||||
import libPackage.foo as foo
|
||||
|
||||
class Case1() {
|
||||
enum class A {
|
||||
zoo, boo;
|
||||
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: libPackage.foo; typeCall: function")!>foo()<!>
|
||||
}
|
||||
|
||||
operator fun invoke() {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE: TestCase2.kt
|
||||
// TESTCASE NUMBER: 2
|
||||
|
||||
package testPackage
|
||||
import libPackage.foo as zoo
|
||||
|
||||
class Case2() {
|
||||
companion object zoo {
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: libPackage.foo; typeCall: function")!>zoo()<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: libPackage.foo; typeCall: function")!>zoo()<!>
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// !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-268
|
||||
* PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 8
|
||||
* RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 9
|
||||
* overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: A companion object of a classifier type named foo at its declaration site
|
||||
*/
|
||||
|
||||
// FILE: Case1.kt
|
||||
package testPackage
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
|
||||
class Case1() {
|
||||
companion object foo {
|
||||
operator fun invoke() {}
|
||||
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: testPackage.Case1.foo.invoke; typeCall: variable&invoke")!>foo()<!>
|
||||
foo.<!DEBUG_INFO_CALL("fqName: testPackage.Case1.foo.invoke; typeCall: operator function")!>invoke()<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE: LibCase2.kt
|
||||
package libPackage
|
||||
fun zoo() {}
|
||||
|
||||
// FILE: TestCase2.kt
|
||||
// TESTCASE NUMBER: 2
|
||||
package testPackage
|
||||
import libPackage.zoo as foo
|
||||
|
||||
class Case2() {
|
||||
companion object foo{
|
||||
operator fun invoke() {}
|
||||
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: testPackage.Case2.foo.invoke; typeCall: variable&invoke")!>foo()<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: testPackage.Case2.foo.invoke; typeCall: variable&invoke")!>foo()<!>
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !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-268
|
||||
* PLACE: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 9
|
||||
* RELEVANT PLACES: overload-resolution, callables-and-invoke-convention -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: An enum entry named foo at its declaration site prio
|
||||
*/
|
||||
|
||||
// FILE: Case1.kt
|
||||
package testPackage
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
|
||||
class Case1() {
|
||||
enum class A {
|
||||
foo, boo;
|
||||
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: testPackage.Case1.A.invoke; typeCall: variable&invoke")!>foo()<!>
|
||||
foo.<!DEBUG_INFO_CALL("fqName: testPackage.Case1.A.invoke; typeCall: operator function")!>invoke()<!>
|
||||
}
|
||||
|
||||
operator fun invoke() {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FILE: LibCase2.kt
|
||||
package libPackage
|
||||
fun zoo() {}
|
||||
|
||||
// FILE: TestCase2.kt
|
||||
// TESTCASE NUMBER: 2
|
||||
package testPackage
|
||||
import libPackage.zoo as foo
|
||||
|
||||
class Case2() {
|
||||
enum class A {
|
||||
foo, boo, zoo;
|
||||
|
||||
fun f() {
|
||||
<!DEBUG_INFO_CALL("fqName: testPackage.Case2.A.invoke; typeCall: variable&invoke")!>foo()<!>
|
||||
}
|
||||
|
||||
operator fun invoke() {}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"2": {
|
||||
"pos": {
|
||||
"8": [
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"casesNumber": 2,
|
||||
"description": "A companion object of a classifier type named foo at its declaration site",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"9": [
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"casesNumber": 2,
|
||||
"description": "A companion object of a classifier type named foo at its declaration site",
|
||||
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2/pos/8.1.kt",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"casesNumber": 2,
|
||||
"description": "An enum entry named foo at its declaration site prio",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"10": [
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"casesNumber": 2,
|
||||
"description": "An enum entry named foo at its declaration site prio",
|
||||
"path": "compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2/pos/9.1.kt",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-268",
|
||||
"casesNumber": 2,
|
||||
"description": "An enum entry named foo at its declaration site prio",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+54
@@ -3504,6 +3504,60 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Callables_and_invoke_convention extends AbstractDiagnosticsTestSpec {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInCallables_and_invoke_convention() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class P_2 extends AbstractDiagnosticsTestSpec {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInP_2() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2/pos")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Pos extends AbstractDiagnosticsTestSpec {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("10.1.kt")
|
||||
public void test10_1() throws Exception {
|
||||
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2/pos/10.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("8.1.kt")
|
||||
public void test8_1() throws Exception {
|
||||
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2/pos/8.1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("9.1.kt")
|
||||
public void test9_1() throws Exception {
|
||||
runTest("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2/pos/9.1.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPos() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/overload-resolution/callables-and-invoke-convention/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements")
|
||||
|
||||
Reference in New Issue
Block a user