[kotlin] Restore dumbAware for K1

#KTIJ-25608
#KTIJ-27573 Fixed

GitOrigin-RevId: 98accc8ea98539b6091ad12e90da76b2569ed1f3
This commit is contained in:
Vladimir Dolzhenko
2023-11-01 22:18:38 +00:00
committed by intellij-monorepo-bot
parent 93eec7cce1
commit 4e3a3ce8e1
37 changed files with 249 additions and 42 deletions
@@ -17,9 +17,4 @@
<highlightUsagesHandlerFactory implementation="org.jetbrains.kotlin.idea.highlighting.KotlinHighlightExitPointsHandlerFactory"/>
</extensions>
<extensions defaultExtensionNs="org.jetbrains.kotlin">
<beforeResolveHighlightingVisitor implementation="org.jetbrains.kotlin.idea.highlighting.DeclarationHighlightingExtension"/>
<beforeResolveHighlightingVisitor implementation="org.jetbrains.kotlin.idea.highlighting.AnnotationsHighlightingExtension"/>
</extensions>
</idea-plugin>
@@ -140,6 +140,11 @@ public abstract class K2HighlightingMetaInfoTestGenerated extends AbstractK2High
runTest("../../idea/tests/testData/highlighterMetaInfo/Annotations.kt");
}
@TestMetadata("AnnotationsInDumbMode.kt")
public void testAnnotationsInDumbMode() throws Exception {
runTest("../../idea/tests/testData/highlighterMetaInfo/AnnotationsInDumbMode.kt");
}
@TestMetadata("AutoCreatedItParameter.kt")
public void testAutoCreatedItParameter() throws Exception {
runTest("../../idea/tests/testData/highlighterMetaInfo/AutoCreatedItParameter.kt");
@@ -240,6 +245,11 @@ public abstract class K2HighlightingMetaInfoTestGenerated extends AbstractK2High
runTest("../../idea/tests/testData/highlighterMetaInfo/PropertiesWithPropertyDeclarations.kt");
}
@TestMetadata("PropertiesWithPropertyDeclarationsInDumbMode.kt")
public void testPropertiesWithPropertyDeclarationsInDumbMode() throws Exception {
runTest("../../idea/tests/testData/highlighterMetaInfo/PropertiesWithPropertyDeclarationsInDumbMode.kt");
}
@TestMetadata("script.kts")
public void testScript() throws Exception {
runTest("../../idea/tests/testData/highlighterMetaInfo/script.kts");
@@ -21,4 +21,9 @@
<highlightVisitor implementation="org.jetbrains.kotlin.idea.highlighter.KotlinRainbowVisitor"/>
</extensions>
<extensions defaultExtensionNs="org.jetbrains.kotlin">
<beforeResolveHighlightingVisitor implementation="org.jetbrains.kotlin.idea.base.highlighting.beforeResolve.DeclarationHighlightingExtension"/>
<beforeResolveHighlightingVisitor implementation="org.jetbrains.kotlin.idea.base.highlighting.beforeResolve.AnnotationsHighlightingExtension"/>
</extensions>
</idea-plugin>
@@ -1,6 +1,6 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.highlighting
package org.jetbrains.kotlin.idea.base.highlighting.beforeResolve
import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder
import com.intellij.openapi.util.TextRange
@@ -15,11 +15,11 @@ internal class AnnotationEntryHighlightingVisitor(
holder: HighlightInfoHolder
) : AbstractHighlightingVisitor(holder) {
override fun visitAnnotationEntry(annotationEntry: KtAnnotationEntry) {
val range = annotationEntry.getTextRangeToHiglight() ?: return
val range = annotationEntry.getTextRangeToHighlight() ?: return
highlightName(annotationEntry.project, range, KotlinHighlightInfoTypeSemanticNames.ANNOTATION)
}
private fun KtAnnotationEntry.getTextRangeToHiglight(): TextRange? {
private fun KtAnnotationEntry.getTextRangeToHighlight(): TextRange? {
val atSymbol = atSymbol ?: return null
val typeReference = typeReference ?: return null
return TextRange(atSymbol.startOffset, typeReference.endOffset)
@@ -1,6 +1,6 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.highlighting
package org.jetbrains.kotlin.idea.base.highlighting.beforeResolve
import com.intellij.codeInsight.daemon.impl.analysis.HighlightInfoHolder
import com.intellij.psi.util.PsiUtilCore
@@ -136,5 +136,6 @@
<orderEntry type="module" module-name="kotlin.jvm-decompiler" scope="TEST" />
<orderEntry type="module" module-name="kotlin.highlighting.k1" scope="TEST" />
<orderEntry type="module" module-name="kotlin.refactorings.common.tests" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.analysis" scope="TEST" />
</component>
</module>
@@ -3,6 +3,7 @@
package org.jetbrains.kotlin.idea.codeMetaInfo
import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.openapi.application.ApplicationManager
@@ -10,6 +11,7 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.module.ModuleManager
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.VfsUtilCore
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiDocumentManager
@@ -21,6 +23,7 @@ import com.intellij.psi.impl.source.tree.TreeElement
import com.intellij.psi.impl.source.tree.TreeUtil
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.UsageSearchContext
import com.intellij.testFramework.DumbModeTestUtils
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
import com.intellij.testFramework.runInEdtAndWait
import com.intellij.util.LineSeparator
@@ -61,6 +64,7 @@ import kotlin.io.path.exists
class CodeMetaInfoTestCase(
val codeMetaInfoTypes: Collection<AbstractCodeMetaInfoRenderConfiguration>,
val checkNoDiagnosticError: Boolean = false,
val dumbMode: Boolean = false,
private val filterMetaInfo: (CodeMetaInfo) -> Boolean = { true },
) : DaemonAnalyzerTestCase() {
@@ -141,7 +145,7 @@ class CodeMetaInfoTestCase(
ApplicationManager.getApplication().runWriteAction { TreeUtil.clearCaches(myFile.node as TreeElement) }
//to initialize caches
if (!DumbService.isDumb(myProject)) {
if (!dumbMode && !DumbService.isDumb(myProject)) {
CacheManager.getInstance(myProject).getFilesWithWord(
"XXX",
UsageSearchContext.IN_COMMENTS,
@@ -150,20 +154,38 @@ class CodeMetaInfoTestCase(
)
}
for (configuration in codeMetaInfoTypes) {
when (configuration) {
is DiagnosticCodeMetaInfoRenderConfiguration -> {
codeMetaInfoForCheck.addAll(getDiagnosticCodeMetaInfos(configuration))
fun task() {
for (configuration in codeMetaInfoTypes) {
when (configuration) {
is DiagnosticCodeMetaInfoRenderConfiguration -> {
codeMetaInfoForCheck.addAll(getDiagnosticCodeMetaInfos(configuration))
}
is HighlightingConfiguration -> {
codeMetaInfoForCheck.addAll(getHighlightingCodeMetaInfos(configuration))
}
is LineMarkerConfiguration -> {
codeMetaInfoForCheck.addAll(getLineMarkerCodeMetaInfos(configuration))
}
else -> throw IllegalArgumentException("Unexpected code meta info configuration: $configuration")
}
is HighlightingConfiguration -> {
codeMetaInfoForCheck.addAll(getHighlightingCodeMetaInfos(configuration))
}
is LineMarkerConfiguration -> {
codeMetaInfoForCheck.addAll(getLineMarkerCodeMetaInfos(configuration))
}
else -> throw IllegalArgumentException("Unexpected code meta info configuration: $configuration")
}
}
if (dumbMode) {
val disposable = Disposer.newCheckedDisposable("mustWaitForSmartMode")
try {
(DaemonCodeAnalyzer.getInstance(project) as DaemonCodeAnalyzerImpl).mustWaitForSmartMode(false, disposable)
DumbModeTestUtils.runInDumbModeSynchronously(project) { task() }
} finally {
Disposer.dispose(disposable)
}
} else {
task()
}
if (codeMetaInfoTypes.any { it is DiagnosticCodeMetaInfoRenderConfiguration } &&
!codeMetaInfoTypes.any { it is HighlightingConfiguration }
) {
@@ -46,6 +46,7 @@ abstract class AbstractHighlightingMetaInfoTest : KotlinMultiFileLightCodeInsigh
allowErrorHighlighting = ALLOW_ERRORS in globalDirectives,
highlightWarnings = HIGHLIGHT_WARNINGS in globalDirectives,
),
dumbMode = DUMB_MODE in globalDirectives
)
codeMetaInfoTestCase.checkFile(file.virtualFile, expectedHighlightingFile, project)
@@ -114,5 +115,6 @@ abstract class AbstractHighlightingMetaInfoTest : KotlinMultiFileLightCodeInsigh
private const val HIGHLIGHT_WARNINGS = "HIGHLIGHT_WARNINGS"
private const val HIGHLIGHTER_ATTRIBUTES_KEY = "HIGHLIGHTER_ATTRIBUTES_KEY"
private const val CHECK_SYMBOL_NAMES = "CHECK_SYMBOL_NAMES"
private const val DUMB_MODE = "DUMB_MODE"
}
}
@@ -19,7 +19,6 @@ import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
import com.intellij.util.io.URLUtil
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import org.jetbrains.kotlin.idea.actions.bytecode.KotlinBytecodeToolWindow
import org.jetbrains.kotlin.idea.base.plugin.artifacts.TestKotlinArtifacts
import org.jetbrains.kotlin.idea.base.test.TestRoot
import org.jetbrains.kotlin.idea.jvmDecompiler.KotlinBytecodeDecompiler
@@ -37,17 +36,29 @@ import java.io.File
class CompiledFilesHighlightingTest: KotlinLightCodeInsightFixtureTestCase() {
@TestMetadata("kotlin/collections/GroupingKt.kotlin_metadata")
fun testKotlinCollectionsGroupingKtKotlinMetadata() {
doTestWithLibraryFile(TestKotlinArtifacts.kotlinStdlibCommon, FileHighlightingSetting.SKIP_INSPECTION)
doTestWithLibraryFile(
TestKotlinArtifacts.kotlinStdlibCommon,
FileHighlightingSetting.SKIP_INSPECTION,
expectedDuplicatedHighlighting = true
)
}
@TestMetadata("kotlin/time/TimeSource.class")
fun testKotlinTimeTimeSourceClass() {
doTestWithLibraryFile(TestKotlinArtifacts.kotlinStdlib, FileHighlightingSetting.SKIP_INSPECTION)
doTestWithLibraryFile(
TestKotlinArtifacts.kotlinStdlib,
FileHighlightingSetting.SKIP_INSPECTION,
expectedDuplicatedHighlighting = true
)
}
@TestMetadata("default/linkdata/package_kotlin.io/0_io.knm")
fun testKotlinNativeLinkdataPackageKotlinIO0ioKnm() {
doTestWithLibraryFile(TestKotlinArtifacts.kotlinStdlibNative, FileHighlightingSetting.SKIP_INSPECTION)
doTestWithLibraryFile(
TestKotlinArtifacts.kotlinStdlibNative,
FileHighlightingSetting.SKIP_INSPECTION,
expectedDuplicatedHighlighting = true
)
}
@TestMetadata("kotlin/annotations/OptIn.kt")
@@ -71,6 +82,7 @@ class CompiledFilesHighlightingTest: KotlinLightCodeInsightFixtureTestCase() {
private fun doTestWithLibraryFile(
libraryFile: File,
expectedHighlightingSetting: FileHighlightingSetting,
expectedDuplicatedHighlighting: Boolean = false,
openFileAction: (VirtualFile) -> VirtualFile = { it }
) {
val libraryVirtualFile =
@@ -89,7 +101,7 @@ class CompiledFilesHighlightingTest: KotlinLightCodeInsightFixtureTestCase() {
val highlightingSetting = HighlightingSettingsPerFile.getInstance(project).getHighlightingSettingForRoot(openedPsiFile)
assertEquals(expectedHighlightingSetting, highlightingSetting)
myFixture.openFileInEditor(fileToOpen)
doTest()
doTest(expectedDuplicatedHighlighting)
}
}
@@ -105,15 +117,21 @@ class CompiledFilesHighlightingTest: KotlinLightCodeInsightFixtureTestCase() {
}
}
private fun doTest() {
private fun doTest(expectedDuplicatedHighlighting: Boolean) {
val fileText = FileUtil.loadFile(File(dataFilePath(fileName().replace('/', '.') + ".txt")), true)
try {
withCustomCompilerOptions(fileText, project, module) {
(myFixture as CodeInsightTestFixtureImpl).canChangeDocumentDuringHighlighting(false)
val fixture = myFixture as CodeInsightTestFixtureImpl
fixture.canChangeDocumentDuringHighlighting(false)
val data = ExpectedHighlightingData(DocumentImpl(fileText), true, true, true)
data.checkSymbolNames()
data.init()
(myFixture as CodeInsightTestFixtureImpl).collectAndCheckHighlighting(data)
val check: () -> Unit = { fixture.collectAndCheckHighlighting(data) }
if (expectedDuplicatedHighlighting) {
ExpectedHighlightingData.expectedDuplicatedHighlighting(check)
} else {
check()
}
}
} catch (e: FileComparisonFailure) {
val highlights =
@@ -140,6 +140,11 @@ public abstract class K1HighlightingMetaInfoTestGenerated extends AbstractK1High
runTest("testData/highlighterMetaInfo/Annotations.kt");
}
@TestMetadata("AnnotationsInDumbMode.kt")
public void testAnnotationsInDumbMode() throws Exception {
runTest("testData/highlighterMetaInfo/AnnotationsInDumbMode.kt");
}
@TestMetadata("AutoCreatedItParameter.kt")
public void testAutoCreatedItParameter() throws Exception {
runTest("testData/highlighterMetaInfo/AutoCreatedItParameter.kt");
@@ -240,6 +245,11 @@ public abstract class K1HighlightingMetaInfoTestGenerated extends AbstractK1High
runTest("testData/highlighterMetaInfo/PropertiesWithPropertyDeclarations.kt");
}
@TestMetadata("PropertiesWithPropertyDeclarationsInDumbMode.kt")
public void testPropertiesWithPropertyDeclarationsInDumbMode() throws Exception {
runTest("testData/highlighterMetaInfo/PropertiesWithPropertyDeclarationsInDumbMode.kt");
}
@TestMetadata("script.kts")
public void testScript() throws Exception {
runTest("testData/highlighterMetaInfo/script.kts");
@@ -17,12 +17,12 @@ fun <symbolName descr="null">foo</symbolName>() {
<symbolName descr="null"><symbolName descr="null">bar</symbolName></symbolName> <symbolName descr="null" textAttributesKey="KOTLIN_ANNOTATION">@Ann</symbolName> { 1 }
@<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: Err" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">Err</error>
<symbolName descr="null" textAttributesKey="KOTLIN_ANNOTATION">@<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: Err" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">Err</error></symbolName>
<warning descr="[UNUSED_EXPRESSION] The expression is unused" textAttributesKey="WARNING_ATTRIBUTES">5</warning>
}
@<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: Err" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">Err</error> class <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">Err1</symbolName>
<symbolName descr="null" textAttributesKey="KOTLIN_ANNOTATION">@<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: Err" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">Err</error></symbolName> class <symbolName descr="null" textAttributesKey="KOTLIN_CLASS"><symbolName descr="null" textAttributesKey="KOTLIN_CLASS">Err1</symbolName></symbolName>
class <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">NotAnn</symbolName>
<error descr="[NOT_AN_ANNOTATION_CLASS] 'NotAnn' is not an annotation class" textAttributesKey="ERRORS_ATTRIBUTES">@<symbolName descr="null" textAttributesKey="KOTLIN_CLASS">NotAnn</symbolName></error>
<error descr="[NOT_AN_ANNOTATION_CLASS] 'NotAnn' is not an annotation class" textAttributesKey="ERRORS_ATTRIBUTES"><symbolName descr="null" textAttributesKey="KOTLIN_ANNOTATION">@<symbolName descr="null" textAttributesKey="KOTLIN_CLASS">NotAnn</symbolName></symbolName></error>
class <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">C</symbolName>
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
fun <symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">test</symbolName>() {
val <symbolName textAttributesKey="KOTLIN_LOCAL_VARIABLE">vect</symbolName> = <symbolName textAttributesKey="KOTLIN_CONSTRUCTOR">MyIterable</symbolName><<symbolName textAttributesKey="KOTLIN_CLASS">Int</symbolName>>()
<symbolName textAttributesKey="KOTLIN_LOCAL_VARIABLE">vect</symbolName>.<symbolName textAttributesKey="KOTLIN_FUNCTION_CALL">filter</symbolName> { <symbolName textAttributesKey="KOTLIN_CLOSURE_DEFAULT_PARAMETER">it</symbolName> != 2 }.<symbolName textAttributesKey="KOTLIN_FUNCTION_CALL">forEach</symbolName> { <symbolName textAttributesKey="KOTLIN_CLOSURE_DEFAULT_PARAMETER">it</symbolName>.<symbolName textAttributesKey="KOTLIN_FUNCTION_CALL">toString</symbolName>() }
@@ -1,5 +1,5 @@
// LANGUAGE_VERSION: 1.8
// EXPECTED_DUPLICATED_HIGHLIGHTING
fun <<symbolName textAttributesKey="KOTLIN_TYPE_PARAMETER">T</symbolName>> <symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">foo</symbolName>(<symbolName textAttributesKey="KOTLIN_PARAMETER">x</symbolName>: <symbolName textAttributesKey="KOTLIN_TYPE_PARAMETER">T & Any</symbolName>) : <symbolName textAttributesKey="KOTLIN_TYPE_PARAMETER">T & Any</symbolName> {
val <symbolName textAttributesKey="KOTLIN_LOCAL_VARIABLE">y</symbolName>: <symbolName textAttributesKey="KOTLIN_TYPE_PARAMETER">T & Any</symbolName> = <symbolName textAttributesKey="KOTLIN_PARAMETER">x</symbolName>
return <symbolName textAttributesKey="KOTLIN_LOCAL_VARIABLE">y</symbolName>
@@ -1,4 +1,5 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
class <symbolName descr="null">X</symbolName><<symbolName descr="null">T</symbolName>>{}
fun <<symbolName descr="null">T</symbolName>> <symbolName descr="null">foo</symbolName>() : <symbolName descr="null">X</symbolName><<symbolName descr="null">T</symbolName>> {<error descr="[NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY] A 'return' expression required in a function with a block body ('{...}')">}</error>
val x <symbolName descr="null">by</symbolName> <error descr="[DELEGATE_SPECIAL_FUNCTION_MISSING] Type 'X<TypeVariable(T)>' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate" textAttributesKey="ERRORS_ATTRIBUTES">foo<<error descr="Type expected">></error>()</error>
val <symbolName descr="null">x</symbolName> <symbolName descr="null">by</symbolName> <error descr="[DELEGATE_SPECIAL_FUNCTION_MISSING] Type 'X<TypeVariable(T)>' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate" textAttributesKey="ERRORS_ATTRIBUTES">foo<<error descr="Type expected">></error>()</error>
@@ -1,5 +1,5 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
<symbolName descr="null" textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">open</symbolName> class <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">Foo</symbolName> {
<symbolName descr="null" textAttributesKey="KOTLIN_KEYWORD">constructor</symbolName>(<warning descr="[UNUSED_PARAMETER] Parameter 'i' is never used" textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES"><symbolName descr="null" textAttributesKey="KOTLIN_PARAMETER">i</symbolName></warning>: <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">Int</symbolName>)
}
@@ -1,4 +1,5 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
package testing
fun <symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">tst</symbolName>(<symbolName textAttributesKey="KOTLIN_PARAMETER">d</symbolName>: <error><symbolName>dynamic</symbolName></error>) {
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
package testing
<symbolName textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">enum</symbolName> class <symbolName textAttributesKey="KOTLIN_ENUM">Test</symbolName> {
@@ -1,4 +1,5 @@
// WITH_STDLIB
// EXPECTED_DUPLICATED_HIGHLIGHTING
fun <symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">global</symbolName>() {
fun <symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">inner</symbolName>() {
@@ -1,5 +1,5 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
interface <symbolName textAttributesKey="KOTLIN_TRAIT">Zoo</symbolName><<symbolName textAttributesKey="KOTLIN_TYPE_PARAMETER">T</symbolName>> {
<error descr="[WRONG_MODIFIER_TARGET] Modifier 'inner' is not applicable to 'enum class'" textAttributesKey="ERRORS_ATTRIBUTES"><symbolName textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">inner</symbolName></error> <symbolName textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">enum</symbolName> class <symbolName textAttributesKey="KOTLIN_ENUM">Var</symbolName> : <symbolName textAttributesKey="KOTLIN_TRAIT">Zoo</symbolName><<error descr="[INACCESSIBLE_OUTER_CLASS_EXPRESSION] Expression is inaccessible from a nested class 'Var'" textAttributesKey="ERRORS_ATTRIBUTES"><symbolName descr="null" textAttributesKey="KOTLIN_TYPE_PARAMETER">T</symbolName></error>>
}
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
fun <symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">test</symbolName>() {
<symbolName textAttributesKey="KOTLIN_CONSTRUCTOR">Test</symbolName>("text", "text")() // BUG
}
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
<symbolName textAttributesKey="KOTLIN_ANNOTATION">@SuppressWarnings</symbolName> class <symbolName textAttributesKey="KOTLIN_CLASS">TheClass</symbolName> : <symbolName textAttributesKey="KOTLIN_TRAIT">Runnable</symbolName>, <symbolName textAttributesKey="KOTLIN_CONSTRUCTOR">Thread</symbolName>() {
val <symbolName textAttributesKey="KOTLIN_INSTANCE_PROPERTY">x</symbolName> = <symbolName textAttributesKey="KOTLIN_SYNTHETIC_EXTENSION_PROPERTY">id</symbolName>
}
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
/**
* @param <symbolName descr="null" textAttributesKey="KDOC_LINK">x</symbolName> foo and <symbolName descr="null" textAttributesKey="KDOC_LINK">[baz]</symbolName>
* @param <symbolName descr="null" textAttributesKey="KDOC_LINK">y</symbolName> bar
@@ -1,4 +1,5 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
package language_injection
<symbolName descr="null">import</symbolName> org.intellij.lang.annotations.<symbolName descr="null">Language</symbolName>
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
<symbolName descr="null" textAttributesKey="KOTLIN_ANNOTATION">@Suppress</symbolName>(<symbolName descr="null" textAttributesKey="KOTLIN_ANNOTATION_ATTRIBUTE_NAME_ATTRIBUTES">names =</symbolName> ["foo"])
fun <symbolName descr="null" textAttributesKey="KOTLIN_FUNCTION_DECLARATION">foo</symbolName>(<symbolName descr="null" textAttributesKey="KOTLIN_PARAMETER">p1</symbolName>: <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">Int</symbolName>, <symbolName descr="null" textAttributesKey="KOTLIN_PARAMETER">p2</symbolName>: <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">String</symbolName>): <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">String</symbolName> {
return <symbolName descr="null" textAttributesKey="KOTLIN_PARAMETER">p2</symbolName> + <symbolName descr="null" textAttributesKey="KOTLIN_PARAMETER">p1</symbolName>
@@ -1,3 +1,5 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
fun <symbolName descr="null" textAttributesKey="KOTLIN_FUNCTION_DECLARATION">test</symbolName>(<symbolName descr="null" textAttributesKey="KOTLIN_PARAMETER">s</symbolName>: <symbolName descr="null" textAttributesKey="KOTLIN_CLASS">String</symbolName>?) {
<symbolName descr="null" textAttributesKey="KOTLIN_PARAMETER">s</symbolName><symbolName descr="null" textAttributesKey="KOTLIN_EXCLEXCL">!!</symbolName>.<symbolName descr="null" textAttributesKey="KOTLIN_INSTANCE_PROPERTY">length</symbolName>
}
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
package testing
object <symbolName textAttributesKey="KOTLIN_OBJECT">O</symbolName> {
@@ -1,4 +1,5 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
class <symbolName textAttributesKey="KOTLIN_CLASS">My</symbolName>(val <symbolName textAttributesKey="KOTLIN_INSTANCE_PROPERTY">x</symbolName>: <symbolName textAttributesKey="KOTLIN_CLASS">Int</symbolName>?)
fun <symbolName textAttributesKey="KOTLIN_CLASS">My</symbolName>?.<symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">foo</symbolName>(): <symbolName textAttributesKey="KOTLIN_CLASS">Int</symbolName> {
@@ -1,2 +1,3 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
val <symbolName textAttributesKey="KOTLIN_PACKAGE_PROPERTY">weekYear</symbolName> = java.util.<symbolName textAttributesKey="KOTLIN_ABSTRACT_CLASS">Calendar</symbolName>.<symbolName textAttributesKey="KOTLIN_FUNCTION_CALL">getInstance</symbolName>().<symbolName textAttributesKey="KOTLIN_SYNTHETIC_EXTENSION_PROPERTY">weekYear</symbolName>
@@ -1,5 +1,5 @@
// IGNORE_K2
// EXPECTED_DUPLICATED_HIGHLIGHTING
<symbolName textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">annotation</symbolName> class <symbolName textAttributesKey="KOTLIN_ANNOTATION">Anno</symbolName>
typealias <symbolName textAttributesKey="KOTLIN_ANNOTATION">AnnoAlias</symbolName> = <symbolName textAttributesKey="KOTLIN_ANNOTATION">Anno</symbolName>
<symbolName textAttributesKey="KOTLIN_ANNOTATION">@Anno</symbolName> fun <symbolName textAttributesKey="KOTLIN_FUNCTION_DECLARATION">annoUsage</symbolName>() {}
@@ -1,5 +1,5 @@
// CONFIGURE_LIBRARY: KotlinTestJunit,JUnit4
// EXPECTED_DUPLICATED_HIGHLIGHTING
<symbolName descr="null">import</symbolName> kotlin.test.<symbolName descr="null">Test</symbolName>
class <symbolName descr="null">Foo</symbolName> {
<symbolName descr="null">@Test</symbolName>
@@ -1,3 +1,4 @@
// EXPECTED_DUPLICATED_HIGHLIGHTING
interface <symbolName textAttributesKey="KOTLIN_TRAIT">TheInterface</symbolName> {
}
@@ -0,0 +1,20 @@
// DUMB_MODE
// FIR_IDENTICAL
// CHECK_SYMBOL_NAMES
// HIGHLIGHTER_ATTRIBUTES_KEY
@Target(AnnotationTarget.CLASS, AnnotationTarget.EXPRESSION)
@Retention(AnnotationRetention.SOURCE)
annotation class Ann
@Ann class A
fun bar(block: () -> Int) = block()
private
fun foo() {
1 + @Ann 2
@Ann 3 + 4
bar @Ann { 1 }
}
@@ -0,0 +1,20 @@
// DUMB_MODE
// FIR_IDENTICAL
// CHECK_SYMBOL_NAMES
// HIGHLIGHTER_ATTRIBUTES_KEY
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_ANNOTATION'")!>@Target<!>(AnnotationTarget.CLASS, AnnotationTarget.EXPRESSION)
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_ANNOTATION'")!>@Retention<!>(AnnotationRetention.SOURCE)
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>annotation<!> class <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_ANNOTATION'")!>Ann<!>
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_ANNOTATION'")!>@Ann<!> class <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_CLASS'")!>A<!>
fun <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_FUNCTION_DECLARATION'")!>bar<!>(<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>block<!>: () -> Int) = block()
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>private<!>
fun <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_FUNCTION_DECLARATION'")!>foo<!>() {
1 + <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_ANNOTATION'")!>@Ann<!> 2
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_ANNOTATION'")!>@Ann<!> 3 + 4
bar <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_ANNOTATION'")!>@Ann<!> { 1 }
}
@@ -7,11 +7,11 @@ fun <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesK
return<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LABEL'")!>@label<!> 2
}
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LABEL'")!>loop@<!> for (<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LOCAL_VARIABLE'")!>i<!> in 1..100) {
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LABEL'")!>loop@<!> for (<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LOCAL_VARIABLE'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>i<!> in 1..100) {
break<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LABEL'")!>@loop<!>
}
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LABEL'")!>loop2@<!> for (<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LOCAL_VARIABLE'")!>i<!> in 1..100) {
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LABEL'")!>loop2@<!> for (<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LOCAL_VARIABLE'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>i<!> in 1..100) {
break<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_LABEL'")!>@loop2<!>
}
@@ -0,0 +1,44 @@
// DUMB_MODE
// FIR_IDENTICAL
// CHECK_SYMBOL_NAMES
// HIGHLIGHTER_ATTRIBUTES_KEY
val packageSize = 0
val packageSizeGetter
get() = packageSize * 2
var packageSizeSetter = 5
set(value) {
field = value * 2
}
var packageSizeBean = 5
get() = packageSize * 2
set(value) {
field = value * 2
}
class test() {
// no highlighting check
val size = 0
val classSize = 0
val classSizeGetter
get() = classSize * 2
var classSizeSetter = 5
set(value) {
field = value * 2
}
var classSizeBean = 5
get() = classSize * 2
set(value) {
field = value * 2
}
fun callCustomPD() {
classSizeBean = 30
}
}
@@ -0,0 +1,44 @@
// DUMB_MODE
// FIR_IDENTICAL
// CHECK_SYMBOL_NAMES
// HIGHLIGHTER_ATTRIBUTES_KEY
val <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PACKAGE_PROPERTY'")!>packageSize<!> = 0
val <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PACKAGE_PROPERTY_CUSTOM_PROPERTY_DECLARATION'")!>packageSizeGetter<!>
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>get<!>() = packageSize * 2
var <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_MUTABLE_VARIABLE'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PACKAGE_PROPERTY_CUSTOM_PROPERTY_DECLARATION'")!>packageSizeSetter<!> = 5
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>set<!>(<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>value<!>) {
field = value * 2
}
var <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_MUTABLE_VARIABLE'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PACKAGE_PROPERTY_CUSTOM_PROPERTY_DECLARATION'")!>packageSizeBean<!> = 5
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>get<!>() = packageSize * 2
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>set<!>(<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>value<!>) {
field = value * 2
}
class <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_CLASS'")!>test<!>() {
// no highlighting check
val <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_INSTANCE_PROPERTY'")!>size<!> = 0
val <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_INSTANCE_PROPERTY'")!>classSize<!> = 0
val <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_INSTANCE_PROPERTY_CUSTOM_PROPERTY_DECLARATION'")!>classSizeGetter<!>
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>get<!>() = classSize * 2
var <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_INSTANCE_PROPERTY_CUSTOM_PROPERTY_DECLARATION'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_MUTABLE_VARIABLE'")!>classSizeSetter<!> = 5
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>set<!>(<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>value<!>) {
field = value * 2
}
var <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_INSTANCE_PROPERTY_CUSTOM_PROPERTY_DECLARATION'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_MUTABLE_VARIABLE'")!>classSizeBean<!> = 5
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>get<!>() = classSize * 2
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_KEYWORD'")!>set<!>(<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>value<!>) {
field = value * 2
}
fun <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_FUNCTION_DECLARATION'")!>callCustomPD<!>() {
classSizeBean = 30
}
}
@@ -7,4 +7,4 @@
<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>public<!> <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>operator<!> fun <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_FUNCTION_DECLARATION'")!>invoke<!>(<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>cause<!>: <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_CLASS'")!>Throwable<!>?)
}
<!HIGHLIGHTING("severity='ERROR'; descr='[ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE] Aliased class should not have type parameters with declaration-site variance'; textAttributesKey='ERRORS_ATTRIBUTES'; highlightingTextAttributesKey='ERRORS_ATTRIBUTES'")!><!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>public<!> <!HIGHLIGHTING("severity='ERROR'; descr='[NOT_A_MULTIPLATFORM_COMPILATION] 'expect' and 'actual' declarations can be used only in multiplatform projects. Learn more about Kotlin Multiplatform: https://kotl.in/multiplatform-setup'; textAttributesKey='ERRORS_ATTRIBUTES'; highlightingTextAttributesKey='ERRORS_ATTRIBUTES'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>actual<!> typealias <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_TYPE_ALIAS'")!>CompletionHandler<!> = (cause: <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_CLASS'")!>Throwable<!>?) -> <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_OBJECT'")!>Unit<!><!>
<!HIGHLIGHTING("severity='ERROR'; descr='[ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE] Aliased class should not have type parameters with declaration-site variance'; textAttributesKey='ERRORS_ATTRIBUTES'; highlightingTextAttributesKey='ERRORS_ATTRIBUTES'")!><!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>public<!> <!HIGHLIGHTING("severity='ERROR'; descr='[NOT_A_MULTIPLATFORM_COMPILATION] 'expect' and 'actual' declarations can be used only in multiplatform projects. Learn more about Kotlin Multiplatform: https://kotl.in/multiplatform-setup'; textAttributesKey='ERRORS_ATTRIBUTES'; highlightingTextAttributesKey='ERRORS_ATTRIBUTES'"), HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_BUILTIN_ANNOTATION'")!>actual<!> typealias <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_TYPE_ALIAS'")!>CompletionHandler<!> = (<!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_PARAMETER'")!>cause<!>: <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_CLASS'")!>Throwable<!>?) -> <!HIGHLIGHTING("severity='SYMBOL_TYPE_SEVERITY'; highlightingTextAttributesKey='KOTLIN_OBJECT'")!>Unit<!><!>