Skip to content

Commit

Permalink
Unmutes more single module tests for analysis API.
Browse files Browse the repository at this point in the history
* fixed rendering logic for error types and flexible types.
* fixed origin for kotlin synthetic property accessors.
* unmuted implicitElements implicitPropertyAccessors javaTypes makeNullable parameterTypes tests.
  • Loading branch information
neetopia committed Sep 15, 2022
1 parent d6c8ab9 commit 0e5a63d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ object KSErrorType : KSType {
override val isFunctionType: Boolean = false

override val isSuspendFunctionType: Boolean = false

override fun toString(): String {
return "<ERROR TYPE>"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ abstract class KSPropertyAccessorImpl(
}

override val origin: Origin by lazy {
mapAAOrigin(ktPropertyAccessorSymbol.origin)
val symbolOrigin = mapAAOrigin(ktPropertyAccessorSymbol.origin)
if (symbolOrigin == Origin.KOTLIN && ktPropertyAccessorSymbol.psi == null) {
Origin.SYNTHETIC
} else {
symbolOrigin
}
}

override val parent: KSNode?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ internal fun KtType.render(): String {
}
}
} else ""
is KtClassErrorType -> "<error>"
is KtClassErrorType -> "<ERROR TYPE>"
is KtCapturedType -> asStringForDebugging()
is KtDefinitelyNotNullType -> original.render() + "!"
is KtDynamicType -> "<dynamic type>"
is KtFlexibleType -> "${lowerBound.render()}...${upperBound.render()}"
is KtFlexibleType -> "(${lowerBound.render()}..${upperBound.render()})"
is KtIntegerLiteralType -> "ILT: $value"
is KtIntersectionType ->
this.conjuncts.joinToString(separator = " & ", prefix = "(", postfix = ")") { it.render() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,12 @@ class KSPAATest : AbstractKSPAATest() {
runTest("../test-utils/testData/api/hello.kt")
}

@Disabled
@TestMetadata("implicitElements.kt")
@Test
fun testImplicitElements() {
runTest("../test-utils/testData/api/implicitElements.kt")
}

@Disabled
@TestMetadata("implicitPropertyAccessors.kt")
@Test
fun testImplicitPropertyAccessors() {
Expand Down Expand Up @@ -344,7 +342,6 @@ class KSPAATest : AbstractKSPAATest() {
runTest("../test-utils/testData/api/javaToKotlinMapper.kt")
}

@Disabled
@TestMetadata("javaTypes.kt")
@Test
fun testJavaTypes() {
Expand Down Expand Up @@ -379,7 +376,6 @@ class KSPAATest : AbstractKSPAATest() {
runTest("../test-utils/testData/api/libOrigins.kt")
}

@Disabled
@TestMetadata("makeNullable.kt")
@Test
fun testMakeNullable() {
Expand Down Expand Up @@ -419,7 +415,6 @@ class KSPAATest : AbstractKSPAATest() {
runTest("../test-utils/testData/api/overridee.kt")
}

@Disabled
@TestMetadata("parameterTypes.kt")
@Test
fun testParameterTypes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ParameterTypeProcessor : AbstractTestProcessor() {
val result = mutableListOf<String>()

override fun toResult(): List<String> {
return result
return result.sorted()
}

override fun process(resolver: Resolver): List<KSAnnotated> {
Expand All @@ -21,7 +21,7 @@ class ParameterTypeProcessor : AbstractTestProcessor() {
}

override fun visitValueParameter(valueParameter: KSValueParameter, data: Unit) {
result.add(valueParameter.type.resolve().toString())
result.add("${valueParameter.name?.asString()}: ${valueParameter.type.resolve()}")
}
},
Unit
Expand Down
16 changes: 8 additions & 8 deletions test-utils/testData/api/parameterTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@

// TEST PROCESSOR: ParameterTypeProcessor
// EXPECTED:
// <ERROR TYPE>
// String
// Int
// Int
// <ERROR TYPE>
// <ERROR TYPE>
// a: Int
// b: <ERROR TYPE>
// c: <ERROR TYPE>
// errorValue: <ERROR TYPE>
// v: String
// value: Int
// END

class Foo {
var a: ErrorType
set(value) {
a = value
set(errorValue) {
a = errorValue
}
var x
get() = "OK"
Expand Down

0 comments on commit 0e5a63d

Please sign in to comment.