From deb6410a5c5b78456013d5cbca57d109cb2d51c3 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Tue, 8 Dec 2015 16:51:46 +0300 Subject: [PATCH] Add test for builtIn stub builder and decompiler These test are by no means exhaustive, the correctness of the subsystem relies on it sharing code with well-tested js-decompilation --- idea/testData/decompiler/builtIns/Any.stubs | 41 + idea/testData/decompiler/builtIns/Any.text | 12 + idea/testData/decompiler/builtIns/Int.stubs | 787 ++++++++++++++++++ idea/testData/decompiler/builtIns/Int.text | 125 +++ .../decompiler/builtIns/kotlin_package.stubs | 90 ++ .../decompiler/builtIns/kotlin_package.text | 12 + .../BuiltInDecompilerConsistencyTest.kt | 85 ++ .../stubBuilder/BuiltInDecompilerTest.kt | 64 ++ 8 files changed, 1216 insertions(+) create mode 100644 idea/testData/decompiler/builtIns/Any.stubs create mode 100644 idea/testData/decompiler/builtIns/Any.text create mode 100644 idea/testData/decompiler/builtIns/Int.stubs create mode 100644 idea/testData/decompiler/builtIns/Int.text create mode 100644 idea/testData/decompiler/builtIns/kotlin_package.stubs create mode 100644 idea/testData/decompiler/builtIns/kotlin_package.text create mode 100644 idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt create mode 100644 idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt diff --git a/idea/testData/decompiler/builtIns/Any.stubs b/idea/testData/decompiler/builtIns/Any.stubs new file mode 100644 index 00000000000..d4696ad67ac --- /dev/null +++ b/idea/testData/decompiler/builtIns/Any.stubs @@ -0,0 +1,41 @@ +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 new file mode 100644 index 00000000000..7e193fb003b --- /dev/null +++ b/idea/testData/decompiler/builtIns/Any.text @@ -0,0 +1,12 @@ +// 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 new file mode 100644 index 00000000000..a1460b61766 --- /dev/null +++ b/idea/testData/decompiler/builtIns/Int.stubs @@ -0,0 +1,787 @@ +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: + DELEGATION_SPECIFIER_LIST: + DELEGATOR_SUPER_CLASS: + TYPE_REFERENCE: + USER_TYPE:[isAbsoluteInRootPackage=false] + USER_TYPE:[isAbsoluteInRootPackage=false] + REFERENCE_EXPRESSION:[referencedName=kotlin] + REFERENCE_EXPRESSION:[referencedName=Number] + DELEGATOR_SUPER_CLASS: + 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=[IntegerConstants]] + MODIFIER_LIST:[public companion] + DELEGATION_SPECIFIER_LIST: + DELEGATOR_SUPER_CLASS: + TYPE_REFERENCE: + USER_TYPE:[isAbsoluteInRootPackage=false] + USER_TYPE:[isAbsoluteInRootPackage=false] + REFERENCE_EXPRESSION:[referencedName=kotlin] + REFERENCE_EXPRESSION:[referencedName=IntegerConstants] + 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: + 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] + REFERENCE_EXPRESSION:[referencedName=kotlin] + 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] + REFERENCE_EXPRESSION:[referencedName=kotlin] + 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] + REFERENCE_EXPRESSION:[referencedName=kotlin] + 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] + REFERENCE_EXPRESSION:[referencedName=kotlin] + 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 new file mode 100644 index 00000000000..3652ab5c99b --- /dev/null +++ b/idea/testData/decompiler/builtIns/Int.text @@ -0,0 +1,125 @@ +// 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 : kotlin.IntegerConstants { + } + + 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.IntRange { /* compiled code */ } + + public final operator fun rangeTo(other: kotlin.Int): kotlin.IntRange { /* compiled code */ } + + public final operator fun rangeTo(other: kotlin.Long): kotlin.LongRange { /* compiled code */ } + + public final operator fun rangeTo(other: kotlin.Short): kotlin.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 new file mode 100644 index 00000000000..e8efb2e9076 --- /dev/null +++ b/idea/testData/decompiler/builtIns/kotlin_package.stubs @@ -0,0 +1,90 @@ +PsiJetFileStubImpl[package=kotlin] + PACKAGE_DIRECTIVE: + REFERENCE_EXPRESSION:[referencedName=kotlin] + IMPORT_LIST: + 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] + 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.identityEquals, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=true, isTopLevel=true, name=identityEquals] + MODIFIER_LIST:[public] + ANNOTATION_ENTRY:[hasValueArguments=false, shortName=Deprecated] + CONSTRUCTOR_CALLEE: + TYPE_REFERENCE: + USER_TYPE:[isAbsoluteInRootPackage=false] + USER_TYPE:[isAbsoluteInRootPackage=false] + REFERENCE_EXPRESSION:[referencedName=kotlin] + REFERENCE_EXPRESSION:[referencedName=Deprecated] + TYPE_REFERENCE: + NULLABLE_TYPE: + USER_TYPE:[isAbsoluteInRootPackage=false] + USER_TYPE:[isAbsoluteInRootPackage=false] + REFERENCE_EXPRESSION:[referencedName=kotlin] + REFERENCE_EXPRESSION:[referencedName=Any] + 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.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 new file mode 100644 index 00000000000..ecaa6cd2c09 --- /dev/null +++ b/idea/testData/decompiler/builtIns/kotlin_package.text @@ -0,0 +1,12 @@ +// IntelliJ API Decompiler stub source generated from a class file +// Implementation of methods is not available + +package kotlin + +public fun arrayOfNulls(size: kotlin.Int): kotlin.Array { /* compiled code */ } + +@kotlin.Deprecated public fun kotlin.Any?.identityEquals(other: kotlin.Any?): kotlin.Boolean { /* 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/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt new file mode 100644 index 00000000000..92d5306e172 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerConsistencyTest.kt @@ -0,0 +1,85 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.decompiler.stubBuilder + +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.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.junit.Assert + +class BuiltInDecompilerConsistencyTest : KotlinLightCodeInsightFixtureTestCase() { + private val classFileDecompiler = KotlinClassFileDecompiler() + private val builtInsDecompiler = KotlinBuiltInDecompiler() + + fun testSameAsClsDecompilerForCompiledBuiltInClasses() { + checkTextAndStubTreeMatchForClassesInDirectory(findDir("kotlin", project)) + checkTextAndStubTreeMatchForClassesInDirectory(findDir("kotlin.annotation", project)) + checkTextAndStubTreeMatchForClassesInDirectory(findDir("kotlin.reflect", project)) + } + + // 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) { + 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) + + Assert.assertTrue("Some classes should be present", intersection.isNotEmpty()) + + 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 + ) + + 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()) + } + } + + private fun getText(file: VirtualFile, kotlinClassFileDecompiler: ClassFileDecompilers.Full): String { + return kotlinClassFileDecompiler.createFileViewProvider(file, PsiManager.getInstance(project), false).document!!.text + } + + override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE +} + + +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 classes = classNameIndex.get(randomClassInPackage, project, GlobalSearchScope.allScope(project)) + return classes.first().containingFile.virtualFile.parent!! +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt new file mode 100644 index 00000000000..358a47a9418 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt @@ -0,0 +1,64 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +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.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 testInt() { + doTest("Int.${KotlinBuiltInClassFileType.defaultExtension}", "Int") + } + + 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(testDataPath + "$testDataName.text"), psiFile.text) + + val stubTreeFromDecompiledText = KtFileStubBuilder().buildStubTree(psiFile) + val expectedText = stubTreeFromDecompiledText.serializeToString() + Assert.assertEquals(expectedText, stubTreeFromDecompiler.serializeToString()) + KotlinTestUtils.assertEqualsToFile(File(testDataPath + "$testDataName.stubs"), expectedText) + } + + override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE + + companion object { + private val testDataPath = PluginTestCaseBase.getTestDataPathBase() + "/decompiler/builtIns/" + } +}