TypeAccessibilityChecker: add more tests

This commit is contained in:
Dmitry Gridin
2019-08-21 18:19:37 +07:00
parent 84d167b7bd
commit 73ae993d81
68 changed files with 412 additions and 29 deletions
@@ -0,0 +1 @@
expect class A
@@ -0,0 +1,6 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
interface Some
class A(actual val <caret>a: Some, b: Int)
@@ -0,0 +1,6 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
interface Some
actual class A(val a: Some, b: Int)
@@ -0,0 +1,3 @@
These declarations cannot be transformed:
a: Some
(a: Some, b: Int)
@@ -0,0 +1,3 @@
expect class A {
}
@@ -0,0 +1,12 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
interface Some
class A {
actual val a: Some
actual <caret>constructor(a: Some, b: Int) {
this.a = a
}
}
@@ -0,0 +1,12 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
interface Some
actual class A {
val a: Some
constructor(a: Some, b: Int) {
this.a = a
}
}
@@ -0,0 +1,3 @@
These declarations cannot be transformed:
actual val a: Some
constructor(a: Some, b: Int){...}
@@ -0,0 +1,7 @@
// "Create expected class in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,class A
// DISABLE-ERRORS
interface Some
actual class <caret>A<T : Some>
@@ -0,0 +1,3 @@
// To be implemented
expect class A {
}
@@ -0,0 +1,8 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
interface Some
actual class A {
actual fun <caret>a(): Some = TODO()
}
@@ -0,0 +1,8 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
interface Some
actual class A {
fun <caret>a(): Some = TODO()
}
@@ -0,0 +1,2 @@
These declarations cannot be transformed:
fun a() = TODO()
@@ -0,0 +1,2 @@
expect class A {
}
@@ -0,0 +1,7 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
class A {
class M
actual fun <caret>a(): M = TODO()
}
@@ -0,0 +1,7 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A {
class M
fun <caret>a(): M = TODO()
}
@@ -0,0 +1,2 @@
These declarations cannot be transformed:
fun a() = TODO()
@@ -0,0 +1,4 @@
// To be implemented
expect class A<T> {
fun a(): T
}
@@ -0,0 +1,6 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A<T> {
actual fun <caret>a(): T = TODO()
}
@@ -0,0 +1,6 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A<T> {
actual fun a(): T = TODO()
}
@@ -0,0 +1 @@
// To be implemented
@@ -0,0 +1,3 @@
// To be implemented
expect class A<T> {
}
@@ -0,0 +1,8 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A<T> {
class B {
actual fun <caret>a(): T = TODO()
}
}
@@ -0,0 +1,8 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A<T> {
class B {
fun a(): T = TODO()
}
}
@@ -0,0 +1,2 @@
These declarations cannot be transformed:
fun a() = TODO()
@@ -0,0 +1,5 @@
expect class A<T> {
class C<F>
class D<F : Any>
class E<F : Any?>
}
@@ -0,0 +1,10 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
class A<T> {
actual class B<F : T>
actual class C<F>
actual class D<F : Any>
actual class <caret>E<F : Any?>
actual class G<F : Dwwwq>
}
@@ -0,0 +1,10 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A<T> {
class B<F : T>
actual class C<F>
actual class D<F : Any>
actual class E<F : Any?>
class G<F : Dwwwq>
}
@@ -0,0 +1,3 @@
These declarations cannot be transformed:
class B
class G
@@ -0,0 +1 @@
// To be implemented
@@ -0,0 +1 @@
// To be implemented
@@ -1,7 +1,7 @@
// "Create expected function in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List<T>){...}
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List&lt;T&gt;) = TODO()
// DISABLE-ERRORS
interface Some
actual fun <T : Some> foo(some: List<T>) {}
actual fun <T> <caret>foo(some: List<T>): Some = TODO()
@@ -0,0 +1 @@
// To be implemented
@@ -1,5 +1,5 @@
// "Create expected function in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List<Some>){...}
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List&lt;Some&gt;){...}
// DISABLE-ERRORS
class Some
@@ -0,0 +1 @@
// To be implemented
@@ -1,5 +1,5 @@
// "Create expected function in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List<T>){...}
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List&lt;T&gt;){...}
// DISABLE-ERRORS
interface Some
@@ -0,0 +1,3 @@
// To be implemented
interface CommonClass
@@ -1,7 +1,7 @@
// "Create expected function in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: Some){...}
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List&lt;T&gt;){...}
// DISABLE-ERRORS
class Some
interface Some
actual fun foo(some: Some) {}
actual fun <T : CommonClass, F : Some> <caret>foo(some: List<T>) {}
@@ -0,0 +1 @@
// To be implemented
@@ -0,0 +1,7 @@
// "Create expected property in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,actual val foo: Some = TODO()
// DISABLE-ERRORS
interface Some
actual val foo<caret>: Some = TODO()
@@ -0,0 +1 @@
// To be implemented
@@ -0,0 +1,7 @@
// "Create expected property in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,actual val &lt;T&gt;Some&lt;T&gt;.foo: Some&lt;T&gt; get() = TODO()
// DISABLE-ERRORS
class Some<T>
actual val <T>Some<T>.<caret>foo: Some<T> get() = TODO()
@@ -0,0 +1,3 @@
// To be implemented
class Some<T>
@@ -0,0 +1,6 @@
// "Create expected property in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,actual val &lt;T: A&gt; Some&lt;T&gt;.foo: Some&lt;T&gt; get() = TODO()
// DISABLE-ERRORS
interface A
actual val <T: A> Some<T>.<caret>foo: Some<T> get() = TODO()
@@ -0,0 +1,6 @@
// "Create actual class for module testModule_JVM (JVM)" "true"
package a
import b.B
expect class <caret>A : B
@@ -0,0 +1,3 @@
package b
open class B
@@ -0,0 +1,5 @@
package a
import b.B
actual class A : B()
@@ -0,0 +1,5 @@
package a
import b.B
expect class A : B
@@ -0,0 +1,3 @@
package b
open class B
@@ -0,0 +1,6 @@
// "Create expected class in common module testModule_Common" "true"
package a
import b.B
actual class <caret>A : B()
@@ -1,7 +0,0 @@
// "Create expected function in common module testModule_Common" "true"
// SHOULD_FAIL_WITH: You cannot create the expect declaration from:,fun foo(some: List<Some>){...}
// DISABLE-ERRORS
class Some
actual fun foo(some: List<Some>) {}
@@ -0,0 +1,3 @@
expect class A<T> {
inner class B<F : T>
}
@@ -0,0 +1,6 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
class A<T> {
actual inner class <caret>B<F : T>
}
@@ -0,0 +1,6 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A<T> {
actual inner class <caret>B<F : T>
}
@@ -0,0 +1,4 @@
expect open class A<T : A<T>> {
class C<T>
inner class B<F : C<C<C<A<T>>>>>
}
@@ -0,0 +1,7 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual open class <caret>A<T: A<T>> {
actual class C<T>
actual inner class B<F : C<C<C<A<T>>>>>
}
@@ -0,0 +1,7 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual open class A<T: A<T>> {
actual class C<T>
actual inner class B<F : C<C<C<A<T>>>>>
}
@@ -0,0 +1,5 @@
expect class A {
class M
fun a(): M
}
@@ -0,0 +1,7 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
class A {
actual class M
actual fun <caret>a(): M = TODO()
}
@@ -0,0 +1,7 @@
// "Create expected class in common module testModule_Common" "true"
// DISABLE-ERRORS
actual class A {
actual class M
actual fun <caret>a(): M = TODO()
}
@@ -0,0 +1,3 @@
// To be implemented
class Some<T>
@@ -0,0 +1,5 @@
// To be implemented
class Some<T>
expect val <T> Some<T>.<caret>foo: Some<T>
@@ -0,0 +1,4 @@
// "Create expected property in common module testModule_Common" "true"
// DISABLE-ERRORS
actual val <T> Some<T>.<caret>foo: Some<T> get() = TODO()
@@ -29,6 +29,99 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiModuleQuickFix"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
}
@TestMetadata("idea/testData/multiModuleQuickFix/accessibilityChecker")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class AccessibilityChecker extends AbstractQuickFixMultiModuleTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
}
public void testAllFilesPresentInAccessibilityChecker() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/multiModuleQuickFix/accessibilityChecker"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, true);
}
@TestMetadata("classPrimaryConstructor")
public void testClassPrimaryConstructor() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/classPrimaryConstructor/");
}
@TestMetadata("classSecondaryConstructor")
public void testClassSecondaryConstructor() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/classSecondaryConstructor/");
}
@TestMetadata("classUpperBounds")
public void testClassUpperBounds() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/classUpperBounds/");
}
@TestMetadata("memberFunction")
public void testMemberFunction() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/memberFunction/");
}
@TestMetadata("memberFunctionAndNestedClass")
public void testMemberFunctionAndNestedClass() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/memberFunctionAndNestedClass/");
}
@TestMetadata("memberFunctionParentType")
public void testMemberFunctionParentType() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/memberFunctionParentType/");
}
@TestMetadata("memberFunctionParentType2")
public void testMemberFunctionParentType2() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/memberFunctionParentType2/");
}
@TestMetadata("nestedClassWithTypeParam")
public void testNestedClassWithTypeParam() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/nestedClassWithTypeParam/");
}
@TestMetadata("topLevelFunParameter")
public void testTopLevelFunParameter() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelFunParameter/");
}
@TestMetadata("topLevelFunReturnType")
public void testTopLevelFunReturnType() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelFunReturnType/");
}
@TestMetadata("topLevelFunTypeParameter")
public void testTopLevelFunTypeParameter() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelFunTypeParameter/");
}
@TestMetadata("topLevelFunUpperBounds")
public void testTopLevelFunUpperBounds() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelFunUpperBounds/");
}
@TestMetadata("topLevelFunUpperBounds2")
public void testTopLevelFunUpperBounds2() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelFunUpperBounds2/");
}
@TestMetadata("topLevelProperty")
public void testTopLevelProperty() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelProperty/");
}
@TestMetadata("topLevelPropertyTypeParam2")
public void testTopLevelPropertyTypeParam2() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelPropertyTypeParam2/");
}
@TestMetadata("topLevelPropertyTypeParamBound")
public void testTopLevelPropertyTypeParamBound() throws Exception {
runTest("idea/testData/multiModuleQuickFix/accessibilityChecker/topLevelPropertyTypeParamBound/");
}
}
@TestMetadata("idea/testData/multiModuleQuickFix/createActual")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -96,6 +189,11 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
runTest("idea/testData/multiModuleQuickFix/createActual/constructorWithJdk/");
}
@TestMetadata("createWithImport")
public void testCreateWithImport() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createActual/createWithImport/");
}
@TestMetadata("defaultParameterInExpected")
public void testDefaultParameterInExpected() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createActual/defaultParameterInExpected/");
@@ -244,6 +342,11 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
runTest("idea/testData/multiModuleQuickFix/createExpect/companion/");
}
@TestMetadata("createWithImport")
public void testCreateWithImport() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/createWithImport/");
}
@TestMetadata("dataClass")
public void testDataClass() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/dataClass/");
@@ -284,21 +387,6 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
runTest("idea/testData/multiModuleQuickFix/createExpect/funWithAccessibleTypeFromCommon/");
}
@TestMetadata("funWithInaccessibleBounds")
public void testFunWithInaccessibleBounds() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/funWithInaccessibleBounds/");
}
@TestMetadata("funWithInaccessibleParameter")
public void testFunWithInaccessibleParameter() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/funWithInaccessibleParameter/");
}
@TestMetadata("funWithInaccessibleTypeParameter")
public void testFunWithInaccessibleTypeParameter() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/funWithInaccessibleTypeParameter/");
}
@TestMetadata("funWithJdk")
public void testFunWithJdk() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/funWithJdk/");
@@ -324,11 +412,26 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
runTest("idea/testData/multiModuleQuickFix/createExpect/inlineClass2/");
}
@TestMetadata("innerClassWithTypeParam")
public void testInnerClassWithTypeParam() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/innerClassWithTypeParam/");
}
@TestMetadata("innerClassWithTypeParam2")
public void testInnerClassWithTypeParam2() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/innerClassWithTypeParam2/");
}
@TestMetadata("innerEnum")
public void testInnerEnum() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/innerEnum/");
}
@TestMetadata("memberFunctionAndNestedClass")
public void testMemberFunctionAndNestedClass() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/memberFunctionAndNestedClass/");
}
@TestMetadata("nestedClass")
public void testNestedClass() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/nestedClass/");
@@ -369,6 +472,11 @@ public class QuickFixMultiModuleTestGenerated extends AbstractQuickFixMultiModul
runTest("idea/testData/multiModuleQuickFix/createExpect/sealedClass/");
}
@TestMetadata("topLevelPropertyWithTypeParam")
public void testTopLevelPropertyWithTypeParam() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/topLevelPropertyWithTypeParam/");
}
@TestMetadata("typeAlias")
public void testTypeAlias() throws Exception {
runTest("idea/testData/multiModuleQuickFix/createExpect/typeAlias/");