From f1307559725dc417904f39ad3da83a806481a20c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 17 Feb 2016 12:56:16 +0300 Subject: [PATCH] Use new built-in binary format (.kotlin_builtins files) in IDE Instead of .kotlin_class and .kotlin_package files, .kotlin_builtins files are now supported: they are decompiled to a long file consisting of all non-real classes (those which do not also have .class files) and members in the corresponding package. Unlike the old files, .kotlin_builtins files have a binary version in the beginning, which allows us to skip decompilation and stub building in case the file has an unsupported version. This could previously lead to exceptions, see KT-11077, EA-79339. The change in DecompiledTextFactory is needed because without "defined in ..." the keys for members in the long decompiled file are not unique, as there are multiple members with exactly the same signatures in different classes (e.g. arithmetic operations in primitive classes). Remove testData files with the decompiled text and stubs of built-in symbols because now that the whole package is decompiled to a single file, it would be painful to update these files each time something in built-in sources changes #KT-11077 Fixed --- .../builtIns/KotlinBuiltInDecompiler.kt | 141 ++-- ...{fileTypes.kt => KotlinBuiltInFileType.kt} | 26 +- .../builtIns/KotlinBuiltInStubBuilder.kt | 84 +- ...ighlighterProviderForDecompiledBuiltIns.kt | 7 +- .../classFile/KotlinClassFileDecompiler.kt | 4 +- .../textBuilder/DecompiledTextFactory.kt | 1 + .../kotlin/idea/util/ProjectRootsUtil.kt | 5 +- idea/src/META-INF/plugin.xml | 10 +- .../idea/KotlinBuiltInFileTypeFactory.kt | 9 +- .../kotlin/idea/goto/gotoContributors.kt | 6 +- .../overrideImplement/ToStringInTrait.kt | 4 +- idea/testData/decompiler/builtIns/Any.stubs | 41 - idea/testData/decompiler/builtIns/Any.text | 12 - idea/testData/decompiler/builtIns/Int.stubs | 795 ------------------ idea/testData/decompiler/builtIns/Int.text | 128 --- .../decompiler/builtIns/kotlin_package.stubs | 246 ------ .../decompiler/builtIns/kotlin_package.text | 31 - idea/testData/resolve/builtins/any.kt | 2 +- idea/testData/resolve/builtins/equals.kt | 2 +- idea/testData/resolve/builtins/int.kt | 2 +- .../resolve/builtins/intArrayConstructor.kt | 2 +- idea/testData/resolve/builtins/nothing.kt | 2 +- idea/testData/resolve/builtins/times.kt | 2 +- idea/testData/resolve/builtins/toString.kt | 2 +- .../BuiltInDecompilerConsistencyTest.kt | 85 +- .../stubBuilder/BuiltInDecompilerTest.kt | 43 +- 26 files changed, 203 insertions(+), 1489 deletions(-) rename idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/{fileTypes.kt => KotlinBuiltInFileType.kt} (63%) delete mode 100644 idea/testData/decompiler/builtIns/Any.stubs delete mode 100644 idea/testData/decompiler/builtIns/Any.text delete mode 100644 idea/testData/decompiler/builtIns/Int.stubs delete mode 100644 idea/testData/decompiler/builtIns/Int.text delete mode 100644 idea/testData/decompiler/builtIns/kotlin_package.stubs delete mode 100644 idea/testData/decompiler/builtIns/kotlin_package.text diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt index 9ea51352e5e..54b9356b280 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt @@ -17,37 +17,40 @@ package org.jetbrains.kotlin.idea.decompiler.builtIns import com.intellij.ide.highlighter.JavaClassFileType -import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.FileViewProvider import com.intellij.psi.PsiManager import com.intellij.psi.compiled.ClassFileDecompilers +import org.jetbrains.annotations.TestOnly +import org.jetbrains.kotlin.builtins.BuiltInsBinaryVersion import org.jetbrains.kotlin.builtins.BuiltInsSerializedResourcePaths +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.idea.decompiler.KotlinDecompiledFileViewProvider import org.jetbrains.kotlin.idea.decompiler.KtDecompiledFile -import org.jetbrains.kotlin.idea.decompiler.common.toClassProto -import org.jetbrains.kotlin.idea.decompiler.common.toPackageProto +import org.jetbrains.kotlin.idea.decompiler.classFile.CURRENT_ABI_VERSION_MARKER +import org.jetbrains.kotlin.idea.decompiler.classFile.FILE_ABI_VERSION_MARKER +import org.jetbrains.kotlin.idea.decompiler.classFile.INCOMPATIBLE_ABI_VERSION_COMMENT import org.jetbrains.kotlin.idea.decompiler.textBuilder.DecompiledText import org.jetbrains.kotlin.idea.decompiler.textBuilder.buildDecompiledText import org.jetbrains.kotlin.idea.decompiler.textBuilder.defaultDecompilerRendererOptions -import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.renderer.DescriptorRenderer -import org.jetbrains.kotlin.serialization.ProtoBuf import org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf import org.jetbrains.kotlin.serialization.deserialization.NameResolverImpl +import java.io.ByteArrayInputStream class KotlinBuiltInDecompiler : ClassFileDecompilers.Full() { private val stubBuilder = KotlinBuiltInStubBuilder() override fun accepts(file: VirtualFile): Boolean { - return file.fileType == KotlinBuiltInClassFileType || file.fileType == KotlinBuiltInPackageFileType + return file.fileType == KotlinBuiltInFileType } override fun getStubBuilder() = stubBuilder override fun createFileViewProvider(file: VirtualFile, manager: PsiManager, physical: Boolean): FileViewProvider { return KotlinDecompiledFileViewProvider(manager, file, physical) { provider -> - if (isInternalBuiltInFile(provider.virtualFile)) { + if (isInternalBuiltInFile(BuiltInDefinitionFile.read(provider.virtualFile))) { null } else { @@ -57,62 +60,86 @@ class KotlinBuiltInDecompiler : ClassFileDecompilers.Full() { } } } - - companion object { - val LOG = Logger.getInstance(KotlinBuiltInDecompiler::class.java) - } } private val decompilerRendererForBuiltIns = DescriptorRenderer.withOptions { defaultDecompilerRendererOptions() } -fun buildDecompiledTextForBuiltIns( - builtInFile: VirtualFile -): DecompiledText { - val directory = builtInFile.parent!! - val nameResolver = readStringTable(directory, KotlinBuiltInDecompiler.LOG)!! - val content = builtInFile.contentsToByteArray() - return when (builtInFile.fileType) { - KotlinBuiltInPackageFileType -> { - val packageFqName = content.toPackageProto(BuiltInsSerializedResourcePaths.extensionRegistry).packageFqName(nameResolver) - val resolver = KotlinBuiltInDeserializerForDecompiler(directory, packageFqName, nameResolver) - buildDecompiledText(packageFqName, resolver.resolveDeclarationsInFacade(packageFqName), decompilerRendererForBuiltIns) - } - KotlinBuiltInClassFileType -> { - val classProto = content.toClassProto(BuiltInsSerializedResourcePaths.extensionRegistry) - val classId = nameResolver.getClassId(classProto.fqName) - val packageFqName = classId.packageFqName - val resolver = KotlinBuiltInDeserializerForDecompiler(directory, packageFqName, nameResolver) - buildDecompiledText( - packageFqName, - listOfNotNull(resolver.resolveTopLevelClass(classId)), - decompilerRendererForBuiltIns +fun buildDecompiledTextForBuiltIns(builtInFile: VirtualFile): DecompiledText { + if (builtInFile.fileType != KotlinBuiltInFileType) { + error("Unexpected file type ${builtInFile.fileType}") + } + + val file = BuiltInDefinitionFile.read(builtInFile) + when (file) { + is BuiltInDefinitionFile.Incompatible -> { + // TODO: test + return DecompiledText( + INCOMPATIBLE_ABI_VERSION_COMMENT + .replace(CURRENT_ABI_VERSION_MARKER, BuiltInsBinaryVersion.INSTANCE.toString()) + .replace(FILE_ABI_VERSION_MARKER, file.version.toString()), + mapOf() ) } - else -> error("Unexpected filetype ${builtInFile.fileType}") - } -} - -fun ProtoBuf.Package.packageFqName(nameResolver: NameResolverImpl): FqName { - return nameResolver.getPackageFqName(getExtension(BuiltInsProtoBuf.packageFqName)) -} - -fun isInternalBuiltInFile(virtualFile: VirtualFile): Boolean { - when (virtualFile.fileType) { - KotlinBuiltInPackageFileType -> { - // do not accept kotlin_package files without packageFqName extension to avoid failing on older runtimes - // this check may be costly but there are few kotlin_package files - val packageProto = virtualFile.contentsToByteArray().toPackageProto(BuiltInsSerializedResourcePaths.extensionRegistry) - return !packageProto.hasExtension(BuiltInsProtoBuf.packageFqName) - } - KotlinBuiltInClassFileType -> { - val correspondsToInnerClass = virtualFile.nameWithoutExtension.contains('.') - if (correspondsToInnerClass) { - return true + is BuiltInDefinitionFile.Compatible -> { + val packageFqName = file.packageFqName + val resolver = KotlinBuiltInDeserializerForDecompiler(file.packageDirectory, packageFqName, file.nameResolver) + val declarations = arrayListOf() + declarations.addAll(resolver.resolveDeclarationsInFacade(packageFqName)) + for (classProto in file.classesToDecompile) { + val classId = file.nameResolver.getClassId(classProto.fqName) + declarations.add(resolver.resolveTopLevelClass(classId)!!) } - val classFileName = virtualFile.nameWithoutExtension + "." + JavaClassFileType.INSTANCE.defaultExtension - val classFileForTheSameClassIsPresent = virtualFile.parent!!.findChild(classFileName) != null - return classFileForTheSameClassIsPresent + return buildDecompiledText(packageFqName, declarations, decompilerRendererForBuiltIns) } - else -> error("Unexpected filetype ${virtualFile.fileType}") } -} \ No newline at end of file +} + +sealed class BuiltInDefinitionFile { + class Incompatible(val version: BuiltInsBinaryVersion) : BuiltInDefinitionFile() + + class Compatible(val proto: BuiltInsProtoBuf.BuiltIns, val packageDirectory: VirtualFile) : BuiltInDefinitionFile() { + val nameResolver = NameResolverImpl(proto.strings, proto.qualifiedNames) + val packageFqName = nameResolver.getPackageFqName(proto.`package`.getExtension(BuiltInsProtoBuf.packageFqName)) + + val classesToDecompile = + if (FILTER_OUT_CLASSES_EXISTING_AS_JVM_CLASS_FILES) proto.classList.filter { classProto -> + shouldDecompileBuiltInClass(nameResolver.getClassId(classProto.fqName)) + } + else proto.classList + + private fun shouldDecompileBuiltInClass(classId: ClassId): Boolean { + if (classId.isNestedClass) return false + + val realJvmClassFileName = classId.shortClassName.asString() + "." + JavaClassFileType.INSTANCE.defaultExtension + return packageDirectory.findChild(realJvmClassFileName) == null + } + } + + companion object { + var FILTER_OUT_CLASSES_EXISTING_AS_JVM_CLASS_FILES = true + @TestOnly set + + fun read(file: VirtualFile): BuiltInDefinitionFile { + val stream = ByteArrayInputStream(file.contentsToByteArray()) + + val version = BuiltInsBinaryVersion.readFrom(stream) + if (!version.isCompatible()) { + return BuiltInDefinitionFile.Incompatible(version) + } + + val proto = BuiltInsProtoBuf.BuiltIns.parseFrom(stream, BuiltInsSerializedResourcePaths.extensionRegistry) + return BuiltInDefinitionFile.Compatible(proto, file.parent) + } + } +} + +internal fun isInternalBuiltInFile(file: BuiltInDefinitionFile): Boolean { + when (file) { + is BuiltInDefinitionFile.Incompatible -> return true + is BuiltInDefinitionFile.Compatible -> { + return file.classesToDecompile.isEmpty() && + file.proto.`package`.functionCount == 0 && + file.proto.`package`.propertyCount == 0 + } + } +} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/fileTypes.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInFileType.kt similarity index 63% rename from idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/fileTypes.kt rename to idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInFileType.kt index 63fd0cdedb1..0521a1d83f3 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/fileTypes.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInFileType.kt @@ -21,28 +21,12 @@ import com.intellij.openapi.vfs.VirtualFile import org.jetbrains.kotlin.builtins.BuiltInsSerializedResourcePaths import org.jetbrains.kotlin.idea.KotlinIcons -object KotlinBuiltInClassFileType : FileType { - override fun getName() = "kotlin_class" +object KotlinBuiltInFileType : FileType { + override fun getName() = "kotlin_builtins" - override fun getDescription() = "Kotlin builtin class" + override fun getDescription() = "Kotlin built-in declarations" - override fun getDefaultExtension() = BuiltInsSerializedResourcePaths.CLASS_METADATA_FILE_EXTENSION - - override fun getIcon() = KotlinIcons.CLASS - - override fun isBinary() = true - - override fun isReadOnly() = true - - override fun getCharset(file: VirtualFile, content: ByteArray) = null -} - -object KotlinBuiltInPackageFileType : FileType { - override fun getName() = "kotlin_package" - - override fun getDescription() = "Kotlin builtin package" - - override fun getDefaultExtension() = BuiltInsSerializedResourcePaths.PACKAGE_FILE_EXTENSION + override fun getDefaultExtension() = BuiltInsSerializedResourcePaths.BUILTINS_FILE_EXTENSION override fun getIcon() = KotlinIcons.FILE @@ -51,4 +35,4 @@ object KotlinBuiltInPackageFileType : FileType { override fun isReadOnly() = true override fun getCharset(file: VirtualFile, content: ByteArray) = null -} \ No newline at end of file +} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInStubBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInStubBuilder.kt index d86aaabd664..0d777be8dfa 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInStubBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInStubBuilder.kt @@ -16,65 +16,53 @@ package org.jetbrains.kotlin.idea.decompiler.builtIns -import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.compiled.ClsStubBuilder import com.intellij.psi.impl.compiled.ClassFileStubBuilder import com.intellij.psi.stubs.PsiFileStub import com.intellij.util.indexing.FileContent -import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.builtins.BuiltInSerializerProtocol import org.jetbrains.kotlin.builtins.BuiltInsSerializedResourcePaths import org.jetbrains.kotlin.idea.decompiler.common.AnnotationLoaderForStubBuilderImpl import org.jetbrains.kotlin.idea.decompiler.common.DirectoryBasedClassDataFinder -import org.jetbrains.kotlin.idea.decompiler.common.toClassProto -import org.jetbrains.kotlin.idea.decompiler.common.toPackageProto -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.ClsStubBuilderComponents -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.createPackageFacadeStub -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.createTopLevelClassStub +import org.jetbrains.kotlin.idea.decompiler.stubBuilder.* import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl import org.jetbrains.kotlin.serialization.deserialization.NameResolver -import org.jetbrains.kotlin.serialization.deserialization.NameResolverImpl +import org.jetbrains.kotlin.serialization.deserialization.ProtoContainer import org.jetbrains.kotlin.serialization.deserialization.TypeTable -import java.io.ByteArrayInputStream class KotlinBuiltInStubBuilder : ClsStubBuilder() { - override fun getStubVersion() = ClassFileStubBuilder.STUB_VERSION + 1 + override fun getStubVersion() = ClassFileStubBuilder.STUB_VERSION + 2 override fun buildFileStub(content: FileContent): PsiFileStub<*>? { + val virtualFile = content.file + assert(virtualFile.fileType == KotlinBuiltInFileType) { "Unexpected file type ${virtualFile.fileType}" } + val file = BuiltInDefinitionFile.read(virtualFile) - if (isInternalBuiltInFile(content.file)) return null + if (isInternalBuiltInFile(file)) return null - return doBuildFileStub(content) - } + when (file) { + is BuiltInDefinitionFile.Incompatible -> { + return createIncompatibleAbiVersionFileStub() + } + is BuiltInDefinitionFile.Compatible -> { + val packageProto = file.proto.`package` + val packageFqName = file.packageFqName + val nameResolver = file.nameResolver + val components = createStubBuilderComponents(virtualFile, packageFqName, nameResolver) + val context = components.createContext(nameResolver, packageFqName, TypeTable(packageProto.typeTable)) - @TestOnly - fun doBuildFileStub(content: FileContent): KotlinFileStubImpl? { - val file = content.file - val directory = file.parent!! - val nameResolver = readStringTable(directory, LOG) ?: return null - val contentAsBytes = content.content - - return when (file.fileType) { - KotlinBuiltInPackageFileType -> { - val packageProto = contentAsBytes.toPackageProto(BuiltInsSerializedResourcePaths.extensionRegistry) - val packageFqName = packageProto.packageFqName(nameResolver) - val components = createStubBuilderComponents(file, packageFqName, nameResolver) - val context = components.createContext( - nameResolver, packageFqName, TypeTable(packageProto.typeTable) + val fileStub = createFileStub(packageFqName) + createCallableStubs( + fileStub, context, + ProtoContainer.Package(packageFqName, context.nameResolver, context.typeTable, packagePartSource = null), + packageProto.functionList, packageProto.propertyList ) - createPackageFacadeStub(packageProto, packageFqName, context) + for (classProto in file.classesToDecompile) { + createClassStub(fileStub, classProto, nameResolver, nameResolver.getClassId(classProto.fqName), context) + } + return fileStub } - KotlinBuiltInClassFileType -> { - val classProto = contentAsBytes.toClassProto(BuiltInsSerializedResourcePaths.extensionRegistry) - val classId = nameResolver.getClassId(classProto.fqName) - val packageFqName = classId.packageFqName - val components = createStubBuilderComponents(file, packageFqName, nameResolver) - val context = components.createContext(nameResolver, packageFqName, TypeTable(classProto.typeTable)) - createTopLevelClassStub(classId, classProto, context) - } - else -> error("Unexpected filetype ${file.fileType}") } } @@ -83,24 +71,4 @@ class KotlinBuiltInStubBuilder : ClsStubBuilder() { val annotationLoader = AnnotationLoaderForStubBuilderImpl(BuiltInSerializerProtocol) return ClsStubBuilderComponents(finder, annotationLoader, file) } - - companion object { - val LOG = Logger.getInstance(KotlinBuiltInStubBuilder::class.java) - } -} - -fun readStringTable(directory: VirtualFile, log: Logger): NameResolverImpl? { - val stringsFileName = "${directory.name}.${BuiltInsSerializedResourcePaths.STRING_TABLE_FILE_EXTENSION}" - val stringTableFile = directory.findFileByRelativePath(stringsFileName) ?: return run { - log.error("$stringsFileName not found in $directory") - null - } - val nameResolver = try { - NameResolverImpl.read(ByteArrayInputStream(stringTableFile.contentsToByteArray(false))) - } - catch (e: Exception) { - log.error("Error reading data from $stringTableFile ", e) - null - } - return nameResolver } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt index 09c2ddc9f50..0eab7367f20 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt @@ -25,9 +25,6 @@ import org.jetbrains.kotlin.idea.highlighter.KotlinHighlighter class KotlinSyntaxHighlighterProviderForDecompiledBuiltIns : SyntaxHighlighterProvider { override fun create(fileType: FileType, project: Project?, file: VirtualFile?): SyntaxHighlighter? { - if (fileType == KotlinBuiltInClassFileType || fileType == KotlinBuiltInPackageFileType) { - return KotlinHighlighter() - } - return null + return if (fileType == KotlinBuiltInFileType) KotlinHighlighter() else null } -} \ No newline at end of file +} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/KotlinClassFileDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/KotlinClassFileDecompiler.kt index 5f09d830ef3..db5a1f22e0d 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/KotlinClassFileDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/KotlinClassFileDecompiler.kt @@ -63,8 +63,8 @@ private val decompilerRendererForClassFiles = DescriptorRenderer.withOptions { typeNormalizer = { type -> if (type.isFlexible()) type.flexibility().lowerBound else type } } -private val FILE_ABI_VERSION_MARKER: String = "FILE_ABI" -private val CURRENT_ABI_VERSION_MARKER: String = "CURRENT_ABI" +internal val FILE_ABI_VERSION_MARKER: String = "FILE_ABI" +internal val CURRENT_ABI_VERSION_MARKER: String = "CURRENT_ABI" val INCOMPATIBLE_ABI_VERSION_GENERAL_COMMENT: String = "// This class file was compiled with different version of Kotlin compiler and can't be decompiled." val INCOMPATIBLE_ABI_VERSION_COMMENT: String = diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/DecompiledTextFactory.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/DecompiledTextFactory.kt index f7be0434633..934a58f3980 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/DecompiledTextFactory.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/textBuilder/DecompiledTextFactory.kt @@ -36,6 +36,7 @@ private val FLEXIBLE_TYPE_COMMENT = "/* platform type */" private val descriptorRendererForKeys = DescriptorRenderer.COMPACT_WITH_MODIFIERS.withOptions { modifiers = DescriptorRendererModifier.ALL + withDefinedIn = true } fun descriptorToKey(descriptor: DeclarationDescriptor): String { diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/ProjectRootsUtil.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/ProjectRootsUtil.kt index 6669df6789d..dfbe100eeeb 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/ProjectRootsUtil.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/ProjectRootsUtil.kt @@ -24,11 +24,10 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiDirectory import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.caches.resolve.JsProjectDetector -import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInClassFileType -import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInPackageFileType +import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInFileType import org.jetbrains.kotlin.idea.util.application.runReadAction -private val classFileLike = setOf(JavaClassFileType.INSTANCE, KotlinBuiltInClassFileType, KotlinBuiltInPackageFileType) +private val classFileLike = listOf(JavaClassFileType.INSTANCE, KotlinBuiltInFileType) object ProjectRootsUtil { @JvmStatic fun isInContent(project: Project, file: VirtualFile, includeProjectSource: Boolean, diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 8acca2d6ba1..9d026691112 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -1386,13 +1386,9 @@ - - - - - - - + + + diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinBuiltInFileTypeFactory.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinBuiltInFileTypeFactory.kt index e24b66636dd..769f071ee0c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinBuiltInFileTypeFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinBuiltInFileTypeFactory.kt @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.jetbrains.kotlin.idea import com.intellij.openapi.fileTypes.FileTypeConsumer import com.intellij.openapi.fileTypes.FileTypeFactory -import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInClassFileType -import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInPackageFileType +import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInFileType class KotlinBuiltInFileTypeFactory : FileTypeFactory() { override fun createFileTypes(consumer: FileTypeConsumer) { - consumer.consume(KotlinBuiltInClassFileType, KotlinBuiltInClassFileType.defaultExtension) - consumer.consume(KotlinBuiltInPackageFileType, KotlinBuiltInPackageFileType.defaultExtension) + consumer.consume(KotlinBuiltInFileType, KotlinBuiltInFileType.defaultExtension) } -} \ No newline at end of file +} diff --git a/idea/src/org/jetbrains/kotlin/idea/goto/gotoContributors.kt b/idea/src/org/jetbrains/kotlin/idea/goto/gotoContributors.kt index bbf615e0546..7858e5587c8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/goto/gotoContributors.kt +++ b/idea/src/org/jetbrains/kotlin/idea/goto/gotoContributors.kt @@ -24,7 +24,7 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.search.DelegatingGlobalSearchScope import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.stubs.StubIndex -import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInClassFileType +import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInFileType import org.jetbrains.kotlin.idea.stubindex.KotlinClassShortNameIndex import org.jetbrains.kotlin.idea.stubindex.KotlinFunctionShortNameIndex import org.jetbrains.kotlin.idea.stubindex.KotlinPropertyShortNameIndex @@ -86,6 +86,6 @@ class KotlinGotoSymbolContributor : ChooseByNameContributor { private class BuiltInClassesScope(baseScope: GlobalSearchScope) : DelegatingGlobalSearchScope(baseScope) { override fun contains(file: VirtualFile): Boolean { - return file.fileType == KotlinBuiltInClassFileType && file in myBaseScope + return file.fileType == KotlinBuiltInFileType && file in myBaseScope } -} \ No newline at end of file +} diff --git a/idea/testData/codeInsight/lineMarker/overrideImplement/ToStringInTrait.kt b/idea/testData/codeInsight/lineMarker/overrideImplement/ToStringInTrait.kt index 163c7ae361c..55b6f1c7f09 100644 --- a/idea/testData/codeInsight/lineMarker/overrideImplement/ToStringInTrait.kt +++ b/idea/testData/codeInsight/lineMarker/overrideImplement/ToStringInTrait.kt @@ -5,6 +5,6 @@ public interface Foo { /* LINEMARKER: Overrides function in 'Any' TARGETS: -Any.kotlin_class +kotlin.kotlin_builtins public open fun <1>toString(): kotlin.String { /* compiled code */ } -*/ \ No newline at end of file +*/ diff --git a/idea/testData/decompiler/builtIns/Any.stubs b/idea/testData/decompiler/builtIns/Any.stubs deleted file mode 100644 index d4696ad67ac..00000000000 --- a/idea/testData/decompiler/builtIns/Any.stubs +++ /dev/null @@ -1,41 +0,0 @@ -PsiJetFileStubImpl[package=kotlin] - PACKAGE_DIRECTIVE: - REFERENCE_EXPRESSION:[referencedName=kotlin] - IMPORT_LIST: - CLASS:[fqName=kotlin.Any, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Any, superNames=[]] - MODIFIER_LIST:[open public] - PRIMARY_CONSTRUCTOR: - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - CLASS_BODY: - FUN:[fqName=kotlin.Any.equals, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=equals] - MODIFIER_LIST:[open public operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - NULLABLE_TYPE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Any] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Boolean] - FUN:[fqName=kotlin.Any.hashCode, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=hashCode] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Any.toString, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toString] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=String] diff --git a/idea/testData/decompiler/builtIns/Any.text b/idea/testData/decompiler/builtIns/Any.text deleted file mode 100644 index 7e193fb003b..00000000000 --- a/idea/testData/decompiler/builtIns/Any.text +++ /dev/null @@ -1,12 +0,0 @@ -// IntelliJ API Decompiler stub source generated from a class file -// Implementation of methods is not available - -package kotlin - -public open class Any public constructor() { - public open operator fun equals(other: kotlin.Any?): kotlin.Boolean { /* compiled code */ } - - public open fun hashCode(): kotlin.Int { /* compiled code */ } - - public open fun toString(): kotlin.String { /* compiled code */ } -} diff --git a/idea/testData/decompiler/builtIns/Int.stubs b/idea/testData/decompiler/builtIns/Int.stubs deleted file mode 100644 index b96578f2be3..00000000000 --- a/idea/testData/decompiler/builtIns/Int.stubs +++ /dev/null @@ -1,795 +0,0 @@ -PsiJetFileStubImpl[package=kotlin] - PACKAGE_DIRECTIVE: - REFERENCE_EXPRESSION:[referencedName=kotlin] - IMPORT_LIST: - CLASS:[fqName=kotlin.Int, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Int, superNames=[Number, Comparable]] - MODIFIER_LIST:[public final] - PRIMARY_CONSTRUCTOR: - MODIFIER_LIST:[private] - VALUE_PARAMETER_LIST: - SUPER_TYPE_LIST: - SUPER_TYPE_ENTRY: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Number] - SUPER_TYPE_ENTRY: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Comparable] - TYPE_ARGUMENT_LIST: - TYPE_PROJECTION:[projectionKind=NONE] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - CLASS_BODY: - OBJECT_DECLARATION:[fqName=kotlin.Int.Companion, isCompanion=true, isLocal=false, isObjectLiteral=false, isTopLevel=false, name=Companion, superNames=[]] - MODIFIER_LIST:[public companion] - CLASS_BODY: - PROPERTY:[fqName=kotlin.Int.Companion.MAX_VALUE, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=MAX_VALUE] - MODIFIER_LIST:[public final const] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - PROPERTY:[fqName=kotlin.Int.Companion.MIN_VALUE, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=MIN_VALUE] - MODIFIER_LIST:[public final const] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.and, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=and] - MODIFIER_LIST:[public final infix] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.compareTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=compareTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.compareTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=compareTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.compareTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=compareTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.compareTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=compareTo] - MODIFIER_LIST:[open public operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.compareTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=compareTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.compareTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=compareTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.dec, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=dec] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.div, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=div] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.div, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=div] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - FUN:[fqName=kotlin.Int.div, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=div] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - FUN:[fqName=kotlin.Int.div, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=div] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.div, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=div] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - FUN:[fqName=kotlin.Int.div, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=div] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.inc, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=inc] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.inv, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=inv] - MODIFIER_LIST:[public final] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.minus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=minus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.minus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=minus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - FUN:[fqName=kotlin.Int.minus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=minus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - FUN:[fqName=kotlin.Int.minus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=minus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.minus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=minus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - FUN:[fqName=kotlin.Int.minus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=minus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.mod, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=mod] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.mod, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=mod] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - FUN:[fqName=kotlin.Int.mod, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=mod] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - FUN:[fqName=kotlin.Int.mod, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=mod] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.mod, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=mod] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - FUN:[fqName=kotlin.Int.mod, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=mod] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.or, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=or] - MODIFIER_LIST:[public final infix] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.plus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=plus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.plus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=plus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - FUN:[fqName=kotlin.Int.plus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=plus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - FUN:[fqName=kotlin.Int.plus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=plus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.plus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=plus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - FUN:[fqName=kotlin.Int.plus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=plus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.rangeTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=rangeTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=ranges] - REFERENCE_EXPRESSION:[referencedName=IntRange] - FUN:[fqName=kotlin.Int.rangeTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=rangeTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=ranges] - REFERENCE_EXPRESSION:[referencedName=IntRange] - FUN:[fqName=kotlin.Int.rangeTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=rangeTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=ranges] - REFERENCE_EXPRESSION:[referencedName=LongRange] - FUN:[fqName=kotlin.Int.rangeTo, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=rangeTo] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=ranges] - REFERENCE_EXPRESSION:[referencedName=IntRange] - FUN:[fqName=kotlin.Int.shl, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=shl] - MODIFIER_LIST:[public final infix] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=bitCount] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.shr, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=shr] - MODIFIER_LIST:[public final infix] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=bitCount] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.times, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=times] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.times, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=times] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - FUN:[fqName=kotlin.Int.times, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=times] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - FUN:[fqName=kotlin.Int.times, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=times] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.times, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=times] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - FUN:[fqName=kotlin.Int.times, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=times] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.toByte, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toByte] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - FUN:[fqName=kotlin.Int.toChar, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toChar] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Char] - FUN:[fqName=kotlin.Int.toDouble, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toDouble] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - FUN:[fqName=kotlin.Int.toFloat, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toFloat] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - FUN:[fqName=kotlin.Int.toInt, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toInt] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.toLong, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toLong] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - FUN:[fqName=kotlin.Int.toShort, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=toShort] - MODIFIER_LIST:[open public] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - FUN:[fqName=kotlin.Int.unaryMinus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=unaryMinus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.unaryPlus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=unaryPlus] - MODIFIER_LIST:[public final operator] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.ushr, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=ushr] - MODIFIER_LIST:[public final infix] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=bitCount] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - FUN:[fqName=kotlin.Int.xor, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=xor] - MODIFIER_LIST:[public final infix] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] diff --git a/idea/testData/decompiler/builtIns/Int.text b/idea/testData/decompiler/builtIns/Int.text deleted file mode 100644 index 50a16001486..00000000000 --- a/idea/testData/decompiler/builtIns/Int.text +++ /dev/null @@ -1,128 +0,0 @@ -// IntelliJ API Decompiler stub source generated from a class file -// Implementation of methods is not available - -package kotlin - -public final class Int private constructor() : kotlin.Number, kotlin.Comparable { - public companion object { - public const final val MAX_VALUE: kotlin.Int /* compiled code */ - - public const final val MIN_VALUE: kotlin.Int /* compiled code */ - } - - public final infix fun and(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun compareTo(other: kotlin.Byte): kotlin.Int { /* compiled code */ } - - public final operator fun compareTo(other: kotlin.Double): kotlin.Int { /* compiled code */ } - - public final operator fun compareTo(other: kotlin.Float): kotlin.Int { /* compiled code */ } - - public open operator fun compareTo(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun compareTo(other: kotlin.Long): kotlin.Int { /* compiled code */ } - - public final operator fun compareTo(other: kotlin.Short): kotlin.Int { /* compiled code */ } - - public final operator fun dec(): kotlin.Int { /* compiled code */ } - - public final operator fun div(other: kotlin.Byte): kotlin.Int { /* compiled code */ } - - public final operator fun div(other: kotlin.Double): kotlin.Double { /* compiled code */ } - - public final operator fun div(other: kotlin.Float): kotlin.Float { /* compiled code */ } - - public final operator fun div(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun div(other: kotlin.Long): kotlin.Long { /* compiled code */ } - - public final operator fun div(other: kotlin.Short): kotlin.Int { /* compiled code */ } - - public final operator fun inc(): kotlin.Int { /* compiled code */ } - - public final fun inv(): kotlin.Int { /* compiled code */ } - - public final operator fun minus(other: kotlin.Byte): kotlin.Int { /* compiled code */ } - - public final operator fun minus(other: kotlin.Double): kotlin.Double { /* compiled code */ } - - public final operator fun minus(other: kotlin.Float): kotlin.Float { /* compiled code */ } - - public final operator fun minus(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun minus(other: kotlin.Long): kotlin.Long { /* compiled code */ } - - public final operator fun minus(other: kotlin.Short): kotlin.Int { /* compiled code */ } - - public final operator fun mod(other: kotlin.Byte): kotlin.Int { /* compiled code */ } - - public final operator fun mod(other: kotlin.Double): kotlin.Double { /* compiled code */ } - - public final operator fun mod(other: kotlin.Float): kotlin.Float { /* compiled code */ } - - public final operator fun mod(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun mod(other: kotlin.Long): kotlin.Long { /* compiled code */ } - - public final operator fun mod(other: kotlin.Short): kotlin.Int { /* compiled code */ } - - public final infix fun or(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun plus(other: kotlin.Byte): kotlin.Int { /* compiled code */ } - - public final operator fun plus(other: kotlin.Double): kotlin.Double { /* compiled code */ } - - public final operator fun plus(other: kotlin.Float): kotlin.Float { /* compiled code */ } - - public final operator fun plus(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun plus(other: kotlin.Long): kotlin.Long { /* compiled code */ } - - public final operator fun plus(other: kotlin.Short): kotlin.Int { /* compiled code */ } - - public final operator fun rangeTo(other: kotlin.Byte): kotlin.ranges.IntRange { /* compiled code */ } - - public final operator fun rangeTo(other: kotlin.Int): kotlin.ranges.IntRange { /* compiled code */ } - - public final operator fun rangeTo(other: kotlin.Long): kotlin.ranges.LongRange { /* compiled code */ } - - public final operator fun rangeTo(other: kotlin.Short): kotlin.ranges.IntRange { /* compiled code */ } - - public final infix fun shl(bitCount: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final infix fun shr(bitCount: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun times(other: kotlin.Byte): kotlin.Int { /* compiled code */ } - - public final operator fun times(other: kotlin.Double): kotlin.Double { /* compiled code */ } - - public final operator fun times(other: kotlin.Float): kotlin.Float { /* compiled code */ } - - public final operator fun times(other: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final operator fun times(other: kotlin.Long): kotlin.Long { /* compiled code */ } - - public final operator fun times(other: kotlin.Short): kotlin.Int { /* compiled code */ } - - public open fun toByte(): kotlin.Byte { /* compiled code */ } - - public open fun toChar(): kotlin.Char { /* compiled code */ } - - public open fun toDouble(): kotlin.Double { /* compiled code */ } - - public open fun toFloat(): kotlin.Float { /* compiled code */ } - - public open fun toInt(): kotlin.Int { /* compiled code */ } - - public open fun toLong(): kotlin.Long { /* compiled code */ } - - public open fun toShort(): kotlin.Short { /* compiled code */ } - - public final operator fun unaryMinus(): kotlin.Int { /* compiled code */ } - - public final operator fun unaryPlus(): kotlin.Int { /* compiled code */ } - - public final infix fun ushr(bitCount: kotlin.Int): kotlin.Int { /* compiled code */ } - - public final infix fun xor(other: kotlin.Int): kotlin.Int { /* compiled code */ } -} diff --git a/idea/testData/decompiler/builtIns/kotlin_package.stubs b/idea/testData/decompiler/builtIns/kotlin_package.stubs deleted file mode 100644 index 3fe1b009d4f..00000000000 --- a/idea/testData/decompiler/builtIns/kotlin_package.stubs +++ /dev/null @@ -1,246 +0,0 @@ -PsiJetFileStubImpl[package=kotlin] - PACKAGE_DIRECTIVE: - REFERENCE_EXPRESSION:[referencedName=kotlin] - IMPORT_LIST: - FUN:[fqName=kotlin.arrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=true, isExtension=false, isTopLevel=true, name=arrayOf] - MODIFIER_LIST:[public inline] - TYPE_PARAMETER_LIST: - TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=T] - MODIFIER_LIST:[reified] - ANNOTATION_ENTRY:[hasValueArguments=false, shortName=PureReifiable] - CONSTRUCTOR_CALLEE: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=internal] - REFERENCE_EXPRESSION:[referencedName=PureReifiable] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=T] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Array] - TYPE_ARGUMENT_LIST: - TYPE_PROJECTION:[projectionKind=NONE] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=T] - FUN:[fqName=kotlin.arrayOfNulls, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=true, isExtension=false, isTopLevel=true, name=arrayOfNulls] - MODIFIER_LIST:[public] - TYPE_PARAMETER_LIST: - TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=T] - MODIFIER_LIST:[reified] - ANNOTATION_ENTRY:[hasValueArguments=false, shortName=PureReifiable] - CONSTRUCTOR_CALLEE: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=internal] - REFERENCE_EXPRESSION:[referencedName=PureReifiable] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=size] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Array] - TYPE_ARGUMENT_LIST: - TYPE_PROJECTION:[projectionKind=NONE] - TYPE_REFERENCE: - NULLABLE_TYPE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=T] - FUN:[fqName=kotlin.booleanArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=booleanArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Boolean] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=BooleanArray] - FUN:[fqName=kotlin.byteArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=byteArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Byte] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=ByteArray] - FUN:[fqName=kotlin.charArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=charArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Char] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=CharArray] - FUN:[fqName=kotlin.doubleArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=doubleArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Double] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=DoubleArray] - FUN:[fqName=kotlin.emptyArray, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=true, isExtension=false, isTopLevel=true, name=emptyArray] - MODIFIER_LIST:[public inline] - TYPE_PARAMETER_LIST: - TYPE_PARAMETER:[fqName=null, isInVariance=false, isOutVariance=false, name=T] - MODIFIER_LIST:[reified] - ANNOTATION_ENTRY:[hasValueArguments=false, shortName=PureReifiable] - CONSTRUCTOR_CALLEE: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=internal] - REFERENCE_EXPRESSION:[referencedName=PureReifiable] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Array] - TYPE_ARGUMENT_LIST: - TYPE_PROJECTION:[projectionKind=NONE] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=T] - FUN:[fqName=kotlin.floatArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=floatArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Float] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=FloatArray] - FUN:[fqName=kotlin.intArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=intArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=IntArray] - FUN:[fqName=kotlin.longArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=longArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Long] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=LongArray] - FUN:[fqName=kotlin.shortArrayOf, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=true, name=shortArrayOf] - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=elements] - MODIFIER_LIST:[vararg] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Short] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=ShortArray] - FUN:[fqName=kotlin.plus, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=true, isTopLevel=true, name=plus] - MODIFIER_LIST:[public operator] - TYPE_REFERENCE: - NULLABLE_TYPE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=String] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=other] - TYPE_REFERENCE: - NULLABLE_TYPE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Any] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=String] - FUN:[fqName=kotlin.toString, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=true, isTopLevel=true, name=toString] - MODIFIER_LIST:[public] - TYPE_REFERENCE: - NULLABLE_TYPE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Any] - VALUE_PARAMETER_LIST: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=String] diff --git a/idea/testData/decompiler/builtIns/kotlin_package.text b/idea/testData/decompiler/builtIns/kotlin_package.text deleted file mode 100644 index 37404764e8c..00000000000 --- a/idea/testData/decompiler/builtIns/kotlin_package.text +++ /dev/null @@ -1,31 +0,0 @@ -// IntelliJ API Decompiler stub source generated from a class file -// Implementation of methods is not available - -package kotlin - -public inline fun arrayOf(vararg elements: T): kotlin.Array { /* compiled code */ } - -public fun arrayOfNulls(size: kotlin.Int): kotlin.Array { /* compiled code */ } - -public fun booleanArrayOf(vararg elements: kotlin.Boolean): kotlin.BooleanArray { /* compiled code */ } - -public fun byteArrayOf(vararg elements: kotlin.Byte): kotlin.ByteArray { /* compiled code */ } - -public fun charArrayOf(vararg elements: kotlin.Char): kotlin.CharArray { /* compiled code */ } - -public fun doubleArrayOf(vararg elements: kotlin.Double): kotlin.DoubleArray { /* compiled code */ } - -public inline fun emptyArray(): kotlin.Array { /* compiled code */ } - -public fun floatArrayOf(vararg elements: kotlin.Float): kotlin.FloatArray { /* compiled code */ } - -public fun intArrayOf(vararg elements: kotlin.Int): kotlin.IntArray { /* compiled code */ } - -public fun longArrayOf(vararg elements: kotlin.Long): kotlin.LongArray { /* compiled code */ } - -public fun shortArrayOf(vararg elements: kotlin.Short): kotlin.ShortArray { /* compiled code */ } - -public operator fun kotlin.String?.plus(other: kotlin.Any?): kotlin.String { /* compiled code */ } - -public fun kotlin.Any?.toString(): kotlin.String { /* compiled code */ } - diff --git a/idea/testData/resolve/builtins/any.kt b/idea/testData/resolve/builtins/any.kt index 0ef31da3c68..ff2bf8d0d6b 100644 --- a/idea/testData/resolve/builtins/any.kt +++ b/idea/testData/resolve/builtins/any.kt @@ -1,4 +1,4 @@ var x : Any? -// BINARY: kotlin/Any.kotlin_class +// BINARY: kotlin/kotlin.kotlin_builtins // SRC: kotlin/Any.kt // TARGET: (kotlin).Any \ No newline at end of file diff --git a/idea/testData/resolve/builtins/equals.kt b/idea/testData/resolve/builtins/equals.kt index 494d1cb6f80..dc7648f389d 100644 --- a/idea/testData/resolve/builtins/equals.kt +++ b/idea/testData/resolve/builtins/equals.kt @@ -1,4 +1,4 @@ val x = 5.equals(5) -// BINARY: kotlin/Any.kotlin_class +// BINARY: kotlin/kotlin.kotlin_builtins // SRC: kotlin/Any.kt // TARGET: (in kotlin.Any).equals(Any?) \ No newline at end of file diff --git a/idea/testData/resolve/builtins/int.kt b/idea/testData/resolve/builtins/int.kt index 1bc2a04f1b9..e6142c30abe 100644 --- a/idea/testData/resolve/builtins/int.kt +++ b/idea/testData/resolve/builtins/int.kt @@ -1,4 +1,4 @@ val x : Int? -// BINARY: kotlin/Int.kotlin_class +// BINARY: kotlin/kotlin.kotlin_builtins // SRC: kotlin/Primitives.kt // TARGET: (kotlin).Int \ No newline at end of file diff --git a/idea/testData/resolve/builtins/intArrayConstructor.kt b/idea/testData/resolve/builtins/intArrayConstructor.kt index 7aca6284e57..401e998c10d 100644 --- a/idea/testData/resolve/builtins/intArrayConstructor.kt +++ b/idea/testData/resolve/builtins/intArrayConstructor.kt @@ -1,4 +1,4 @@ val ia = IntArray(4) -// BINARY: kotlin/IntArray.kotlin_class +// BINARY: kotlin/kotlin.kotlin_builtins // SRC: kotlin/Arrays.kt // TARGET: (in kotlin.IntArray).IntArray(Int) \ No newline at end of file diff --git a/idea/testData/resolve/builtins/nothing.kt b/idea/testData/resolve/builtins/nothing.kt index bb30b6e73d7..c2bb60e88e9 100644 --- a/idea/testData/resolve/builtins/nothing.kt +++ b/idea/testData/resolve/builtins/nothing.kt @@ -1,4 +1,4 @@ var x : Nothing -// BINARY: kotlin/Nothing.kotlin_class +// BINARY: kotlin/kotlin.kotlin_builtins // SRC: kotlin/Nothing.kt // TARGET: (kotlin).Nothing \ No newline at end of file diff --git a/idea/testData/resolve/builtins/times.kt b/idea/testData/resolve/builtins/times.kt index 65407f16d1f..6073016a87f 100644 --- a/idea/testData/resolve/builtins/times.kt +++ b/idea/testData/resolve/builtins/times.kt @@ -1,4 +1,4 @@ val x = 2.0 * 3.0 -// BINARY: kotlin/Double.kotlin_class +// BINARY: kotlin/kotlin.kotlin_builtins // SRC: kotlin/Primitives.kt // TARGET: (in kotlin.Double).times(Double) \ No newline at end of file diff --git a/idea/testData/resolve/builtins/toString.kt b/idea/testData/resolve/builtins/toString.kt index a087237d2ec..d6a53b3de09 100644 --- a/idea/testData/resolve/builtins/toString.kt +++ b/idea/testData/resolve/builtins/toString.kt @@ -1,4 +1,4 @@ val x = 5.toString() -// BINARY: kotlin/Any.kotlin_class +// BINARY: kotlin/kotlin.kotlin_builtins // SRC: kotlin/Any.kt // TARGET: (in kotlin.Any).toString() diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt index 92d5306e172..85c89bfedd7 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt @@ -16,70 +16,83 @@ package org.jetbrains.kotlin.idea.decompiler.stubBuilder +import com.intellij.ide.highlighter.JavaClassFileType import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.PsiManager -import com.intellij.psi.compiled.ClassFileDecompilers import com.intellij.psi.search.GlobalSearchScope import com.intellij.util.indexing.FileContentImpl +import org.jetbrains.kotlin.builtins.BuiltInsSerializedResourcePaths +import org.jetbrains.kotlin.idea.caches.IDEKotlinBinaryClassCache +import org.jetbrains.kotlin.idea.decompiler.builtIns.BuiltInDefinitionFile import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInDecompiler -import org.jetbrains.kotlin.idea.decompiler.builtIns.buildDecompiledTextForBuiltIns -import org.jetbrains.kotlin.idea.decompiler.builtIns.isInternalBuiltInFile import org.jetbrains.kotlin.idea.decompiler.classFile.KotlinClassFileDecompiler import org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.psi.stubs.KotlinClassStub +import org.jetbrains.kotlin.psi.stubs.elements.KtClassElementType import org.junit.Assert class BuiltInDecompilerConsistencyTest : KotlinLightCodeInsightFixtureTestCase() { private val classFileDecompiler = KotlinClassFileDecompiler() private val builtInsDecompiler = KotlinBuiltInDecompiler() + override fun setUp() { + super.setUp() + BuiltInDefinitionFile.FILTER_OUT_CLASSES_EXISTING_AS_JVM_CLASS_FILES = false + } + + override fun tearDown() { + BuiltInDefinitionFile.FILTER_OUT_CLASSES_EXISTING_AS_JVM_CLASS_FILES = true + super.tearDown() + } + fun testSameAsClsDecompilerForCompiledBuiltInClasses() { - checkTextAndStubTreeMatchForClassesInDirectory(findDir("kotlin", project)) - checkTextAndStubTreeMatchForClassesInDirectory(findDir("kotlin.annotation", project)) - checkTextAndStubTreeMatchForClassesInDirectory(findDir("kotlin.reflect", project)) + doTest("kotlin") + doTest("kotlin.annotation") + doTest("kotlin.collections") + doTest("kotlin.ranges") + doTest("kotlin.reflect") } - // check builtIn decompiler against classFile decompiler, assuming the latter is well tested - // check for classes which are both compiled to jvm (.class) and serialized (.kotlin_class) - // in IDE we would actually hide corresponding .kotlin_class files and show .class files only - private fun checkTextAndStubTreeMatchForClassesInDirectory(dir: VirtualFile) { + // Check stubs for decompiled built-in classes against stubs for decompiled JVM class files, assuming the latter are well tested + // Check only those classes, stubs for which are present in the stub for a decompiled .kotlin_builtins file + private fun doTest(packageFqName: String) { + val dir = findDir(packageFqName, project) val groupedByExtension = dir.children.groupBy { it.extension } - val classFiles = groupedByExtension["class"]!!.map { it.nameWithoutExtension } - val kotlinClassFiles = groupedByExtension["kotlin_class"]!!.map { it.nameWithoutExtension } - val intersection = classFiles.intersect(kotlinClassFiles) + val classFiles = groupedByExtension[JavaClassFileType.INSTANCE.defaultExtension]!!.map { it.nameWithoutExtension } + val builtInsFile = groupedByExtension[BuiltInsSerializedResourcePaths.BUILTINS_FILE_EXTENSION]!!.single() - Assert.assertTrue("Some classes should be present", intersection.isNotEmpty()) + val builtInFileStub = builtInsDecompiler.stubBuilder.buildFileStub(FileContentImpl.createByFile(builtInsFile))!! - intersection.forEach { className -> - val classFile = dir.findChild(className + ".class")!! - val builtInFile = dir.findChild(className + ".kotlin_class")!! - Assert.assertEquals( - "Text mismatch for $className", getText(classFile, classFileDecompiler), - buildDecompiledTextForBuiltIns(builtInFile).text // use internal api to avoid calling isInternalBuiltInFile - ) + val classesEncountered = arrayListOf() - Assert.assertTrue(isInternalBuiltInFile(builtInFile)) - - val classFileStub = classFileDecompiler.stubBuilder.buildFileStub(FileContentImpl.createByFile(classFile))!! - // use internal api to avoid calling isInternalBuiltInFile - val builtInFileStub = builtInsDecompiler.stubBuilder.doBuildFileStub(FileContentImpl.createByFile(builtInFile))!! - Assert.assertEquals("Stub mismatch for $className", classFileStub.serializeToString(), builtInFileStub.serializeToString()) + for (className in classFiles) { + val classFile = dir.findChild(className + "." + JavaClassFileType.INSTANCE.defaultExtension)!! + val fileContent = FileContentImpl.createByFile(classFile) + if (IDEKotlinBinaryClassCache.getKotlinBinaryClassHeaderData(fileContent.file) == null) continue + val fileStub = classFileDecompiler.stubBuilder.buildFileStub(fileContent) ?: continue + val classStub = fileStub.findChildStubByType(KtClassElementType.getStubType(false)) as? KotlinClassStub ?: continue + val classFqName = classStub.getFqName()!! + val builtInClassStub = builtInFileStub.childrenStubs.firstOrNull { + it is KotlinClassStub && it.getFqName() == classFqName + } ?: continue + Assert.assertEquals("Stub mismatch for $classFqName", classStub.serializeToString(), builtInClassStub.serializeToString()) + classesEncountered.add(classFqName) } - } - private fun getText(file: VirtualFile, kotlinClassFileDecompiler: ClassFileDecompilers.Full): String { - return kotlinClassFileDecompiler.createFileViewProvider(file, PsiManager.getInstance(project), false).document!!.text + Assert.assertTrue("Too few classes encountered in package $packageFqName: $classesEncountered", classesEncountered.size >= 5) } override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE } - -fun findDir(packageFqName: String, project: Project): VirtualFile { +internal fun findDir(packageFqName: String, project: Project): VirtualFile { val classNameIndex = KotlinFullClassNameIndex.getInstance() - val randomClassInPackage = classNameIndex.getAllKeys(project).find { it.startsWith(packageFqName + ".") && "." !in it.substringAfter(packageFqName + ".") }!! + val randomClassInPackage = classNameIndex.getAllKeys(project).first { + it.startsWith(packageFqName + ".") && "." !in it.substringAfter(packageFqName + ".") + } val classes = classNameIndex.get(randomClassInPackage, project, GlobalSearchScope.allScope(project)) - return classes.first().containingFile.virtualFile.parent!! -} \ No newline at end of file + return classes.first().containingFile.virtualFile.parent +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt index 277af4459f8..f40eb1f5d08 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt @@ -18,47 +18,30 @@ package org.jetbrains.kotlin.idea.decompiler.stubBuilder import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import com.intellij.util.indexing.FileContentImpl -import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInClassFileType -import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInPackageFileType +import org.jetbrains.kotlin.builtins.BuiltInsSerializedResourcePaths import org.jetbrains.kotlin.idea.decompiler.builtIns.KotlinBuiltInStubBuilder import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase import org.jetbrains.kotlin.psi.stubs.elements.KtFileStubBuilder -import org.jetbrains.kotlin.test.KotlinTestUtils import org.junit.Assert -import java.io.File class BuiltInDecompilerTest : LightCodeInsightFixtureTestCase() { - - fun testAny() { - doTest("Any.${KotlinBuiltInClassFileType.defaultExtension}", "Any") + fun testBuiltInStubTreeEqualToStubTreeFromDecompiledText() { + doTest("kotlin") + doTest("kotlin.collections") } - fun testInt() { - doTest("Int.${KotlinBuiltInClassFileType.defaultExtension}", "Int") - } + private fun doTest(packageFqName: String) { + val dirInRuntime = findDir(packageFqName, project) + val kotlinBuiltInsVirtualFile = dirInRuntime.children.single { + it.extension == BuiltInsSerializedResourcePaths.BUILTINS_FILE_EXTENSION + } + val stubTreeFromDecompiler = KotlinBuiltInStubBuilder().buildFileStub(FileContentImpl.createByFile(kotlinBuiltInsVirtualFile))!! + myFixture.configureFromExistingVirtualFile(kotlinBuiltInsVirtualFile) - fun testKotlinPackage() { - doTest("kotlin.${KotlinBuiltInPackageFileType.defaultExtension}", "kotlin_package") - } - - private fun doTest(fileName: String, testDataName: String) { - val kotlinDirInRuntime = findDir("kotlin", project) - val anyKotlinClass = kotlinDirInRuntime.findChild(fileName)!! - val stubTreeFromDecompiler = KotlinBuiltInStubBuilder().buildFileStub(FileContentImpl.createByFile(anyKotlinClass))!! - myFixture.configureFromExistingVirtualFile(anyKotlinClass) - val psiFile = myFixture.file - KotlinTestUtils.assertEqualsToFile(File(testDirPath + "$testDataName.text"), psiFile.text) - - val stubTreeFromDecompiledText = KtFileStubBuilder().buildStubTree(psiFile) + val stubTreeFromDecompiledText = KtFileStubBuilder().buildStubTree(myFixture.file) val expectedText = stubTreeFromDecompiledText.serializeToString() - Assert.assertEquals(expectedText, stubTreeFromDecompiler.serializeToString()) - KotlinTestUtils.assertEqualsToFile(File(testDirPath + "$testDataName.stubs"), expectedText) + Assert.assertEquals("Stub mismatch for package $packageFqName", expectedText, stubTreeFromDecompiler.serializeToString()) } override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - - companion object { - private val testDirPath = PluginTestCaseBase.getTestDataPathBase() + "/decompiler/builtIns/" - } }