[AA] check symbol pointer restoring without psi anchor

^KT-54311
This commit is contained in:
Dmitrii Gridin
2022-10-20 12:01:10 +02:00
committed by Space Team
parent 636024f676
commit 4bd604f2ed
64 changed files with 177 additions and 19 deletions
@@ -46,8 +46,10 @@ internal class KtFe10DescSyntheticFieldSymbol(
override fun createPointer(): KtSymbolPointer<KtVariableLikeSymbol> = withValidityAssertion { override fun createPointer(): KtSymbolPointer<KtVariableLikeSymbol> = withValidityAssertion {
val accessorPsi = descriptor.containingDeclaration.toSourceElement.getPsi() val accessorPsi = descriptor.containingDeclaration.toSourceElement.getPsi()
if (accessorPsi is KtPropertyAccessor) { if (accessorPsi is KtPropertyAccessor) {
val accessorPointer = KtPsiBasedSymbolPointer<KtPropertyAccessorSymbol>(accessorPsi.createSmartPointer()) val accessorPointer = KtPsiBasedSymbolPointer.createForSymbolFromPsi<KtPropertyAccessorSymbol>(accessorPsi)
return KtFe10DescSyntheticFieldSymbolPointer(accessorPointer) if (accessorPointer != null) {
return KtFe10DescSyntheticFieldSymbolPointer(accessorPointer)
}
} }
return KtFe10NeverRestoringSymbolPointer() return KtFe10NeverRestoringSymbolPointer()
@@ -7,11 +7,15 @@ package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.components.KtDeclarationRendererOptions import org.jetbrains.kotlin.analysis.api.components.KtDeclarationRendererOptions
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K2
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_SYMBOL_RESTORE import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_SYMBOL_RESTORE
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_SYMBOL_RESTORE_K1 import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_SYMBOL_RESTORE_K1
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_SYMBOL_RESTORE_K2 import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.DO_NOT_CHECK_SYMBOL_RESTORE_K2
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.PRETTY_RENDERING_MODE import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.SymbolTestDirectives.PRETTY_RENDERING_MODE
import org.jetbrains.kotlin.analysis.api.symbols.* import org.jetbrains.kotlin.analysis.api.symbols.*
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtPsiBasedSymbolPointer
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiSingleFileTest import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiSingleFileTest
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
@@ -20,7 +24,9 @@ import org.jetbrains.kotlin.analysis.utils.printer.prettyPrint
import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.model.Directive import org.jetbrains.kotlin.test.directives.model.Directive
import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
import org.jetbrains.kotlin.test.model.TestModule import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions import org.jetbrains.kotlin.test.services.assertions
@@ -42,19 +48,32 @@ abstract class AbstractSymbolTest : AbstractAnalysisApiSingleFileTest() {
override fun doTestByFileStructure(ktFile: KtFile, module: TestModule, testServices: TestServices) { override fun doTestByFileStructure(ktFile: KtFile, module: TestModule, testServices: TestServices) {
val directives = module.directives val directives = module.directives
val directiveToIgnore = DO_NOT_CHECK_SYMBOL_RESTORE.takeIf { it in directives } val directiveToIgnoreSymbolRestore = directives.doNotCheckSymbolRestoreDirective()
?: DO_NOT_CHECK_SYMBOL_RESTORE_K1.takeIf { configurator.frontendKind == FrontendKind.Fe10 && it in directives } val directiveToIgnoreNonPsiSymbolRestore = directives.doNotCheckNonPsiSymbolRestoreDirective()
?: DO_NOT_CHECK_SYMBOL_RESTORE_K2.takeIf { configurator.frontendKind == FrontendKind.Fir && it in directives }
val renderMode = directives[PRETTY_RENDERING_MODE].singleOrNull() val prettyRenderOptions = when (directives.singleOrZeroValue(PRETTY_RENDERING_MODE) ?: prettyRenderMode) {
val prettyRenderOptions = when (renderMode ?: prettyRenderMode) {
PrettyRenderingMode.RENDER_SYMBOLS_LINE_BY_LINE -> renderingOptions PrettyRenderingMode.RENDER_SYMBOLS_LINE_BY_LINE -> renderingOptions
PrettyRenderingMode.RENDER_SYMBOLS_NESTED -> renderingOptions.copy(renderClassMembers = true) PrettyRenderingMode.RENDER_SYMBOLS_NESTED -> renderingOptions.copy(renderClassMembers = true)
} }
fun KtSymbol.safePointer(): KtSymbolPointer<KtSymbol>? { fun KtSymbol.safePointer(): PointerWrapper? {
val result = kotlin.runCatching { createPointer() } val regularPointer = runCatching(::createPointer).let {
return if (directiveToIgnore == null) result.getOrThrow() else result.getOrNull() if (directiveToIgnoreSymbolRestore == null) it.getOrThrow() else it.getOrNull()
} ?: return null
val nonPsiPointer = kotlin.runCatching {
if (this is KtFileSymbol) return@runCatching null
KtPsiBasedSymbolPointer.withDisabledPsiBasedPointers(::createPointer)
}
return PointerWrapper(
regularPointer = regularPointer,
pointerWithoutPsiAnchor = if (directiveToIgnoreSymbolRestore == null && directiveToIgnoreNonPsiSymbolRestore == null)
nonPsiPointer.getOrThrow()
else
nonPsiPointer.getOrNull(),
)
} }
val pointersWithRendered = executeOnPooledThreadInReadAction { val pointersWithRendered = executeOnPooledThreadInReadAction {
@@ -93,9 +112,45 @@ abstract class AbstractSymbolTest : AbstractAnalysisApiSingleFileTest() {
configurator.doOutOfBlockModification(ktFile) configurator.doOutOfBlockModification(ktFile)
restoreSymbolsInOtherReadActionAndCompareResults(directiveToIgnore, ktFile, pointersWithRendered.pointers, testServices) restoreSymbolsInOtherReadActionAndCompareResults(
directiveToIgnore = directiveToIgnoreSymbolRestore,
pointerAccessor = PointerWrapper::regularPointer,
ktFile = ktFile,
pointersWithRendered = pointersWithRendered.pointers,
testServices = testServices,
)
if (directiveToIgnoreSymbolRestore == null) {
restoreSymbolsInOtherReadActionAndCompareResults(
directiveToIgnore = directiveToIgnoreNonPsiSymbolRestore,
pointerAccessor = PointerWrapper::pointerWithoutPsiAnchor,
ktFile = ktFile,
pointersWithRendered = pointersWithRendered.pointers,
testServices = testServices,
)
}
} }
private fun RegisteredDirectives.doNotCheckSymbolRestoreDirective(): Directive? = findSpecificDirective(
commonDirective = DO_NOT_CHECK_SYMBOL_RESTORE,
k1Directive = DO_NOT_CHECK_SYMBOL_RESTORE_K1,
k2Directive = DO_NOT_CHECK_SYMBOL_RESTORE_K2,
)
private fun RegisteredDirectives.doNotCheckNonPsiSymbolRestoreDirective(): Directive? = findSpecificDirective(
commonDirective = DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE,
k1Directive = DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1,
k2Directive = DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K2,
)
private fun RegisteredDirectives.findSpecificDirective(
commonDirective: Directive,
k1Directive: Directive,
k2Directive: Directive,
): Directive? = commonDirective.takeIf { it in this }
?: k1Directive.takeIf { configurator.frontendKind == FrontendKind.Fe10 && it in this }
?: k2Directive.takeIf { configurator.frontendKind == FrontendKind.Fir && it in this }
private fun compareResults( private fun compareResults(
data: SymbolPointersData, data: SymbolPointersData,
testServices: TestServices, testServices: TestServices,
@@ -116,6 +171,7 @@ abstract class AbstractSymbolTest : AbstractAnalysisApiSingleFileTest() {
private fun restoreSymbolsInOtherReadActionAndCompareResults( private fun restoreSymbolsInOtherReadActionAndCompareResults(
directiveToIgnore: Directive?, directiveToIgnore: Directive?,
pointerAccessor: (PointerWrapper) -> KtSymbolPointer<KtSymbol>?,
ktFile: KtFile, ktFile: KtFile,
pointersWithRendered: List<PointerWithRenderedSymbol>, pointersWithRendered: List<PointerWithRenderedSymbol>,
testServices: TestServices, testServices: TestServices,
@@ -123,12 +179,13 @@ abstract class AbstractSymbolTest : AbstractAnalysisApiSingleFileTest() {
var failed = false var failed = false
try { try {
val restored = analyseForTest(ktFile) { val restored = analyseForTest(ktFile) {
pointersWithRendered.map { (pointer, expectedRender) -> pointersWithRendered.map { (pointerWrapper, expectedRender) ->
val restored = pointer!!.restoreSymbol() ?: error("Symbol $expectedRender was not restored") val pointer = pointerWrapper?.let(pointerAccessor) ?: error("Symbol pointer for $expectedRender was not created")
val restored = pointer.restoreSymbol() ?: error("Symbol $expectedRender was not restored")
renderSymbolForComparison(restored) renderSymbolForComparison(restored)
} }
} }
val actual = restored.renderAsDeclarations() val actual = restored.renderAsDeclarations()
testServices.assertions.assertEqualsToTestDataFileSibling(actual) testServices.assertions.assertEqualsToTestDataFileSibling(actual)
} catch (e: Throwable) { } catch (e: Throwable) {
@@ -164,6 +221,18 @@ object SymbolTestDirectives : SimpleDirectivesContainer() {
description = "Symbol restoring for some symbols in current test is not supported yet in K2", description = "Symbol restoring for some symbols in current test is not supported yet in K2",
) )
val DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE by directive(
description = "Symbol restoring w/o psi for some symbols in current test is not supported yet",
)
val DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1 by directive(
description = "Symbol restoring w/o psi for some symbols in current test is not supported yet in K1",
)
val DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K2 by directive(
description = "Symbol restoring w/o psi for some symbols in current test is not supported yet in K2",
)
val PRETTY_RENDERING_MODE by enumDirective(description = "Explicit rendering mode") { PrettyRenderingMode.valueOf(it) } val PRETTY_RENDERING_MODE by enumDirective(description = "Explicit rendering mode") { PrettyRenderingMode.valueOf(it) }
} }
@@ -183,6 +252,11 @@ private data class SymbolPointersData(
) )
private data class PointerWithRenderedSymbol( private data class PointerWithRenderedSymbol(
val pointer: KtSymbolPointer<*>?, val pointer: PointerWrapper?,
val rendered: String, val rendered: String,
) )
private data class PointerWrapper(
val regularPointer: KtSymbolPointer<*>,
val pointerWithoutPsiAnchor: KtSymbolPointer<*>?,
)
@@ -1,11 +1,12 @@
/* /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * 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. * 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.symbols.pointers package org.jetbrains.kotlin.analysis.api.symbols.pointers
import com.intellij.psi.SmartPsiElementPointer import com.intellij.psi.SmartPsiElementPointer
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbolOrigin import org.jetbrains.kotlin.analysis.api.symbols.KtSymbolOrigin
@@ -15,7 +16,7 @@ import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtObjectLiteralExpression import org.jetbrains.kotlin.psi.KtObjectLiteralExpression
import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
public class KtPsiBasedSymbolPointer<S : KtSymbol>(private val psiPointer: SmartPsiElementPointer<out KtElement>) : public class KtPsiBasedSymbolPointer<S : KtSymbol> private constructor(private val psiPointer: SmartPsiElementPointer<out KtElement>) :
KtSymbolPointer<S>() { KtSymbolPointer<S>() {
@Deprecated("Consider using org.jetbrains.kotlin.analysis.api.KtAnalysisSession.restoreSymbol") @Deprecated("Consider using org.jetbrains.kotlin.analysis.api.KtAnalysisSession.restoreSymbol")
override fun restoreSymbol(analysisSession: KtAnalysisSession): S? { override fun restoreSymbol(analysisSession: KtAnalysisSession): S? {
@@ -35,7 +36,7 @@ public class KtPsiBasedSymbolPointer<S : KtSymbol>(private val psiPointer: Smart
public companion object { public companion object {
public fun <S : KtSymbol> createForSymbolFromSource(symbol: S): KtPsiBasedSymbolPointer<S>? { public fun <S : KtSymbol> createForSymbolFromSource(symbol: S): KtPsiBasedSymbolPointer<S>? {
if (symbol.origin != KtSymbolOrigin.SOURCE) return null if (disablePsiPointer || symbol.origin != KtSymbolOrigin.SOURCE) return null
val psi = when (val psi = symbol.psi) { val psi = when (val psi = symbol.psi) {
is KtDeclaration -> psi is KtDeclaration -> psi
@@ -46,5 +47,25 @@ public class KtPsiBasedSymbolPointer<S : KtSymbol>(private val psiPointer: Smart
return KtPsiBasedSymbolPointer(psi.createSmartPointer()) return KtPsiBasedSymbolPointer(psi.createSmartPointer())
} }
public fun <S : KtSymbol> createForSymbolFromPsi(ktElement: KtElement): KtPsiBasedSymbolPointer<S>? {
if (disablePsiPointer) return null
return KtPsiBasedSymbolPointer(ktElement.createSmartPointer())
}
@TestOnly
@Synchronized
public fun <T> withDisabledPsiBasedPointers(action: () -> T): T {
disablePsiPointer = true
return try {
action()
} finally {
disablePsiPointer = false
}
}
@Volatile
private var disablePsiPointer: Boolean = false
} }
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
package test package test
enum class E { enum class E {
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
package test package test
class Foo class Foo
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
package test package test
class Foo class Foo
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
package test package test
class SomeClass1 class SomeClass1
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// DO_NOT_CHECK_SYMBOL_RESTORE // DO_NOT_CHECK_SYMBOL_RESTORE
package test package test
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// DO_NOT_CHECK_SYMBOL_RESTORE // DO_NOT_CHECK_SYMBOL_RESTORE
package test package test
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
package test package test
class SomeClass class SomeClass
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
package test package test
class SomeClass class SomeClass
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
package test package test
interface ClassA interface ClassA
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
private val _commonSettingsLazy: A = null = ob<caret>ject : A<Int> { private val _commonSettingsLazy: A = null = ob<caret>ject : A<Int> {
override fun x() {} override fun x() {}
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
private val commonSettingsLazy = o<caret>bject A<LanguageVersionSettings> { private val commonSettingsLazy = o<caret>bject A<LanguageVersionSettings> {
println(x) println(x)
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
annotation class ReceiverAnnotation annotation class ReceiverAnnotation
@Target(AnnotationTarget.TYPE) @Target(AnnotationTarget.TYPE)
annotation class ReceiverTypeAnnotation annotation class ReceiverTypeAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
annotation class PropertyAnnotation annotation class PropertyAnnotation
annotation class FieldAnnotation annotation class FieldAnnotation
annotation class GetAnnotation annotation class GetAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
annotation class PropertyAnnotation annotation class PropertyAnnotation
annotation class GetAnnotation annotation class GetAnnotation
annotation class ExplicitGetAnnotation annotation class ExplicitGetAnnotation
@@ -9,4 +10,4 @@ annotation class ReceiverTypeAnnotation
@property:PropertyAnnotation @property:PropertyAnnotation
@get:GetAnnotation @get:GetAnnotation
val @receiver:ReceiverAnnotation @ReceiverTypeAnnotation Long.x: Int val @receiver:ReceiverAnnotation @ReceiverTypeAnnotation Long.x: Int
@ExplicitGetAnnotation ge<caret>t() = 1 @ExplicitGetAnnotation ge<caret>t() = 1
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// WITH_STDLIB // WITH_STDLIB
annotation class PropertyAnnotation annotation class PropertyAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// PRETTY_RENDERING_MODE: RENDER_SYMBOLS_NESTED // PRETTY_RENDERING_MODE: RENDER_SYMBOLS_NESTED
annotation class PropertyAnnotation annotation class PropertyAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// WITH_STDLIB // WITH_STDLIB
annotation class PropertyAnnotation annotation class PropertyAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
annotation class ReceiverAnnotation annotation class ReceiverAnnotation
@Target(AnnotationTarget.TYPE) @Target(AnnotationTarget.TYPE)
annotation class ReceiverTypeAnnotation annotation class ReceiverTypeAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
annotation class PropertyAnnotation annotation class PropertyAnnotation
annotation class FieldAnnotation annotation class FieldAnnotation
annotation class GetAnnotation annotation class GetAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
annotation class Anno(val param1: String, val param2: Int) annotation class Anno(val param1: String, val param2: Int)
@Anno(param1 = "param", 2) @Anno(param1 = "param", 2)
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
class AnonymousContainer { class AnonymousContainer {
val anonymousObject = object : Runnable { val anonymousObject = object : Runnable {
override fun run() { override fun run() {
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
var p: Int var p: Int
get() = field get() = field
set(value) { set(value) {
@@ -1,2 +1,3 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
class A { class A {
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
class A { class A {
val i: Int val i: Int
init { init {
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
class A { class A {
val a: Int = 10 val a: Int = 10
fun x() = 10 fun x() = 10
@@ -1,2 +1,3 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
class A(val a: Int, b: String) { class A(val a: Int, b: String) {
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
class A() { class A() {
constructor(x: Int): this() constructor(x: Int): this()
constructor(y: Int, z: String) : this(y) constructor(y: Int, z: String) : this(y)
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
import org.jetbrains.annotations.NotNull import org.jetbrains.annotations.NotNull
class A<@NotNull T, R> { class A<@NotNull T, R> {
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
context(kotlin.Int, s@kotlin.String) context(kotlin.Int, s@kotlin.String)
class A { class A {
constructor(int: Int) {} constructor(int: Int) {}
@@ -1,2 +1,3 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
context(Int, s@String) context(Int, s@String)
fun y(){} fun y(){}
@@ -1,2 +1,3 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
context(Int, s@String) context(Int, s@String)
val y get() = 10 val y get() = 10
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// WITH_STDLIB // WITH_STDLIB
class MyColor(val x: Int, val y: Int, val z: Int) class MyColor(val x: Int, val y: Int, val z: Int)
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// WITH_STDLIB // WITH_STDLIB
@Deprecated("don't use i") @Deprecated("don't use i")
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
data class P(val x: Int, val y: Int) data class P(val x: Int, val y: Int)
fun destruct(): Int { fun destruct(): Int {
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
class Foo { class Foo {
val p : dynamic = null val p : dynamic = null
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
enum class X { enum class X {
Y, Z; Y, Z;
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
enum class Style(val value: String) { enum class Style(val value: String) {
SHEET("foo") { SHEET("foo") {
override val exitAnimation: String override val exitAnimation: String
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
var p: Int var p: Int
field = "test" field = "test"
get() = field.length get() = field.length
@@ -1 +1,2 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
fun String.foo(): Int = 10 fun String.foo(): Int = 10
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
fun usage() { fun usage() {
for (loopVariable in 1..10) {} for (loopVariable in 1..10) {}
} }
@@ -1 +1,2 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
fun foo(x: Int) {} fun foo(x: Int) {}
@@ -1 +1,2 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
fun <X> foo(x: X) {} fun <X> foo(x: X) {}
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
class A { class A {
constructor(i: Int) constructor(i: Int)
} }
@@ -1 +1,2 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
fun foo(): Int = 10 fun foo(): Int = 10
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
fun foo() { fun foo() {
val lam1 = { a: Int -> val lam1 = { a: Int ->
val b = 1 val b = 1
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// WITH_STDLIB // WITH_STDLIB
@JvmField @JvmField
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
// WITH_STDLIB // WITH_STDLIB
class Foo { class Foo {
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
fun yyy() { fun yyy() {
val q = 10 val q = 10
fun aaa() {} fun aaa() {}
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
class A { class A {
fun x(): Int fun x(): Int
fun y() fun y()
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
class A { class A {
val x: Int = 10 val x: Int = 10
val Int.y get() = this val Int.y get() = this
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
class X<T> { class X<T> {
inner class Y<T1> inner class Y<T1>
class Z<T2> class Z<T2>
@@ -1,2 +1,3 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
fun x(): Int = 10 fun x(): Int = 10
fun y() {} fun y() {}
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
val x: Int = 10 val x: Int = 10
val Int.y get() = this val Int.y get() = this
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
class X<T> class X<T>
private typealias Y<Z> = X<Z> private typealias Y<Z> = X<Z>
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
@Target(AnnotationTarget.TYPE) @Target(AnnotationTarget.TYPE)
annotation class Anno1 annotation class Anno1
@Target(AnnotationTarget.TYPE) @Target(AnnotationTarget.TYPE)
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
inline fun foo( inline fun foo(
inlineParameter: () -> Int, inlineParameter: () -> Int,
crossinline crossinlineParameter: () -> Int, crossinline crossinlineParameter: () -> Int,
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE_K1
fun primitive(vararg a: Int) fun primitive(vararg a: Int)
fun nullablePrimitive(vararg b: Float?) fun nullablePrimitive(vararg b: Float?)
fun nonPrimitive(vararg c: Any) fun nonPrimitive(vararg c: Any)
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
annotation class PropertyAnnotation annotation class PropertyAnnotation
annotation class FieldAnnotation annotation class FieldAnnotation
annotation class GetAnnotation annotation class GetAnnotation
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
inline fun <T, R> T.use(block: (T) -> R): R { inline fun <T, R> T.use(block: (T) -> R): R {
return block(this) return block(this)
} }
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
// IGNORE_FE10 // IGNORE_FE10
package test package test
@@ -1,3 +1,4 @@
// DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE
annotation class ReceiverAnnotation annotation class ReceiverAnnotation
@Target(AnnotationTarget.TYPE) @Target(AnnotationTarget.TYPE)
annotation class ReceiverTypeAnnotation annotation class ReceiverTypeAnnotation