From d0c78e51165e97327664e82a9ed784b669c65846 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 22 Jan 2024 11:24:48 +0100 Subject: [PATCH] K2/tests: add /* hidden ... */ rendering to scope dumper --- .../weirdCharBuffers.overrides.txt | 12 ++++++------ .../frontend/fir/handlers/FirScopeDumpHandler.kt | 7 +++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/testData/diagnostics/tests/j+k/collectionOverrides/weirdCharBuffers.overrides.txt b/compiler/testData/diagnostics/tests/j+k/collectionOverrides/weirdCharBuffers.overrides.txt index cc2646d60a8..446384bd5d0 100644 --- a/compiler/testData/diagnostics/tests/j+k/collectionOverrides/weirdCharBuffers.overrides.txt +++ b/compiler/testData/diagnostics/tests/j+k/collectionOverrides/weirdCharBuffers.overrides.txt @@ -1,12 +1,12 @@ CharBuffer: [Enhancement]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBuffer [id: 0] - [Enhancement]: public final operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBuffer [id: 0] + [Enhancement]: /* hidden due to clash */ public final operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBuffer [id: 0] [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1] CharBufferX: [Enhancement]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferX [id: 0] [Enhancement]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /X [id: 1] - [Enhancement]: public final operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferX [id: 0] + [Enhancement]: /* hidden due to clash */ public final operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferX [id: 0] [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1] NonCharSequenceBuffer: @@ -16,23 +16,23 @@ NonCharSequenceBuffer: NonCharBuffer: [Enhancement]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /NonCharBuffer [id: 0] - [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /NonCharBuffer [id: 0] + [Library]: /* hidden due to clash */ public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /NonCharBuffer [id: 0] [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1] CharBufferXAllInherited: - [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXAllInherited [id: 0] + [Library]: /* hidden due to clash */ public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXAllInherited [id: 0] [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1] [Enhancement]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXAllInherited [id: 0] CharBufferXYAllInherited: - [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXYAllInherited [id: 0] + [Library]: /* hidden due to clash */ public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXYAllInherited [id: 0] [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1] [IntersectionOverride]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXYAllInherited [id: 0] [Enhancement]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /X [id: 1] [Enhancement]: protected/*protected and package*/ abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /Y [id: 2] CharBufferXYCharAt: - [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXYCharAt [id: 0] + [Library]: /* hidden due to clash */ public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXYCharAt [id: 0] [Library]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Use site scope of kotlin/CharSequence [id: 1] [RenamedForOverride]: public abstract fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharAt [id: 2] [IntersectionOverride]: public abstract operator fun get(index: R|kotlin/Int|): R|kotlin/Char| from Java enhancement scope for /CharBufferXYCharAt [id: 0] diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirScopeDumpHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirScopeDumpHandler.kt index faa91f90283..f282d864344 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirScopeDumpHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirScopeDumpHandler.kt @@ -9,6 +9,8 @@ import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.isHiddenEverywhereBesideSuperCalls +import org.jetbrains.kotlin.fir.declarations.isHiddenToOvercomeSignatureClash import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.renderer.FirRenderer import org.jetbrains.kotlin.fir.resolve.ScopeSession @@ -144,6 +146,11 @@ class FirScopeDumpHandler(testServices: TestServices) : FirAnalysisHandler(testS private fun SmartPrinter.printInfo(declaration: FirCallableDeclaration, scope: FirTypeScope, counter: SymbolCounter) { val origin = declaration.origin.takeUnless { it == FirDeclarationOrigin.BuiltIns } ?: FirDeclarationOrigin.Library print("[$origin]: ") + if (declaration.isHiddenEverywhereBesideSuperCalls == true) { + print("/* hidden beside supers */ ") + } else if (declaration.isHiddenToOvercomeSignatureClash == true) { + print("/* hidden due to clash */ ") + } val renderedDeclaration = FirRenderer.noAnnotationBodiesAccessorAndArguments().renderElementAsString(declaration).trim() print(renderedDeclaration) print(" from $scope")