[psi] avoid usage of SAFE_IDENTIFIER_FOR_NO_NAME
This name leads to inconsistency between FqName from stub and FqName from ClassId. The first one is `no_name_in_PSI_3d19d79d_1ba9_4cd0_b7f5_b46aa3cd5d40` but the second one is `<no name provided>`. We can't just replace SAFE_IDENTIFIER_FOR_NO_NAME to NO_NAME_PROVIDED due to many places with unsafe logic inside type mapping. ^KTIJ-26848 Fixed
This commit is contained in:
committed by
Space Team
parent
ae02d78aff
commit
bd10ee10fe
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.intellij.psi.impl.DebugUtil
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.psi.stubs.impl.STUB_TO_STRING_PREFIX
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.nio.file.Paths
|
||||
@@ -47,7 +46,7 @@ fun StubElement<out PsiElement>.serializeToString(): String {
|
||||
}
|
||||
|
||||
private fun serializeStubToString(stubElement: StubElement<*>): String {
|
||||
val treeStr = DebugUtil.stubTreeToString(stubElement).replace(SpecialNames.SAFE_IDENTIFIER_FOR_NO_NAME.asString(), "<no name>")
|
||||
val treeStr = DebugUtil.stubTreeToString(stubElement)
|
||||
|
||||
// Nodes are stored in form "NodeType:Node" and have too many repeating information for Kotlin stubs
|
||||
// Remove all repeating information (See KotlinStubBaseImpl.toString())
|
||||
|
||||
@@ -15,5 +15,3 @@ package one.two
|
||||
/* ClassId: one/two/B.<no name provided> */object
|
||||
/* ClassId: one/two/B.<no name provided> */typealias
|
||||
}
|
||||
|
||||
// IGNORE_CONSISTENCY_CHECK: KTIJ-26848
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@@ -651,9 +651,7 @@ fun KtNamedDeclaration.safeNameForLazyResolve(): Name {
|
||||
return nameAsName.safeNameForLazyResolve()
|
||||
}
|
||||
|
||||
fun Name?.safeNameForLazyResolve(): Name {
|
||||
return SpecialNames.safeIdentifier(this)
|
||||
}
|
||||
fun Name?.safeNameForLazyResolve(): Name = this?.takeUnless(Name::isSpecial) ?: SpecialNames.NO_NAME_PROVIDED
|
||||
|
||||
fun KtNamedDeclaration.safeFqNameForLazyResolve(): FqName? {
|
||||
//NOTE: should only create special names for package level declarations, so we can safely rely on real fq name for parent
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2023 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.psi.stubs
|
||||
@@ -23,7 +12,7 @@ object KotlinStubVersions {
|
||||
// Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version
|
||||
// if you are not 100% sure it can be avoided.
|
||||
// Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version.
|
||||
const val SOURCE_STUB_VERSION = 156
|
||||
const val SOURCE_STUB_VERSION = 157
|
||||
|
||||
// Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed
|
||||
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
|
||||
|
||||
Reference in New Issue
Block a user