[Analysis API FIR] fix "ConeClassLikeTypeImpl is not resolved to symbol for on-error type"
We should not expect builtins to be always available as they are taken from indecies. For K1 and FIR Standalone implementations, the builtins are always available. ^KT-62010 fixed
This commit is contained in:
committed by
Space Team
parent
f5d859f209
commit
1aa5cf031f
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.impl.base.test.cases.types
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtType
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
|
||||
import org.jetbrains.kotlin.test.directives.model.singleValue
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import java.util.Locale
|
||||
|
||||
abstract class AbstractBuiltInTypeTest : AbstractTypeTest() {
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder) {
|
||||
super.configureTest(builder)
|
||||
builder.apply {
|
||||
useDirectives(Directives)
|
||||
}
|
||||
}
|
||||
|
||||
context(KtAnalysisSession)
|
||||
override fun getType(ktFile: KtFile, module: TestModule, testServices: TestServices): KtType {
|
||||
val builtInTypeName = module.directives.singleValue(Directives.BUILTIN_TYPE_NAME)
|
||||
val typeMethod = builtinTypes::class.java.methods.singleOrNull {
|
||||
it.name == "get${builtInTypeName.uppercase(Locale.US)}"
|
||||
}!!
|
||||
typeMethod.isAccessible = true
|
||||
return typeMethod.invoke(builtinTypes) as KtType
|
||||
}
|
||||
|
||||
object Directives : SimpleDirectivesContainer() {
|
||||
val BUILTIN_TYPE_NAME by stringDirective("name of built in type")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user