diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingDeclarationProviderTest.kt index c82eccd795..ec024ea7d5 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingDeclarationProviderTest.kt @@ -20,6 +20,7 @@ class KoImportAliasDeclarationForKoContainingDeclarationProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingFileProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingFileProviderTest.kt index e82e179432..753fb21303 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingFileProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoContainingFileProviderTest.kt @@ -19,6 +19,7 @@ class KoImportAliasDeclarationForKoContainingFileProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoLocationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoLocationProviderTest.kt index 69cc426e3a..035836d4f6 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoLocationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoLocationProviderTest.kt @@ -19,6 +19,7 @@ class KoImportAliasDeclarationForKoLocationProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoNameProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoNameProviderTest.kt index 03e7a037bb..9b4e93aaba 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoNameProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoNameProviderTest.kt @@ -23,6 +23,7 @@ class KoImportAliasDeclarationForKoNameProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPackageProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPackageProviderTest.kt index 60f9c7bbcf..1376b905ce 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPackageProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPackageProviderTest.kt @@ -16,6 +16,7 @@ class KoImportAliasDeclarationForKoPackageProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -33,6 +34,7 @@ class KoImportAliasDeclarationForKoPackageProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPathProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPathProviderTest.kt index da01512d34..44bbdee5f6 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPathProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoPathProviderTest.kt @@ -21,6 +21,7 @@ class KoImportAliasDeclarationForKoPathProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -42,6 +43,7 @@ class KoImportAliasDeclarationForKoPathProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -67,6 +69,7 @@ class KoImportAliasDeclarationForKoPathProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -90,6 +93,7 @@ class KoImportAliasDeclarationForKoPathProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoResideInPackageProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoResideInPackageProviderTest.kt index 2ea817c441..c4d8d73afa 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoResideInPackageProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoResideInPackageProviderTest.kt @@ -17,6 +17,7 @@ class KoImportAliasDeclarationForKoResideInPackageProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoTextProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoTextProviderTest.kt index b83cea5b82..7040b59d89 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoTextProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationForKoTextProviderTest.kt @@ -20,6 +20,7 @@ class KoImportAliasDeclarationForKoTextProviderTest { ?.parameters ?.first() ?.type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationTest.kt index 54e76fa311..b44e7012b5 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koimportalias/KoImportAliasDeclarationTest.kt @@ -13,6 +13,7 @@ class KoImportAliasDeclarationTest { .properties() .first() .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -27,6 +28,7 @@ class KoImportAliasDeclarationTest { .properties() .first() .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoPropertyProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoPropertyProviderTest.kt index a8948d4b0b..213560e82e 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoPropertyProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kointerface/KoInterfaceDeclarationForKoPropertyProviderTest.kt @@ -116,9 +116,9 @@ class KoInterfaceDeclarationForKoPropertyProviderTest { assertSoftly(sut) { numProperties(includeNested = true) shouldBeEqualTo 2 numProperties(includeNested = false) shouldBeEqualTo 1 - countProperties(includeNested = false) { it.hasValModifier } shouldBeEqualTo 1 - countProperties { it.hasValModifier } shouldBeEqualTo 2 - countProperties { it.name == "fixtureProperty" && it.hasVarModifier } shouldBeEqualTo 0 + countProperties(includeNested = false) { it.isVal } shouldBeEqualTo 1 + countProperties { it.isVal } shouldBeEqualTo 2 + countProperties { it.name == "fixtureProperty" && it.isVar } shouldBeEqualTo 0 } } diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoPropertyProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoPropertyProviderTest.kt index 0f83009dbc..9e454abe9f 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoPropertyProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koobject/KoObjectDeclarationForKoPropertyProviderTest.kt @@ -116,9 +116,9 @@ class KoObjectDeclarationForKoPropertyProviderTest { assertSoftly(sut) { numProperties(includeNested = true) shouldBeEqualTo 2 numProperties(includeNested = false) shouldBeEqualTo 1 - countProperties(includeNested = false) { it.hasValModifier } shouldBeEqualTo 1 - countProperties { it.hasValModifier } shouldBeEqualTo 2 - countProperties { it.name == "fixtureProperty" && it.hasVarModifier } shouldBeEqualTo 0 + countProperties(includeNested = false) { it.isVal } shouldBeEqualTo 1 + countProperties { it.isVal } shouldBeEqualTo 2 + countProperties { it.name == "fixtureProperty" && it.isVar } shouldBeEqualTo 0 } } diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/KoParameterDeclarationForKoValModifierProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/KoParameterDeclarationForKoValModifierProviderTest.kt deleted file mode 100644 index c921d60917..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/KoParameterDeclarationForKoValModifierProviderTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.koparameter.forkomodifier - -import com.lemonappdev.konsist.TestSnippetProvider.getSnippetKoScope -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoParameterDeclarationForKoValModifierProviderTest { - @Test - fun `parameter-without-val-modifier`() { - // given - val sut = - getSnippetFile("parameter-without-val-modifier") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - - // then - sut?.hasValModifier shouldBeEqualTo false - } - - @Test - fun `parameter-with-val-modifier`() { - // given - val sut = - getSnippetFile("parameter-with-val-modifier") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - - // then - sut?.hasValModifier shouldBeEqualTo true - } - - private fun getSnippetFile(fileName: String) = - getSnippetKoScope("core/declaration/koparameter/forkomodifier/snippet/forkovalmodifierprovider/", fileName) -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/KoParameterDeclarationForKoVarModifierProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/KoParameterDeclarationForKoVarModifierProviderTest.kt deleted file mode 100644 index 876c97f3c0..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/KoParameterDeclarationForKoVarModifierProviderTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.koparameter.forkomodifier - -import com.lemonappdev.konsist.TestSnippetProvider.getSnippetKoScope -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoParameterDeclarationForKoVarModifierProviderTest { - @Test - fun `parameter-without-var-modifier`() { - // given - val sut = - getSnippetFile("parameter-without-var-modifier") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - - // then - sut?.hasVarModifier shouldBeEqualTo false - } - - @Test - fun `parameter-with-var-modifier`() { - // given - val sut = - getSnippetFile("parameter-with-var-modifier") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - - // then - sut?.hasVarModifier shouldBeEqualTo true - } - - private fun getSnippetFile(fileName: String) = - getSnippetKoScope("core/declaration/koparameter/forkomodifier/snippet/forkovarmodifierprovider/", fileName) -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovalmodifierprovider/parameter-with-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovalmodifierprovider/parameter-with-val-modifier.kttest deleted file mode 100644 index accec34b30..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovalmodifierprovider/parameter-with-val-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -class FixtureClass(val fixtureParameter: FixtureType) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovalmodifierprovider/parameter-without-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovalmodifierprovider/parameter-without-val-modifier.kttest deleted file mode 100644 index 298c082c94..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovalmodifierprovider/parameter-without-val-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -class FixtureClass(vararg fixtureParameter: FixtureType) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovarmodifierprovider/parameter-with-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovarmodifierprovider/parameter-with-var-modifier.kttest deleted file mode 100644 index 1586a65e8a..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovarmodifierprovider/parameter-with-var-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -class FixtureClass(var fixtureParameter: FixtureType) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovarmodifierprovider/parameter-without-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovarmodifierprovider/parameter-without-var-modifier.kttest deleted file mode 100644 index accec34b30..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koparameter/forkomodifier/snippet/forkovarmodifierprovider/parameter-without-var-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -class FixtureClass(val fixtureParameter: FixtureType) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/KoPropertyDeclarationForKoValModifierProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/KoPropertyDeclarationForKoValModifierProviderTest.kt deleted file mode 100644 index 0057ecb2b9..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/KoPropertyDeclarationForKoValModifierProviderTest.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.koproperty.forkomodifier - -import com.lemonappdev.konsist.TestSnippetProvider -import com.lemonappdev.konsist.api.ext.list.properties -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoPropertyDeclarationForKoValModifierProviderTest { - @Test - fun `property-has-no-val-modifier`() { - // given - val sut = - getSnippetFile("property-has-no-val-modifier") - .properties() - .first() - - // then - sut.hasValModifier shouldBeEqualTo false - } - - @Test - fun `property-has-val-modifier`() { - // given - val sut = - getSnippetFile("property-has-val-modifier") - .properties() - .first() - - // then - sut.hasValModifier shouldBeEqualTo true - } - - @Test - fun `property-defined-in-constructor-has-no-val-modifier`() { - // given - val sut = - getSnippetFile("property-defined-in-constructor-has-no-val-modifier") - .classes() - .properties() - .first() - - // then - sut.hasValModifier shouldBeEqualTo false - } - - @Test - fun `property-defined-in-constructor-has-val-modifier`() { - // given - val sut = - getSnippetFile("property-defined-in-constructor-has-val-modifier") - .classes() - .properties() - .first() - - // then - sut.hasValModifier shouldBeEqualTo true - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope( - "core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/", - fileName, - ) -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/KoPropertyDeclarationForKoVarModifierProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/KoPropertyDeclarationForKoVarModifierProviderTest.kt deleted file mode 100644 index dc055b4e2c..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/KoPropertyDeclarationForKoVarModifierProviderTest.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.koproperty.forkomodifier - -import com.lemonappdev.konsist.TestSnippetProvider -import com.lemonappdev.konsist.api.ext.list.properties -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoPropertyDeclarationForKoVarModifierProviderTest { - @Test - fun `property-has-no-var-modifier`() { - // given - val sut = - getSnippetFile("property-has-no-var-modifier") - .properties() - .first() - - // then - sut.hasVarModifier shouldBeEqualTo false - } - - @Test - fun `property-has-var-modifier`() { - // given - val sut = - getSnippetFile("property-has-var-modifier") - .properties() - .first() - - // then - sut.hasVarModifier shouldBeEqualTo true - } - - @Test - fun `property-defined-in-constructor-has-no-var-modifier`() { - // given - val sut = - getSnippetFile("property-defined-in-constructor-has-no-var-modifier") - .classes() - .properties() - .first() - - // then - sut.hasVarModifier shouldBeEqualTo false - } - - @Test - fun `property-defined-in-constructor-has-var-modifier`() { - // given - val sut = - getSnippetFile("property-defined-in-constructor-has-var-modifier") - .classes() - .properties() - .first() - - // then - sut.hasVarModifier shouldBeEqualTo true - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope( - "core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/", - fileName, - ) -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-defined-in-constructor-has-no-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-defined-in-constructor-has-no-val-modifier.kttest deleted file mode 100644 index c580ce16a2..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-defined-in-constructor-has-no-val-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass(var fixtureProperty: Int) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-defined-in-constructor-has-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-defined-in-constructor-has-val-modifier.kttest deleted file mode 100644 index 1b7f576fb2..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-defined-in-constructor-has-val-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass(val fixtureProperty: Int) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-has-no-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-has-no-val-modifier.kttest deleted file mode 100644 index ce8ce6297d..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-has-no-val-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -var fixtureProperty: Boolean = true diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-has-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-has-val-modifier.kttest deleted file mode 100644 index 3195307f79..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovalmodifierprovider/property-has-val-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty: Int = 6 diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-defined-in-constructor-has-no-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-defined-in-constructor-has-no-var-modifier.kttest deleted file mode 100644 index 1b7f576fb2..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-defined-in-constructor-has-no-var-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass(val fixtureProperty: Int) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-defined-in-constructor-has-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-defined-in-constructor-has-var-modifier.kttest deleted file mode 100644 index c580ce16a2..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-defined-in-constructor-has-var-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass(var fixtureProperty: Int) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-has-no-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-has-no-var-modifier.kttest deleted file mode 100644 index 3195307f79..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-has-no-var-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty: Int = 6 diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-has-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-has-var-modifier.kttest deleted file mode 100644 index ce8ce6297d..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/koproperty/forkomodifier/snippet/forkovarmodifierprovider/property-has-var-modifier.kttest +++ /dev/null @@ -1 +0,0 @@ -var fixtureProperty: Boolean = true diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest.kt index 6224b7d386..f9b4ec0fbc 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest.kt @@ -20,20 +20,13 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo null - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false it?.parameters shouldBeEqualTo null it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false } } @@ -50,20 +43,13 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo null - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false it?.parameters shouldBeEqualTo null it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false } } @@ -80,20 +66,13 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo emptyList() - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true it?.parameters shouldBeEqualTo emptyList() it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true } } @@ -110,20 +89,13 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo emptyList() - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true it?.parameters shouldBeEqualTo emptyList() it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true } } @@ -140,26 +112,16 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") - it?.numParameterTypes shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.numParameters shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -176,26 +138,16 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") - it?.numParameterTypes shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.numParameters shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -212,26 +164,19 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") - it?.numParameterTypes shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") it?.numParameters shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 2 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> + parameter.type.sourceDeclaration?.isKotlinType == true || parameter.type.isGeneric + } shouldBeEqualTo + true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -248,26 +193,19 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") - it?.numParameterTypes shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") it?.numParameters shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 2 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> + parameter.type.sourceDeclaration?.isKotlinType == true || parameter.type.isGeneric + } shouldBeEqualTo + true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -284,8 +222,6 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.parameters?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") } @@ -304,8 +240,6 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.parameters?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") } @@ -325,8 +259,8 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType shouldBeEqualTo null - it?.hasReturnType { type -> type.isKotlinType } shouldBeEqualTo false - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(Unit::class) shouldBeEqualTo false it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } @@ -346,8 +280,8 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType?.name shouldBeEqualTo "Unit" - it?.hasReturnType { type -> type.isKotlinType } shouldBeEqualTo true - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(Unit::class) shouldBeEqualTo true it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } @@ -367,8 +301,8 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType?.name shouldBeEqualTo "List" - it?.hasReturnType { type -> type.isGenericType } shouldBeEqualTo true - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.isGeneric } shouldBeEqualTo true + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } } @@ -387,8 +321,8 @@ class KoTypeArgumentDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType?.name shouldBeEqualTo "FixtureClass" - it?.hasReturnType { type -> type.isClass } shouldBeEqualTo true - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isClass == true } shouldBeEqualTo true + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(FixtureClass::class) shouldBeEqualTo true it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/KoTypeArgumentDeclarationForKoIsGenericTypeProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/KoTypeArgumentDeclarationForKoIsGenericTypeProviderTest.kt deleted file mode 100644 index f7d0eec20b..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/KoTypeArgumentDeclarationForKoIsGenericTypeProviderTest.kt +++ /dev/null @@ -1,75 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.kotypeargument - -import com.lemonappdev.konsist.TestSnippetProvider -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.Arguments.arguments -import org.junit.jupiter.params.provider.MethodSource - -class KoTypeArgumentDeclarationForKoIsGenericTypeProviderTest { - @ParameterizedTest - @MethodSource("provideValues") - fun `type-argument-is-not-generic-type`(fileName: String) { - // given - val sut = - getSnippetFile(fileName) - .properties() - .first() - .type - ?.typeArguments - ?.firstOrNull() - - // then - sut?.isGenericType shouldBeEqualTo false - } - - @Test - fun `generic-type-argument`() { - // given - val sut = - getSnippetFile("generic-type-argument") - .properties() - .first() - .type - ?.typeArguments - ?.firstOrNull() - - // then - sut?.isGenericType shouldBeEqualTo true - } - - @Test - fun `typealias-with-generic-type-argument`() { - // given - val sut = - getSnippetFile("typealias-with-generic-type-argument") - .properties() - .first() - .type - ?.typeArguments - ?.firstOrNull() - - // then - sut?.isGenericType shouldBeEqualTo true - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope("core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/", fileName) - - companion object { - @Suppress("unused") - @JvmStatic - fun provideValues() = - listOf( - arguments("class-type-argument"), - arguments("external-type-argument"), - arguments("function-type-argument"), - arguments("import-alias-type-argument"), - arguments("interface-type-argument"), - arguments("kotlin-type-argument"), - arguments("object-type-argument"), - arguments("typealias-without-generic-type-argument"), - ) - } -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/class-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/class-type-argument.kttest deleted file mode 100644 index 7b3140624e..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/class-type-argument.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureClass - -val fixtureProperty1: List = emptyList() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/external-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/external-type-argument.kttest deleted file mode 100644 index 733ff43505..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/external-type-argument.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.externalfixture.FixtureExternalClass - -val fixtureProperty1: List = emptyList() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/function-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/function-type-argument.kttest deleted file mode 100644 index 290cd9461c..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/function-type-argument.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: List<(String) -> Unit> = emptyList() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/generic-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/generic-type-argument.kttest deleted file mode 100644 index a55c8e752f..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/generic-type-argument.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: List> = listOf() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/import-alias-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/import-alias-type-argument.kttest deleted file mode 100644 index 9d19e47a5d..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/import-alias-type-argument.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureClass as FixtureAlias - -val fixtureProperty1: List = emptyList() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/interface-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/interface-type-argument.kttest deleted file mode 100644 index 8c374beb3f..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/interface-type-argument.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureInterface - -val fixtureProperty1: List = emptyList() - -class FixtureClass : FixtureInterface diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/kotlin-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/kotlin-type-argument.kttest deleted file mode 100644 index 069cce93af..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/kotlin-type-argument.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: List = emptyList() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/object-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/object-type-argument.kttest deleted file mode 100644 index 70d9b37bfd..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/object-type-argument.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -val fixtureProperty1: List = emptyList() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/typealias-with-generic-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/typealias-with-generic-type-argument.kttest deleted file mode 100644 index 48a5064b29..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/typealias-with-generic-type-argument.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureClass - -val fixtureProperty1: List = emptyList() - -typealias FixtureTypeAlias = Set diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/typealias-without-generic-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/typealias-without-generic-type-argument.kttest deleted file mode 100644 index 67f7f4c17c..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeargument/snippet/forkoisgenerictypeprovider/typealias-without-generic-type-argument.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureClass - -val fixtureProperty1: List = emptyList() - -typealias FixtureTypeAlias = (FixtureClass) -> Unit diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingDeclarationProviderTest.kt index 1d94c92050..330aa5fa62 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingDeclarationProviderTest.kt @@ -18,6 +18,7 @@ class KoTypeParameterDeclarationForKoContainingDeclarationProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -34,7 +35,8 @@ class KoTypeParameterDeclarationForKoContainingDeclarationProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then (sut?.containingDeclaration as? KoNameProvider)?.name shouldBeEqualTo "class-type-parameter-containing-declaration" @@ -49,6 +51,7 @@ class KoTypeParameterDeclarationForKoContainingDeclarationProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -63,6 +66,7 @@ class KoTypeParameterDeclarationForKoContainingDeclarationProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingFileProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingFileProviderTest.kt index 89e065b620..681b23b4f6 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingFileProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoContainingFileProviderTest.kt @@ -18,6 +18,7 @@ class KoTypeParameterDeclarationForKoContainingFileProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -34,7 +35,8 @@ class KoTypeParameterDeclarationForKoContainingFileProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then (sut?.containingDeclaration as? KoNameProvider)?.name shouldBeEqualTo "class-type-parameter-containing-file" @@ -49,6 +51,7 @@ class KoTypeParameterDeclarationForKoContainingFileProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -63,6 +66,7 @@ class KoTypeParameterDeclarationForKoContainingFileProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoLocationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoLocationProviderTest.kt index 5b95aecaa3..6e738fccdd 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoLocationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoLocationProviderTest.kt @@ -17,6 +17,7 @@ class KoTypeParameterDeclarationForKoLocationProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -33,7 +34,8 @@ class KoTypeParameterDeclarationForKoLocationProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then sut?.location shouldBeEqualTo "${sut?.path}:1:20" @@ -48,6 +50,7 @@ class KoTypeParameterDeclarationForKoLocationProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -62,6 +65,7 @@ class KoTypeParameterDeclarationForKoLocationProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoNameProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoNameProviderTest.kt index 2e6cf83645..1083464dc7 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoNameProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoNameProviderTest.kt @@ -19,6 +19,7 @@ class KoTypeParameterDeclarationForKoNameProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -41,7 +42,8 @@ class KoTypeParameterDeclarationForKoNameProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then assertSoftly(sut) { @@ -62,6 +64,7 @@ class KoTypeParameterDeclarationForKoNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -82,6 +85,7 @@ class KoTypeParameterDeclarationForKoNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPackageProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPackageProviderTest.kt index d87f54bd24..ac93ce64e3 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPackageProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPackageProviderTest.kt @@ -17,6 +17,7 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -31,6 +32,7 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -47,7 +49,8 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then sut?.packagee shouldBeEqualTo null @@ -63,7 +66,8 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then sut?.packagee?.name shouldBeEqualTo "com.fixturepackage" @@ -78,6 +82,7 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -93,6 +98,7 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -107,6 +113,7 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -121,6 +128,7 @@ class KoTypeParameterDeclarationForKoPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPathProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPathProviderTest.kt index 3447c25f9d..09aa176566 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPathProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoPathProviderTest.kt @@ -19,6 +19,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -36,6 +37,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -57,6 +59,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -76,6 +79,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -97,7 +101,8 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then assertSoftly(sut?.path) { @@ -116,7 +121,8 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then sut @@ -139,7 +145,8 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then assertSoftly(sut) { @@ -160,7 +167,8 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then assertSoftly(sut) { @@ -180,6 +188,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -198,6 +207,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -220,6 +230,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -240,6 +251,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -259,6 +271,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -276,6 +289,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -297,6 +311,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -316,6 +331,7 @@ class KoTypeParameterDeclarationForKoPathProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoResideInPackageProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoResideInPackageProviderTest.kt index 9f6ca5a9af..607049c6f0 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoResideInPackageProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoResideInPackageProviderTest.kt @@ -18,6 +18,7 @@ class KoTypeParameterDeclarationForKoResideInPackageProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -39,7 +40,8 @@ class KoTypeParameterDeclarationForKoResideInPackageProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then assertSoftly(sut) { @@ -59,6 +61,7 @@ class KoTypeParameterDeclarationForKoResideInPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -78,6 +81,7 @@ class KoTypeParameterDeclarationForKoResideInPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoTextProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoTextProviderTest.kt index f3476458a9..10fbc51b35 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoTextProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoTextProviderTest.kt @@ -18,6 +18,7 @@ class KoTypeParameterDeclarationForKoTextProviderTest { .functions() .returnTypes .firstOrNull() + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -44,7 +45,8 @@ class KoTypeParameterDeclarationForKoTextProviderTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then assertSoftly(sut) { @@ -69,6 +71,7 @@ class KoTypeParameterDeclarationForKoTextProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -93,6 +96,7 @@ class KoTypeParameterDeclarationForKoTextProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoUpperBoundsProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoUpperBoundsProviderTest.kt index 0ad8d610b5..2a728f5967 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoUpperBoundsProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationForKoUpperBoundsProviderTest.kt @@ -114,7 +114,7 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { upperBounds.size shouldBeEqualTo 2 numUpperBounds shouldBeEqualTo 2 countUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo 2 - countUpperBounds { upperBound -> upperBound.isKotlinCollectionType } shouldBeEqualTo 1 + countUpperBounds { upperBound -> upperBound.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 hasUpperBounds() shouldBeEqualTo true hasUpperBoundWithName(emptyList()) shouldBeEqualTo true hasUpperBoundWithName(emptySet()) shouldBeEqualTo true @@ -151,9 +151,9 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence")) shouldBeEqualTo false hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence"), ignoreCase = true) shouldBeEqualTo true hasUpperBound { it.hasNameStartingWith("List") } shouldBeEqualTo true - hasUpperBound { upperBound -> upperBound.isKotlinType } shouldBeEqualTo true + hasUpperBound { upperBound -> upperBound.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true hasAllUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo true - hasAllUpperBounds { upperBound -> upperBound.isInterface } shouldBeEqualTo true + hasAllUpperBounds { upperBound -> upperBound.sourceDeclaration?.isInterface == true } shouldBeEqualTo true } } @@ -265,7 +265,7 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { upperBounds.size shouldBeEqualTo 2 numUpperBounds shouldBeEqualTo 2 countUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo 2 - countUpperBounds { upperBound -> upperBound.isKotlinCollectionType } shouldBeEqualTo 1 + countUpperBounds { upperBound -> upperBound.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 hasUpperBounds() shouldBeEqualTo true hasUpperBoundWithName(emptyList()) shouldBeEqualTo true hasUpperBoundWithName(emptySet()) shouldBeEqualTo true @@ -302,9 +302,9 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence")) shouldBeEqualTo false hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence"), ignoreCase = true) shouldBeEqualTo true hasUpperBound { it.hasNameStartingWith("List") } shouldBeEqualTo true - hasUpperBound { upperBound -> upperBound.isKotlinType } shouldBeEqualTo true + hasUpperBound { upperBound -> upperBound.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true hasAllUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo true - hasAllUpperBounds { upperBound -> upperBound.isInterface } shouldBeEqualTo true + hasAllUpperBounds { upperBound -> upperBound.sourceDeclaration?.isInterface == true } shouldBeEqualTo true } } @@ -416,7 +416,7 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { upperBounds.size shouldBeEqualTo 2 numUpperBounds shouldBeEqualTo 2 countUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo 2 - countUpperBounds { upperBound -> upperBound.isKotlinCollectionType } shouldBeEqualTo 1 + countUpperBounds { upperBound -> upperBound.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 hasUpperBounds() shouldBeEqualTo true hasUpperBoundWithName(emptyList()) shouldBeEqualTo true hasUpperBoundWithName(emptySet()) shouldBeEqualTo true @@ -453,9 +453,9 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence")) shouldBeEqualTo false hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence"), ignoreCase = true) shouldBeEqualTo true hasUpperBound { it.hasNameStartingWith("List") } shouldBeEqualTo true - hasUpperBound { upperBound -> upperBound.isKotlinType } shouldBeEqualTo true + hasUpperBound { upperBound -> upperBound.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true hasAllUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo true - hasAllUpperBounds { upperBound -> upperBound.isInterface } shouldBeEqualTo true + hasAllUpperBounds { upperBound -> upperBound.sourceDeclaration?.isInterface == true } shouldBeEqualTo true } } @@ -567,7 +567,7 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { upperBounds.size shouldBeEqualTo 2 numUpperBounds shouldBeEqualTo 2 countUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo 2 - countUpperBounds { upperBound -> upperBound.isKotlinCollectionType } shouldBeEqualTo 1 + countUpperBounds { upperBound -> upperBound.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 hasUpperBounds() shouldBeEqualTo true hasUpperBoundWithName(emptyList()) shouldBeEqualTo true hasUpperBoundWithName(emptySet()) shouldBeEqualTo true @@ -604,9 +604,9 @@ class KoTypeParameterDeclarationForKoUpperBoundsProviderTest { hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence")) shouldBeEqualTo false hasUpperBoundsWithAllNames(setOf("list<*>", "charsequence"), ignoreCase = true) shouldBeEqualTo true hasUpperBound { it.hasNameStartingWith("List") } shouldBeEqualTo true - hasUpperBound { upperBound -> upperBound.isKotlinType } shouldBeEqualTo true + hasUpperBound { upperBound -> upperBound.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true hasAllUpperBounds { it.hasNameStartingWith("List") || it.hasNameStartingWith("Char") } shouldBeEqualTo true - hasAllUpperBounds { upperBound -> upperBound.isInterface } shouldBeEqualTo true + hasAllUpperBounds { upperBound -> upperBound.sourceDeclaration?.isInterface == true } shouldBeEqualTo true } } diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationTest.kt index 1b81bad272..8533a12a6d 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kotypeparameter/KoTypeParameterDeclarationTest.kt @@ -16,6 +16,7 @@ class KoTypeParameterDeclarationTest { .functions() .first() .returnType + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -32,7 +33,8 @@ class KoTypeParameterDeclarationTest { .parameters .first() .type - .asTypeParameterDeclaration() + .sourceDeclaration + ?.asTypeParameterDeclaration() // then sut.toString() shouldBeEqualTo "TestType" @@ -47,6 +49,7 @@ class KoTypeParameterDeclarationTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -61,6 +64,7 @@ class KoTypeParameterDeclarationTest { .properties() .first() .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/KoVariableDeclarationForKoValModifierProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/KoVariableDeclarationForKoValModifierProviderTest.kt deleted file mode 100644 index 9a24825409..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/KoVariableDeclarationForKoValModifierProviderTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.kovariable.forkomodifier - -import com.lemonappdev.konsist.TestSnippetProvider -import com.lemonappdev.konsist.api.ext.list.variables -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoVariableDeclarationForKoValModifierProviderTest { - @Test - fun `variable-has-no-val-modifier`() { - // given - val sut = - getSnippetFile("variable-has-no-val-modifier") - .functions() - .variables - .first() - - // then - sut.hasValModifier shouldBeEqualTo false - } - - @Test - fun `variable-has-val-modifier`() { - // given - val sut = - getSnippetFile("variable-has-val-modifier") - .functions() - .variables - .first() - - // then - sut.hasValModifier shouldBeEqualTo true - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope( - "core/declaration/kovariable/forkomodifier/snippet/forkovalmodifierprovider/", - fileName, - ) -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/KoVariableDeclarationForKoVarModifierProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/KoVariableDeclarationForKoVarModifierProviderTest.kt deleted file mode 100644 index 4f98990da1..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/KoVariableDeclarationForKoVarModifierProviderTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.kovariable.forkomodifier - -import com.lemonappdev.konsist.TestSnippetProvider -import com.lemonappdev.konsist.api.ext.list.variables -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoVariableDeclarationForKoVarModifierProviderTest { - @Test - fun `variable-has-no-var-modifier`() { - // given - val sut = - getSnippetFile("variable-has-no-var-modifier") - .functions() - .variables - .first() - - // then - sut.hasVarModifier shouldBeEqualTo false - } - - @Test - fun `variable-has-var-modifier`() { - // given - val sut = - getSnippetFile("variable-has-var-modifier") - .functions() - .variables - .first() - - // then - sut.hasVarModifier shouldBeEqualTo true - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope( - "core/declaration/kovariable/forkomodifier/snippet/forkovarmodifierprovider/", - fileName, - ) -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovalmodifierprovider/variable-has-no-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovalmodifierprovider/variable-has-no-val-modifier.kttest deleted file mode 100644 index 8ff5ea3392..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovalmodifierprovider/variable-has-no-val-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -fun fixtureFunction() { - var fixtureProperty = "" -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovalmodifierprovider/variable-has-val-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovalmodifierprovider/variable-has-val-modifier.kttest deleted file mode 100644 index e3dd37507a..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovalmodifierprovider/variable-has-val-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -fun fixtureFunction() { - val fixtureProperty = "" -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovarmodifierprovider/variable-has-no-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovarmodifierprovider/variable-has-no-var-modifier.kttest deleted file mode 100644 index e3dd37507a..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovarmodifierprovider/variable-has-no-var-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -fun fixtureFunction() { - val fixtureProperty = "" -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovarmodifierprovider/variable-has-var-modifier.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovarmodifierprovider/variable-has-var-modifier.kttest deleted file mode 100644 index 8ff5ea3392..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/kovariable/forkomodifier/snippet/forkovarmodifierprovider/variable-has-var-modifier.kttest +++ /dev/null @@ -1,3 +0,0 @@ -fun fixtureFunction() { - var fixtureProperty = "" -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest.kt index 7a6ca477b3..005c69cdea 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest.kt @@ -13,6 +13,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -27,6 +28,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -41,6 +43,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -55,6 +58,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -69,6 +73,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -83,6 +88,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -97,6 +103,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -111,6 +118,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -173,6 +181,7 @@ class KoKotlinTypeDeclarationForKoFullyQualifiedNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoNameProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoNameProviderTest.kt index 28bd13004a..f90e3ddc66 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoNameProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoNameProviderTest.kt @@ -14,6 +14,7 @@ class KoKotlinTypeDeclarationForKoNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -34,6 +35,7 @@ class KoKotlinTypeDeclarationForKoNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -124,6 +126,7 @@ class KoKotlinTypeDeclarationForKoNameProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoPackageProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoPackageProviderTest.kt index e9a31b8a09..ac8fd9df36 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoPackageProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoPackageProviderTest.kt @@ -13,6 +13,7 @@ class KoKotlinTypeDeclarationForKoPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -27,6 +28,7 @@ class KoKotlinTypeDeclarationForKoPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoResideInPackageProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoResideInPackageProviderTest.kt index c57a14f70c..4bb8ebac62 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoResideInPackageProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoResideInPackageProviderTest.kt @@ -14,6 +14,7 @@ class KoKotlinTypeDeclarationForKoResideInPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -33,6 +34,7 @@ class KoKotlinTypeDeclarationForKoResideInPackageProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoTextProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoTextProviderTest.kt index 910c6c0335..591ef06aae 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoTextProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationForKoTextProviderTest.kt @@ -14,6 +14,7 @@ class KoKotlinTypeDeclarationForKoTextProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -38,6 +39,7 @@ class KoKotlinTypeDeclarationForKoTextProviderTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationTest.kt index fb39a01b66..b3b5011bfe 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kokotlintype/KoKotlinTypeDeclarationTest.kt @@ -13,6 +13,7 @@ class KoKotlinTypeDeclarationTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then @@ -27,6 +28,7 @@ class KoKotlinTypeDeclarationTest { .properties() .first() .type + ?.sourceDeclaration ?.asKotlinTypeDeclaration() // then diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoDeclarationCastProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoDeclarationCastProviderTest.kt deleted file mode 100644 index 1b88b2e674..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoDeclarationCastProviderTest.kt +++ /dev/null @@ -1,1611 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.type.kotype - -import com.lemonappdev.konsist.TestSnippetProvider -import com.lemonappdev.konsist.api.Konsist -import com.lemonappdev.konsist.api.declaration.KoClassDeclaration -import com.lemonappdev.konsist.api.declaration.KoExternalDeclaration -import com.lemonappdev.konsist.api.declaration.KoImportAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoInterfaceDeclaration -import com.lemonappdev.konsist.api.declaration.KoObjectDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeParameterDeclaration -import com.lemonappdev.konsist.api.declaration.type.KoKotlinTypeDeclaration -import com.lemonappdev.konsist.api.declaration.type.KoStarProjectionDeclaration -import com.lemonappdev.konsist.externalfixture.FixtureExternalClass -import com.lemonappdev.konsist.testdata.FixtureClass -import com.lemonappdev.konsist.testdata.FixtureCollection1 -import com.lemonappdev.konsist.testdata.FixtureInterface -import com.lemonappdev.konsist.testdata.FixtureObject -import com.lemonappdev.konsist.testdata.FixtureType -import org.amshove.kluent.assertSoftly -import org.amshove.kluent.shouldBeEqualTo -import org.amshove.kluent.shouldBeInstanceOf -import org.junit.jupiter.api.Test -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.Arguments.arguments -import org.junit.jupiter.params.provider.MethodSource - -@Suppress("detekt.LargeClass", "detekt.LongMethod") -class KoTypeDeclarationForKoDeclarationCastProviderTest { - @Test - fun `nullable-class-type`() { - // given - val sut = - getSnippetFile("nullable-class-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asClassDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.asClassDeclaration()?.name shouldBeEqualTo "FixtureType" - it?.hasClassDeclaration() shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-class-type`() { - // given - val sut = - getSnippetFile("not-nullable-class-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asClassDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.asClassDeclaration()?.name shouldBeEqualTo "FixtureType" - it?.hasClassDeclaration() shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureType" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureType::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-object-type`() { - // given - val sut = - getSnippetFile("nullable-object-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo true - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo true - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.asObjectDeclaration()?.name shouldBeEqualTo "FixtureObject" - it?.hasObjectDeclaration() shouldBeEqualTo true - it?.hasObjectDeclaration { declaration -> declaration.name == "FixtureObject" } shouldBeEqualTo true - it?.hasObjectDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.hasClassOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-object-type`() { - // given - val sut = - getSnippetFile("not-nullable-object-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo true - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo true - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.asObjectDeclaration()?.name shouldBeEqualTo "FixtureObject" - it?.hasObjectDeclaration() shouldBeEqualTo true - it?.hasObjectDeclaration { declaration -> declaration.name == "FixtureObject" } shouldBeEqualTo true - it?.hasObjectDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.hasClassOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoObjectDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-interface-type`() { - // given - val sut = - getSnippetFile("nullable-interface-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo true - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo true - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.asInterfaceDeclaration()?.name shouldBeEqualTo "FixtureInterface" - it?.hasInterfaceDeclaration() shouldBeEqualTo true - it?.hasInterfaceDeclaration { declaration -> declaration.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasInterfaceDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-interface-type`() { - // given - val sut = - getSnippetFile("not-nullable-interface-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo true - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo true - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.asInterfaceDeclaration()?.name shouldBeEqualTo "FixtureInterface" - it?.hasInterfaceDeclaration() shouldBeEqualTo true - it?.hasInterfaceDeclaration { declaration -> declaration.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasInterfaceDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasInterfaceOrObjectDeclarationOf(FixtureObject::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoInterfaceDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureClass" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureInterface::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-import-alias-type`() { - // given - val sut = - getSnippetFile("not-nullable-import-alias-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo true - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeInstanceOf KoImportAliasDeclaration::class - it?.asImportAliasDeclaration()?.name shouldBeEqualTo "ImportAlias" - it?.hasImportAliasDeclaration() shouldBeEqualTo true - it?.hasImportAliasDeclaration { declaration -> declaration.name == "ImportAlias" } shouldBeEqualTo true - it?.hasImportAliasDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-typealias-type`() { - // given - val sut = - getSnippetFile("nullable-typealias-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo true - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeInstanceOf KoTypeAliasDeclaration::class - it?.asTypeAliasDeclaration()?.name shouldBeEqualTo "FixtureTypeAlias" - it?.hasTypeAliasDeclaration() shouldBeEqualTo true - it?.hasTypeAliasDeclaration { declaration -> declaration.name == "FixtureTypeAlias" } shouldBeEqualTo true - it?.hasTypeAliasDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-import-alias-type`() { - // given - val sut = - getSnippetFile("nullable-import-alias-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo true - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeInstanceOf KoImportAliasDeclaration::class - it?.asImportAliasDeclaration()?.name shouldBeEqualTo "ImportAlias" - it?.hasImportAliasDeclaration() shouldBeEqualTo true - it?.hasImportAliasDeclaration { declaration -> declaration.name == "ImportAlias" } shouldBeEqualTo true - it?.hasImportAliasDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-type-parameter`() { - // given - val sut = - getSnippetFile("nullable-type-parameter") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo true - it?.isExternal shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeInstanceOf KoTypeParameterDeclaration::class - it?.asTypeParameterDeclaration()?.name shouldBeEqualTo "TestType" - it?.hasTypeParameterDeclaration() shouldBeEqualTo true - it?.hasTypeParameterDeclaration { declaration -> declaration.name == "TestType" } shouldBeEqualTo true - it?.hasTypeParameterDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-type-parameter`() { - // given - val sut = - getSnippetFile("not-nullable-type-parameter") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo true - it?.isExternal shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeInstanceOf KoTypeParameterDeclaration::class - it?.asTypeParameterDeclaration()?.name shouldBeEqualTo "TestType" - it?.hasTypeParameterDeclaration() shouldBeEqualTo true - it?.hasTypeParameterDeclaration { declaration -> declaration.name == "TestType" } shouldBeEqualTo true - it?.hasTypeParameterDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-typealias-type`() { - // given - val sut = - getSnippetFile("not-nullable-typealias-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo true - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeInstanceOf KoTypeAliasDeclaration::class - it?.asTypeAliasDeclaration()?.name shouldBeEqualTo "FixtureTypeAlias" - it?.hasTypeAliasDeclaration() shouldBeEqualTo true - it?.hasTypeAliasDeclaration { declaration -> declaration.name == "FixtureTypeAlias" } shouldBeEqualTo true - it?.hasTypeAliasDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-kotlin-type`() { - // given - val sut = - getSnippetFile("nullable-kotlin-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo true - it?.isKotlinBasicType shouldBeEqualTo true - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeInstanceOf KoKotlinTypeDeclaration::class - it?.asKotlinTypeDeclaration()?.name shouldBeEqualTo "String" - it?.hasKotlinTypeDeclaration() shouldBeEqualTo true - it?.hasKotlinTypeDeclaration { declaration -> declaration.name == "String" } shouldBeEqualTo true - it?.hasKotlinTypeDeclaration { declaration -> declaration.name == "Set" } shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(String::class) shouldBeEqualTo true - it?.hasKotlinTypeDeclarationOf(Int::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeInstanceOf KoKotlinTypeDeclaration::class - it?.asKotlinBasicTypeDeclaration()?.name shouldBeEqualTo "String" - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo true - it?.hasKotlinBasicTypeDeclaration { declaration -> declaration.name == "String" } shouldBeEqualTo true - it?.hasKotlinBasicTypeDeclaration { declaration -> declaration.name == "Set" } shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(String::class) shouldBeEqualTo true - it?.hasKotlinBasicTypeDeclarationOf(Int::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(String::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(String::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(String::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.hasExternalDeclarationOf(String::class) shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-kotlin-type`() { - // given - val sut = - getSnippetFile("not-nullable-kotlin-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo true - it?.isKotlinBasicType shouldBeEqualTo true - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeInstanceOf KoKotlinTypeDeclaration::class - it?.asKotlinTypeDeclaration()?.name shouldBeEqualTo "String" - it?.hasKotlinTypeDeclaration() shouldBeEqualTo true - it?.hasKotlinTypeDeclaration { declaration -> declaration.name == "String" } shouldBeEqualTo true - it?.hasKotlinTypeDeclaration { declaration -> declaration.name == "Set" } shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(String::class) shouldBeEqualTo true - it?.hasKotlinTypeDeclarationOf(Int::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeInstanceOf KoKotlinTypeDeclaration::class - it?.asKotlinBasicTypeDeclaration()?.name shouldBeEqualTo "String" - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo true - it?.hasKotlinBasicTypeDeclaration { declaration -> declaration.name == "String" } shouldBeEqualTo true - it?.hasKotlinBasicTypeDeclaration { declaration -> declaration.name == "Set" } shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(String::class) shouldBeEqualTo true - it?.hasKotlinBasicTypeDeclarationOf(Int::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(String::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(String::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(String::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.hasExternalDeclarationOf(String::class) shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-function-type`() { - // given - val sut = - getSnippetFile("nullable-function-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-function-type`() { - // given - val sut = - getSnippetFile("not-nullable-function-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-generic-type`() { - // given - val sut = - getSnippetFile("nullable-generic-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asClassDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.asClassDeclaration()?.name shouldBeEqualTo "FixtureCollection1" - it?.hasClassDeclaration() shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-generic-type`() { - // given - val sut = - getSnippetFile("not-nullable-generic-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it?.asClassDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.asClassDeclaration()?.name shouldBeEqualTo "FixtureCollection1" - it?.hasClassDeclaration() shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassOrObjectDeclaration { decl -> decl.name == "FixtureObject" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeInstanceOf KoClassDeclaration::class - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureCollection1" } shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "FixtureInterface" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureCollection1::class) shouldBeEqualTo true - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureCollection1::class) shouldBeEqualTo false - it?.asExternalDeclaration() shouldBeEqualTo null - it?.hasExternalDeclaration() shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `nullable-external-type`() { - // given - val sut = - getSnippetFile("nullable-external-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo true - it?.asExternalDeclaration() shouldBeInstanceOf KoExternalDeclaration::class - it?.asExternalDeclaration()?.name shouldBeEqualTo "FixtureExternalClass" - it?.hasExternalDeclaration() shouldBeEqualTo true - it?.hasExternalDeclaration { declaration -> declaration.name == "FixtureExternalClass" } shouldBeEqualTo true - it?.hasExternalDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasExternalDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo true - it?.hasExternalDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-external-type`() { - // given - val sut = - getSnippetFile("not-nullable-external-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo true - it?.isClassOrInterface shouldBeEqualTo true - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo true - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo true - it?.asExternalDeclaration() shouldBeInstanceOf KoExternalDeclaration::class - it?.asExternalDeclaration()?.name shouldBeEqualTo "FixtureExternalClass" - it?.hasExternalDeclaration() shouldBeEqualTo true - it?.hasExternalDeclaration { declaration -> declaration.name == "FixtureExternalClass" } shouldBeEqualTo true - it?.hasExternalDeclaration { declaration -> declaration.name == "OtherName" } shouldBeEqualTo false - it?.hasExternalDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo true - it?.hasExternalDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasClassDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.hasObjectDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asClassOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo null - it?.hasClassOrInterfaceOrObjectDeclaration() shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclaration { decl -> decl.name == "someName" } shouldBeEqualTo false - it?.hasClassOrInterfaceOrObjectDeclarationOf(FixtureClass::class) shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinTypeDeclarationOf(FixtureExternalClass::class) shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `star-projection-type`() { - // given - val sut = - getSnippetFile("star-projection-type") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - ?.typeArguments - ?.firstOrNull() - ?.sourceDeclaration - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isClassOrObject shouldBeEqualTo false - it?.isClassOrInterface shouldBeEqualTo false - it?.isInterfaceOrObject shouldBeEqualTo false - it?.isClassOrInterfaceOrObject shouldBeEqualTo false - it?.isTypeAlias shouldBeEqualTo false - it?.isImportAlias shouldBeEqualTo false - it?.isKotlinType shouldBeEqualTo false - it?.isKotlinBasicType shouldBeEqualTo false - it?.isKotlinCollectionType shouldBeEqualTo false - it?.isTypeParameter shouldBeEqualTo false - it?.isExternal shouldBeEqualTo false - it shouldBeInstanceOf KoStarProjectionDeclaration::class - it?.asClassDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasObjectDeclaration() shouldBeEqualTo false - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.asTypeAliasDeclaration() shouldBeEqualTo null - it?.hasTypeAliasDeclaration() shouldBeEqualTo false - it?.asImportAliasDeclaration() shouldBeEqualTo null - it?.hasImportAliasDeclaration() shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinTypeDeclaration() shouldBeEqualTo false - it?.asKotlinBasicTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinBasicTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinBasicTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asKotlinCollectionTypeDeclaration() shouldBeEqualTo null - it?.hasKotlinCollectionTypeDeclaration() shouldBeEqualTo false - it?.hasKotlinCollectionTypeDeclarationOf(FixtureType::class) shouldBeEqualTo false - it?.asTypeParameterDeclaration() shouldBeEqualTo null - it?.hasTypeParameterDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `class-type-with-kotlin-type-name`() { - // given - val sut = - getSnippetFile("class-type-with-kotlin-type-name") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo true - it?.isKotlinType shouldBeEqualTo false - it?.asKotlinTypeDeclaration() shouldBeEqualTo null - } - } - - @ParameterizedTest - @MethodSource("provideValuesForKindOfTypeDeclaredOutsideProject") - fun `kind-of-type-declared-outside-project`( - fileName: String, - isClass: Boolean, - isInterface: Boolean, - isObject: Boolean, - ) { - // given - val sut = - getSnippetFile(fileName) - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type - ?.sourceDeclaration - - // then - assertSoftly(sut) { - it?.isClass shouldBeEqualTo isClass - it?.isInterface shouldBeEqualTo isInterface - it?.isObject shouldBeEqualTo isObject - it?.asClassDeclaration() shouldBeEqualTo null - it?.asInterfaceDeclaration() shouldBeEqualTo null - it?.asObjectDeclaration() shouldBeEqualTo null - it?.hasClassDeclaration() shouldBeEqualTo false - it?.hasInterfaceDeclaration() shouldBeEqualTo false - it?.hasObjectDeclaration() shouldBeEqualTo false - } - } - - @Test - fun `kind-of-type-not-on-classpath`() { - // given - val sut = - Konsist - .scopeFromFile(UNCOMPILED_PARENT_TEST_DATA_PATH) - .classes() - .first { it.name == "FixtureClassWithTypeNotOnClasspath" } - .primaryConstructor - ?.parameters - ?.first() - ?.type - ?.sourceDeclaration - - // then - assertSoftly(sut) { - it?.isExternal shouldBeEqualTo true - it?.isClass shouldBeEqualTo false - it?.isInterface shouldBeEqualTo false - it?.isObject shouldBeEqualTo false - } - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope( - "core/declaration/type/kotype/snippet/forkodeclarationcastprovider/", - fileName, - ) - - companion object { - private const val UNCOMPILED_PARENT_TEST_DATA_PATH = - "lib/src/integrationTest/resources/com/lemonappdev/konsist/testdata/UncompiledParentTestData.kt" - - @Suppress("unused") - @JvmStatic - fun provideValuesForKindOfTypeDeclaredOutsideProject() = - listOf( - arguments("not-nullable-external-type", true, false, false), - arguments("external-interface-type", false, true, false), - arguments("external-object-type", false, false, true), - arguments("external-companion-object-type", false, false, true), - arguments("external-nested-interface-type", false, true, false), - arguments("not-nullable-kotlin-type", true, false, false), - arguments("kotlin-interface-type", false, true, false), - arguments("kotlin-object-type", false, false, true), - ) - } -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest.kt index 399e89ef9c..7fea638710 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest.kt @@ -18,20 +18,13 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo null - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false it?.parameters shouldBeEqualTo null it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false } } @@ -46,20 +39,13 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo null - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false it?.parameters shouldBeEqualTo null it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false } } @@ -74,20 +60,13 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo emptyList() - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true it?.parameters shouldBeEqualTo emptyList() it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true } } @@ -102,20 +81,13 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes shouldBeEqualTo emptyList() - it?.numParameterTypes shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true it?.parameters shouldBeEqualTo emptyList() it?.numParameters shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 0 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 0 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true } } @@ -130,26 +102,16 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") - it?.numParameterTypes shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.numParameters shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -164,26 +126,16 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") - it?.numParameterTypes shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.numParameters shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 0 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 0 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -198,26 +150,19 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") - it?.numParameterTypes shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") it?.numParameters shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 2 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> + parameter.type.sourceDeclaration?.isKotlinType == true || parameter.type.isGeneric + } shouldBeEqualTo + true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -232,26 +177,19 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") - it?.numParameterTypes shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameterTypes { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameterTypes { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameterType { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameterType { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameterTypes { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameterTypes { parameter -> parameter.type.isExternal } shouldBeEqualTo false it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String", "List") it?.numParameters shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinType } shouldBeEqualTo 2 - it?.countParameters { parameter -> parameter.type.isKotlinCollectionType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isKotlinBasicType } shouldBeEqualTo 1 - it?.countParameters { parameter -> parameter.type.isClass } shouldBeEqualTo 1 - it?.hasParameter { parameter -> parameter.type.isKotlinType } shouldBeEqualTo true - it?.hasParameter { parameter -> parameter.type.isExternal } shouldBeEqualTo false - it?.hasAllParameters { parameter -> parameter.type.isKotlinType || parameter.type.isGenericType } shouldBeEqualTo true - it?.hasAllParameters { parameter -> parameter.type.isExternal } shouldBeEqualTo false + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo 2 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinCollectionType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isKotlinBasicType == true } shouldBeEqualTo 1 + it?.countParameters { parameter -> parameter.type.sourceDeclaration?.isClass == true } shouldBeEqualTo 1 + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasParameter { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false + it?.hasAllParameters { parameter -> + parameter.type.sourceDeclaration?.isKotlinType == true || parameter.type.isGeneric + } shouldBeEqualTo + true + it?.hasAllParameters { parameter -> parameter.type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false } } @@ -266,8 +204,6 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.parameters?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") } @@ -284,8 +220,6 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { - it?.parameterTypes?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") - it?.parameterTypes?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") it?.parameters?.map { parameter -> parameter.name } shouldBeEqualTo listOf("fixtureParameter") it?.parameters?.map { parameter -> parameter.type.name } shouldBeEqualTo listOf("String") } @@ -303,8 +237,8 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType shouldBeEqualTo null - it?.hasReturnType { type -> type.isKotlinType } shouldBeEqualTo false - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(Unit::class) shouldBeEqualTo false it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } @@ -322,8 +256,8 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType?.name shouldBeEqualTo "Unit" - it?.hasReturnType { type -> type.isKotlinType } shouldBeEqualTo true - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isKotlinType == true } shouldBeEqualTo true + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(Unit::class) shouldBeEqualTo true it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } @@ -341,8 +275,8 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType?.name shouldBeEqualTo "List" - it?.hasReturnType { type -> type.isGenericType } shouldBeEqualTo true - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.isGeneric } shouldBeEqualTo true + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } } @@ -359,8 +293,8 @@ class KoTypeDeclarationForKoFunctionTypeDeclarationProviderTest { // then assertSoftly(sut) { it?.returnType?.name shouldBeEqualTo "FixtureClass" - it?.hasReturnType { type -> type.isClass } shouldBeEqualTo true - it?.hasReturnType { type -> type.isExternal } shouldBeEqualTo false + it?.hasReturnType { type -> type.sourceDeclaration?.isClass == true } shouldBeEqualTo true + it?.hasReturnType { type -> type.sourceDeclaration?.isExternal == true } shouldBeEqualTo false it?.hasReturnTypeOf(FixtureClass::class) shouldBeEqualTo true it?.hasReturnTypeOf(String::class) shouldBeEqualTo false } diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoIsGenericTypeProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoIsGenericTypeProviderTest.kt deleted file mode 100644 index fbc07f1c65..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoIsGenericTypeProviderTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.type.kotype - -import com.lemonappdev.konsist.TestSnippetProvider -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.Arguments.arguments -import org.junit.jupiter.params.provider.MethodSource - -class KoTypeDeclarationForKoIsGenericTypeProviderTest { - @ParameterizedTest - @MethodSource("provideValues") - fun `is-generic-type`( - fileName: String, - value: Boolean, - ) { - // given - val sut = - getSnippetFile(fileName) - .properties() - .first() - .type - - // then - sut?.isGenericType shouldBeEqualTo value - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope("core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/", fileName) - - companion object { - @Suppress("unused") - @JvmStatic - fun provideValues() = - listOf( - arguments("kotlin-type", false), - arguments("generic-type", true), - arguments("generic-class-type", true), - arguments("not-generic-class-type", false), - arguments("interface-type", false), - arguments("object-type", false), - arguments("function-type", false), - arguments("generic-import-alias-type", true), - arguments("not-generic-import-alias-type", false), - arguments("generic-typealias-type", true), - arguments("not-generic-typealias-type", false), - arguments("external-type", false), - ) - } -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoSourceAndAliasTypeProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoSourceAndAliasTypeProviderTest.kt deleted file mode 100644 index 33e41975f8..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/KoTypeDeclarationForKoSourceAndAliasTypeProviderTest.kt +++ /dev/null @@ -1,395 +0,0 @@ -package com.lemonappdev.konsist.core.declaration.type.kotype - -import com.lemonappdev.konsist.TestSnippetProvider -import com.lemonappdev.konsist.api.provider.KoSourceAndAliasTypeProvider -import org.amshove.kluent.assertSoftly -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoTypeDeclarationForKoSourceAndAliasTypeProviderTest { - @Test - fun `nullable-class-type`() { - // given - val sut = - getSnippetFile("nullable-class-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureType?" - it?.bareSourceType shouldBeEqualTo "FixtureType" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-class-type`() { - // given - val sut = - getSnippetFile("not-nullable-class-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureType" - it?.bareSourceType shouldBeEqualTo "FixtureType" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-interface-type`() { - // given - val sut = - getSnippetFile("nullable-interface-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureInterface?" - it?.bareSourceType shouldBeEqualTo "FixtureInterface" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-interface-type`() { - // given - val sut = - getSnippetFile("not-nullable-interface-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureInterface" - it?.bareSourceType shouldBeEqualTo "FixtureInterface" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-object-type`() { - // given - val sut = - getSnippetFile("nullable-object-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureObject?" - it?.bareSourceType shouldBeEqualTo "FixtureObject" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-object-type`() { - // given - val sut = - getSnippetFile("not-nullable-object-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureObject" - it?.bareSourceType shouldBeEqualTo "FixtureObject" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-typealias-type`() { - // given - val sut = - getSnippetFile("nullable-typealias-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureTypeAlias?" - it?.bareSourceType shouldBeEqualTo "() -> Unit" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-typealias-type`() { - // given - val sut = - getSnippetFile("not-nullable-typealias-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureTypeAlias" - it?.bareSourceType shouldBeEqualTo "() -> Unit" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-type-parameter`() { - // given - val sut = - getSnippetFile("nullable-type-parameter") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "TestType?" - it?.bareSourceType shouldBeEqualTo "TestType" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-type-parameter`() { - // given - val sut = - getSnippetFile("not-nullable-type-parameter") - .classes() - .first() - .primaryConstructor - ?.parameters - ?.first() - ?.type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "TestType" - it?.bareSourceType shouldBeEqualTo "TestType" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-kotlin-type`() { - // given - val sut = - getSnippetFile("not-nullable-kotlin-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "String" - it?.bareSourceType shouldBeEqualTo "String" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-kotlin-type`() { - // given - val sut = - getSnippetFile("nullable-kotlin-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "String?" - it?.bareSourceType shouldBeEqualTo "String" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-generic-type`() { - // given - val sut = - getSnippetFile("not-nullable-generic-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "List" - it?.bareSourceType shouldBeEqualTo "List" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-generic-type-with-nullable-type-argument`() { - // given - val sut = - getSnippetFile("not-nullable-generic-type-with-nullable-type-argument") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "List" - it?.bareSourceType shouldBeEqualTo "List" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-generic-type`() { - // given - val sut = - getSnippetFile("nullable-generic-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "List?" - it?.bareSourceType shouldBeEqualTo "List" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-generic-type-with-nullable-type-argument`() { - // given - val sut = - getSnippetFile("nullable-generic-type-with-nullable-type-argument") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "List?" - it?.bareSourceType shouldBeEqualTo "List" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-import-alias-type`() { - // given - val sut = - getSnippetFile("not-nullable-import-alias-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureType" - it?.bareSourceType shouldBeEqualTo "FixtureType" - it?.isAlias shouldBeEqualTo true - } - } - - @Test - fun `nullable-import-alias-type`() { - // given - val sut = - getSnippetFile("nullable-import-alias-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureType" - it?.bareSourceType shouldBeEqualTo "FixtureType" - it?.isAlias shouldBeEqualTo true - } - } - - @Test - fun `not-nullable-function-type`() { - // given - val sut = - getSnippetFile("not-nullable-function-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "() -> Unit" - it?.bareSourceType shouldBeEqualTo "() -> Unit" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-function-type`() { - // given - val sut = - getSnippetFile("nullable-function-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "(() -> Unit)?" - it?.bareSourceType shouldBeEqualTo "() -> Unit" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `not-nullable-external-type`() { - // given - val sut = - getSnippetFile("not-nullable-external-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureExternalClass" - it?.bareSourceType shouldBeEqualTo "FixtureExternalClass" - it?.isAlias shouldBeEqualTo false - } - } - - @Test - fun `nullable-external-type`() { - // given - val sut = - getSnippetFile("nullable-external-type") - .properties() - .first() - .type as? KoSourceAndAliasTypeProvider - - // then - assertSoftly(sut) { - it?.sourceType shouldBeEqualTo "FixtureExternalClass?" - it?.bareSourceType shouldBeEqualTo "FixtureExternalClass" - it?.isAlias shouldBeEqualTo false - } - } - - private fun getSnippetFile(fileName: String) = - TestSnippetProvider.getSnippetKoScope( - "core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/", - fileName, - ) -} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/class-type-with-kotlin-type-name.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/class-type-with-kotlin-type-name.kttest deleted file mode 100644 index 925e7731f7..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/class-type-with-kotlin-type-name.kttest +++ /dev/null @@ -1,5 +0,0 @@ -package com.fixturepackage - -class SampleClass(val sampleParameter: Result) - -class Result diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-companion-object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-companion-object-type.kttest deleted file mode 100644 index df0143c1d4..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-companion-object-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import kotlin.random.Random - -class FixtureClass1(val fixtureProperty1: Random.Default) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-interface-type.kttest deleted file mode 100644 index 7e9a5ef29e..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-interface-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.externalfixture.FixtureExternalInterface - -class FixtureClass1(val fixtureProperty1: FixtureExternalInterface) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-nested-interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-nested-interface-type.kttest deleted file mode 100644 index d1f3a0b528..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-nested-interface-type.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass1(val fixtureProperty1: Thread.UncaughtExceptionHandler) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-object-type.kttest deleted file mode 100644 index 42f39602da..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/external-object-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import kotlin.coroutines.EmptyCoroutineContext - -class FixtureClass1(val fixtureProperty1: EmptyCoroutineContext) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/kotlin-interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/kotlin-interface-type.kttest deleted file mode 100644 index 89665e1442..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/kotlin-interface-type.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass1(val fixtureProperty1: CharSequence) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/kotlin-object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/kotlin-object-type.kttest deleted file mode 100644 index 6e5199b5a5..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/kotlin-object-type.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass1(val fixtureProperty1: Unit) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-class-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-class-type.kttest deleted file mode 100644 index e24f2c3d54..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-class-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -class FixtureClass1(val fixtureProperty1: FixtureType) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-external-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-external-type.kttest deleted file mode 100644 index 02037c8bcd..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-external-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.externalfixture.FixtureExternalClass - -class FixtureClass1(val fixtureProperty1: FixtureExternalClass) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-function-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-function-type.kttest deleted file mode 100644 index 487d35bbf4..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-function-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -class FixtureClass1(val fixtureProperty1: (FixtureObject) -> Unit) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-generic-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-generic-type.kttest deleted file mode 100644 index 390fd546b7..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-generic-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureCollection1 - -class FixtureClass1(val fixtureProperty1: FixtureCollection1) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-import-alias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-import-alias-type.kttest deleted file mode 100644 index 835a2c590a..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-import-alias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject as ImportAlias - -class FixtureClass1(val fixtureProperty1: ImportAlias) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-interface-type.kttest deleted file mode 100644 index b3ac734ed7..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-interface-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureInterface - -class FixtureClass1(val fixtureProperty1: FixtureInterface) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-kotlin-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-kotlin-type.kttest deleted file mode 100644 index 3c76a622cb..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-kotlin-type.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass1(val fixtureProperty1: String) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-object-type.kttest deleted file mode 100644 index be2a3b32f6..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-object-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -class FixtureClass1(val fixtureProperty1: FixtureObject) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-type-parameter.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-type-parameter.kttest deleted file mode 100644 index 752fafbd4c..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-type-parameter.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass (fixtureProperty: TestType) {} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-typealias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-typealias-type.kttest deleted file mode 100644 index 7c9ee6de48..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/not-nullable-typealias-type.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -class FixtureClass1(val fixtureProperty1: FixtureTypeAlias) - -typealias FixtureTypeAlias = (FixtureObject) -> Unit diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-class-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-class-type.kttest deleted file mode 100644 index f86d9d30c6..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-class-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -class FixtureClass1(val fixtureProperty1: FixtureType?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-external-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-external-type.kttest deleted file mode 100644 index 3425c5f64c..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-external-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.externalfixture.FixtureExternalClass - -class FixtureClass1(val fixtureProperty1: FixtureExternalClass?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-function-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-function-type.kttest deleted file mode 100644 index 8d1baf277f..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-function-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -class FixtureClass1(val fixtureProperty1: ((FixtureObject) -> Unit)?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-generic-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-generic-type.kttest deleted file mode 100644 index 89ec2d5bd1..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-generic-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureCollection1 - -class FixtureClass1(val fixtureProperty1: FixtureCollection1?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-import-alias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-import-alias-type.kttest deleted file mode 100644 index 9520e77896..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-import-alias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject as ImportAlias - -class FixtureClass1(val fixtureProperty1: ImportAlias?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-interface-type.kttest deleted file mode 100644 index 2f132d6786..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-interface-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureInterface - -class FixtureClass1(val fixtureProperty1: FixtureInterface?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-kotlin-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-kotlin-type.kttest deleted file mode 100644 index d9d5051637..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-kotlin-type.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass1(val fixtureProperty1: String?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-object-type.kttest deleted file mode 100644 index f7d24783d2..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-object-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -class FixtureClass1(val fixtureProperty1: FixtureObject?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-type-parameter.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-type-parameter.kttest deleted file mode 100644 index 54a20459b8..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-type-parameter.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass (fixtureProperty: TestType?) {} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-typealias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-typealias-type.kttest deleted file mode 100644 index 17c907dea4..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/nullable-typealias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureTypeAlias - -class FixtureClass1(val fixtureProperty1: FixtureTypeAlias?) diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/star-projection-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/star-projection-type.kttest deleted file mode 100644 index ca31003cbe..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkodeclarationcastprovider/star-projection-type.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass (fixtureProperty: List<*>) {} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/external-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/external-type.kttest deleted file mode 100644 index f627498602..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/external-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.externalfixture.FixtureExternalClass - -val fixtureProperty1: FixtureExternalClass = FixtureExternalClass() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/function-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/function-type.kttest deleted file mode 100644 index d9a09779f6..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/function-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -val fixtureProperty1: (String) -> Unit = {} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-class-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-class-type.kttest deleted file mode 100644 index 8e73b62a43..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-class-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureGenericClassWithParameter - -val fixtureProperty1: FixtureGenericClassWithParameter = FixtureGenericClassWithParameter("") diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-import-alias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-import-alias-type.kttest deleted file mode 100644 index 7ffe66f2c3..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-import-alias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureGenericClassWithParameter as FixtureAlias - -val fixtureProperty1: FixtureAlias = FixtureAlias("") diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-type.kttest deleted file mode 100644 index a55c8e752f..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-type.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: List> = listOf() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-typealias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-typealias-type.kttest deleted file mode 100644 index a8d6433821..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/generic-typealias-type.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureGenericClassWithParameter - -val fixtureProperty1: FixtureTypeAlias = FixtureTypeAlias("") - -typealias FixtureTypeAlias = FixtureGenericClassWithParameter diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/interface-type.kttest deleted file mode 100644 index eb4d90e8e3..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/interface-type.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureInterface - -val fixtureProperty1: FixtureInterface = FixtureClass() - -class FixtureClass : FixtureInterface diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/kotlin-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/kotlin-type.kttest deleted file mode 100644 index fcc3698d97..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/kotlin-type.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: String = "" diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-class-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-class-type.kttest deleted file mode 100644 index fd84ade9b7..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-class-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureClass - -val fixtureProperty1: FixtureClass = FixtureClass() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-import-alias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-import-alias-type.kttest deleted file mode 100644 index c98440f8e7..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-import-alias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureClass as FixtureAlias - -val fixtureProperty1: FixtureAlias = FixtureAlias() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-typealias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-typealias-type.kttest deleted file mode 100644 index 05fab6b3d5..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/not-generic-typealias-type.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureClass - -val fixtureProperty1: FixtureTypeAlias = {} - -typealias FixtureTypeAlias = (FixtureClass) -> Unit diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/object-type.kttest deleted file mode 100644 index bf36d18fe4..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkoisgenerictypeprovider/object-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -val fixtureProperty1: FixtureObject = FixtureObject diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/FixturePropertyDeprecated.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/FixturePropertyDeprecated.kt deleted file mode 100644 index e74099066c..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/FixturePropertyDeprecated.kt +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -val fixturePropertyDeprecated: FixtureType? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-class-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-class-type.kttest deleted file mode 100644 index 18c7ed93c6..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-class-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -val fixtureProperty1: FixtureType = FixtureType() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-external-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-external-type.kttest deleted file mode 100644 index f627498602..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-external-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.externalfixture.FixtureExternalClass - -val fixtureProperty1: FixtureExternalClass = FixtureExternalClass() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-function-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-function-type.kttest deleted file mode 100644 index 19e2a5ca3a..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-function-type.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: () -> Unit = {} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-generic-type-with-nullable-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-generic-type-with-nullable-type-argument.kttest deleted file mode 100644 index 62d946a0b2..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-generic-type-with-nullable-type-argument.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -val fixtureProperty1: List = listOf() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-generic-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-generic-type.kttest deleted file mode 100644 index 0bcb10719a..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-generic-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -val fixtureProperty1: List = listOf() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-import-alias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-import-alias-type.kttest deleted file mode 100644 index ba08fd991a..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-import-alias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType as ImportAlias - -val fixtureProperty1: ImportAlias = ImportAlias() diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-interface-type.kttest deleted file mode 100644 index e885e887b3..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-interface-type.kttest +++ /dev/null @@ -1,5 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureInterface - -val fixtureProperty1: FixtureInterface = FixtureClass() - -class FixtureClass: FixtureInterface diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-kotlin-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-kotlin-type.kttest deleted file mode 100644 index fcc3698d97..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-kotlin-type.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: String = "" diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-object-type.kttest deleted file mode 100644 index bf36d18fe4..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-object-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -val fixtureProperty1: FixtureObject = FixtureObject diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-type-parameter.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-type-parameter.kttest deleted file mode 100644 index 752fafbd4c..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-type-parameter.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass (fixtureProperty: TestType) {} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-typealias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-typealias-type.kttest deleted file mode 100644 index 1a4e1b2ff1..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/not-nullable-typealias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -val fixtureProperty1: FixtureTypeAlias = {} - -typealias FixtureTypeAlias = () -> Unit diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-class-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-class-type.kttest deleted file mode 100644 index a5a88f8062..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-class-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -val fixtureProperty1: FixtureType? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-external-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-external-type.kttest deleted file mode 100644 index b86e4e9e56..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-external-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.externalfixture.FixtureExternalClass - -val fixtureProperty1: FixtureExternalClass? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-function-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-function-type.kttest deleted file mode 100644 index 809617b8bf..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-function-type.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: (() -> Unit)? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-generic-type-with-nullable-type-argument.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-generic-type-with-nullable-type-argument.kttest deleted file mode 100644 index 8896625282..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-generic-type-with-nullable-type-argument.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -val fixtureProperty1: List? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-generic-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-generic-type.kttest deleted file mode 100644 index 0569d358e7..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-generic-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType - -val fixtureProperty1: List? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-import-alias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-import-alias-type.kttest deleted file mode 100644 index b7ce837c73..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-import-alias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureType as ImportAlias - -val fixtureProperty1: ImportAlias? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-interface-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-interface-type.kttest deleted file mode 100644 index 6101ffb8bd..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-interface-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureInterface - -val fixtureProperty1: FixtureInterface? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-kotlin-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-kotlin-type.kttest deleted file mode 100644 index 349a2d1b25..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-kotlin-type.kttest +++ /dev/null @@ -1 +0,0 @@ -val fixtureProperty1: String? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-object-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-object-type.kttest deleted file mode 100644 index a8d0fa9d56..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-object-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -import com.lemonappdev.konsist.testdata.FixtureObject - -val fixtureProperty1: FixtureObject? = null diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-type-parameter.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-type-parameter.kttest deleted file mode 100644 index 54a20459b8..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-type-parameter.kttest +++ /dev/null @@ -1 +0,0 @@ -class FixtureClass (fixtureProperty: TestType?) {} diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-typealias-type.kttest b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-typealias-type.kttest deleted file mode 100644 index 41ac2149b9..0000000000 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/declaration/type/kotype/snippet/forkosourceandaliastypeprovider/nullable-typealias-type.kttest +++ /dev/null @@ -1,3 +0,0 @@ -val fixtureProperty1: FixtureTypeAlias? = null - -typealias FixtureTypeAlias = () -> Unit diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderListTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderListTest.kt index 13e8c427c7..aad291d087 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderListTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderListTest.kt @@ -4,7 +4,7 @@ import com.lemonappdev.konsist.TestSnippetProvider import com.lemonappdev.konsist.api.declaration.KoFileDeclaration import com.lemonappdev.konsist.api.provider.KoNameProvider import com.lemonappdev.konsist.api.provider.KoReturnProvider -import com.lemonappdev.konsist.api.provider.KoSourceAndAliasTypeProvider +import com.lemonappdev.konsist.api.provider.KoSourceTypeProvider import com.lemonappdev.konsist.api.verify.assertEmpty import com.lemonappdev.konsist.api.verify.assertNotEmpty import com.lemonappdev.konsist.core.exception.KoAssertionFailedException @@ -58,7 +58,7 @@ class AssertEmptyOnProviderListTest { getSnippetFile("provider-assert-empty-error-on-list-containing-one-null-value") .declarations() .filterNot { it is KoFileDeclaration } - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } // then try { @@ -78,7 +78,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("provider-assert-empty-error-on-list-containing-two-null-values") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } // then try { @@ -206,7 +206,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("provider-assert-not-empty-error-with-custom-message") .declarations() - .filterIsInstance() + .filterIsInstance() // then try { @@ -227,7 +227,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("provider-assert-not-empty-error-with-custom-message-and-strict-set-to-true") .declarations() - .filterIsInstance() + .filterIsInstance() // then try { @@ -247,7 +247,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-empty-passes-when-item-list-is-empty") .declarations() - .filterIsInstance() + .filterIsInstance() // then sut.assertEmpty() @@ -276,7 +276,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-empty-fails-when-item-list-has-only-nulls") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } // when val func = { @@ -293,7 +293,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-empty-passes-when-item-list-is-empty-and-strict-set-to-true") .declarations() - .filterIsInstance() + .filterIsInstance() // then sut.assertEmpty(strict = true) @@ -320,7 +320,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-empty-passes-when-item-list-has-only-nulls-and-strict-set-to-true") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } // then sut.assertEmpty(strict = true) @@ -344,7 +344,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-not-empty-fails-when-item-list-is-empty") .declarations() - .filterIsInstance() + .filterIsInstance() // when val func = { @@ -361,7 +361,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-not-empty-passes-when-item-list-has-only-nulls") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } // then sut.assertNotEmpty() @@ -385,7 +385,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-not-empty-fails-when-item-list-is-empty-and-strict-set-to-true") .declarations() - .filterIsInstance() + .filterIsInstance() // when val func = { @@ -402,7 +402,7 @@ class AssertEmptyOnProviderListTest { val sut = getSnippetFile("assert-not-empty-fails-when-item-list-has-only-nulls-and-strict-set-to-true") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } // when val func = { diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderSequenceTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderSequenceTest.kt index 7dd8854263..f426a84179 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderSequenceTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertempty/AssertEmptyOnProviderSequenceTest.kt @@ -4,7 +4,7 @@ import com.lemonappdev.konsist.TestSnippetProvider import com.lemonappdev.konsist.api.declaration.KoFileDeclaration import com.lemonappdev.konsist.api.provider.KoNameProvider import com.lemonappdev.konsist.api.provider.KoReturnProvider -import com.lemonappdev.konsist.api.provider.KoSourceAndAliasTypeProvider +import com.lemonappdev.konsist.api.provider.KoSourceTypeProvider import com.lemonappdev.konsist.api.verify.assertEmpty import com.lemonappdev.konsist.api.verify.assertNotEmpty import com.lemonappdev.konsist.core.exception.KoAssertionFailedException @@ -60,7 +60,7 @@ class AssertEmptyOnProviderSequenceTest { getSnippetFile("provider-assert-empty-error-on-list-containing-one-null-value") .declarations() .filterNot { it is KoFileDeclaration } - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } .asSequence() // then @@ -81,7 +81,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("provider-assert-empty-error-on-list-containing-two-null-values") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } .asSequence() // then @@ -214,7 +214,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("provider-assert-not-empty-error-with-custom-message") .declarations() - .filterIsInstance() + .filterIsInstance() .asSequence() // then @@ -236,7 +236,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("provider-assert-not-empty-error-with-custom-message-and-strict-set-to-true") .declarations() - .filterIsInstance() + .filterIsInstance() .asSequence() // then @@ -257,7 +257,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-empty-passes-when-item-list-is-empty") .declarations() - .filterIsInstance() + .filterIsInstance() .asSequence() // then @@ -288,7 +288,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-empty-fails-when-item-list-has-only-nulls") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } .asSequence() // when @@ -306,7 +306,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-empty-passes-when-item-list-is-empty-and-strict-set-to-true") .declarations() - .filterIsInstance() + .filterIsInstance() .asSequence() // then @@ -335,7 +335,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-empty-passes-when-item-list-has-only-nulls-and-strict-set-to-true") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } .asSequence() // then @@ -361,7 +361,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-not-empty-fails-when-item-list-is-empty") .declarations() - .filterIsInstance() + .filterIsInstance() .asSequence() // when @@ -379,7 +379,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-not-empty-passes-when-item-list-has-only-nulls") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } .asSequence() // then @@ -405,7 +405,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-not-empty-fails-when-item-list-is-empty-and-strict-set-to-true") .declarations() - .filterIsInstance() + .filterIsInstance() .asSequence() // when @@ -423,7 +423,7 @@ class AssertEmptyOnProviderSequenceTest { val sut = getSnippetFile("assert-not-empty-fails-when-item-list-has-only-nulls-and-strict-set-to-true") .declarations() - .map { it as? KoSourceAndAliasTypeProvider } + .map { it as? KoSourceTypeProvider } .asSequence() // when diff --git a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertnull/AssertNullOnSingleProviderTest.kt b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertnull/AssertNullOnSingleProviderTest.kt index bb41866ac4..1b16d228fc 100644 --- a/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertnull/AssertNullOnSingleProviderTest.kt +++ b/lib/src/integrationTest/kotlin/com/lemonappdev/konsist/core/verify/koproviderassert/assertnull/AssertNullOnSingleProviderTest.kt @@ -4,7 +4,7 @@ import com.lemonappdev.konsist.TestSnippetProvider import com.lemonappdev.konsist.api.declaration.KoFileDeclaration import com.lemonappdev.konsist.api.provider.KoDeclarationCastProvider import com.lemonappdev.konsist.api.provider.KoNameProvider -import com.lemonappdev.konsist.api.provider.KoSourceAndAliasTypeProvider +import com.lemonappdev.konsist.api.provider.KoSourceTypeProvider import com.lemonappdev.konsist.api.verify.assertNotNull import com.lemonappdev.konsist.api.verify.assertNull import com.lemonappdev.konsist.core.exception.KoAssertionFailedException @@ -101,7 +101,7 @@ class AssertNullOnSingleProviderTest { val sut = getSnippetFile("assert-null-passes-when-item-has-null-value") .declarations() - .filterIsInstance() + .filterIsInstance() .firstOrNull() // then @@ -130,7 +130,7 @@ class AssertNullOnSingleProviderTest { val sut = getSnippetFile("assert-not-null-fails-when-item-has-null-value") .declarations() - .filterIsInstance() + .filterIsInstance() .firstOrNull() // when diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoParameterDeclaration.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoParameterDeclaration.kt index 786a5c8729..7478e4716f 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoParameterDeclaration.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoParameterDeclaration.kt @@ -20,9 +20,7 @@ import com.lemonappdev.konsist.api.provider.KoTextProvider import com.lemonappdev.konsist.api.provider.modifier.KoCrossInlineModifierProvider import com.lemonappdev.konsist.api.provider.modifier.KoModifierProvider import com.lemonappdev.konsist.api.provider.modifier.KoNoInlineModifierProvider -import com.lemonappdev.konsist.api.provider.modifier.KoValModifierProvider import com.lemonappdev.konsist.api.provider.modifier.KoVarArgModifierProvider -import com.lemonappdev.konsist.api.provider.modifier.KoVarModifierProvider /** * Represents a Kotlin parameter declaration. @@ -45,8 +43,6 @@ interface KoParameterDeclaration : KoResideInPackageProvider, KoTextProvider, KoNonNullableTypeProvider, - KoVarModifierProvider, - KoValModifierProvider, KoVarArgModifierProvider, KoNoInlineModifierProvider, KoCrossInlineModifierProvider, diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoPropertyDeclaration.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoPropertyDeclaration.kt index 1ba1719d0c..b6863fdd4c 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoPropertyDeclaration.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoPropertyDeclaration.kt @@ -40,8 +40,6 @@ import com.lemonappdev.konsist.api.provider.modifier.KoLateinitModifierProvider import com.lemonappdev.konsist.api.provider.modifier.KoModifierProvider import com.lemonappdev.konsist.api.provider.modifier.KoOpenModifierProvider import com.lemonappdev.konsist.api.provider.modifier.KoOverrideModifierProvider -import com.lemonappdev.konsist.api.provider.modifier.KoValModifierProvider -import com.lemonappdev.konsist.api.provider.modifier.KoVarModifierProvider import com.lemonappdev.konsist.api.provider.modifier.KoVisibilityModifierProvider /** @@ -74,8 +72,6 @@ interface KoPropertyDeclaration : KoIsTopLevelProvider, KoValueProvider, KoVisibilityModifierProvider, - KoValModifierProvider, - KoVarModifierProvider, KoLateinitModifierProvider, KoOverrideModifierProvider, KoAbstractModifierProvider, diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoTypeArgumentDeclaration.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoTypeArgumentDeclaration.kt index b7a5de2380..6ccdcca79c 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoTypeArgumentDeclaration.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoTypeArgumentDeclaration.kt @@ -4,7 +4,6 @@ import com.lemonappdev.konsist.api.provider.KoBaseProvider import com.lemonappdev.konsist.api.provider.KoFunctionTypeDeclarationProvider import com.lemonappdev.konsist.api.provider.KoIsFunctionTypeProvider import com.lemonappdev.konsist.api.provider.KoIsGenericProvider -import com.lemonappdev.konsist.api.provider.KoIsGenericTypeProvider import com.lemonappdev.konsist.api.provider.KoIsStarProjectionProvider import com.lemonappdev.konsist.api.provider.KoLocationProvider import com.lemonappdev.konsist.api.provider.KoNameProvider @@ -31,7 +30,6 @@ interface KoTypeArgumentDeclaration : KoInModifierProvider, KoLocationProvider, KoPathProvider, - KoIsGenericTypeProvider, KoIsGenericProvider, KoIsFunctionTypeProvider, KoFunctionTypeDeclarationProvider, diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoVariableDeclaration.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoVariableDeclaration.kt index 3fc415d6c7..287ecffe4f 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoVariableDeclaration.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/KoVariableDeclaration.kt @@ -19,8 +19,6 @@ import com.lemonappdev.konsist.api.provider.KoSourceSetProvider import com.lemonappdev.konsist.api.provider.KoTacitTypeProvider import com.lemonappdev.konsist.api.provider.KoTextProvider import com.lemonappdev.konsist.api.provider.KoValueProvider -import com.lemonappdev.konsist.api.provider.modifier.KoValModifierProvider -import com.lemonappdev.konsist.api.provider.modifier.KoVarModifierProvider /** * Represents a Kotlin variable declaration. @@ -42,9 +40,7 @@ interface KoVariableDeclaration : KoResideInPackageProvider, KoSourceSetProvider, KoTextProvider, - KoValModifierProvider, KoValueProvider, - KoVarModifierProvider, KoTacitTypeProvider, KoIsValProvider, KoIsVarProvider diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/type/KoTypeDeclaration.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/type/KoTypeDeclaration.kt index 7db724ca9f..c3b4d644de 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/type/KoTypeDeclaration.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/declaration/type/KoTypeDeclaration.kt @@ -1,29 +1,14 @@ package com.lemonappdev.konsist.api.declaration.type import com.lemonappdev.konsist.api.declaration.KoBaseDeclaration -import com.lemonappdev.konsist.api.declaration.KoClassDeclaration -import com.lemonappdev.konsist.api.declaration.KoExternalDeclaration -import com.lemonappdev.konsist.api.declaration.KoFunctionDeclaration -import com.lemonappdev.konsist.api.declaration.KoImportAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoInterfaceDeclaration -import com.lemonappdev.konsist.api.declaration.KoObjectDeclaration import com.lemonappdev.konsist.api.declaration.KoPackageDeclaration -import com.lemonappdev.konsist.api.declaration.KoPropertyDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeParameterDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndInterfaceAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndInterfaceDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoInterfaceAndObjectDeclaration import com.lemonappdev.konsist.api.provider.KoAnnotationProvider import com.lemonappdev.konsist.api.provider.KoBaseProvider import com.lemonappdev.konsist.api.provider.KoContainingDeclarationProvider import com.lemonappdev.konsist.api.provider.KoContainingFileProvider -import com.lemonappdev.konsist.api.provider.KoDeclarationCastProvider import com.lemonappdev.konsist.api.provider.KoFunctionTypeDeclarationProvider import com.lemonappdev.konsist.api.provider.KoIsFunctionTypeProvider import com.lemonappdev.konsist.api.provider.KoIsGenericProvider -import com.lemonappdev.konsist.api.provider.KoIsGenericTypeProvider import com.lemonappdev.konsist.api.provider.KoIsMutableTypeProvider import com.lemonappdev.konsist.api.provider.KoIsNullableProvider import com.lemonappdev.konsist.api.provider.KoLocationProvider @@ -32,14 +17,11 @@ import com.lemonappdev.konsist.api.provider.KoNameProvider import com.lemonappdev.konsist.api.provider.KoPackageProvider import com.lemonappdev.konsist.api.provider.KoPathProvider import com.lemonappdev.konsist.api.provider.KoResideInPackageProvider -import com.lemonappdev.konsist.api.provider.KoSourceAndAliasTypeProvider import com.lemonappdev.konsist.api.provider.KoSourceDeclarationProvider import com.lemonappdev.konsist.api.provider.KoSourceSetProvider import com.lemonappdev.konsist.api.provider.KoSourceTypeProvider import com.lemonappdev.konsist.api.provider.KoTextProvider import com.lemonappdev.konsist.api.provider.KoTypeArgumentProvider -import com.lemonappdev.konsist.core.annotation.RemoveInVersion -import kotlin.reflect.KClass /** * Represents a Kotlin type declaration. @@ -57,10 +39,8 @@ interface KoTypeDeclaration : KoContainingDeclarationProvider, KoModuleProvider, KoSourceSetProvider, - KoIsGenericTypeProvider, KoIsGenericProvider, KoIsFunctionTypeProvider, - KoSourceAndAliasTypeProvider, KoSourceTypeProvider, KoPackageProvider, KoResideInPackageProvider, @@ -68,9 +48,7 @@ interface KoTypeDeclaration : KoSourceDeclarationProvider, KoIsMutableTypeProvider, KoTypeArgumentProvider, - KoFunctionTypeDeclarationProvider, - @RemoveInVersion("0.19.0") - KoDeclarationCastProvider { + KoFunctionTypeDeclarationProvider { /** * Package of the file where the type is referenced (the use site), not the package where the type is declared, * e.g. for `fun Foo.bar()` declared in `com.app`, `receiverType.packagee` is `com.app` even if `Foo` is declared @@ -80,217 +58,4 @@ interface KoTypeDeclaration : * `type.sourceDeclaration?.asClassDeclaration()?.packagee`. */ override val packagee: KoPackageDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClass")) - override val isClass: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isObject")) - override val isObject: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isInterface")) - override val isInterface: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClassOrObject")) - override val isClassOrObject: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClassOrInterface")) - override val isClassOrInterface: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isInterfaceOrObject")) - override val isInterfaceOrObject: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClassOrInterfaceOrObject")) - override val isClassOrInterfaceOrObject: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isTypeAlias")) - override val isTypeAlias: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isImportAlias")) - override val isImportAlias: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isKotlinType")) - override val isKotlinType: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isKotlinBasicType")) - override val isKotlinBasicType: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isKotlinCollectionType")) - override val isKotlinCollectionType: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isTypeParameter")) - override val isTypeParameter: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isExternal")) - override val isExternal: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isFunction")) - override val isFunction: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isProperty")) - override val isProperty: Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asClassDeclaration()")) - override fun asClassDeclaration(): KoClassDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asObjectDeclaration()")) - override fun asObjectDeclaration(): KoObjectDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asInterfaceDeclaration()")) - override fun asInterfaceDeclaration(): KoInterfaceDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asClassOrObjectDeclaration()")) - override fun asClassOrObjectDeclaration(): KoClassAndObjectDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asClassOrInterfaceDeclaration()")) - override fun asClassOrInterfaceDeclaration(): KoClassAndInterfaceDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asInterfaceOrObjectDeclaration()")) - override fun asInterfaceOrObjectDeclaration(): KoInterfaceAndObjectDeclaration? - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.asClassOrInterfaceOrObjectDeclaration()"), - ) - override fun asClassOrInterfaceOrObjectDeclaration(): KoClassAndInterfaceAndObjectDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asTypeAliasDeclaration()")) - override fun asTypeAliasDeclaration(): KoTypeAliasDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asImportAliasDeclaration()")) - override fun asImportAliasDeclaration(): KoImportAliasDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asKotlinTypeDeclaration()")) - override fun asKotlinTypeDeclaration(): KoKotlinTypeDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asKotlinBasicTypeDeclaration()")) - override fun asKotlinBasicTypeDeclaration(): KoKotlinTypeDeclaration? - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.asKotlinCollectionTypeDeclaration()"), - ) - override fun asKotlinCollectionTypeDeclaration(): KoKotlinTypeDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asTypeParameterDeclaration()")) - override fun asTypeParameterDeclaration(): KoTypeParameterDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asExternalDeclaration()")) - override fun asExternalDeclaration(): KoExternalDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asFunctionDeclaration()")) - override fun asFunctionDeclaration(): KoFunctionDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asPropertyDeclaration()")) - override fun asPropertyDeclaration(): KoPropertyDeclaration? - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassDeclaration()")) - override fun hasClassDeclaration(predicate: ((KoClassDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassDeclarationOf()")) - override fun hasClassDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasObjectDeclaration()")) - override fun hasObjectDeclaration(predicate: ((KoObjectDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasObjectDeclarationOf()")) - override fun hasObjectDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasInterfaceDeclaration()")) - override fun hasInterfaceDeclaration(predicate: ((KoInterfaceDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasInterfaceDeclarationOf()")) - override fun hasInterfaceDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassOrObjectDeclaration()")) - override fun hasClassOrObjectDeclaration(predicate: ((KoClassAndObjectDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassOrObjectDeclarationOf()")) - override fun hasClassOrObjectDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassOrInterfaceDeclaration()")) - override fun hasClassOrInterfaceDeclaration(predicate: ((KoClassAndInterfaceDeclaration) -> Boolean)?): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasClassOrInterfaceDeclarationOf()"), - ) - override fun hasClassOrInterfaceDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasInterfaceOrObjectDeclaration()"), - ) - override fun hasInterfaceOrObjectDeclaration(predicate: ((KoInterfaceAndObjectDeclaration) -> Boolean)?): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasInterfaceOrObjectDeclarationOf()"), - ) - override fun hasInterfaceOrObjectDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasClassOrInterfaceOrObjectDeclaration()"), - ) - override fun hasClassOrInterfaceOrObjectDeclaration(predicate: ((KoClassAndInterfaceAndObjectDeclaration) -> Boolean)?): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasClassOrInterfaceOrObjectDeclarationOf()"), - ) - override fun hasClassOrInterfaceOrObjectDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasTypeAliasDeclaration()")) - override fun hasTypeAliasDeclaration(predicate: ((KoTypeAliasDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasImportAliasDeclaration()")) - override fun hasImportAliasDeclaration(predicate: ((KoImportAliasDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasKotlinTypeDeclaration()")) - override fun hasKotlinTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasKotlinTypeDeclarationOf()")) - override fun hasKotlinTypeDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasKotlinBasicTypeDeclaration()")) - override fun hasKotlinBasicTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)?): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasKotlinBasicTypeDeclarationOf()"), - ) - override fun hasKotlinBasicTypeDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasKotlinCollectionTypeDeclaration()"), - ) - override fun hasKotlinCollectionTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)?): Boolean - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasKotlinCollectionTypeDeclarationOf()"), - ) - override fun hasKotlinCollectionTypeDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasTypeParameterDeclaration()")) - override fun hasTypeParameterDeclaration(predicate: ((KoTypeParameterDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasExternalDeclaration()")) - override fun hasExternalDeclaration(predicate: ((KoExternalDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasExternalDeclarationOf()")) - override fun hasExternalDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasFunctionDeclaration()")) - override fun hasFunctionDeclaration(predicate: ((KoFunctionDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasFunctionDeclarationOf()")) - override fun hasFunctionDeclarationOf(kClass: KClass<*>): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasPropertyDeclaration()")) - override fun hasPropertyDeclaration(predicate: ((KoPropertyDeclaration) -> Boolean)?): Boolean - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasPropertyDeclarationOf()")) - override fun hasPropertyDeclarationOf(kClass: KClass<*>): Boolean } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/DeprecatedKoDeclarationCastProviderListExt.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/DeprecatedKoDeclarationCastProviderListExt.kt deleted file mode 100644 index 06cbf2e6c4..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/DeprecatedKoDeclarationCastProviderListExt.kt +++ /dev/null @@ -1,1569 +0,0 @@ -@file:Suppress("detekt.TooManyFunctions") - -package com.lemonappdev.konsist.api.ext.list - -import com.lemonappdev.konsist.api.declaration.KoClassDeclaration -import com.lemonappdev.konsist.api.declaration.KoExternalDeclaration -import com.lemonappdev.konsist.api.declaration.KoImportAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoInterfaceDeclaration -import com.lemonappdev.konsist.api.declaration.KoObjectDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeParameterDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndInterfaceAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndInterfaceDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoInterfaceAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.type.KoKotlinTypeDeclaration -import com.lemonappdev.konsist.api.declaration.type.KoTypeDeclaration -import kotlin.reflect.KClass - -/** - * List containing class declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the class declaration. - * If null, all class declarations are included. - * @return A list of class declarations that match the provided predicate, or all class declarations if no predicate - * is provided. - * @see KoTypeDeclaration.hasClassDeclaration - * @see KoTypeDeclaration.asClassDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().classDeclarations()")) -fun List.classDeclarations(predicate: ((KoClassDeclaration) -> Boolean)? = null): List = - filter { it.hasClassDeclaration(predicate) } - .mapNotNull { it.asClassDeclaration() } - -/** - * List containing object declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the object declaration. - * If null, all object declarations are included. - * @return A list of object declarations that match the provided predicate, or all object declarations if no predicate - * is provided. - * @see KoTypeDeclaration.hasObjectDeclaration - * @see KoTypeDeclaration.asObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().objectDeclarations()")) -fun List.objectDeclarations(predicate: ((KoObjectDeclaration) -> Boolean)? = null): List = - filter { it.hasObjectDeclaration(predicate) } - .mapNotNull { it.asObjectDeclaration() } - -/** - * List containing interface declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the interface declaration. - * If null, all interface declarations are included. - * @return A list of interface declarations that match the provided predicate, or all interface declarations if no - * predicate is provided. - * @see KoTypeDeclaration.hasInterfaceDeclaration - * @see KoTypeDeclaration.asInterfaceDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().interfaceDeclarations()")) -fun List.interfaceDeclarations( - predicate: ((KoInterfaceDeclaration) -> Boolean)? = null, -): List = - filter { it.hasInterfaceDeclaration(predicate) } - .mapNotNull { it.asInterfaceDeclaration() } - -/** - * List containing class and object declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the class and object declaration. - * If null, all class and object declarations are included. - * @return A list of class and object declarations that match the provided predicate, or all class and object - * declarations if no predicate is provided. - * @see KoTypeDeclaration.hasClassOrObjectDeclaration - * @see KoTypeDeclaration.asClassOrObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().classAndObjectDeclarations()")) -fun List.classAndObjectDeclarations( - predicate: ((KoClassAndObjectDeclaration) -> Boolean)? = null, -): List = - filter { it.hasClassOrObjectDeclaration(predicate) } - .mapNotNull { it.asClassOrObjectDeclaration() } - -/** - * List containing class and interface declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the class and interface declaration. - * If null, all class and interface declarations are included. - * @return A list of class and interface declarations that match the provided predicate, or all class and interface - * declarations if no predicate is provided. - * @see KoTypeDeclaration.hasClassOrInterfaceDeclaration - * @see KoTypeDeclaration.asClassOrInterfaceDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().classAndInterfaceDeclarations()")) -fun List.classAndInterfaceDeclarations( - predicate: ((KoClassAndInterfaceDeclaration) -> Boolean)? = null, -): List = - filter { it.hasClassOrInterfaceDeclaration(predicate) } - .mapNotNull { it.asClassOrInterfaceDeclaration() } - -/** - * List containing interface and object declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the interface and object declaration. - * If null, all interface and object declarations are included. - * @return A list of interface and object declarations that match the provided predicate, or all interface and object - * declarations if no predicate is provided. - * @see KoTypeDeclaration.hasInterfaceOrObjectDeclaration - * @see KoTypeDeclaration.asInterfaceOrObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().interfaceAndObjectDeclarations()")) -fun List.interfaceAndObjectDeclarations( - predicate: ((KoInterfaceAndObjectDeclaration) -> Boolean)? = null, -): List = - filter { it.hasInterfaceOrObjectDeclaration(predicate) } - .mapNotNull { it.asInterfaceOrObjectDeclaration() } - -/** - * List containing class, interface and object declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the class, interface and object declaration. - * If null, all class, interface and object declarations are included. - * @return A list of class, interface and object declarations that match the provided predicate, or all class, - * interface and object declarations if no predicate - * is provided. - * @see KoTypeDeclaration.hasClassOrInterfaceOrObjectDeclaration - * @see KoTypeDeclaration.asClassOrInterfaceOrObjectDeclaration - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().classAndInterfaceAndObjectDeclarations()"), -) -fun List.classAndInterfaceAndObjectDeclarations( - predicate: ((KoClassAndInterfaceAndObjectDeclaration) -> Boolean)? = null, -): List = - filter { it.hasClassOrInterfaceOrObjectDeclaration(predicate) } - .mapNotNull { it.asClassOrInterfaceOrObjectDeclaration() } - -/** - * List containing type alias declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the type alias declaration. - * If null, all type alias declarations are included. - * @return A list of type alias declarations that match the provided predicate, or all type alias declarations if no - * predicate is provided. - * @see KoTypeDeclaration.hasTypeAliasDeclaration - * @see KoTypeDeclaration.asTypeAliasDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().typeAliasDeclarations()")) -fun List.typeAliasDeclarations( - predicate: ((KoTypeAliasDeclaration) -> Boolean)? = null, -): List = - filter { it.hasTypeAliasDeclaration(predicate) } - .mapNotNull { it.asTypeAliasDeclaration() } - -/** - * List containing import alias declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the import alias declaration. - * If null, all import alias declarations are included. - * @return A list of import alias declarations that match the provided predicate, or all import alias declarations if - * no predicate is provided. - * @see KoTypeDeclaration.hasImportAliasDeclaration - * @see KoTypeDeclaration.asImportAliasDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().importAliasDeclarations()")) -fun List.importAliasDeclarations( - predicate: ((KoImportAliasDeclaration) -> Boolean)? = null, -): List = - filter { it.hasImportAliasDeclaration(predicate) } - .mapNotNull { it.asImportAliasDeclaration() } - -/** - * List containing Kotlin type declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the Kotlin type declaration. - * If null, all Kotlin type declarations are included. - * @return A list of Kotlin type declarations that match the provided predicate, or all Kotlin type declarations if - * no predicate is provided. - * @see KoTypeDeclaration.hasKotlinTypeDeclaration - * @see KoTypeDeclaration.asKotlinTypeDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().kotlinTypeDeclarations()")) -fun List.kotlinTypeDeclarations( - predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null, -): List = - filter { it.hasKotlinTypeDeclaration(predicate) } - .mapNotNull { it.asKotlinTypeDeclaration() } - -/** - * List containing Kotlin basic type declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the Kotlin basic type declaration. - * If null, all Kotlin basic type declarations are included. - * @return A list of Kotlin basic type declarations that match the provided predicate, or all Kotlin basic type - * declarations if no predicate is provided. - * @see KoTypeDeclaration.hasKotlinBasicTypeDeclaration - * @see KoTypeDeclaration.asKotlinBasicTypeDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().kotlinBasicTypeDeclarations()")) -fun List.kotlinBasicTypeDeclarations( - predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null, -): List = - filter { it.hasKotlinBasicTypeDeclaration(predicate) } - .mapNotNull { it.asKotlinBasicTypeDeclaration() } - -/** - * List containing Kotlin collection type declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the Kotlin collection type declaration. - * If null, all Kotlin collection type declarations are included. - * @return A list of Kotlin collection type declarations that match the provided predicate, or all Kotlin collection type - * declarations if no predicate is provided. - * @see KoTypeDeclaration.hasKotlinCollectionTypeDeclaration - * @see KoTypeDeclaration.asKotlinCollectionTypeDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().kotlinCollectionTypeDeclarations()")) -fun List.kotlinCollectionTypeDeclarations( - predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null, -): List = - filter { it.hasKotlinCollectionTypeDeclaration(predicate) } - .mapNotNull { it.asKotlinCollectionTypeDeclaration() } - -/** - * List containing type parameter declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the type parameter declaration. - * If null, all type parameter declarations are included. - * @return A list of type parameter declarations that match the provided predicate, or all type parameter declarations - * if no predicate is provided. - * @see KoTypeDeclaration.hasTypeParameterDeclaration - * @see KoTypeDeclaration.asTypeParameterDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().typeParameterDeclarations()")) -fun List.typeParameterDeclarations( - predicate: ((KoTypeParameterDeclaration) -> Boolean)? = null, -): List = - filter { it.hasTypeParameterDeclaration(predicate) } - .mapNotNull { it.asTypeParameterDeclaration() } - -/** - * List containing external declarations associated with declarations. - * - * @param predicate A function that defines the condition to be met by the external declaration. - * If null, all external declarations are included. - * @return A list of external declarations that match the provided predicate, or all external declarations - * if no predicate is provided. - * @see KoTypeDeclaration.hasExternalDeclaration - * @see KoTypeDeclaration.asExternalDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().externalDeclarations()")) -fun List.externalDeclarations( - predicate: ((KoExternalDeclaration) -> Boolean)? = null, -): List = - filter { it.hasExternalDeclaration(predicate) } - .mapNotNull { it.asExternalDeclaration() } - -/** - * List containing declarations with the specified class declaration. - * - * @param predicate The predicate function to determine if a class declaration satisfies a condition. - * @return A list containing declarations with the specified class declaration. - * @see KoTypeDeclaration.asClassDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withClassDeclaration()")) -fun List.withClassDeclaration(predicate: ((KoClassDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> it.asClassDeclaration() != null - else -> it.asClassDeclaration()?.let { classDeclaration -> predicate(classDeclaration) } == true - } - } - -/** - * List containing declarations without the specified class declaration. - * - * @param predicate The predicate function to determine if a class declaration satisfies a condition. - * @return A list containing declarations without the specified class declaration. - * @see KoTypeDeclaration.asClassDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutClassDeclaration()")) -fun List.withoutClassDeclaration(predicate: ((KoClassDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> it.asClassDeclaration() != null - else -> it.asClassDeclaration()?.let { classDeclaration -> predicate(classDeclaration) } == true - } - } - -/** - * List containing declarations with class declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class declaration to include. - * @param kClasses The Kotlin class(es) representing the class declaration(s) to include. - * @return A list containing declarations with the class declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withClassDeclarationOf()")) -fun List.withClassDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withClassDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with class declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class declaration(s) to include. - * @return A list containing declarations with the class declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withClassDeclarationOf()")) -fun List.withClassDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasClassDeclaration() - else -> kClasses.any { kClass -> it.hasClassDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without class declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class declaration to exclude. - * @param kClasses The Kotlin class(es) representing the class declaration(s) to exclude. - * @return A list containing declarations without class declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutClassDeclarationOf()")) -fun List.withoutClassDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutClassDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without class declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class declaration(s) to exclude. - * @return A list containing declarations without class declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutClassDeclarationOf()")) -fun List.withoutClassDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasClassDeclaration() - else -> kClasses.any { kClass -> it.hasClassDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified object declaration. - * - * @param predicate The predicate function to determine if an object declaration satisfies a condition. - * @return A list containing declarations with the specified object declaration. - * @see KoTypeDeclaration.asObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withObjectDeclaration()")) -fun List.withObjectDeclaration(predicate: ((KoObjectDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> it.asObjectDeclaration() != null - else -> it.asObjectDeclaration()?.let { objectDeclaration -> predicate(objectDeclaration) } == true - } - } - -/** - * List containing declarations without the specified object declaration. - * - * @param predicate The predicate function to determine if an object declaration satisfies a condition. - * @return A list containing declarations without the specified object declaration. - * @see KoTypeDeclaration.asObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutObjectDeclaration()")) -fun List.withoutObjectDeclaration(predicate: ((KoObjectDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> it.asObjectDeclaration() != null - else -> it.asObjectDeclaration()?.let { objectDeclaration -> predicate(objectDeclaration) } == true - } - } - -/** - * List containing declarations with object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the object declaration to include. - * @param kClasses The Kotlin class(es) representing the object declaration(s) to include. - * @return A list containing declarations with the object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasObjectDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withObjectDeclarationOf()")) -fun List.withObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the object declaration(s) to include. - * @return A list containing declarations with the object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasObjectDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withObjectDeclarationOf()")) -fun List.withObjectDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasObjectDeclaration() - else -> kClasses.any { kClass -> it.hasObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the object declaration to exclude. - * @param kClasses The Kotlin class(es) representing the object declaration(s) to exclude. - * @return A list containing declarations without object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasObjectDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutObjectDeclarationOf()")) -fun List.withoutObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the object declaration(s) to exclude. - * @return A list containing declarations without object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasObjectDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutObjectDeclarationOf()")) -fun List.withoutObjectDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasObjectDeclaration() - else -> kClasses.any { kClass -> it.hasObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified interface declaration. - * - * @param predicate The predicate function to determine if an interface declaration satisfies a condition. - * @return A list containing declarations with the specified interface declaration. - * @see KoTypeDeclaration.asInterfaceDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withInterfaceDeclaration()")) -fun List.withInterfaceDeclaration(predicate: ((KoInterfaceDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.asInterfaceDeclaration() != null - } - - else -> { - it.asInterfaceDeclaration()?.let { interfaceDeclaration -> predicate(interfaceDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified interface declaration. - * - * @param predicate The predicate function to determine if an interface declaration satisfies a condition. - * @return A list containing declarations without the specified interface declaration. - * @see KoTypeDeclaration.asInterfaceDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutInterfaceDeclaration()")) -fun List.withoutInterfaceDeclaration(predicate: ((KoInterfaceDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> { - it.asInterfaceDeclaration() != null - } - - else -> { - it.asInterfaceDeclaration()?.let { interfaceDeclaration -> predicate(interfaceDeclaration) } == true - } - } - } - -/** - * List containing declarations with interface declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the interface declaration to include. - * @param kClasses The Kotlin class(es) representing the interface declaration(s) to include. - * @return A list containing declarations with the interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withInterfaceDeclarationOf()")) -fun List.withInterfaceDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withInterfaceDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with interface declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the interface declaration(s) to include. - * @return A list containing declarations with the interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withInterfaceDeclarationOf()")) -fun List.withInterfaceDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasInterfaceDeclaration() - else -> kClasses.any { kClass -> it.hasInterfaceDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without interface declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the interface declaration to exclude. - * @param kClasses The Kotlin class(es) representing the interface declaration(s) to exclude. - * @return A list containing declarations without interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutInterfaceDeclarationOf()")) -fun List.withoutInterfaceDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutInterfaceDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without interface declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the interface declaration(s) to exclude. - * @return A list containing declarations without interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutInterfaceDeclarationOf()")) -fun List.withoutInterfaceDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasInterfaceDeclaration() - else -> kClasses.any { kClass -> it.hasInterfaceDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified class or object declaration. - * - * @param predicate The predicate function to determine if a class or object declaration satisfies a condition. - * @return A list containing declarations with the specified class or object declaration. - * @see KoTypeDeclaration.asClassOrObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withClassOrObjectDeclaration()")) -fun List.withClassOrObjectDeclaration(predicate: ((KoClassAndObjectDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> it.asClassOrObjectDeclaration() != null - else -> it.asClassOrObjectDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations without the specified class or object declaration. - * - * @param predicate The predicate function to determine if a class or object declaration satisfies a condition. - * @return A list containing declarations without the specified class or object declaration. - * @see KoTypeDeclaration.asClassOrObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutClassOrObjectDeclaration()")) -fun List.withoutClassOrObjectDeclaration( - predicate: ((KoClassAndObjectDeclaration) -> Boolean)? = null, -): List = - filterNot { - when (predicate) { - null -> it.asClassOrObjectDeclaration() != null - else -> it.asClassOrObjectDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations with class or object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class or object declaration to include. - * @param kClasses The Kotlin class(es) representing the class or object declaration(s) to include. - * @return A list containing declarations with the class or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrObjectDeclarationOf - */ - -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withClassOrObjectDeclarationOf()")) -fun List.withClassOrObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withClassOrObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with class or object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class or object declaration(s) to include. - * @return A list containing declarations with the class or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrObjectDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withClassOrObjectDeclarationOf()")) -fun List.withClassOrObjectDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasClassOrObjectDeclaration() - else -> kClasses.any { kClass -> it.hasClassOrObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without class or object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class or object declaration to exclude. - * @param kClasses The Kotlin class(es) representing the class or object declaration(s) to exclude. - * @return A list containing declarations without class or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrObjectDeclarationOf()"), -) -fun List.withoutClassOrObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutClassOrObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without class or object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class or object declaration(s) to exclude. - * @return A list containing declarations without class or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrObjectDeclarationOf()"), -) -fun List.withoutClassOrObjectDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasClassOrObjectDeclaration() - else -> kClasses.any { kClass -> it.hasClassOrObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified class or interface declaration. - * - * @param predicate The predicate function to determine if a class or interface declaration satisfies a condition. - * @return A list containing declarations with the specified class or interface declaration. - * @see KoTypeDeclaration.asClassOrInterfaceDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withClassOrInterfaceDeclaration()")) -fun List.withClassOrInterfaceDeclaration( - predicate: ((KoClassAndInterfaceDeclaration) -> Boolean)? = null, -): List = - filter { - when (predicate) { - null -> it.asClassOrInterfaceDeclaration() != null - else -> it.asClassOrInterfaceDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations without the specified class or interface declaration. - * - * @param predicate The predicate function to determine if a class or interface declaration satisfies a condition. - * @return A list containing declarations without the specified class or interface declaration. - * @see KoTypeDeclaration.asClassOrInterfaceDeclaration - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrInterfaceDeclaration()"), -) -fun List.withoutClassOrInterfaceDeclaration( - predicate: ((KoClassAndInterfaceDeclaration) -> Boolean)? = null, -): List = - filterNot { - when (predicate) { - null -> it.asClassOrInterfaceDeclaration() != null - else -> it.asClassOrInterfaceDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations with class or interface declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class or interface declaration to include. - * @param kClasses The Kotlin class(es) representing the class or interface declaration(s) to include. - * @return A list containing declarations with the class or interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceDeclarationOf - */ - -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withClassOrInterfaceDeclarationOf()"), -) -fun List.withClassOrInterfaceDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withClassOrInterfaceDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with class or interface declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class or interface declaration(s) to include. - * @return A list containing declarations with the class or interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withClassOrInterfaceDeclarationOf()"), -) -fun List.withClassOrInterfaceDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasClassOrInterfaceDeclaration() - else -> kClasses.any { kClass -> it.hasClassOrInterfaceDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without class or interface declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class or interface declaration to exclude. - * @param kClasses The Kotlin class(es) representing the class or interface declaration(s) to exclude. - * @return A list containing declarations without class or interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrInterfaceDeclarationOf()"), -) -fun List.withoutClassOrInterfaceDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutClassOrInterfaceDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without class or interface declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class or interface declaration(s) to exclude. - * @return A list containing declarations without class or interface declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrInterfaceDeclarationOf()"), -) -fun List.withoutClassOrInterfaceDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasClassOrInterfaceDeclaration() - else -> kClasses.any { kClass -> it.hasClassOrInterfaceDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified interface or object declaration. - * - * @param predicate The predicate function to determine if an interface or object declaration satisfies a condition. - * @return A list containing declarations with the specified interface or object declaration. - * @see KoTypeDeclaration.asInterfaceOrObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withInterfaceOrObjectDeclaration()")) -fun List.withInterfaceOrObjectDeclaration( - predicate: ((KoInterfaceAndObjectDeclaration) -> Boolean)? = null, -): List = - filter { - when (predicate) { - null -> it.asInterfaceOrObjectDeclaration() != null - else -> it.asInterfaceOrObjectDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations without the specified interface or object declaration. - * - * @param predicate The predicate function to determine if an interface or object declaration satisfies a condition. - * @return A list containing declarations without the specified interface or object declaration. - * @see KoTypeDeclaration.asInterfaceOrObjectDeclaration - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutInterfaceOrObjectDeclaration()"), -) -fun List.withoutInterfaceOrObjectDeclaration( - predicate: ((KoInterfaceAndObjectDeclaration) -> Boolean)? = null, -): List = - filterNot { - when (predicate) { - null -> it.asInterfaceOrObjectDeclaration() != null - else -> it.asInterfaceOrObjectDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations with interface or object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the interface or object declaration to include. - * @param kClasses The Kotlin class(es) representing the interface or object declaration(s) to include. - * @return A list containing declarations with the interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceOrObjectDeclarationOf - */ - -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withInterfaceOrObjectDeclarationOf()"), -) -fun List.withInterfaceOrObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withInterfaceOrObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with interface or object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the interface or object declaration(s) to include. - * @return A list containing declarations with the interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withInterfaceOrObjectDeclarationOf()"), -) -fun List.withInterfaceOrObjectDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasInterfaceOrObjectDeclaration() - else -> kClasses.any { kClass -> it.hasInterfaceOrObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without interface or object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the interface or object declaration to exclude. - * @param kClasses The Kotlin class(es) representing the interface or object declaration(s) to exclude. - * @return A list containing declarations without interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutInterfaceOrObjectDeclarationOf()"), -) -fun List.withoutInterfaceOrObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutInterfaceOrObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without interface or object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the interface or object declaration(s) to exclude. - * @return A list containing declarations without interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasInterfaceOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutInterfaceOrObjectDeclarationOf()"), -) -fun List.withoutInterfaceOrObjectDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasInterfaceOrObjectDeclaration() - else -> kClasses.any { kClass -> it.hasInterfaceOrObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified class, interface or object declaration. - * - * @param predicate The predicate function to determine if a class, interface or object declaration satisfies a condition. - * @return A list containing declarations with the specified class, interface or object declaration. - * @see KoTypeDeclaration.asClassOrInterfaceOrObjectDeclaration - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withClassOrInterfaceOrObjectDeclaration()"), -) -fun List.withClassOrInterfaceOrObjectDeclaration( - predicate: ((KoClassAndInterfaceAndObjectDeclaration) -> Boolean)? = null, -): List = - filter { - when (predicate) { - null -> it.asClassOrInterfaceOrObjectDeclaration() != null - else -> it.asClassOrInterfaceOrObjectDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations without the specified class, interface or object declaration. - * - * @param predicate The predicate function to determine if a class, interface or object declaration satisfies a condition. - * @return A list containing declarations without the specified class, interface or object declaration. - * @see KoTypeDeclaration.asClassOrInterfaceOrObjectDeclaration - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrInterfaceOrObjectDeclaration()"), -) -fun List.withoutClassOrInterfaceOrObjectDeclaration( - predicate: ((KoClassAndInterfaceAndObjectDeclaration) -> Boolean)? = null, -): List = - filterNot { - when (predicate) { - null -> it.asClassOrInterfaceOrObjectDeclaration() != null - else -> it.asClassOrInterfaceOrObjectDeclaration()?.let { declaration -> predicate(declaration) } == true - } - } - -/** - * List containing declarations with class, interface or object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class, interface or object declaration to include. - * @param kClasses The Kotlin class(es) representing the class, interface or object declaration(s) to include. - * @return A list containing declarations with the class, interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceOrObjectDeclarationOf - */ - -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withClassOrInterfaceOrObjectDeclarationOf()"), -) -fun List.withClassOrInterfaceOrObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withClassOrInterfaceOrObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with class, interface or object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class, interface or object declaration(s) to include. - * @return A list containing declarations with the class, interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withClassOrInterfaceOrObjectDeclarationOf()"), -) -fun List.withClassOrInterfaceOrObjectDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasClassOrInterfaceOrObjectDeclaration() - else -> kClasses.any { kClass -> it.hasClassOrInterfaceOrObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without class, interface or object declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the class, interface or object declaration to exclude. - * @param kClasses The Kotlin class(es) representing the class, interface or object declaration(s) to exclude. - * @return A list containing declarations without class, interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrInterfaceOrObjectDeclarationOf()"), -) -fun List.withoutClassOrInterfaceOrObjectDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutClassOrInterfaceOrObjectDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without class, interface or object declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the class, interface or object declaration(s) to exclude. - * @return A list containing declarations without class, interface or object declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasClassOrInterfaceOrObjectDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutClassOrInterfaceOrObjectDeclarationOf()"), -) -fun List.withoutClassOrInterfaceOrObjectDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasClassOrInterfaceOrObjectDeclaration() - else -> kClasses.any { kClass -> it.hasClassOrInterfaceOrObjectDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified type alias declaration. - * - * @param predicate The predicate function to determine if a type alias declaration satisfies a condition. - * @return A list containing declarations with the specified type alias declaration. - * @see KoTypeDeclaration.asTypeAliasDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withTypeAliasDeclaration()")) -fun List.withTypeAliasDeclaration(predicate: ((KoTypeAliasDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.isTypeAlias - } - - else -> { - it.asTypeAliasDeclaration()?.let { typeAliasDeclaration -> predicate(typeAliasDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified type alias declaration. - * - * @param predicate The predicate function to determine if a type alias declaration satisfies a condition. - * @return A list containing declarations without the specified type alias declaration. - * @see KoTypeDeclaration.asTypeAliasDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutTypeAliasDeclaration()")) -fun List.withoutTypeAliasDeclaration(predicate: ((KoTypeAliasDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> { - it.isTypeAlias - } - - else -> { - it.asTypeAliasDeclaration()?.let { typeAliasDeclaration -> predicate(typeAliasDeclaration) } == true - } - } - } - -/** - * List containing declarations with the specified import alias declaration. - * - * @param predicate The predicate function to determine if an import alias declaration satisfies a condition. - * @return A list containing declarations with the specified import alias declaration. - * @see KoTypeDeclaration.isImportAlias - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withImportAliasDeclaration()")) -fun List.withImportAliasDeclaration(predicate: ((KoImportAliasDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.isImportAlias - } - - else -> { - it - .asImportAliasDeclaration() - ?.let { importAliasDeclaration -> predicate(importAliasDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified import alias declaration. - * - * @param predicate The predicate function to determine if an import alias declaration satisfies a condition. - * @return A list containing declarations without the specified import alias declaration. - * @see KoTypeDeclaration.isImportAlias - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutImportAliasDeclaration()")) -fun List.withoutImportAliasDeclaration(predicate: ((KoImportAliasDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> { - it.isImportAlias - } - - else -> { - it - .asImportAliasDeclaration() - ?.let { importAliasDeclaration -> predicate(importAliasDeclaration) } == true - } - } - } - -/** - * List containing declarations with the specified Kotlin type declaration. - * - * @param predicate The predicate function to determine if a Kotlin type declaration satisfies a condition. - * @return A list containing declarations with the specified Kotlin type declaration. - * @see KoTypeDeclaration.asKotlinTypeDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withKotlinTypeDeclaration()")) -fun List.withKotlinTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.isKotlinType - } - - else -> { - it.asKotlinTypeDeclaration()?.let { kotlinTypeDeclaration -> predicate(kotlinTypeDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified Kotlin type declaration. - * - * @param predicate The predicate function to determine if a Kotlin type declaration satisfies a condition. - * @return A list containing declarations without the specified Kotlin type declaration. - * @see KoTypeDeclaration.asKotlinTypeDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutKotlinTypeDeclaration()")) -fun List.withoutKotlinTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> { - it.isKotlinType - } - - else -> { - it.asKotlinTypeDeclaration()?.let { kotlinTypeDeclaration -> predicate(kotlinTypeDeclaration) } == true - } - } - } - -/** - * List containing declarations with Kotlin type declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the Kotlin type declaration to include. - * @param kClasses The Kotlin class(es) representing the Kotlin type declaration(s) to include. - * @return A list containing declarations with the Kotlin type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withKotlinTypeDeclarationOf()")) -fun List.withKotlinTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withKotlinTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with Kotlin type declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the Kotlin type declaration(s) to include. - * @return A list containing declarations with the Kotlin type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withKotlinTypeDeclarationOf()")) -fun List.withKotlinTypeDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasKotlinTypeDeclaration() - else -> kClasses.any { kClass -> it.hasKotlinTypeDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without Kotlin type declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the Kotlin type declaration to exclude. - * @param kClasses The Kotlin class(es) representing the Kotlin type declaration(s) to exclude. - * @return A list containing declarations without Kotlin type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutKotlinTypeDeclarationOf()")) -fun List.withoutKotlinTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutKotlinTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without Kotlin type declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the Kotlin type declaration(s) to exclude. - * @return A list containing declarations without Kotlin type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutKotlinTypeDeclarationOf()")) -fun List.withoutKotlinTypeDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasKotlinTypeDeclaration() - else -> kClasses.any { kClass -> it.hasKotlinTypeDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified Kotlin basic type declaration. - * - * @param predicate The predicate function to determine if a Kotlin basic type declaration satisfies a condition. - * @return A list containing declarations with the specified Kotlin basic type declaration. - * @see KoTypeDeclaration.isKotlinBasicType - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withKotlinBasicTypeDeclaration()")) -fun List.withKotlinBasicTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.isKotlinBasicType - } - - else -> { - it - .asKotlinBasicTypeDeclaration() - ?.let { kotlinTypeDeclaration -> predicate(kotlinTypeDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified Kotlin basic type declaration. - * - * @param predicate The predicate function to determine if a Kotlin basic type declaration satisfies a condition. - * @return A list containing declarations without the specified Kotlin basic type declaration. - * @see KoTypeDeclaration.isKotlinBasicType - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutKotlinBasicTypeDeclaration()"), -) -fun List.withoutKotlinBasicTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> { - it.isKotlinBasicType - } - - else -> { - it - .asKotlinBasicTypeDeclaration() - ?.let { kotlinTypeDeclaration -> predicate(kotlinTypeDeclaration) } == true - } - } - } - -/** - * List containing declarations with Kotlin basic type declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the Kotlin basic type declaration to include. - * @param kClasses The Kotlin class(es) representing the Kotlin basic type declaration(s) to include. - * @return A list containing declarations with the Kotlin basic type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinBasicTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withKotlinBasicTypeDeclarationOf()")) -fun List.withKotlinBasicTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withKotlinBasicTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with Kotlin basic type declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the Kotlin basic type declaration(s) to include. - * @return A list containing declarations with the Kotlin basic type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinBasicTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withKotlinBasicTypeDeclarationOf()")) -fun List.withKotlinBasicTypeDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.isKotlinBasicType - else -> kClasses.any { kClass -> it.hasKotlinBasicTypeDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without Kotlin basic type declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the Kotlin basic type declaration to exclude. - * @param kClasses The Kotlin class(es) representing the Kotlin basic type declaration(s) to exclude. - * @return A list containing declarations without Kotlin basic type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinBasicTypeDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutKotlinBasicTypeDeclarationOf()"), -) -fun List.withoutKotlinBasicTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutKotlinBasicTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without Kotlin basic type declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the Kotlin basic type declaration(s) to exclude. - * @return A list containing declarations without Kotlin basic type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinBasicTypeDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutKotlinBasicTypeDeclarationOf()"), -) -fun List.withoutKotlinBasicTypeDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.isKotlinBasicType - else -> kClasses.any { kClass -> it.hasKotlinBasicTypeDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified Kotlin collection type declaration. - * - * @param predicate The predicate function to determine if a Kotlin collection type declaration satisfies a condition. - * @return A list containing declarations with the specified Kotlin collection type declaration. - * @see KoTypeDeclaration.isKotlinCollectionType - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withKotlinCollectionTypeDeclaration()"), -) -fun List.withKotlinCollectionTypeDeclaration( - predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null, -): List = - filter { - when (predicate) { - null -> { - it.isKotlinCollectionType - } - - else -> { - it - .asKotlinCollectionTypeDeclaration() - ?.let { kotlinTypeDeclaration -> predicate(kotlinTypeDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified Kotlin collection type declaration. - * - * @param predicate The predicate function to determine if a Kotlin collection type declaration satisfies a condition. - * @return A list containing declarations without the specified Kotlin collection type declaration. - * @see KoTypeDeclaration.isKotlinCollectionType - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutKotlinCollectionTypeDeclaration()"), -) -fun List.withoutKotlinCollectionTypeDeclaration( - predicate: ((KoKotlinTypeDeclaration) -> Boolean)? = null, -): List = - filterNot { - when (predicate) { - null -> { - it.isKotlinCollectionType - } - - else -> { - it - .asKotlinCollectionTypeDeclaration() - ?.let { kotlinTypeDeclaration -> predicate(kotlinTypeDeclaration) } == true - } - } - } - -/** - * List containing declarations with Kotlin collection type declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the Kotlin collection type declaration to include. - * @param kClasses The Kotlin class(es) representing the Kotlin collection type declaration(s) to include. - * @return A list containing declarations with the Kotlin collection type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinCollectionTypeDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withKotlinCollectionTypeDeclarationOf()"), -) -fun List.withKotlinCollectionTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withKotlinCollectionTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with Kotlin collection type declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the Kotlin collection type declaration(s) to include. - * @return A list containing declarations with the Kotlin collection type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinCollectionTypeDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withKotlinCollectionTypeDeclarationOf()"), -) -fun List.withKotlinCollectionTypeDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.isKotlinCollectionType - else -> kClasses.any { kClass -> it.hasKotlinCollectionTypeDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without Kotlin collection type declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the Kotlin collection type declaration to exclude. - * @param kClasses The Kotlin class(es) representing the Kotlin collection type declaration(s) to exclude. - * @return A list containing declarations without Kotlin collection type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinCollectionTypeDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutKotlinCollectionTypeDeclarationOf()"), -) -fun List.withoutKotlinCollectionTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutKotlinCollectionTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without Kotlin collection type declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the Kotlin collection type declaration(s) to exclude. - * @return A list containing declarations without Kotlin collection type declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasKotlinCollectionTypeDeclarationOf - */ -@Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclarations().withoutKotlinCollectionTypeDeclarationOf()"), -) -fun List.withoutKotlinCollectionTypeDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.isKotlinCollectionType - else -> kClasses.any { kClass -> it.hasKotlinCollectionTypeDeclarationOf(kClass) } - } - } - -/** - * List containing declarations with the specified type parameter declaration. - * - * @param predicate The predicate function to determine if a type parameter declaration satisfies a condition. - * @return A list containing declarations with the specified type parameter declaration. - * @see KoTypeDeclaration.isTypeParameter - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withTypeParameterDeclaration()")) -fun List.withTypeParameterDeclaration(predicate: ((KoTypeParameterDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.isTypeParameter - } - - else -> { - it - .asTypeParameterDeclaration() - ?.let { typeParameter -> predicate(typeParameter) } == true - } - } - } - -/** - * List containing declarations without the specified type parameter declaration. - * - * @param predicate The predicate function to determine if a type parameter declaration satisfies a condition. - * @return A list containing declarations without the specified type parameter declaration. - * @see KoTypeDeclaration.isTypeParameter - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutTypeParameterDeclaration()")) -fun List.withoutTypeParameterDeclaration( - predicate: ((KoTypeParameterDeclaration) -> Boolean)? = null, -): List = - filterNot { - when (predicate) { - null -> { - it.isTypeParameter - } - - else -> { - it - .asTypeParameterDeclaration() - ?.let { typeParameter -> predicate(typeParameter) } == true - } - } - } - -/** - * List containing declarations with the specified external declaration. - * - * @param predicate The predicate function to determine if an external declaration satisfies a condition. - * @return A list containing declarations with the specified external declaration. - * @see KoTypeDeclaration.isExternal - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withExternalDeclaration()")) -fun List.withExternalDeclaration(predicate: ((KoExternalDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.isExternal - } - - else -> { - it - .asExternalDeclaration() - ?.let { externalDeclaration -> predicate(externalDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified external declaration. - * - * @param predicate The predicate function to determine if an external declaration satisfies a condition. - * @return A list containing declarations without the specified external declaration. - * @see KoTypeDeclaration.isExternal - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutExternalDeclaration()")) -fun List.withoutExternalDeclaration(predicate: ((KoExternalDeclaration) -> Boolean)? = null): List = - filterNot { - when (predicate) { - null -> { - it.isExternal - } - - else -> { - it - .asExternalDeclaration() - ?.let { externalDeclaration -> predicate(externalDeclaration) } == true - } - } - } - -/** - * List containing declarations with external declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the external declaration to include. - * @param kClasses The Kotlin class(es) representing the external declaration(s) to include. - * @return A list containing declarations with the external declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasExternalDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withExternalDeclarationOf()")) -fun List.withExternalDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withExternalDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with external declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the external declaration(s) to include. - * @return A list containing declarations with the external declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasExternalDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withExternalDeclarationOf()")) -fun List.withExternalDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasExternalDeclaration() - else -> kClasses.any { kClass -> it.hasExternalDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without external declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the external declaration to exclude. - * @param kClasses The Kotlin class(es) representing the external declaration(s) to exclude. - * @return A list containing declarations without external declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasExternalDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutExternalDeclarationOf()")) -fun List.withoutExternalDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutExternalDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without external declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the external declaration(s) to exclude. - * @return A list containing declarations without external declaration of the specified Kotlin class(es). - * @see KoTypeDeclaration.hasExternalDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclarations().withoutExternalDeclarationOf()")) -fun List.withoutExternalDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasExternalDeclaration() - else -> kClasses.any { kClass -> it.hasExternalDeclarationOf(kClass) } - } - } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoDeclarationCastProviderListExt.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoDeclarationCastProviderListExt.kt index b3960e966a..8ea2762b9a 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoDeclarationCastProviderListExt.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoDeclarationCastProviderListExt.kt @@ -17,69 +17,6 @@ import com.lemonappdev.konsist.api.declaration.type.KoKotlinTypeDeclaration import com.lemonappdev.konsist.api.provider.KoDeclarationCastProvider import kotlin.reflect.KClass -/** - * List containing class declarations associated with types. - * - * @see KoDeclarationCastProvider.asClassDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("classDeclarations()")) -val List.classDeclarations: List - get() = mapNotNull { it.asClassDeclaration() } - -/** - * List containing object declarations associated with types. - * - * @see KoDeclarationCastProvider.asObjectDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("objectDeclarations()")) -val List.objectDeclarations: List - get() = mapNotNull { it.asObjectDeclaration() } - -/** - * List containing interface declarations associated with types. - * - * @see KoDeclarationCastProvider.asInterfaceDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("interfaceDeclarations()")) -val List.interfaceDeclarations: List - get() = mapNotNull { it.asInterfaceDeclaration() } - -/** - * List containing type alias declarations associated with types. - * - * @see KoDeclarationCastProvider.asTypeAliasDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("typeAliasDeclarations()")) -val List.typeAliasDeclarations: List - get() = mapNotNull { it.asTypeAliasDeclaration() } - -/** - * List containing import alias declarations associated with types. - * - * @see KoDeclarationCastProvider.asImportAliasDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("importAliasDeclarations()")) -val List.importAliasDeclarations: List - get() = mapNotNull { it.asImportAliasDeclaration() } - -/** - * List containing Kotlin type declarations associated with types. - * - * @see KoDeclarationCastProvider.asKotlinTypeDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("kotlinTypeDeclarations()")) -val List.kotlinTypeDeclarations: List - get() = mapNotNull { it.asKotlinTypeDeclaration() } - -/** - * List containing external type declarations associated with types. - * - * @see KoDeclarationCastProvider.asExternalDeclaration - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("externalDeclarations()")) -val List.externalTypeDeclarations: List - get() = mapNotNull { it.asExternalDeclaration() } - /** * List containing class declarations associated with declarations. * @@ -1478,111 +1415,3 @@ fun List.withoutExternalDeclarationOf(kClasse else -> kClasses.any { kClass -> it.hasExternalDeclarationOf(kClass) } } } - -/** - * List containing declarations with the specified external declaration. - * - * @param predicate The predicate function to determine if an external declaration satisfies a condition. - * @return A list containing declarations with the specified external declaration. - * @see KoDeclarationCastProvider.isExternalType - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withExternalDeclaration")) -fun List.withExternalTypeDeclaration(predicate: ((KoExternalDeclaration) -> Boolean)? = null): List = - filter { - when (predicate) { - null -> { - it.isExternalType - } - - else -> { - it - .asExternalTypeDeclaration() - ?.let { externalDeclaration -> predicate(externalDeclaration) } == true - } - } - } - -/** - * List containing declarations without the specified external declaration. - * - * @param predicate The predicate function to determine if an external declaration satisfies a condition. - * @return A list containing declarations without the specified external declaration. - * @see KoDeclarationCastProvider.isExternalType - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutExternalDeclaration")) -fun List.withoutExternalTypeDeclaration( - predicate: ((KoExternalDeclaration) -> Boolean)? = null, -): List = - filterNot { - when (predicate) { - null -> { - it.isExternalType - } - - else -> { - it - .asExternalTypeDeclaration() - ?.let { externalDeclaration -> predicate(externalDeclaration) } == true - } - } - } - -/** - * List containing declarations with external declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the external declaration to include. - * @param kClasses The Kotlin class(es) representing the external declaration(s) to include. - * @return A list containing declarations with the external declaration of the specified Kotlin class(es). - * @see KoDeclarationCastProvider.hasExternalTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withExternalDeclarationOf")) -fun List.withExternalTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withExternalTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations with external declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the external declaration(s) to include. - * @return A list containing declarations with the external declaration of the specified Kotlin class(es). - * @see KoDeclarationCastProvider.hasExternalTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withExternalDeclarationOf")) -fun List.withExternalTypeDeclarationOf(kClasses: Collection>): List = - filter { - when { - kClasses.isEmpty() -> it.hasExternalTypeDeclaration() - else -> kClasses.any { kClass -> it.hasExternalTypeDeclarationOf(kClass) } - } - } - -/** - * List containing declarations without external declaration of the specified Kotlin class(es). - * - * @param kClass The Kotlin class representing the external declaration to exclude. - * @param kClasses The Kotlin class(es) representing the external declaration(s) to exclude. - * @return A list containing declarations without external declaration of the specified Kotlin class(es). - * @see KoDeclarationCastProvider.hasExternalTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutExternalDeclarationOf")) -fun List.withoutExternalTypeDeclarationOf( - kClass: KClass<*>, - vararg kClasses: KClass<*>, -): List = withoutExternalTypeDeclarationOf(listOf(kClass, *kClasses)) - -/** - * List containing declarations without external declaration of the specified Kotlin class(es). - * - * @param kClasses The Kotlin class(es) representing the external declaration(s) to exclude. - * @return A list containing declarations without external declaration of the specified Kotlin class(es). - * @see KoDeclarationCastProvider.hasExternalTypeDeclarationOf - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutExternalDeclarationOf")) -fun List.withoutExternalTypeDeclarationOf(kClasses: Collection>): List = - filterNot { - when { - kClasses.isEmpty() -> it.hasExternalTypeDeclaration() - else -> kClasses.any { kClass -> it.hasExternalTypeDeclarationOf(kClass) } - } - } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExt.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExt.kt index aab5079237..d7288f011f 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExt.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExt.kt @@ -13,15 +13,6 @@ import kotlin.reflect.KClass val List.returnTypes: List get() = mapNotNull { it.returnType } -/** - * Gets the list of parameter types for the function declarations in the list. - * - * @see KoFunctionTypeDeclarationProvider.parameterTypes - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("parameters")) -val List.parameterTypes: List - get() = parameters - /** * Gets the list of parameters for the function declarations in the list. * @@ -108,72 +99,6 @@ fun List.withoutReturnTypeOf(kClasses } } -/** - * Filters the list by parameter type using the given predicate. - * - * @param predicate A function that defines the condition to be met by the parameter type. - * @return A list of function declarations that match the predicate for at least one parameter type. - * @see KoFunctionTypeDeclarationProvider.hasParameter - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withParameter(predicate)")) -fun List.withParameterType(predicate: (KoParameterDeclaration) -> Boolean): List = - withParameter(predicate) - -/** - * Filters the list by excluding functions that match the parameter type predicate. - * - * @param predicate A function that defines the condition to be met by the parameter type. - * @return A list of function declarations that do not match the predicate for the parameter type. - * @see KoFunctionTypeDeclarationProvider.hasParameter - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutParameter(predicate)")) -fun List.withoutParameterType(predicate: (KoParameterDeclaration) -> Boolean): List = - withoutParameter(predicate) - -/** - * Filters the list by requiring that all parameter types match the given predicate. - * - * @param predicate A function that defines the condition to be met by all parameter types. - * @return A list of function declarations where all parameter types match the given predicate. - * @see KoFunctionTypeDeclarationProvider.hasAllParameters - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withAllParameters(predicate)")) -fun List.withAllParameterTypes(predicate: (KoParameterDeclaration) -> Boolean): List = - withAllParameters(predicate) - -/** - * Filters the list by excluding functions where all parameter types match the given predicate. - * - * @param predicate A function that defines the condition to be met by all parameter types. - * @return A list of function declarations where not all parameter types match the given predicate. - * @see KoFunctionTypeDeclarationProvider.hasAllParameters - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutAllParameters(predicate)")) -fun List.withoutAllParameterTypes(predicate: (KoParameterDeclaration) -> Boolean): List = - withoutAllParameters(predicate) - -/** - * Filters the list by parameter types as a collection using the given predicate. - * - * @param predicate A function that defines the condition to be met by the list of parameter types. - * @return A list of function declarations that match the predicate for the list of parameter types. - * @see KoFunctionTypeDeclarationProvider.parameters - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withParameters(predicate)")) -fun List.withParameterTypes(predicate: (List) -> Boolean): List = - withParameters(predicate) - -/** - * Filters the list by excluding functions that match the parameter types predicate as a collection. - * - * @param predicate A function that defines the condition to be met by the list of parameter types. - * @return A list of function declarations that do not match the predicate for the list of parameter types. - * @see KoFunctionTypeDeclarationProvider.parameters - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutParameters(predicate)")) -fun List.withoutParameterTypes(predicate: (List) -> Boolean): List = - withoutParameters(predicate) - /** * Filters the list by parameter using the given predicate. * diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoIsGenericTypeProviderListExt.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoIsGenericTypeProviderListExt.kt deleted file mode 100644 index e6b3082733..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/KoIsGenericTypeProviderListExt.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.lemonappdev.konsist.api.ext.list - -import com.lemonappdev.konsist.api.provider.KoIsGenericTypeProvider - -/** - * List containing declarations with generic type. - * - * @return A list containing declarations with the generic types. - * @see KoIsGenericTypeProvider.isGenericType - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withGeneric")) -fun List.withGenericType(): List = filter { it.isGenericType } - -/** - * List containing declarations without generic type. - * - * @return A list containing declarations without the generic types. - * @see KoIsGenericTypeProvider.isGenericType - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutGeneric")) -fun List.withoutGenericType(): List = filterNot { it.isGenericType } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoValModifierProviderListExt.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoValModifierProviderListExt.kt deleted file mode 100644 index 775463cc2f..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoValModifierProviderListExt.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.lemonappdev.konsist.api.ext.list.modifierprovider - -import com.lemonappdev.konsist.api.provider.modifier.KoValModifierProvider - -/** - * List containing declarations with `val` modifier. - * - * @return A list containing declarations with the `val` modifier. - * @see KoValModifierProvider.hasValModifier - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withVal")) -fun List.withValModifier(): List = filter { it.hasValModifier } - -/** - * List containing declarations without `val` modifier. - * - * @return A list containing declarations without the `val` modifier. - * @see KoValModifierProvider.hasValModifier - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutVal")) -fun List.withoutValModifier(): List = filterNot { it.hasValModifier } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoVarModifierProviderListExt.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoVarModifierProviderListExt.kt deleted file mode 100644 index f1bce1684f..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoVarModifierProviderListExt.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.lemonappdev.konsist.api.ext.list.modifierprovider - -import com.lemonappdev.konsist.api.provider.modifier.KoVarModifierProvider - -/** - * List containing declarations with `var` modifier. - * - * @return A list containing declarations with the `var` modifier. - * @see KoVarModifierProvider.hasVarModifier - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withVar")) -fun List.withVarModifier(): List = filter { it.hasVarModifier } - -/** - * List containing declarations without `var` modifier. - * - * @return A list containing declarations without the `var` modifier. - * @see KoVarModifierProvider.hasVarModifier - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("withoutVar")) -fun List.withoutVarModifier(): List = filterNot { it.hasVarModifier } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoDeclarationCastProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoDeclarationCastProvider.kt index aef7b6302e..39cc9263bf 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoDeclarationCastProvider.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoDeclarationCastProvider.kt @@ -112,13 +112,6 @@ interface KoDeclarationCastProvider : */ val isExternal: Boolean - /** - * Determines whether the source declaration is an external type. - * An external type refers to a type that is defined outside the project's codebase, e.g. in an external library. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isExternal")) - val isExternalType: Boolean - /** * Determines whether the declaration is a function. */ @@ -228,15 +221,6 @@ interface KoDeclarationCastProvider : */ fun asExternalDeclaration(): KoExternalDeclaration? - /** - * Represents the external declaration associated with this declaration. - * An external type refers to a type that is defined outside the project's codebase, e.g. in an external library. - * - * @return the external declaration associated with this declaration. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("asExternal")) - fun asExternalTypeDeclaration(): KoExternalDeclaration? - /** * Represents the function declaration associated with this declaration. * @@ -473,28 +457,6 @@ interface KoDeclarationCastProvider : */ fun hasExternalDeclarationOf(kClass: KClass<*>): Boolean - /** - * Whether the type has a specified external type declaration. - * An external type refers to a type that is defined outside the project's codebase, e.g. in an external library. - * - * @param predicate The predicate function used to determine if an external type declaration satisfies a condition. - * @return `true` if the type has the specified external type declaration (or any external type declaration if [predicate] is - * `null`), `false` otherwise. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("hasExternalDeclaration")) - fun hasExternalTypeDeclaration(predicate: ((KoExternalDeclaration) -> Boolean)? = null): Boolean - - /** - * Whether the type has an external type declaration of the specified Kotlin class. - * An external type refers to a type that is defined outside the project's codebase, e.g. in an external library. - * - * @param kClass The Kotlin class representing the external type declaration to check for. - * @return `true` if the type has an external type declaration (type defined outside the project codebase, e.g. - * in an external library) matching the specified KClass, `false` otherwise. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("hasExternalDeclarationOf")) - fun hasExternalTypeDeclarationOf(kClass: KClass<*>): Boolean - /** * Whether the declaration has a specified function declaration. * diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoFunctionTypeDeclarationProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoFunctionTypeDeclarationProvider.kt index e53e0281d6..f2b6676759 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoFunctionTypeDeclarationProvider.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoFunctionTypeDeclarationProvider.kt @@ -8,18 +8,6 @@ import kotlin.reflect.KClass * Provides access to function type declarations, including details about parameters and return types. */ interface KoFunctionTypeDeclarationProvider : KoBaseProvider { - /** - * Represents the parameters of the function type. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("parameters")) - val parameterTypes: List? - - /** - * The number of parameters for the function type. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("numParameters")) - val numParameterTypes: Int - /** * Represents the parameters of the function type. */ @@ -35,33 +23,6 @@ interface KoFunctionTypeDeclarationProvider : KoBaseProvider { */ val returnType: KoTypeDeclaration? - /** - * Counts the number of parameter types that match the given predicate. - * - * @param predicate A function that evaluates each parameter declaration. - * @return The number of parameters that match the predicate. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("countParameters")) - fun countParameterTypes(predicate: (KoParameterDeclaration) -> Boolean): Int - - /** - * Checks if any parameter type matches the given predicate. - * - * @param predicate A function that evaluates each parameter declaration. - * @return `true` if any parameter type matches the predicate, otherwise `false`. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("hasParameter")) - fun hasParameterType(predicate: (KoParameterDeclaration) -> Boolean): Boolean - - /** - * Checks if all parameter types match the given predicate. - * - * @param predicate A function that evaluates each parameter declaration. - * @return `true` if all parameter types match the predicate, otherwise `false`. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("hasAllParameters")) - fun hasAllParameterTypes(predicate: (KoParameterDeclaration) -> Boolean): Boolean - /** * Counts the number of parameters that match the given predicate. * diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoIsGenericTypeProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoIsGenericTypeProvider.kt deleted file mode 100644 index 97c16dcc89..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoIsGenericTypeProvider.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.lemonappdev.konsist.api.provider - -/** - * An interface representing a Kotlin declaration that provides information about whether it is a generic type. - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoIsGenericProvider")) -interface KoIsGenericTypeProvider : KoBaseProvider { - /** - * Determines whether the type is a generic type. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isGeneric")) - val isGenericType: Boolean -} diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoSourceAndAliasTypeProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoSourceAndAliasTypeProvider.kt deleted file mode 100644 index 08f0654bc7..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/KoSourceAndAliasTypeProvider.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.lemonappdev.konsist.api.provider - -/** - * An interface representing a Kotlin declaration that provides access to its source type and import alias name. - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoSourceTypeProvider")) -interface KoSourceAndAliasTypeProvider : KoBaseProvider { - /** - * Returns `true` if this type is defined by an import alias. - * - * For the type import `import com.app.MyClass as MyAlias` the `isAlias` will be `true`. - * For the type import `import com.app.MyClass` the `isAlias` will be `false`. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isImportAlias")) - val isAlias: Boolean - - /** - * The source type. - * For `val car:MyClass` it will be "MyClass". - * For `val car:MyClass` it will be "MyClass". - * - * @see bareSourceType - */ - val sourceType: String - - /** - * The source type without generic type arguments and nullability ("?"). - * - * For `val car:MyClass` value will be "MyClass". - * For `val car:MyClass?` value will be "MyClass". - * For `val car:MyClass` value will be "MyClass". - * For `val car:MyClass?` value will be "MyClass". - * For `val car:com.app.MyClass` value will be "MyClass". - * - * @see sourceType - */ - val bareSourceType: String -} diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/modifier/KoValModifierProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/modifier/KoValModifierProvider.kt deleted file mode 100644 index 0c4b65b7ae..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/modifier/KoValModifierProvider.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.lemonappdev.konsist.api.provider.modifier - -import com.lemonappdev.konsist.api.provider.KoBaseProvider - -/** - * An interface representing a Kotlin declaration that provides information about whether it has a `val` modifier. - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoIsValProvider")) -interface KoValModifierProvider : KoBaseProvider { - /** - * Determines whether the declaration has the `val` modifier. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVal")) - val hasValModifier: Boolean -} diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/modifier/KoVarModifierProvider.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/modifier/KoVarModifierProvider.kt deleted file mode 100644 index 6a0a75a2c0..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/api/provider/modifier/KoVarModifierProvider.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.lemonappdev.konsist.api.provider.modifier - -import com.lemonappdev.konsist.api.provider.KoBaseProvider - -/** - * An interface representing a Kotlin declaration that provides information about whether it has a `var` modifier. - */ -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoIsVarProvider")) -interface KoVarModifierProvider : KoBaseProvider { - /** - * Determines whether the declaration has the `var` modifier. - */ - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVar")) - val hasVarModifier: Boolean -} diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoParameterDeclarationCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoParameterDeclarationCore.kt index 96832f274d..8f06b5a098 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoParameterDeclarationCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoParameterDeclarationCore.kt @@ -25,9 +25,7 @@ import com.lemonappdev.konsist.core.provider.KoTextProviderCore import com.lemonappdev.konsist.core.provider.modifier.KoCrossInlineModifierProviderCore import com.lemonappdev.konsist.core.provider.modifier.KoModifierProviderCore import com.lemonappdev.konsist.core.provider.modifier.KoNoInlineModifierProviderCore -import com.lemonappdev.konsist.core.provider.modifier.KoValModifierProviderCore import com.lemonappdev.konsist.core.provider.modifier.KoVarArgModifierProviderCore -import com.lemonappdev.konsist.core.provider.modifier.KoVarModifierProviderCore import com.lemonappdev.konsist.core.provider.packagee.KoPackageDeclarationProviderCore import org.jetbrains.kotlin.com.intellij.psi.PsiElement import org.jetbrains.kotlin.psi.KtAnnotationEntry @@ -55,8 +53,6 @@ internal class KoParameterDeclarationCore private constructor( KoResideInPackageProviderCore, KoTextProviderCore, KoNonNullableTypeProviderCore, - KoVarModifierProviderCore, - KoValModifierProviderCore, KoVarArgModifierProviderCore, KoNoInlineModifierProviderCore, KoCrossInlineModifierProviderCore, @@ -95,14 +91,6 @@ internal class KoParameterDeclarationCore private constructor( ignoreCase: Boolean, ): Boolean = name?.let { type.hasName(it, ignoreCase) } == true - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVal")) - override val hasValModifier: Boolean - get() = ktParameter.valOrVarKeyword?.text == "val" - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVar")) - override val hasVarModifier: Boolean - get() = ktParameter.valOrVarKeyword?.text == "var" - override val isVal: Boolean get() = ktParameter.valOrVarKeyword?.text == "val" diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoPropertyDeclarationCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoPropertyDeclarationCore.kt index eb4073c839..65b3b043f4 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoPropertyDeclarationCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoPropertyDeclarationCore.kt @@ -46,8 +46,6 @@ import com.lemonappdev.konsist.core.provider.modifier.KoLateinitModifierProvider import com.lemonappdev.konsist.core.provider.modifier.KoModifierProviderCore import com.lemonappdev.konsist.core.provider.modifier.KoOpenModifierProviderCore import com.lemonappdev.konsist.core.provider.modifier.KoOverrideModifierProviderCore -import com.lemonappdev.konsist.core.provider.modifier.KoValModifierProviderCore -import com.lemonappdev.konsist.core.provider.modifier.KoVarModifierProviderCore import com.lemonappdev.konsist.core.provider.modifier.KoVisibilityModifierProviderCore import com.lemonappdev.konsist.core.provider.packagee.KoPackageDeclarationProviderCore import org.jetbrains.kotlin.com.intellij.psi.PsiElement @@ -102,8 +100,6 @@ internal class KoPropertyDeclarationCore private constructor( KoIsTopLevelProviderCore, KoValueProviderCore, KoVisibilityModifierProviderCore, - KoValModifierProviderCore, - KoVarModifierProviderCore, KoLateinitModifierProviderCore, KoOverrideModifierProviderCore, KoAbstractModifierProviderCore, @@ -156,24 +152,6 @@ internal class KoPropertyDeclarationCore private constructor( .firstOrNull() } - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVal")) - override val hasValModifier: Boolean - get() = - when (ktCallableDeclaration) { - is KtProperty -> !ktCallableDeclaration.isVar - is KtParameter -> ktCallableDeclaration.valOrVarKeyword?.text == "val" - else -> false - } - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVar")) - override val hasVarModifier: Boolean - get() = - when (ktCallableDeclaration) { - is KtProperty -> ktCallableDeclaration.isVar - is KtParameter -> ktCallableDeclaration.valOrVarKeyword?.text == "var" - else -> false - } - override val isVal: Boolean get() = when (ktCallableDeclaration) { diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoTypeArgumentDeclarationCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoTypeArgumentDeclarationCore.kt index 15279bc321..43c3928f0a 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoTypeArgumentDeclarationCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoTypeArgumentDeclarationCore.kt @@ -8,7 +8,6 @@ import com.lemonappdev.konsist.core.provider.KoBaseProviderCore import com.lemonappdev.konsist.core.provider.KoFunctionTypeDeclarationProviderCore import com.lemonappdev.konsist.core.provider.KoIsFunctionTypeProviderCore import com.lemonappdev.konsist.core.provider.KoIsGenericProviderCore -import com.lemonappdev.konsist.core.provider.KoIsGenericTypeProviderCore import com.lemonappdev.konsist.core.provider.KoIsStarProjectionProviderCore import com.lemonappdev.konsist.core.provider.KoLocationProviderCore import com.lemonappdev.konsist.core.provider.KoNameProviderCore @@ -48,7 +47,6 @@ data class KoTypeArgumentDeclarationCore( KoInModifierProviderCore, KoLocationProviderCore, KoPathProviderCore, - KoIsGenericTypeProviderCore, KoIsGenericProviderCore, KoIsFunctionTypeProviderCore, KoFunctionTypeDeclarationProviderCore, diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoVariableDeclarationCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoVariableDeclarationCore.kt index d9c9ce2431..509ad17227 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoVariableDeclarationCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/KoVariableDeclarationCore.kt @@ -22,8 +22,6 @@ import com.lemonappdev.konsist.core.provider.KoSourceSetProviderCore import com.lemonappdev.konsist.core.provider.KoTacitTypeProviderCore import com.lemonappdev.konsist.core.provider.KoTextProviderCore import com.lemonappdev.konsist.core.provider.KoValueProviderCore -import com.lemonappdev.konsist.core.provider.modifier.KoValModifierProviderCore -import com.lemonappdev.konsist.core.provider.modifier.KoVarModifierProviderCore import com.lemonappdev.konsist.core.provider.packagee.KoPackageDeclarationProviderCore import org.jetbrains.kotlin.com.intellij.psi.PsiElement import org.jetbrains.kotlin.psi.KtAnnotationEntry @@ -53,8 +51,6 @@ internal class KoVariableDeclarationCore private constructor( KoResideInPackageProviderCore, KoTextProviderCore, KoValueProviderCore, - KoValModifierProviderCore, - KoVarModifierProviderCore, KoTacitTypeProviderCore, KoIsValProviderCore, KoIsVarProviderCore { @@ -83,14 +79,6 @@ internal class KoVariableDeclarationCore private constructor( .firstOrNull() } - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVal")) - override val hasValModifier: Boolean - get() = !ktProperty.isVar - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isVar")) - override val hasVarModifier: Boolean - get() = ktProperty.isVar - override val isVal: Boolean get() = !ktProperty.isVar diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/type/KoTypeDeclarationCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/type/KoTypeDeclarationCore.kt index 77119ee123..d0b5b8ef31 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/type/KoTypeDeclarationCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/declaration/type/KoTypeDeclarationCore.kt @@ -1,35 +1,17 @@ package com.lemonappdev.konsist.core.declaration.type import com.lemonappdev.konsist.api.declaration.KoBaseDeclaration -import com.lemonappdev.konsist.api.declaration.KoClassDeclaration -import com.lemonappdev.konsist.api.declaration.KoExternalDeclaration -import com.lemonappdev.konsist.api.declaration.KoFunctionDeclaration -import com.lemonappdev.konsist.api.declaration.KoImportAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoInterfaceDeclaration -import com.lemonappdev.konsist.api.declaration.KoObjectDeclaration import com.lemonappdev.konsist.api.declaration.KoPackageDeclaration -import com.lemonappdev.konsist.api.declaration.KoPropertyDeclaration -import com.lemonappdev.konsist.api.declaration.KoSourceDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeAliasDeclaration -import com.lemonappdev.konsist.api.declaration.KoTypeParameterDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndInterfaceAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndInterfaceDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoClassAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.combined.KoInterfaceAndObjectDeclaration -import com.lemonappdev.konsist.api.declaration.type.KoKotlinTypeDeclaration import com.lemonappdev.konsist.api.declaration.type.KoTypeDeclaration -import com.lemonappdev.konsist.core.annotation.RemoveInVersion import com.lemonappdev.konsist.core.cache.KoDeclarationCache import com.lemonappdev.konsist.core.cache.KoPropertyCache import com.lemonappdev.konsist.core.provider.KoAnnotationProviderCore import com.lemonappdev.konsist.core.provider.KoBaseProviderCore import com.lemonappdev.konsist.core.provider.KoContainingDeclarationProviderCore import com.lemonappdev.konsist.core.provider.KoContainingFileProviderCore -import com.lemonappdev.konsist.core.provider.KoDeclarationCastProviderCore import com.lemonappdev.konsist.core.provider.KoFunctionTypeDeclarationProviderCore import com.lemonappdev.konsist.core.provider.KoIsFunctionTypeProviderCore import com.lemonappdev.konsist.core.provider.KoIsGenericProviderCore -import com.lemonappdev.konsist.core.provider.KoIsGenericTypeProviderCore import com.lemonappdev.konsist.core.provider.KoIsMutableTypeProviderCore import com.lemonappdev.konsist.core.provider.KoIsNullableProviderCore import com.lemonappdev.konsist.core.provider.KoLocationProviderCore @@ -37,7 +19,6 @@ import com.lemonappdev.konsist.core.provider.KoModuleProviderCore import com.lemonappdev.konsist.core.provider.KoNameProviderCore import com.lemonappdev.konsist.core.provider.KoPathProviderCore import com.lemonappdev.konsist.core.provider.KoResideInPackageProviderCore -import com.lemonappdev.konsist.core.provider.KoSourceAndAliasTypeProviderCore import com.lemonappdev.konsist.core.provider.KoSourceDeclarationProviderCore import com.lemonappdev.konsist.core.provider.KoSourceSetProviderCore import com.lemonappdev.konsist.core.provider.KoSourceTypeProviderCore @@ -55,7 +36,6 @@ import org.jetbrains.kotlin.psi.KtNullableType import org.jetbrains.kotlin.psi.KtTypeProjection import org.jetbrains.kotlin.psi.KtTypeReference import org.jetbrains.kotlin.psi.KtUserType -import kotlin.reflect.KClass @Suppress("detekt.TooManyFunctions") internal class KoTypeDeclarationCore private constructor( @@ -74,16 +54,12 @@ internal class KoTypeDeclarationCore private constructor( KoContainingDeclarationProviderCore, KoModuleProviderCore, KoSourceSetProviderCore, - KoSourceAndAliasTypeProviderCore, KoSourceTypeProviderCore, - KoIsGenericTypeProviderCore, KoIsGenericProviderCore, KoIsFunctionTypeProviderCore, KoPackageProviderCore, KoResideInPackageProviderCore, KoAnnotationProviderCore, - @RemoveInVersion("0.19.0") - KoDeclarationCastProviderCore, KoSourceDeclarationProviderCore, KoIsMutableTypeProviderCore, KoTypeArgumentProviderCore, @@ -138,15 +114,6 @@ internal class KoTypeDeclarationCore private constructor( override val text: String get() = if (ktCallExpression != null) name else super.text - @Volatile - private var cachedKoDeclarationCastProviderDeclaration: Any? = KoPropertyCache.NOT_COMPUTED - - override val koDeclarationCastProviderDeclaration: KoSourceDeclaration? - get() = - KoPropertyCache.getOrCompute(cachedKoDeclarationCastProviderDeclaration, { - cachedKoDeclarationCastProviderDeclaration = it - }) { sourceDeclaration } - @Volatile private var cachedName: Any? = KoPropertyCache.NOT_COMPUTED @@ -224,14 +191,12 @@ internal class KoTypeDeclarationCore private constructor( @Volatile private var cachedSourceType: Any? = KoPropertyCache.NOT_COMPUTED - @RemoveInVersion("0.19.0") override val sourceType: String get() = KoPropertyCache.getOrCompute(cachedSourceType, { cachedSourceType = it }) { super.sourceType } @Volatile private var cachedBareSourceType: Any? = KoPropertyCache.NOT_COMPUTED - @RemoveInVersion("0.19.0") override val bareSourceType: String get() = KoPropertyCache.getOrCompute( @@ -239,269 +204,6 @@ internal class KoTypeDeclarationCore private constructor( { cachedBareSourceType = it }, ) { super.bareSourceType } - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClass")) - override val isClass: Boolean - get() = super.isClass - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isObject")) - override val isObject: Boolean - get() = super.isObject - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isInterface")) - override val isInterface: Boolean - get() = super.isInterface - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClassOrObject")) - override val isClassOrObject: Boolean - get() = super.isClassOrObject - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClassOrInterface")) - override val isClassOrInterface: Boolean - get() = super.isClassOrInterface - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isInterfaceOrObject")) - override val isInterfaceOrObject: Boolean - get() = super.isInterfaceOrObject - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isClassOrInterfaceOrObject")) - override val isClassOrInterfaceOrObject: Boolean - get() = super.isClassOrInterfaceOrObject - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isTypeAlias")) - override val isTypeAlias: Boolean - get() = super.isTypeAlias - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isImportAlias")) - override val isImportAlias: Boolean - get() = super.isImportAlias - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isKotlinType")) - override val isKotlinType: Boolean - get() = super.isKotlinType - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isKotlinBasicType")) - override val isKotlinBasicType: Boolean - get() = super.isKotlinBasicType - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isKotlinCollectionType")) - override val isKotlinCollectionType: Boolean - get() = super.isKotlinCollectionType - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isTypeParameter")) - override val isTypeParameter: Boolean - get() = super.isTypeParameter - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isExternal")) - override val isExternal: Boolean - get() = super.isExternal - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isFunction")) - override val isFunction: Boolean - get() = super.isFunction - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.isProperty")) - override val isProperty: Boolean - get() = super.isProperty - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asClassDeclaration()")) - override fun asClassDeclaration(): KoClassDeclaration? = super.asClassDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asObjectDeclaration()")) - override fun asObjectDeclaration(): KoObjectDeclaration? = super.asObjectDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asInterfaceDeclaration()")) - override fun asInterfaceDeclaration(): KoInterfaceDeclaration? = super.asInterfaceDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asClassOrObjectDeclaration()")) - override fun asClassOrObjectDeclaration(): KoClassAndObjectDeclaration? = - super.asClassOrObjectDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asClassOrInterfaceDeclaration()")) - override fun asClassOrInterfaceDeclaration(): KoClassAndInterfaceDeclaration? = - super.asClassOrInterfaceDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asInterfaceOrObjectDeclaration()")) - override fun asInterfaceOrObjectDeclaration(): KoInterfaceAndObjectDeclaration? = - super.asInterfaceOrObjectDeclaration() - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.asClassOrInterfaceOrObjectDeclaration()"), - ) - override fun asClassOrInterfaceOrObjectDeclaration(): KoClassAndInterfaceAndObjectDeclaration? = - super.asClassOrInterfaceOrObjectDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asTypeAliasDeclaration()")) - override fun asTypeAliasDeclaration(): KoTypeAliasDeclaration? = super.asTypeAliasDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asImportAliasDeclaration()")) - override fun asImportAliasDeclaration(): KoImportAliasDeclaration? = super.asImportAliasDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asKotlinTypeDeclaration()")) - override fun asKotlinTypeDeclaration(): KoKotlinTypeDeclaration? = super.asKotlinTypeDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asKotlinBasicTypeDeclaration()")) - override fun asKotlinBasicTypeDeclaration(): KoKotlinTypeDeclaration? = - super.asKotlinBasicTypeDeclaration() - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.asKotlinCollectionTypeDeclaration()"), - ) - override fun asKotlinCollectionTypeDeclaration(): KoKotlinTypeDeclaration? = - super.asKotlinCollectionTypeDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asTypeParameterDeclaration()")) - override fun asTypeParameterDeclaration(): KoTypeParameterDeclaration? = - super.asTypeParameterDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asExternalDeclaration()")) - override fun asExternalDeclaration(): KoExternalDeclaration? = super.asExternalDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asFunctionDeclaration()")) - override fun asFunctionDeclaration(): KoFunctionDeclaration? = super.asFunctionDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.asPropertyDeclaration()")) - override fun asPropertyDeclaration(): KoPropertyDeclaration? = super.asPropertyDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassDeclaration()")) - override fun hasClassDeclaration(predicate: ((KoClassDeclaration) -> Boolean)?): Boolean = - super.hasClassDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassDeclarationOf()")) - override fun hasClassDeclarationOf(kClass: KClass<*>): Boolean = super.hasClassDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasObjectDeclaration()")) - override fun hasObjectDeclaration(predicate: ((KoObjectDeclaration) -> Boolean)?): Boolean = - super.hasObjectDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasObjectDeclarationOf()")) - override fun hasObjectDeclarationOf(kClass: KClass<*>): Boolean = super.hasObjectDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasInterfaceDeclaration()")) - override fun hasInterfaceDeclaration(predicate: ((KoInterfaceDeclaration) -> Boolean)?): Boolean = - super.hasInterfaceDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasInterfaceDeclarationOf()")) - override fun hasInterfaceDeclarationOf(kClass: KClass<*>): Boolean = - super.hasInterfaceDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassOrObjectDeclaration()")) - override fun hasClassOrObjectDeclaration(predicate: ((KoClassAndObjectDeclaration) -> Boolean)?): Boolean = - super.hasClassOrObjectDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassOrObjectDeclarationOf()")) - override fun hasClassOrObjectDeclarationOf(kClass: KClass<*>): Boolean = - super.hasClassOrObjectDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasClassOrInterfaceDeclaration()")) - override fun hasClassOrInterfaceDeclaration(predicate: ((KoClassAndInterfaceDeclaration) -> Boolean)?): Boolean = - super.hasClassOrInterfaceDeclaration(predicate) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasClassOrInterfaceDeclarationOf()"), - ) - override fun hasClassOrInterfaceDeclarationOf(kClass: KClass<*>): Boolean = - super.hasClassOrInterfaceDeclarationOf(kClass) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasInterfaceOrObjectDeclaration()"), - ) - override fun hasInterfaceOrObjectDeclaration(predicate: ((KoInterfaceAndObjectDeclaration) -> Boolean)?): Boolean = - super.hasInterfaceOrObjectDeclaration(predicate) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasInterfaceOrObjectDeclarationOf()"), - ) - override fun hasInterfaceOrObjectDeclarationOf(kClass: KClass<*>): Boolean = - super.hasInterfaceOrObjectDeclarationOf(kClass) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasClassOrInterfaceOrObjectDeclaration()"), - ) - override fun hasClassOrInterfaceOrObjectDeclaration(predicate: ((KoClassAndInterfaceAndObjectDeclaration) -> Boolean)?): Boolean = - super.hasClassOrInterfaceOrObjectDeclaration(predicate) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasClassOrInterfaceOrObjectDeclarationOf()"), - ) - override fun hasClassOrInterfaceOrObjectDeclarationOf(kClass: KClass<*>): Boolean = - super.hasClassOrInterfaceOrObjectDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasTypeAliasDeclaration()")) - override fun hasTypeAliasDeclaration(predicate: ((KoTypeAliasDeclaration) -> Boolean)?): Boolean = - super.hasTypeAliasDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasImportAliasDeclaration()")) - override fun hasImportAliasDeclaration(predicate: ((KoImportAliasDeclaration) -> Boolean)?): Boolean = - super.hasImportAliasDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasKotlinTypeDeclaration()")) - override fun hasKotlinTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)?): Boolean = - super.hasKotlinTypeDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasKotlinTypeDeclarationOf()")) - override fun hasKotlinTypeDeclarationOf(kClass: KClass<*>): Boolean = - super.hasKotlinTypeDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasKotlinBasicTypeDeclaration()")) - override fun hasKotlinBasicTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)?): Boolean = - super.hasKotlinBasicTypeDeclaration(predicate) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasKotlinBasicTypeDeclarationOf()"), - ) - override fun hasKotlinBasicTypeDeclarationOf(kClass: KClass<*>): Boolean = - super.hasKotlinBasicTypeDeclarationOf(kClass) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasKotlinCollectionTypeDeclaration()"), - ) - override fun hasKotlinCollectionTypeDeclaration(predicate: ((KoKotlinTypeDeclaration) -> Boolean)?): Boolean = - super.hasKotlinCollectionTypeDeclaration(predicate) - - @Deprecated( - "Will be removed in version 0.19.0", - ReplaceWith("sourceDeclaration?.hasKotlinCollectionTypeDeclarationOf()"), - ) - override fun hasKotlinCollectionTypeDeclarationOf(kClass: KClass<*>): Boolean = - super.hasKotlinCollectionTypeDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasTypeParameterDeclaration()")) - override fun hasTypeParameterDeclaration(predicate: ((KoTypeParameterDeclaration) -> Boolean)?): Boolean = - super.hasTypeParameterDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasExternalDeclaration()")) - override fun hasExternalDeclaration(predicate: ((KoExternalDeclaration) -> Boolean)?): Boolean = - super.hasExternalDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasExternalDeclarationOf()")) - override fun hasExternalDeclarationOf(kClass: KClass<*>): Boolean = - super.hasExternalDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasFunctionDeclaration()")) - override fun hasFunctionDeclaration(predicate: ((KoFunctionDeclaration) -> Boolean)?): Boolean = - super.hasFunctionDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasFunctionDeclarationOf()")) - override fun hasFunctionDeclarationOf(kClass: KClass<*>): Boolean = - super.hasFunctionDeclarationOf(kClass) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasPropertyDeclaration()")) - override fun hasPropertyDeclaration(predicate: ((KoPropertyDeclaration) -> Boolean)?): Boolean = - super.hasPropertyDeclaration(predicate) - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("sourceDeclaration?.hasPropertyDeclarationOf()")) - override fun hasPropertyDeclarationOf(kClass: KClass<*>): Boolean = - super.hasPropertyDeclarationOf(kClass) - override fun toString(): String = text internal companion object { diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoDeclarationCastProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoDeclarationCastProviderCore.kt index 4344d192e9..3381d49023 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoDeclarationCastProviderCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoDeclarationCastProviderCore.kt @@ -84,10 +84,6 @@ internal interface KoDeclarationCastProviderCore : override val isProperty: Boolean get() = koDeclarationCastProviderDeclaration is KoPropertyDeclaration - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("isExternal")) - override val isExternalType: Boolean - get() = isExternal - override val isStarProjection: Boolean get() = koDeclarationCastProviderDeclaration is KoStarProjectionDeclaration @@ -135,9 +131,6 @@ internal interface KoDeclarationCastProviderCore : override fun asExternalDeclaration(): KoExternalDeclaration? = koDeclarationCastProviderDeclaration as? KoExternalDeclaration - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("asExternalDeclaration")) - override fun asExternalTypeDeclaration(): KoExternalDeclaration? = asExternalDeclaration() - override fun asFunctionDeclaration(): KoFunctionDeclaration? = koDeclarationCastProviderDeclaration as? KoFunctionDeclaration override fun asPropertyDeclaration(): KoPropertyDeclaration? = koDeclarationCastProviderDeclaration as? KoPropertyDeclaration @@ -243,12 +236,6 @@ internal interface KoDeclarationCastProviderCore : override fun hasExternalDeclarationOf(kClass: KClass<*>): Boolean = kClass.qualifiedName == asExternalDeclaration()?.fullyQualifiedName - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("hasExternalDeclaration")) - override fun hasExternalTypeDeclaration(predicate: ((KoExternalDeclaration) -> Boolean)?): Boolean = hasExternalDeclaration() - - @Deprecated("Will be removed in version 0.19.0", ReplaceWith("hasExternalDeclarationOf")) - override fun hasExternalTypeDeclarationOf(kClass: KClass<*>): Boolean = hasExternalDeclarationOf(kClass) - override fun hasFunctionDeclaration(predicate: ((KoFunctionDeclaration) -> Boolean)?): Boolean = when (predicate) { null -> isFunction diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoFunctionTypeDeclarationProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoFunctionTypeDeclarationProviderCore.kt index 5f814e5233..4fc0c03234 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoFunctionTypeDeclarationProviderCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoFunctionTypeDeclarationProviderCore.kt @@ -17,14 +17,6 @@ internal interface KoFunctionTypeDeclarationProviderCore : KoBaseProviderCore { val ktFunctionType: KtFunctionType? - @Deprecated("Will be removed in version 0.19.0", replaceWith = ReplaceWith("parameters")) - override val parameterTypes: List? - get() = parameters - - @Deprecated("Will be removed in version 0.19.0", replaceWith = ReplaceWith("numParameters")) - override val numParameterTypes: Int - get() = numParameters - override val parameters: List? get() = ktFunctionType @@ -48,15 +40,6 @@ internal interface KoFunctionTypeDeclarationProviderCore : override fun hasReturnTypeOf(kClass: KClass<*>): Boolean = hasTypeOf(returnType, kClass) - @Deprecated("Will be removed in version 0.19.0", replaceWith = ReplaceWith("countParameters")) - override fun countParameterTypes(predicate: (KoParameterDeclaration) -> Boolean): Int = countParameters(predicate) - - @Deprecated("Will be removed in version 0.19.0", replaceWith = ReplaceWith("hasParameter")) - override fun hasParameterType(predicate: (KoParameterDeclaration) -> Boolean): Boolean = hasParameter(predicate) - - @Deprecated("Will be removed in version 0.19.0", replaceWith = ReplaceWith("hasAllParameters")) - override fun hasAllParameterTypes(predicate: (KoParameterDeclaration) -> Boolean): Boolean = hasAllParameters(predicate) - override fun countParameters(predicate: (KoParameterDeclaration) -> Boolean): Int = parameters?.count { predicate(it) } ?: 0 override fun hasParameter(predicate: (KoParameterDeclaration) -> Boolean): Boolean = parameters?.any(predicate) ?: false diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoIsGenericTypeProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoIsGenericTypeProviderCore.kt deleted file mode 100644 index cda816dfe8..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoIsGenericTypeProviderCore.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.lemonappdev.konsist.core.provider - -import com.lemonappdev.konsist.api.provider.KoIsGenericTypeProvider - -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoIsGenericProviderCore")) -internal interface KoIsGenericTypeProviderCore : - KoIsGenericTypeProvider, - KoBaseProviderCore, - KoIsGenericProviderCore { - @Deprecated("Will be removed in version 0.19.0", replaceWith = ReplaceWith("isGeneric")) - override val isGenericType: Boolean - get() = isGeneric -} diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoSourceAndAliasTypeProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoSourceAndAliasTypeProviderCore.kt deleted file mode 100644 index 2e788289d1..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoSourceAndAliasTypeProviderCore.kt +++ /dev/null @@ -1,50 +0,0 @@ -package com.lemonappdev.konsist.core.provider - -import com.lemonappdev.konsist.api.declaration.KoFileDeclaration -import com.lemonappdev.konsist.api.declaration.type.KoTypeDeclaration -import com.lemonappdev.konsist.api.provider.KoSourceAndAliasTypeProvider -import com.lemonappdev.konsist.core.declaration.KoFileDeclarationCore -import com.lemonappdev.konsist.core.util.TypeUtil -import org.jetbrains.kotlin.psi.KtElement - -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoSourceTypeProvider")) -internal interface KoSourceAndAliasTypeProviderCore : - KoSourceAndAliasTypeProvider, - KoTextProviderCore, - KoBaseProviderCore { - val ktElement: KtElement - - private val file: KoFileDeclaration - get() = KoFileDeclarationCore.getInstance(ktElement.containingKtFile) - - @Deprecated("Will be removed in version 0.19.0", replaceWith = ReplaceWith("isImportAlias")) - override val isAlias: Boolean - get() = (this as? KoTypeDeclaration)?.sourceDeclaration?.isImportAlias == true - - override val sourceType: String - get() = - if (isAlias) { - file - .imports - .firstOrNull { it.alias?.name == ktElement.text.removeSuffix("?") } - ?.name - ?.split(".") - ?.toMutableList() - ?.lastOrNull { it.isNotBlank() } - ?: text - } else { - text - } - - override val bareSourceType: String - get() = - when { - this is KoTypeDeclaration && sourceDeclaration?.isTypeAlias == true -> { - sourceDeclaration?.asTypeAliasDeclaration()?.type?.text ?: text - } - - else -> { - TypeUtil.getBareType(sourceType) - } - } -} diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoSourceTypeProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoSourceTypeProviderCore.kt index 60b570f12d..79990825db 100644 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoSourceTypeProviderCore.kt +++ b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/KoSourceTypeProviderCore.kt @@ -2,7 +2,6 @@ package com.lemonappdev.konsist.core.provider import com.lemonappdev.konsist.api.declaration.KoFileDeclaration import com.lemonappdev.konsist.api.declaration.type.KoTypeDeclaration -import com.lemonappdev.konsist.api.provider.KoDeclarationCastProvider import com.lemonappdev.konsist.api.provider.KoSourceTypeProvider import com.lemonappdev.konsist.core.declaration.KoFileDeclarationCore import com.lemonappdev.konsist.core.util.TypeUtil @@ -19,7 +18,7 @@ internal interface KoSourceTypeProviderCore : override val sourceType: String get() = - if ((this as? KoDeclarationCastProvider)?.isImportAlias == true) { + if ((this as? KoTypeDeclaration)?.sourceDeclaration?.isImportAlias == true) { file .imports .firstOrNull { it.alias?.name == ktElement.text.removeSuffix("?") } diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/modifier/KoValModifierProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/modifier/KoValModifierProviderCore.kt deleted file mode 100644 index 78d73e5176..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/modifier/KoValModifierProviderCore.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.lemonappdev.konsist.core.provider.modifier - -import com.lemonappdev.konsist.api.provider.modifier.KoValModifierProvider -import com.lemonappdev.konsist.core.provider.KoBaseProviderCore - -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoIsValProvider")) -internal interface KoValModifierProviderCore : - KoValModifierProvider, - KoBaseProviderCore diff --git a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/modifier/KoVarModifierProviderCore.kt b/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/modifier/KoVarModifierProviderCore.kt deleted file mode 100644 index 5467e8f656..0000000000 --- a/lib/src/main/kotlin/com/lemonappdev/konsist/core/provider/modifier/KoVarModifierProviderCore.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.lemonappdev.konsist.core.provider.modifier - -import com.lemonappdev.konsist.api.provider.modifier.KoVarModifierProvider -import com.lemonappdev.konsist.core.provider.KoBaseProviderCore - -@Deprecated("Will be removed in version 0.19.0", ReplaceWith("KoIsVarProvider")) -internal interface KoVarModifierProviderCore : - KoVarModifierProvider, - KoBaseProviderCore diff --git a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExtTest.kt b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExtTest.kt index fc958e3c86..4a76f69e49 100644 --- a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExtTest.kt +++ b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoFunctionTypeDeclarationProviderListExtTest.kt @@ -539,189 +539,4 @@ class KoFunctionTypeDeclarationProviderListExtTest { // then sut shouldBeEqualTo listOf(declaration2) } - - @Test - fun `parameterTypes returns parameter types from all declarations`() { - // given - val parameterType1: KoParameterDeclaration = mockk() - val parameterType2: KoParameterDeclaration = mockk() - val parameterType3: KoParameterDeclaration = mockk() - val declaration1: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns listOf(parameterType1, parameterType2) - } - val declaration2: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns listOf(parameterType3) - } - val declaration3: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns emptyList() - } - val declarations = listOf(declaration1, declaration2, declaration3) - - // when - val sut = declarations.parameterTypes - - // then - sut shouldBeEqualTo listOf(parameterType1, parameterType2, parameterType3) - } - - @Test - fun `withParameterType{} returns declaration with parameter type which satisfy predicate`() { - // given - val suffix = "Name" - val predicate: (KoParameterDeclaration) -> Boolean = { it.hasNameEndingWith(suffix) } - val declaration1: KoFunctionTypeDeclarationProvider = - mockk { - every { hasParameter(predicate) } returns true - } - val declaration2: KoFunctionTypeDeclarationProvider = - mockk { - every { hasParameter(predicate) } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withParameterType(predicate) - - // then - sut shouldBeEqualTo listOf(declaration1) - } - - @Test - fun `withoutParameterType{} returns declaration without parameter type which satisfy predicate`() { - // given - val suffix = "Name" - val predicate: (KoParameterDeclaration) -> Boolean = { it.hasNameEndingWith(suffix) } - val declaration1: KoFunctionTypeDeclarationProvider = - mockk { - every { hasParameter(predicate) } returns true - } - val declaration2: KoFunctionTypeDeclarationProvider = - mockk { - every { hasParameter(predicate) } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withoutParameterType(predicate) - - // then - sut shouldBeEqualTo listOf(declaration2) - } - - @Test - fun `withAllParameterTypes{} returns declaration with all parameter types satisfy predicate`() { - // given - val suffix = "Name" - val predicate: (KoParameterDeclaration) -> Boolean = { it.hasNameEndingWith(suffix) } - val declaration1: KoFunctionTypeDeclarationProvider = - mockk { - every { hasAllParameters(predicate) } returns true - } - val declaration2: KoFunctionTypeDeclarationProvider = - mockk { - every { hasAllParameters(predicate) } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withAllParameterTypes(predicate) - - // then - sut shouldBeEqualTo listOf(declaration1) - } - - @Test - fun `withoutAllParameterTypes{} returns declaration with all parameter types which not satisfy predicate`() { - // given - val suffix = "Name" - val predicate: (KoParameterDeclaration) -> Boolean = { it.hasNameEndingWith(suffix) } - val declaration1: KoFunctionTypeDeclarationProvider = - mockk { - every { hasAllParameters(predicate) } returns true - } - val declaration2: KoFunctionTypeDeclarationProvider = - mockk { - every { hasAllParameters(predicate) } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withoutAllParameterTypes(predicate) - - // then - sut shouldBeEqualTo listOf(declaration2) - } - - @Test - fun `withParameterType{} returns declaration with parameter types which satisfy predicate`() { - // given - val suffix = "Name" - val predicate: (List) -> Boolean = - { it.all { argument -> argument.hasNameEndingWith(suffix) } } - val parameterType1: KoParameterDeclaration = - mockk { - every { hasNameEndingWith(suffix) } returns true - } - val parameterType2: KoParameterDeclaration = - mockk { - every { hasNameEndingWith(suffix) } returns false - } - val declaration1: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns listOf(parameterType1) - } - val declaration2: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns listOf(parameterType2) - } - val declaration3: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns emptyList() - } - val declarations = listOf(declaration1, declaration2, declaration3) - - // when - val sut = declarations.withParameterTypes(predicate) - - // then - sut shouldBeEqualTo listOf(declaration1, declaration3) - } - - @Test - fun `withoutParameterType{} returns declaration without parameter types which satisfy predicate`() { - // given - val suffix = "Name" - val predicate: (List) -> Boolean = - { it.all { argument -> argument.hasNameEndingWith(suffix) } } - val parameterType1: KoParameterDeclaration = - mockk { - every { hasNameEndingWith(suffix) } returns true - } - val parameterType2: KoParameterDeclaration = - mockk { - every { hasNameEndingWith(suffix) } returns false - } - val declaration1: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns listOf(parameterType1) - } - val declaration2: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns listOf(parameterType2) - } - val declaration3: KoFunctionTypeDeclarationProvider = - mockk { - every { parameters } returns emptyList() - } - val declarations = listOf(declaration1, declaration2, declaration3) - - // when - val sut = declarations.withoutParameterTypes(predicate) - - // then - sut shouldBeEqualTo listOf(declaration2) - } } diff --git a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoIsGenericTypeProviderListExtTest.kt b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoIsGenericTypeProviderListExtTest.kt deleted file mode 100644 index c25c0b0908..0000000000 --- a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/KoIsGenericTypeProviderListExtTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.lemonappdev.konsist.api.ext.list - -import com.lemonappdev.konsist.api.provider.KoIsGenericTypeProvider -import io.mockk.every -import io.mockk.mockk -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoIsGenericTypeProviderListExtTest { - @Test - fun `withGenericType() returns type with generic type`() { - // given - val type1: KoIsGenericTypeProvider = - mockk { - every { isGenericType } returns true - } - val type2: KoIsGenericTypeProvider = - mockk { - every { isGenericType } returns false - } - val types = listOf(type1, type2) - - // when - val sut = types.withGenericType() - - // then - sut shouldBeEqualTo listOf(type1) - } - - @Test - fun `withoutGenericType() returns type without generic type`() { - // given - val type1: KoIsGenericTypeProvider = - mockk { - every { isGenericType } returns true - } - val type2: KoIsGenericTypeProvider = - mockk { - every { isGenericType } returns false - } - val types = listOf(type1, type2) - - // when - val sut = types.withoutGenericType() - - // then - sut shouldBeEqualTo listOf(type2) - } -} diff --git a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoValModifierProviderListExtTest.kt b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoValModifierProviderListExtTest.kt deleted file mode 100644 index fcc1230fb7..0000000000 --- a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoValModifierProviderListExtTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.lemonappdev.konsist.api.ext.list.modifierprovider - -import com.lemonappdev.konsist.api.provider.modifier.KoValModifierProvider -import io.mockk.every -import io.mockk.mockk -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoValModifierProviderListExtTest { - @Test - fun `withValModifier() returns declaration with val modifier`() { - // given - val declaration1: KoValModifierProvider = - mockk { - every { hasValModifier } returns true - } - val declaration2: KoValModifierProvider = - mockk { - every { hasValModifier } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withValModifier() - - // then - sut shouldBeEqualTo listOf(declaration1) - } - - @Test - fun `withoutValModifier() returns declaration without val modifier`() { - // given - val declaration1: KoValModifierProvider = - mockk { - every { hasValModifier } returns true - } - val declaration2: KoValModifierProvider = - mockk { - every { hasValModifier } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withoutValModifier() - - // then - sut shouldBeEqualTo listOf(declaration2) - } -} diff --git a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoVarModifierProviderListExtTest.kt b/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoVarModifierProviderListExtTest.kt deleted file mode 100644 index 143dc317f0..0000000000 --- a/lib/src/test/kotlin/com/lemonappdev/konsist/api/ext/list/modifierprovider/KoVarModifierProviderListExtTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.lemonappdev.konsist.api.ext.list.modifierprovider - -import com.lemonappdev.konsist.api.provider.modifier.KoVarModifierProvider -import io.mockk.every -import io.mockk.mockk -import org.amshove.kluent.shouldBeEqualTo -import org.junit.jupiter.api.Test - -class KoVarModifierProviderListExtTest { - @Test - fun `withVarModifier() returns declaration with var modifier`() { - // given - val declaration1: KoVarModifierProvider = - mockk { - every { hasVarModifier } returns true - } - val declaration2: KoVarModifierProvider = - mockk { - every { hasVarModifier } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withVarModifier() - - // then - sut shouldBeEqualTo listOf(declaration1) - } - - @Test - fun `withoutVarModifier() returns declaration without var modifier`() { - // given - val declaration1: KoVarModifierProvider = - mockk { - every { hasVarModifier } returns true - } - val declaration2: KoVarModifierProvider = - mockk { - every { hasVarModifier } returns false - } - val declarations = listOf(declaration1, declaration2) - - // when - val sut = declarations.withoutVarModifier() - - // then - sut shouldBeEqualTo listOf(declaration2) - } -} diff --git a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoModuleProviderTest.kt b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoModuleProviderTest.kt index b50a23eca1..6fbf45aa08 100644 --- a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoModuleProviderTest.kt +++ b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoModuleProviderTest.kt @@ -24,6 +24,7 @@ class KoImportAliasForKoModuleProviderTest { .properties() .first { it.name == "appPropertyWithImportAliasType" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -43,6 +44,7 @@ class KoImportAliasForKoModuleProviderTest { .properties() .first { it.name == "libPropertyWithImportAliasType" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -62,6 +64,7 @@ class KoImportAliasForKoModuleProviderTest { .properties() .first { it.name == "rootPropertyWithImportAliasType" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoSourceSetProviderTest.kt b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoSourceSetProviderTest.kt index 8b9639077b..40c6fc73f5 100644 --- a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoSourceSetProviderTest.kt +++ b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/koimportalias/KoImportAliasForKoSourceSetProviderTest.kt @@ -22,6 +22,7 @@ class KoImportAliasForKoSourceSetProviderTest { .properties() .first { it.name == "appPropertyWithImportAliasType" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -41,6 +42,7 @@ class KoImportAliasForKoSourceSetProviderTest { .properties() .first { it.name == "appPropertyWithImportAliasTypeTest" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -60,6 +62,7 @@ class KoImportAliasForKoSourceSetProviderTest { .properties() .first { it.name == "libPropertyWithImportAliasType" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -79,6 +82,7 @@ class KoImportAliasForKoSourceSetProviderTest { .properties() .first { it.name == "libPropertyWithImportAliasTypeTest" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -98,6 +102,7 @@ class KoImportAliasForKoSourceSetProviderTest { .properties() .first { it.name == "rootPropertyWithImportAliasType" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then @@ -117,6 +122,7 @@ class KoImportAliasForKoSourceSetProviderTest { .properties() .first { it.name == "rootSrcPropertyWithImportAliasType" } .type + ?.sourceDeclaration ?.asImportAliasDeclaration() // then diff --git a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotype/KoTypeForKoTypeDeclarationProviderTest.kt b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotype/KoTypeForKoTypeDeclarationProviderTest.kt index 61b536e8cc..9cda37628d 100644 --- a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotype/KoTypeForKoTypeDeclarationProviderTest.kt +++ b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotype/KoTypeForKoTypeDeclarationProviderTest.kt @@ -216,7 +216,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.ClassType") @@ -240,7 +241,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.ClassType") @@ -265,7 +267,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.InterfaceType") @@ -289,7 +292,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.InterfaceType") @@ -314,7 +318,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.ObjectType") @@ -338,7 +343,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.ObjectType") @@ -363,7 +369,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.TypeAliasType") @@ -387,7 +394,8 @@ class KoTypeForKoTypeDeclarationProviderTest { // then assertSoftly(sut) { sourceDeclaration shouldBeInstanceOf KoImportAliasDeclaration::class - asImportAliasDeclaration() + sourceDeclaration + ?.asImportAliasDeclaration() ?.importDirective ?.name .shouldBeEqualTo("com.lemonappdev.fixture.fortypetest.importaliascase.declarations.TypeAliasType") diff --git a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoModuleProviderTest.kt b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoModuleProviderTest.kt index d2633c470a..493131cdae 100644 --- a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoModuleProviderTest.kt +++ b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoModuleProviderTest.kt @@ -23,6 +23,7 @@ class KoTypeParameterForKoModuleProviderTest { .properties() .first { it.name == "appPropertyWithTypeParameter" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -42,6 +43,7 @@ class KoTypeParameterForKoModuleProviderTest { .properties() .first { it.name == "libPropertyWithTypeParameter" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -61,6 +63,7 @@ class KoTypeParameterForKoModuleProviderTest { .properties() .first { it.name == "rootPropertyWithTypeParameter" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then diff --git a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoSourceSetProviderTest.kt b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoSourceSetProviderTest.kt index 780dd21c90..a5f7e81b7a 100644 --- a/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoSourceSetProviderTest.kt +++ b/misc/projects/test-projects/konsist-declaration-tester/app/src/integrationTest/kotlin/com/lemonappdev/konsist/declaration/type/kotypeparameter/KoTypeParameterForKoSourceSetProviderTest.kt @@ -21,6 +21,7 @@ class KoTypeParameterForKoSourceSetProviderTest { .properties() .first { it.name == "appPropertyWithTypeParameter" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -40,6 +41,7 @@ class KoTypeParameterForKoSourceSetProviderTest { .properties() .first { it.name == "appPropertyWithTypeParameterTest" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -59,6 +61,7 @@ class KoTypeParameterForKoSourceSetProviderTest { .properties() .first { it.name == "libPropertyWithTypeParameter" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -78,6 +81,7 @@ class KoTypeParameterForKoSourceSetProviderTest { .properties() .first { it.name == "libPropertyWithTypeParameterTest" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -97,6 +101,7 @@ class KoTypeParameterForKoSourceSetProviderTest { .properties() .first { it.name == "rootPropertyWithTypeParameter" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then @@ -116,6 +121,7 @@ class KoTypeParameterForKoSourceSetProviderTest { .properties() .first { it.name == "rootSrcPropertyWithTypeParameter" } .type + ?.sourceDeclaration ?.asTypeParameterDeclaration() // then