AA: introduce KtDynamicType
This commit is contained in:
committed by
Ilya Kirillov
parent
e81231a78f
commit
2d52c59bc7
+1
@@ -232,6 +232,7 @@ private fun <T : CallableDescriptor> T.unwrapUseSiteSubstitutionOverride(): T {
|
||||
|
||||
internal fun KotlinType.toKtType(analysisContext: Fe10AnalysisContext): KtType {
|
||||
return when (val unwrappedType = unwrap()) {
|
||||
is DynamicType -> KtFe10DynamicType(unwrappedType, analysisContext)
|
||||
is FlexibleType -> KtFe10FlexibleType(unwrappedType, analysisContext)
|
||||
is DefinitelyNotNullType -> KtFe10DefinitelyNotNullType(unwrappedType, analysisContext)
|
||||
is ErrorType -> KtFe10ClassErrorType(unwrappedType, analysisContext)
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.types
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.ktNullability
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.asStringForDebugging
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtDynamicType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtTypeNullability
|
||||
import org.jetbrains.kotlin.types.DynamicType
|
||||
|
||||
internal class KtFe10DynamicType(
|
||||
override val type: DynamicType,
|
||||
override val analysisContext: Fe10AnalysisContext
|
||||
) : KtDynamicType(), KtFe10Type {
|
||||
override fun asStringForDebugging(): String = withValidityAssertion { type.asStringForDebugging() }
|
||||
|
||||
override val nullability: KtTypeNullability
|
||||
get() = withValidityAssertion { type.ktNullability }
|
||||
}
|
||||
+6
@@ -112,6 +112,12 @@ public class Fe10IdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated extends A
|
||||
runTest("analysis/analysis-api/testData/symbols/symbolByPsi/deprecated.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dynamic.kt")
|
||||
public void testDynamic() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/symbols/symbolByPsi/dynamic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user