[Analysis API] fix "Cannot compute containing PSI for unknown source kind 'org.jetbrains.kotlin.KtFakeSourceElementKind$DefaultAccessor'" exception on getContainingSymbol call for default setter parameter
^KT-64825 fixed
This commit is contained in:
committed by
Space Team
parent
de4953adf6
commit
d5b59c48c2
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.components.containingDeclarationProvider
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtPropertySymbol
|
||||
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiSingleFileTest
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.expressionMarkerProvider
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.assertions
|
||||
|
||||
abstract class AbstractContainingDeclarationProviderForSetterParameterTest : AbstractAnalysisApiSingleFileTest() {
|
||||
override fun doTestByFileStructure(ktFile: KtFile, module: TestModule, testServices: TestServices) {
|
||||
val context = testServices.expressionMarkerProvider.getElementOfTypeAtCaret<KtProperty>(ktFile)
|
||||
|
||||
analyseForTest(context) { declaration ->
|
||||
val propertySymbol = (declaration as KtProperty).getVariableSymbol() as KtPropertySymbol
|
||||
val setterSymbol = propertySymbol.setter!!
|
||||
val setterParameterSymbol = setterSymbol.valueParameters.single()
|
||||
testServices.assertions.assertEquals(propertySymbol, setterSymbol.getContainingSymbol())
|
||||
testServices.assertions.assertEquals(setterSymbol, setterParameterSymbol.getContainingSymbol())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user