From cb6941d2129ab1c4ce69055984584fc0ed880145 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 21 Apr 2022 17:00:53 +0100 Subject: [PATCH 01/34] Account for JVM type equivalency when recognising unspecialised types (As before, these are not really unspecialised, they are instantiated by their own type parameters, but this replicates the behaviour of the Java extractor) --- .../src/main/kotlin/KotlinUsesExtractor.kt | 5 +---- .../src/main/kotlin/utils/ClassNames.kt | 7 ++++++- .../src/main/kotlin/utils/TypeSubstitution.kt | 16 +++++++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 2c58842e9e4..3b9454755f1 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -122,10 +122,7 @@ open class KotlinUsesExtractor( } fun getJavaEquivalentClass(c: IrClass) = - c.fqNameWhenAvailable?.toUnsafe() - ?.let { JavaToKotlinClassMap.mapKotlinToJava(it) } - ?.let { pluginContext.referenceClass(it.asSingleFqName()) } - ?.owner + getJavaEquivalentClassId(c)?.let { pluginContext.referenceClass(it.asSingleFqName()) }?.owner /** * Gets a KotlinFileExtractor based on this one, except it attributes locations to the file that declares the given class. diff --git a/java/kotlin-extractor/src/main/kotlin/utils/ClassNames.kt b/java/kotlin-extractor/src/main/kotlin/utils/ClassNames.kt index cdcdd535a2c..5a9713087eb 100644 --- a/java/kotlin-extractor/src/main/kotlin/utils/ClassNames.kt +++ b/java/kotlin-extractor/src/main/kotlin/utils/ClassNames.kt @@ -7,7 +7,9 @@ import org.jetbrains.kotlin.load.kotlin.VirtualFileKotlinClass import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable import org.jetbrains.kotlin.ir.util.parentClassOrNull import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource @@ -84,4 +86,7 @@ fun getContainingClassOrSelf(decl: IrDeclaration): IrClass? { is IrClass -> decl else -> decl.parentClassOrNull } -} \ No newline at end of file +} + +fun getJavaEquivalentClassId(c: IrClass) = + c.fqNameWhenAvailable?.toUnsafe()?.let { JavaToKotlinClassMap.mapKotlinToJava(it) } \ No newline at end of file diff --git a/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt b/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt index 5e0d392ca64..b297e917de2 100644 --- a/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt +++ b/java/kotlin-extractor/src/main/kotlin/utils/TypeSubstitution.kt @@ -1,6 +1,7 @@ package com.github.codeql.utils import com.github.codeql.KotlinUsesExtractor +import com.github.codeql.getJavaEquivalentClassId import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor import org.jetbrains.kotlin.descriptors.ClassKind @@ -19,6 +20,7 @@ import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection +import org.jetbrains.kotlin.ir.util.classId import org.jetbrains.kotlin.ir.util.constructedClassType import org.jetbrains.kotlin.ir.util.constructors import org.jetbrains.kotlin.ir.util.parentAsClass @@ -195,13 +197,25 @@ fun IrTypeArgument.withQuestionMark(b: Boolean): IrTypeArgument = typealias TypeSubstitution = (IrType, KotlinUsesExtractor.TypeContext, IrPluginContext) -> IrType +fun matchingTypeParameters(l: IrTypeParameter?, r: IrTypeParameter): Boolean { + if (l === r) + return true + if (l == null) + return false + // Special case: match List's E and MutableList's E, for example, because in the JVM lowering they will map to the same thing. + val lParent = l.parent as? IrClass ?: return false + val rParent = r.parent as? IrClass ?: return false + val lJavaId = getJavaEquivalentClassId(lParent) ?: lParent.classId + return (getJavaEquivalentClassId(rParent) ?: rParent.classId) == lJavaId && l.name == r.name +} + // Returns true if type is C where C is declared `class C { ... }` fun isUnspecialised(paramsContainer: IrTypeParametersContainer, args: List): Boolean { val unspecialisedHere = paramsContainer.typeParameters.zip(args).all { paramAndArg -> (paramAndArg.second as? IrTypeProjection)?.let { // Type arg refers to the class' own type parameter? it.variance == Variance.INVARIANT && - it.type.classifierOrNull?.owner === paramAndArg.first + matchingTypeParameters(it.type.classifierOrNull?.owner as? IrTypeParameter, paramAndArg.first) } ?: false } val remainingArgs = args.drop(paramsContainer.typeParameters.size) From 12e3401ae062978b44889e4ff37bd3e1a4b273fb Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 22 Apr 2022 16:56:47 +0100 Subject: [PATCH 02/34] Map special getters onto their correct JVM names These include Collection.size() for example, which has a Kotlin property called `size` but whose getter is not named `getSize()`. These would normally be accounted for using `@JvmName`, but some core methods are lowered by a special compiler pass instead. --- .../src/main/kotlin/KotlinUsesExtractor.kt | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 3b9454755f1..49a3cfde922 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -4,8 +4,9 @@ import com.github.codeql.utils.* import com.github.codeql.utils.versions.isRawType import com.semmle.extractor.java.OdasaOutput import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.backend.common.ir.allOverridden import org.jetbrains.kotlin.backend.common.lower.parentsWithSelf -import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap +import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.DescriptorVisibilities import org.jetbrains.kotlin.ir.declarations.* @@ -19,6 +20,7 @@ import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.util.OperatorNameConventions @@ -49,6 +51,41 @@ open class KotlinUsesExtractor( TypeResult(fakeKotlinType(), "", "") ) + private data class MethodKey(val className: FqName, val functionName: Name) + + private fun makeDescription(className: FqName, functionName: String) = MethodKey(className, Name.guessByFirstCharacter(functionName)) + + // This essentially mirrors SpecialBridgeMethods.kt, a backend pass which isn't easily available to our extractor. + private val specialFunctions = mapOf( + makeDescription(StandardNames.FqNames.collection, "") to "size", + makeDescription(FqName("java.util.Collection"), "") to "size", + makeDescription(StandardNames.FqNames.map, "") to "size", + makeDescription(FqName("java.util.Map"), "") to "size", + makeDescription(StandardNames.FqNames.charSequence.toSafe(), "") to "length", + makeDescription(FqName("java.lang.CharSequence"), "") to "length", + makeDescription(StandardNames.FqNames.map, "") to "keys", + makeDescription(FqName("java.util.Map"), "") to "keys", + makeDescription(StandardNames.FqNames.map, "") to "values", + makeDescription(FqName("java.util.Map"), "") to "values", + makeDescription(StandardNames.FqNames.map, "") to "entries", + makeDescription(FqName("java.util.Map"), "") to "entries" + ) + + private val specialFunctionShortNames = specialFunctions.keys.map { it.functionName }.toSet() + + fun getSpecialJvmName(f: IrFunction): String? { + if (specialFunctionShortNames.contains(f.name) && f is IrSimpleFunction) { + f.allOverridden(true).forEach { overriddenFunc -> + overriddenFunc.parentAsClass.fqNameWhenAvailable?.let { parentFqName -> + specialFunctions[MethodKey(parentFqName, f.name)]?.let { + return it + } + } + } + } + return null + } + fun getJvmName(container: IrAnnotationContainer): String? { for(a: IrConstructorCall in container.annotations) { val t = a.type @@ -67,7 +104,7 @@ open class KotlinUsesExtractor( } } } - return null + return (container as? IrFunction)?.let { getSpecialJvmName(container) } } @OptIn(kotlin.ExperimentalStdlibApi::class) // Annotation required by kotlin versions < 1.5 From 134f88fe8e7f8d38fd7ea5d2b818c861d5f968c0 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Mon, 25 Apr 2022 14:57:42 +0100 Subject: [PATCH 03/34] Accept test results --- java/ql/test/kotlin/library-tests/reflection/PrintAst.expected | 2 +- java/ql/test/kotlin/library-tests/types/types.expected | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/java/ql/test/kotlin/library-tests/reflection/PrintAst.expected b/java/ql/test/kotlin/library-tests/reflection/PrintAst.expected index 3918bc031b6..13b6b6e63b2 100644 --- a/java/ql/test/kotlin/library-tests/reflection/PrintAst.expected +++ b/java/ql/test/kotlin/library-tests/reflection/PrintAst.expected @@ -11,7 +11,7 @@ reflection.kt: # 47| 0: [MethodAccess] get(...) # 47| -1: [ExtensionReceiverAccess] this # 47| 0: [SubExpr] ... - ... -# 47| 0: [MethodAccess] getLength(...) +# 47| 0: [MethodAccess] length(...) # 47| -1: [ExtensionReceiverAccess] this # 47| 1: [IntegerLiteral] 1 # 49| 2: [Method] fn2 diff --git a/java/ql/test/kotlin/library-tests/types/types.expected b/java/ql/test/kotlin/library-tests/types/types.expected index 7802402a108..5fe5d97d0b2 100644 --- a/java/ql/test/kotlin/library-tests/types/types.expected +++ b/java/ql/test/kotlin/library-tests/types/types.expected @@ -1406,7 +1406,6 @@ | ListIterator | GenericType, Interface, ParameterizedType | | ListIterator<> | Interface, RawType | | ListIterator | Interface, ParameterizedType | -| ListIterator | Interface, ParameterizedType | | LoadOperation | GenericType, Interface, ParameterizedType | | LoadOperation<> | Interface, RawType | | LoadOperation | Interface, ParameterizedType | From 1e78f2893c2273e3eb1be01c34aa8b66b93c4781 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Mon, 25 Apr 2022 21:10:24 +0100 Subject: [PATCH 04/34] Add test for special method getters --- .../src/main/kotlin/KotlinUsesExtractor.kt | 8 ++++---- .../library-tests/special-method-getters/test.expected | 9 +++++++++ .../kotlin/library-tests/special-method-getters/test.kt | 1 + .../kotlin/library-tests/special-method-getters/test.ql | 4 ++++ 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 java/ql/test/kotlin/library-tests/special-method-getters/test.expected create mode 100644 java/ql/test/kotlin/library-tests/special-method-getters/test.kt create mode 100644 java/ql/test/kotlin/library-tests/special-method-getters/test.ql diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 49a3cfde922..643f548f837 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -63,12 +63,12 @@ open class KotlinUsesExtractor( makeDescription(FqName("java.util.Map"), "") to "size", makeDescription(StandardNames.FqNames.charSequence.toSafe(), "") to "length", makeDescription(FqName("java.lang.CharSequence"), "") to "length", - makeDescription(StandardNames.FqNames.map, "") to "keys", - makeDescription(FqName("java.util.Map"), "") to "keys", + makeDescription(StandardNames.FqNames.map, "") to "keySet", + makeDescription(FqName("java.util.Map"), "") to "keySet", makeDescription(StandardNames.FqNames.map, "") to "values", makeDescription(FqName("java.util.Map"), "") to "values", - makeDescription(StandardNames.FqNames.map, "") to "entries", - makeDescription(FqName("java.util.Map"), "") to "entries" + makeDescription(StandardNames.FqNames.map, "") to "entrySet", + makeDescription(FqName("java.util.Map"), "") to "entrySet" ) private val specialFunctionShortNames = specialFunctions.keys.map { it.functionName }.toSet() diff --git a/java/ql/test/kotlin/library-tests/special-method-getters/test.expected b/java/ql/test/kotlin/library-tests/special-method-getters/test.expected new file mode 100644 index 00000000000..fdec7b0e605 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/special-method-getters/test.expected @@ -0,0 +1,9 @@ +| test.kt:1:84:1:89 | length(...) | length | +| test.kt:1:97:1:100 | size(...) | size | +| test.kt:1:108:1:111 | size(...) | size | +| test.kt:1:119:1:122 | keySet(...) | keySet | +| test.kt:1:124:1:127 | size(...) | size | +| test.kt:1:135:1:140 | values(...) | values | +| test.kt:1:142:1:145 | size(...) | size | +| test.kt:1:153:1:159 | entrySet(...) | entrySet | +| test.kt:1:161:1:164 | size(...) | size | diff --git a/java/ql/test/kotlin/library-tests/special-method-getters/test.kt b/java/ql/test/kotlin/library-tests/special-method-getters/test.kt new file mode 100644 index 00000000000..d83aee0f131 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/special-method-getters/test.kt @@ -0,0 +1 @@ +fun test(cs: CharSequence, col: Collection, map: Map) = cs.length + col.size + map.size + map.keys.size + map.values.size + map.entries.size diff --git a/java/ql/test/kotlin/library-tests/special-method-getters/test.ql b/java/ql/test/kotlin/library-tests/special-method-getters/test.ql new file mode 100644 index 00000000000..257b3344501 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/special-method-getters/test.ql @@ -0,0 +1,4 @@ +import java + +from MethodAccess ma +select ma, ma.getCallee().toString() From 25fce5f6bb34960401cfc5f9e34db2230ef606d6 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 26 Apr 2022 09:47:30 +0200 Subject: [PATCH 05/34] Identify data classes during extraction --- .../src/main/kotlin/KotlinFileExtractor.kt | 4 ++++ java/ql/lib/config/semmlecode.dbscheme | 4 ++++ java/ql/lib/semmle/code/java/Type.qll | 7 +++++++ .../library-tests/data-classes/data_classes.expected | 1 + .../test/kotlin/library-tests/data-classes/data_classes.ql | 5 +++++ 5 files changed, 21 insertions(+) create mode 100644 java/ql/test/kotlin/library-tests/data-classes/data_classes.expected create mode 100644 java/ql/test/kotlin/library-tests/data-classes/data_classes.ql diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index c5f29a3eff7..93d58a2b872 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -386,6 +386,10 @@ open class KotlinFileExtractor( } else if (kind != ClassKind.CLASS && kind != ClassKind.OBJECT) { logger.warnElement("Unrecognised class kind $kind", c) } + + if (c.isData) { + tw.writeKtDataClasses(classId) + } } val locId = tw.getLocation(c) diff --git a/java/ql/lib/config/semmlecode.dbscheme b/java/ql/lib/config/semmlecode.dbscheme index b9225587bc0..4d08fc9cb3c 100755 --- a/java/ql/lib/config/semmlecode.dbscheme +++ b/java/ql/lib/config/semmlecode.dbscheme @@ -1232,3 +1232,7 @@ ktFunctionOriginalNames( unique int id: @method ref, string name: string ref ) + +ktDataClasses( + unique int id: @class ref +) diff --git a/java/ql/lib/semmle/code/java/Type.qll b/java/ql/lib/semmle/code/java/Type.qll index d2c28f27936..1ad46f15640 100755 --- a/java/ql/lib/semmle/code/java/Type.qll +++ b/java/ql/lib/semmle/code/java/Type.qll @@ -714,6 +714,13 @@ class CompanionObject extends Class { Field getInstance() { type_companion_object(_, result, this) } } +/** + * A Kotlin data class declaration. + */ +class DataClass extends Class { + DataClass() { ktDataClasses(this) } +} + /** * A record declaration. */ diff --git a/java/ql/test/kotlin/library-tests/data-classes/data_classes.expected b/java/ql/test/kotlin/library-tests/data-classes/data_classes.expected new file mode 100644 index 00000000000..83ca5b96184 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/data-classes/data_classes.expected @@ -0,0 +1 @@ +| dc.kt:1:1:1:71 | ProtoMapValue | diff --git a/java/ql/test/kotlin/library-tests/data-classes/data_classes.ql b/java/ql/test/kotlin/library-tests/data-classes/data_classes.ql new file mode 100644 index 00000000000..f42d9f76602 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/data-classes/data_classes.ql @@ -0,0 +1,5 @@ +import java + +from DataClass c +where c.fromSource() +select c From fa0bd0366c3c12b67444a443b9f2d0325808de08 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 26 Apr 2022 10:51:35 +0200 Subject: [PATCH 06/34] Fix extension property labels --- .../src/main/kotlin/KotlinFileExtractor.kt | 10 ++--- .../src/main/kotlin/KotlinUsesExtractor.kt | 43 ++++++++++--------- .../properties/properties.expected | 2 + .../library-tests/properties/properties.kt | 6 +++ 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 93d58a2b872..80b84dabf46 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -795,14 +795,14 @@ open class KotlinFileExtractor( return id } - fun extractProperty(p: IrProperty, parentId: Label, extractBackingField: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgs: List?) { + fun extractProperty(p: IrProperty, parentId: Label, extractBackingField: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?) { with("property", p) { if (isFake(p)) return DeclarationStackAdjuster(p).use { - val id = useProperty(p, parentId) - val locId = getLocation(p, classTypeArgs) + val id = useProperty(p, parentId, classTypeArgsIncludingOuterClasses) + val locId = getLocation(p, classTypeArgsIncludingOuterClasses) tw.writeKtProperties(id, p.name.asString()) tw.writeHasLocation(id, locId) @@ -811,7 +811,7 @@ open class KotlinFileExtractor( val setter = p.setter if (getter != null) { - val getterId = extractFunction(getter, parentId, extractBackingField, typeSubstitution, classTypeArgs)?.cast() + val getterId = extractFunction(getter, parentId, extractBackingField, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast() if (getterId != null) { tw.writeKtPropertyGetters(id, getterId) } @@ -825,7 +825,7 @@ open class KotlinFileExtractor( if (!p.isVar) { logger.errorElement("!isVar property with a setter", p) } - val setterId = extractFunction(setter, parentId, extractBackingField, typeSubstitution, classTypeArgs)?.cast() + val setterId = extractFunction(setter, parentId, extractBackingField, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast() if (setterId != null) { tw.writeKtPropertySetters(id, setterId) } diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 643f548f837..d59dddc4cdc 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -7,16 +7,12 @@ import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.ir.allOverridden import org.jetbrains.kotlin.backend.common.lower.parentsWithSelf import org.jetbrains.kotlin.builtins.StandardNames -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrConst -import org.jetbrains.kotlin.ir.expressions.IrConstructorCall -import org.jetbrains.kotlin.ir.symbols.IrClassSymbol -import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol +import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.types.* -import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl -import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection +import org.jetbrains.kotlin.ir.types.impl.* import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.name.FqName @@ -808,7 +804,9 @@ open class KotlinUsesExtractor( // The type parameters of the function. This does not include type parameters of enclosing classes. functionTypeParameters: List, // The type arguments of enclosing classes of the function. - classTypeArgsIncludingOuterClasses: List? + classTypeArgsIncludingOuterClasses: List?, + // The prefix used in the label. "callable", unless a property label is created, then it's "property". + prefix: String = "callable" ): String { val parentId = maybeParentId ?: useDeclarationParent(parent, false, classTypeArgsIncludingOuterClasses, true) val allParams = if (extensionReceiverParameter == null) { @@ -844,7 +842,7 @@ open class KotlinUsesExtractor( // method (and presumably that disambiguation is never needed when the method belongs to a parameterized // instance of a generic class), but as of now I don't know when the raw method would be referred to. val typeArgSuffix = if (functionTypeParameters.isNotEmpty() && classTypeArgsIncludingOuterClasses.isNullOrEmpty()) "<${functionTypeParameters.size}>" else ""; - return "@\"callable;{$parentId}.$name($paramTypeIds){$returnTypeId}${typeArgSuffix}\"" + return "@\"$prefix;{$parentId}.$name($paramTypeIds){$returnTypeId}${typeArgSuffix}\"" } protected fun IrFunction.isLocalFunction(): Boolean { @@ -1174,24 +1172,29 @@ open class KotlinUsesExtractor( if (parentId == null) { return null } else { - return getPropertyLabel(p, parentId) + return getPropertyLabel(p, parentId, null) } } - fun getPropertyLabel(p: IrProperty, parentId: Label) = - "@\"property;{$parentId};${p.name.asString()}\"" + private fun getPropertyLabel(p: IrProperty, parentId: Label, classTypeArgsIncludingOuterClasses: List?): String { + val getter = p.getter + val setter = p.setter - fun useProperty(p: IrProperty): Label? { - val label = getPropertyLabel(p) - if (label == null) { - return null + val func = getter ?: setter + val ext = func?.extensionReceiverParameter + + return if (ext == null) { + "@\"property;{$parentId};${p.name.asString()}\"" } else { - return tw.getLabelFor(label).also { extractPropertyLaterIfExternalFileMember(p) } + val returnType = getter?.returnType ?: setter?.valueParameters?.singleOrNull()?.type ?: pluginContext.irBuiltIns.unitType + val typeParams = getFunctionTypeParameters(func) + + getFunctionLabel(p.parent, parentId, p.name.asString(), listOf(), returnType, ext, typeParams, classTypeArgsIncludingOuterClasses, "property") } } - fun useProperty(p: IrProperty, parentId: Label): Label = - tw.getLabelFor(getPropertyLabel(p, parentId)).also { extractPropertyLaterIfExternalFileMember(p) } + fun useProperty(p: IrProperty, parentId: Label, classTypeArgsIncludingOuterClasses: List?): Label = + tw.getLabelFor(getPropertyLabel(p, parentId, classTypeArgsIncludingOuterClasses)).also { extractPropertyLaterIfExternalFileMember(p) } fun getEnumEntryLabel(ee: IrEnumEntry): String { val parentId = useDeclarationParent(ee.parent, false) diff --git a/java/ql/test/kotlin/library-tests/properties/properties.expected b/java/ql/test/kotlin/library-tests/properties/properties.expected index e1ebdabfd2a..b98fcd92b43 100644 --- a/java/ql/test/kotlin/library-tests/properties/properties.expected +++ b/java/ql/test/kotlin/library-tests/properties/properties.expected @@ -46,3 +46,5 @@ fieldDeclarations | properties.kt:38:5:38:34 | internalProp | properties.kt:38:14:38:34 | getInternalProp | file://:0:0:0:0 | | properties.kt:38:5:38:34 | internalProp | internal | | properties.kt:67:1:67:23 | constVal | properties.kt:67:7:67:23 | getConstVal | file://:0:0:0:0 | | properties.kt:67:1:67:23 | constVal | public | | properties.kt:70:5:70:16 | prop | properties.kt:70:5:70:16 | getProp | file://:0:0:0:0 | | properties.kt:70:5:70:16 | prop | public | +| properties.kt:78:1:79:13 | x | properties.kt:79:5:79:13 | getX | file://:0:0:0:0 | | file://:0:0:0:0 | | public | +| properties.kt:80:1:81:13 | x | properties.kt:81:5:81:13 | getX | file://:0:0:0:0 | | file://:0:0:0:0 | | public | diff --git a/java/ql/test/kotlin/library-tests/properties/properties.kt b/java/ql/test/kotlin/library-tests/properties/properties.kt index b9f7073f636..e435eb3f553 100644 --- a/java/ql/test/kotlin/library-tests/properties/properties.kt +++ b/java/ql/test/kotlin/library-tests/properties/properties.kt @@ -73,3 +73,9 @@ class C { println(c.prop) } } + + +val Int.x : Int + get() = 5 +val Double.x : Int + get() = 5 From ce87a89009b14aa0eed6086581538c29d7f8aac2 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Tue, 19 Apr 2022 15:15:06 +0100 Subject: [PATCH 07/34] Replace Map and similar functions with their Java cousins This didn't appear to be necessary because the Kotlin and Java versions of Map (for example) are designed to be compatible, but in certain cases their functions have the same erasure but not the same type (e.g. Map.getOrDefault(K, V) vs. Map.getOrDefault(Object, V). These have different erasures which was leading to callable-binding inconsistencies. --- .../src/main/kotlin/KotlinUsesExtractor.kt | 23 +++++++++++++++++-- .../library-tests/java-map-methods/test.kt | 1 + .../library-tests/java-map-methods/test.ql | 4 ++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 java/ql/test/kotlin/library-tests/java-map-methods/test.kt create mode 100644 java/ql/test/kotlin/library-tests/java-map-methods/test.ql diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index d59dddc4cdc..c2a7e60ae98 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -899,17 +899,36 @@ open class KotlinUsesExtractor( return id } + fun kotlinFunctionToJavaEquivalent(f: IrFunction) = + f.parent.let { + when (it) { + is IrClass -> + getJavaEquivalentClass(it)?.let { javaClass -> + if (javaClass != it) + javaClass.declarations.find { decl -> + decl is IrFunction && decl.name == f.name && decl.valueParameters.size == f.valueParameters.size + } as IrFunction + else + null + } + else -> null + } ?: f + } + fun useFunction(f: IrFunction, classTypeArgsIncludingOuterClasses: List? = null): Label { if (f.isLocalFunction()) { val ids = getLocallyVisibleFunctionLabels(f) return ids.function.cast() } else { - return useFunctionCommon(f, getFunctionLabel(f, classTypeArgsIncludingOuterClasses)) + val realFunction = kotlinFunctionToJavaEquivalent(f) + return useFunctionCommon(realFunction, getFunctionLabel(realFunction, classTypeArgsIncludingOuterClasses)) } } fun useFunction(f: IrFunction, parentId: Label, classTypeArgsIncludingOuterClasses: List?) = - useFunctionCommon(f, getFunctionLabel(f, parentId, classTypeArgsIncludingOuterClasses)) + kotlinFunctionToJavaEquivalent(f).let { + useFunctionCommon(it, getFunctionLabel(it, parentId, classTypeArgsIncludingOuterClasses)) + } fun getTypeArgumentLabel( arg: IrTypeArgument diff --git a/java/ql/test/kotlin/library-tests/java-map-methods/test.kt b/java/ql/test/kotlin/library-tests/java-map-methods/test.kt new file mode 100644 index 00000000000..9a40d3c29bf --- /dev/null +++ b/java/ql/test/kotlin/library-tests/java-map-methods/test.kt @@ -0,0 +1 @@ +fun test(m: Map) = m.getOrDefault(1, 2) diff --git a/java/ql/test/kotlin/library-tests/java-map-methods/test.ql b/java/ql/test/kotlin/library-tests/java-map-methods/test.ql new file mode 100644 index 00000000000..2694f59162d --- /dev/null +++ b/java/ql/test/kotlin/library-tests/java-map-methods/test.ql @@ -0,0 +1,4 @@ +import java + +from MethodAccess ma +select ma.getCallee().getAParameter().getType().toString() From 71d2e7be3ed04b158b4c1e07a4145426d696bbac Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 20 Apr 2022 11:46:26 +0100 Subject: [PATCH 08/34] Don't replace own callables, and use a more exact replacement-finding test --- .../src/main/kotlin/KotlinFileExtractor.kt | 4 +- .../src/main/kotlin/KotlinUsesExtractor.kt | 49 ++++++++++++------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 80b84dabf46..61f3435d762 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -682,7 +682,9 @@ open class KotlinFileExtractor( ?: if (f.isLocalFunction()) getLocallyVisibleFunctionLabels(f).function else - useFunction(f, parentId, classTypeArgsIncludingOuterClasses) + // If this is a class that would ordinarily be replaced by a Java equivalent (e.g. kotlin.Map -> java.util.Map), + // don't replace here, really extract the Kotlin version: + useFunction(f, parentId, classTypeArgsIncludingOuterClasses, noReplace = true) val sourceDeclaration = if (typeSubstitution != null) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index c2a7e60ae98..67458192825 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -899,34 +899,47 @@ open class KotlinUsesExtractor( return id } - fun kotlinFunctionToJavaEquivalent(f: IrFunction) = - f.parent.let { - when (it) { - is IrClass -> - getJavaEquivalentClass(it)?.let { javaClass -> - if (javaClass != it) - javaClass.declarations.find { decl -> - decl is IrFunction && decl.name == f.name && decl.valueParameters.size == f.valueParameters.size - } as IrFunction - else + fun kotlinFunctionToJavaEquivalent(f: IrFunction, noReplace: Boolean) = + if (noReplace) + f + else + f.parentClassOrNull?.let { parentClass -> + getJavaEquivalentClass(parentClass)?.let { javaClass -> + if (javaClass != parentClass) + // Look for an exact type match... + javaClass.declarations.find { decl -> + decl is IrFunction && + decl.name == f.name && + decl.valueParameters.size == f.valueParameters.size && + decl.valueParameters.zip(f.valueParameters).all { p -> p.first.type == p.second.type } + } ?: + // Or if there is none, look for the only viable overload + javaClass.declarations.singleOrNull { decl -> + decl is IrFunction && + decl.name == f.name && + decl.valueParameters.size == f.valueParameters.size + } ?: + run { + logger.warn("Couldn't find a Java equivalent function to ${f.name}") null - } - else -> null - } ?: f - } + } + else + null + } + } as IrFunction? ?: f - fun useFunction(f: IrFunction, classTypeArgsIncludingOuterClasses: List? = null): Label { + fun useFunction(f: IrFunction, classTypeArgsIncludingOuterClasses: List? = null, noReplace: Boolean = false): Label { if (f.isLocalFunction()) { val ids = getLocallyVisibleFunctionLabels(f) return ids.function.cast() } else { - val realFunction = kotlinFunctionToJavaEquivalent(f) + val realFunction = kotlinFunctionToJavaEquivalent(f, noReplace) return useFunctionCommon(realFunction, getFunctionLabel(realFunction, classTypeArgsIncludingOuterClasses)) } } - fun useFunction(f: IrFunction, parentId: Label, classTypeArgsIncludingOuterClasses: List?) = - kotlinFunctionToJavaEquivalent(f).let { + fun useFunction(f: IrFunction, parentId: Label, classTypeArgsIncludingOuterClasses: List?, noReplace: Boolean = false) = + kotlinFunctionToJavaEquivalent(f, noReplace).let { useFunctionCommon(it, getFunctionLabel(it, parentId, classTypeArgsIncludingOuterClasses)) } From 77056c9bff833e6c1b84499b9dc064afb00448ae Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 20 Apr 2022 11:51:21 +0100 Subject: [PATCH 09/34] Add test expectations --- .../library-tests/data-classes/callees.expected | 2 +- .../library-tests/java-map-methods/test.expected | 2 ++ .../test/kotlin/library-tests/this/call.expected | 16 ++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 java/ql/test/kotlin/library-tests/java-map-methods/test.expected diff --git a/java/ql/test/kotlin/library-tests/data-classes/callees.expected b/java/ql/test/kotlin/library-tests/data-classes/callees.expected index b2dd4085a2a..c4b66f2d3a0 100644 --- a/java/ql/test/kotlin/library-tests/data-classes/callees.expected +++ b/java/ql/test/kotlin/library-tests/data-classes/callees.expected @@ -5,4 +5,4 @@ | dc.kt:0:0:0:0 | times(...) | Int.times | | dc.kt:0:0:0:0 | toString(...) | Arrays.toString | | dc.kt:0:0:0:0 | toString(...) | Arrays.toString | -| dc.kt:1:1:1:71 | super(...) | Any.Any | +| dc.kt:1:1:1:71 | super(...) | Object.Object | diff --git a/java/ql/test/kotlin/library-tests/java-map-methods/test.expected b/java/ql/test/kotlin/library-tests/java-map-methods/test.expected new file mode 100644 index 00000000000..0a646e52fe1 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/java-map-methods/test.expected @@ -0,0 +1,2 @@ +| Integer | +| Object | diff --git a/java/ql/test/kotlin/library-tests/this/call.expected b/java/ql/test/kotlin/library-tests/this/call.expected index afb0a7ede60..59ca46c4a04 100644 --- a/java/ql/test/kotlin/library-tests/this/call.expected +++ b/java/ql/test/kotlin/library-tests/this/call.expected @@ -1,13 +1,13 @@ -| this.kt:2:1:58:1 | super(...) | Any | -| this.kt:3:5:53:5 | super(...) | Any | +| this.kt:2:1:58:1 | super(...) | Object | +| this.kt:3:5:53:5 | super(...) | Object | | this.kt:9:66:17:13 | ...->... | | -| this.kt:9:66:17:13 | super(...) | Any | +| this.kt:9:66:17:13 | super(...) | Object | | this.kt:12:82:16:17 | ...->... | | -| this.kt:12:82:16:17 | super(...) | Any | +| this.kt:12:82:16:17 | super(...) | Object | | this.kt:19:42:21:13 | ...->... | | -| this.kt:19:42:21:13 | super(...) | Any | +| this.kt:19:42:21:13 | super(...) | Object | | this.kt:23:30:25:13 | ...->... | | -| this.kt:23:30:25:13 | super(...) | Any | +| this.kt:23:30:25:13 | super(...) | Object | | this.kt:36:13:36:25 | topLevelFun(...) | topLevelFun | | this.kt:37:13:37:22 | outerFun(...) | outerFun | | this.kt:38:13:38:22 | innerFun(...) | innerFun | @@ -19,5 +19,5 @@ | this.kt:44:18:44:35 | topLevelInnerFun(...) | topLevelInnerFun | | this.kt:45:18:45:32 | outerInnerFun(...) | outerInnerFun | | this.kt:46:18:46:40 | topLevelOuterInnerFun(...) | topLevelOuterInnerFun | -| this.kt:64:1:65:1 | super(...) | Any | -| this.kt:67:1:68:1 | super(...) | Any | +| this.kt:64:1:65:1 | super(...) | Object | +| this.kt:67:1:68:1 | super(...) | Object | From 16af811b6916d0da3e985573616767ff96f05870 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 20 Apr 2022 16:58:28 +0100 Subject: [PATCH 10/34] Allow imprecise matching for Kotlin -> Java method translation This allows the particular case of Collection.toArray(IntFunction) to match, since both Java and Kotlin functions take an IntFunction but they use different function-local type variables. This would also allow toArray(Array) to work similarly. --- java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 67458192825..28ea8666b9d 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -911,7 +911,10 @@ open class KotlinUsesExtractor( decl is IrFunction && decl.name == f.name && decl.valueParameters.size == f.valueParameters.size && - decl.valueParameters.zip(f.valueParameters).all { p -> p.first.type == p.second.type } + // Note matching by classifier not the whole type so that generic arguments are allowed to differ, + // as they always will for method type parameters occurring in parameter types (e.g. toArray(T[] array) + // Differing only by nullability would also be insignificant if it came up. + decl.valueParameters.zip(f.valueParameters).all { p -> p.first.type.classifierOrNull == p.second.type.classifierOrNull } } ?: // Or if there is none, look for the only viable overload javaClass.declarations.singleOrNull { decl -> From 22e48ca39a000db590439b3c5082178b9cecbbbd Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 20 Apr 2022 17:26:23 +0100 Subject: [PATCH 11/34] Accept test changes --- .../kotlin/library-tests/inherited-callee/test.expected | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/ql/test/kotlin/library-tests/inherited-callee/test.expected b/java/ql/test/kotlin/library-tests/inherited-callee/test.expected index 3f5cee5b85f..38f8f9f0666 100644 --- a/java/ql/test/kotlin/library-tests/inherited-callee/test.expected +++ b/java/ql/test/kotlin/library-tests/inherited-callee/test.expected @@ -3,8 +3,8 @@ | Test.java:25:5:25:16 | hashCode(...) | hashCode | Object | | Test.java:26:5:26:17 | inheritMe(...) | inheritMe | Test | | Test.java:28:5:28:34 | inheritedInterfaceMethodJ(...) | inheritedInterfaceMethodJ | ParentIf | -| Test.kt:23:7:23:16 | toString(...) | toString | Any | -| Test.kt:24:7:24:15 | equals(...) | equals | Any | -| Test.kt:25:7:25:16 | hashCode(...) | hashCode | Any | +| Test.kt:23:7:23:16 | toString(...) | toString | Object | +| Test.kt:24:7:24:15 | equals(...) | equals | Object | +| Test.kt:25:7:25:16 | hashCode(...) | hashCode | Object | | Test.kt:26:7:26:17 | inheritMe(...) | inheritMe | TestKt | | Test.kt:28:9:28:35 | inheritedInterfaceMethodK(...) | inheritedInterfaceMethodK | ParentIf | From b1849f5f0a6dac4629968e6a7d2af70664d1e1ed Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Tue, 26 Apr 2022 17:02:07 +0100 Subject: [PATCH 12/34] Expand error message --- java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 28ea8666b9d..cef82175f11 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -923,7 +923,7 @@ open class KotlinUsesExtractor( decl.valueParameters.size == f.valueParameters.size } ?: run { - logger.warn("Couldn't find a Java equivalent function to ${f.name}") + logger.warn("Couldn't find a Java equivalent function to ${parentClass.fqNameWhenAvailable}.${f.name} in ${javaClass.fqNameWhenAvailable}") null } else From 7e17074b411bba9bc4c83125e83f4323d4d2eb0b Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 27 Apr 2022 12:22:23 +0100 Subject: [PATCH 13/34] Allow arithmetic functions not mapping to Java equivalents --- .../src/main/kotlin/KotlinUsesExtractor.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index cef82175f11..57e58e2453a 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -899,6 +899,13 @@ open class KotlinUsesExtractor( return id } + // These are classes with Java equivalents, but whose methods don't all exist on those Java equivalents-- + // for example, the numeric classes define arithmetic functions (Int.plus, Long.or and so on) that lower to + // primitive arithmetic on the JVM, but which we extract as calls to reflect the source syntax more closely. + private val expectedMissingEquivalents = setOf( + "kotlin.Boolean", "kotlin.Byte", "kotlin.Char", "kotlin.Double", "kotlin.Float", "kotlin.Int", "kotlin.Long", "kotlin.Number", "kotlin.Short" + ) + fun kotlinFunctionToJavaEquivalent(f: IrFunction, noReplace: Boolean) = if (noReplace) f @@ -923,7 +930,10 @@ open class KotlinUsesExtractor( decl.valueParameters.size == f.valueParameters.size } ?: run { - logger.warn("Couldn't find a Java equivalent function to ${parentClass.fqNameWhenAvailable}.${f.name} in ${javaClass.fqNameWhenAvailable}") + val parentFqName = parentClass.fqNameWhenAvailable?.asString() + if (!expectedMissingEquivalents.contains(parentFqName)) { + logger.warn("Couldn't find a Java equivalent function to $parentFqName.${f.name} in ${javaClass.fqNameWhenAvailable}") + } null } else From 776322bac289e79202d86d1c67d7a5e84883b0d5 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 26 Apr 2022 09:24:57 +0200 Subject: [PATCH 14/34] Add foreach dataflow tests --- .../library-tests/dataflow/foreach/C1.java | 22 +++++++++++++++++++ .../library-tests/dataflow/foreach/C2.kt | 18 +++++++++++++++ .../dataflow/foreach/test.expected | 7 ++++++ .../library-tests/dataflow/foreach/test.ql | 19 ++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 java/ql/test/kotlin/library-tests/dataflow/foreach/C1.java create mode 100644 java/ql/test/kotlin/library-tests/dataflow/foreach/C2.kt create mode 100644 java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected create mode 100644 java/ql/test/kotlin/library-tests/dataflow/foreach/test.ql diff --git a/java/ql/test/kotlin/library-tests/dataflow/foreach/C1.java b/java/ql/test/kotlin/library-tests/dataflow/foreach/C1.java new file mode 100644 index 00000000000..164f9bd1795 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/dataflow/foreach/C1.java @@ -0,0 +1,22 @@ +public final class C1 { + public final String taint(String t) { + return t; + } + + public final void sink(Object a) { + } + + public final void test() { + String[] l = new String[]{this.taint("a"), ""}; + this.sink(l); + this.sink(l[0]); + + for(int i = 0; i < l.length; i++) { + this.sink(l[i]); + } + + for (String s : l) { + this.sink(s); + } + } +} diff --git a/java/ql/test/kotlin/library-tests/dataflow/foreach/C2.kt b/java/ql/test/kotlin/library-tests/dataflow/foreach/C2.kt new file mode 100644 index 00000000000..7a98abaa110 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/dataflow/foreach/C2.kt @@ -0,0 +1,18 @@ +class C2 { + fun taint(t: String): String { + return t + } + + fun sink(a: Any?) {} + fun test() { + val l = arrayOf(taint("a"), "") + sink(l) + sink(l[0]) + for (i in l.indices) { + sink(l[i]) + } + for (s in l) { + sink(s) + } + } +} diff --git a/java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected b/java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected new file mode 100644 index 00000000000..4b8dba979dd --- /dev/null +++ b/java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected @@ -0,0 +1,7 @@ +| C1.java:10:44:10:46 | "a" | C1.java:11:17:11:17 | l | +| C1.java:10:44:10:46 | "a" | C1.java:12:17:12:20 | ...[...] | +| C1.java:10:44:10:46 | "a" | C1.java:15:20:15:23 | ...[...] | +| C1.java:10:44:10:46 | "a" | C1.java:19:20:19:20 | s | +| C2.kt:8:32:8:32 | a | C2.kt:9:14:9:14 | l | +| C2.kt:8:32:8:32 | a | C2.kt:10:14:10:17 | ...[...] | +| C2.kt:8:32:8:32 | a | C2.kt:12:18:12:21 | ...[...] | diff --git a/java/ql/test/kotlin/library-tests/dataflow/foreach/test.ql b/java/ql/test/kotlin/library-tests/dataflow/foreach/test.ql new file mode 100644 index 00000000000..c14c0ca83d2 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/dataflow/foreach/test.ql @@ -0,0 +1,19 @@ +import java +import semmle.code.java.dataflow.TaintTracking +import semmle.code.java.dataflow.ExternalFlow + +class Conf extends TaintTracking::Configuration { + Conf() { this = "qltest:foreach-array-iterator" } + + override predicate isSource(DataFlow::Node n) { + n.asExpr().(Argument).getCall().getCallee().hasName("taint") + } + + override predicate isSink(DataFlow::Node n) { + n.asExpr().(Argument).getCall().getCallee().hasName("sink") + } +} + +from DataFlow::Node src, DataFlow::Node sink, Conf conf +where conf.hasFlow(src, sink) +select src, sink From 538e05995a10d5e970b08ac77965af8b1d9fc914 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Wed, 27 Apr 2022 11:12:23 +0200 Subject: [PATCH 15/34] Fix dataflow for `kotlin.Array.iterator()` --- java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll | 1 + .../code/java/dataflow/internal/DataFlowPrivate.qll | 8 ++++++++ .../lib/semmle/code/java/frameworks/KotlinStdLib.qll | 10 ++++++++++ .../library-tests/dataflow/foreach/test.expected | 1 + 4 files changed, 20 insertions(+) create mode 100644 java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll diff --git a/java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll b/java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll index 7584acfab09..3aa228c5c9c 100644 --- a/java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll +++ b/java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll @@ -143,6 +143,7 @@ private module Frameworks { private import semmle.code.java.frameworks.JMS private import semmle.code.java.frameworks.RabbitMQ private import semmle.code.java.regex.RegexFlowModels + private import semmle.code.java.frameworks.KotlinStdLib } private predicate sourceModelCsv(string row) { diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll index c883f8ea56d..e026048f2ca 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll @@ -205,6 +205,11 @@ private predicate canContainBool(Type t) { any(BooleanType b).(RefType).getASourceSupertype+() = t } +private predicate isArray(Type t) { + t instanceof Array or + t.(RefType).getSourceDeclaration().hasQualifiedName("kotlin", "Array") +} + /** * Holds if `t1` and `t2` are compatible, that is, whether data can flow from * a node of type `t1` to a node of type `t2`. @@ -221,6 +226,9 @@ predicate compatibleTypes(Type t1, Type t2) { erasedHaveIntersection(e1, e2) or canContainBool(e1) and canContainBool(e2) + or + // Make java array and `kotlin.Array` types compatible. + isArray(e1) and isArray(e2) ) } diff --git a/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll new file mode 100644 index 00000000000..b57ca706bb5 --- /dev/null +++ b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll @@ -0,0 +1,10 @@ +/** Definitions of taint steps in the KotlinStdLib framework */ + +import java +private import semmle.code.java.dataflow.ExternalFlow + +private class KotlinStdLibSummaryCsv extends SummaryModelCsv { + override predicate row(string row) { + row = ["kotlin;Array;false;iterator;();;Argument[-1].ArrayElement;ReturnValue.Element;value"] + } +} diff --git a/java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected b/java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected index 4b8dba979dd..f204c12ebe2 100644 --- a/java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected +++ b/java/ql/test/kotlin/library-tests/dataflow/foreach/test.expected @@ -5,3 +5,4 @@ | C2.kt:8:32:8:32 | a | C2.kt:9:14:9:14 | l | | C2.kt:8:32:8:32 | a | C2.kt:10:14:10:17 | ...[...] | | C2.kt:8:32:8:32 | a | C2.kt:12:18:12:21 | ...[...] | +| C2.kt:8:32:8:32 | a | C2.kt:15:18:15:18 | s | From fbae0f5053af41f90564bba87dac069a78463e2e Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Thu, 28 Apr 2022 10:46:46 +0200 Subject: [PATCH 16/34] Revert dataflow changes, extract actual iterator function --- .../src/main/kotlin/KotlinFileExtractor.kt | 22 +++++++++++++++++++ .../dataflow/internal/DataFlowPrivate.qll | 8 ------- .../code/java/frameworks/KotlinStdLib.qll | 5 ++++- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 61f3435d762..4f34b649525 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -1347,6 +1347,23 @@ open class KotlinFileExtractor( return result } + private fun findTopLevelFunctionOrWarn(functionFilter: String, type: String, warnAgainstElement: IrElement): IrFunction? { + + val fn = pluginContext.referenceFunctions(FqName(functionFilter)) + .firstOrNull { it.owner.parentClassOrNull?.fqNameWhenAvailable?.asString() == type } + ?.owner + + if (fn != null) { + if (fn.parentClassOrNull != null) { + extractExternalClassLater(fn.parentAsClass) + } + } else { + logger.errorElement("Couldn't find JVM intrinsic function $functionFilter in $type", warnAgainstElement) + } + + return fn + } + val javaLangString by lazy { val result = pluginContext.referenceClass(FqName("java.lang.String"))?.owner result?.let { extractExternalClassLater(it) } @@ -1860,6 +1877,11 @@ open class KotlinFileExtractor( } } } + isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "iterator") && c.origin == IrStatementOrigin.FOR_LOOP_ITERATOR -> { + findTopLevelFunctionOrWarn("kotlin.jvm.internal.iterator", "kotlin.jvm.internal.ArrayIteratorKt", c)?.let { iteratorFn -> + extractRawMethodAccess(iteratorFn, c, callable, parent, idx, enclosingStmt, listOf(c.dispatchReceiver), null, null, listOf((c.dispatchReceiver!!.type as IrSimpleType).arguments.first().typeOrNull!!)) + } + } isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "get") && c.origin == IrStatementOrigin.GET_ARRAY_ELEMENT -> { val id = tw.getFreshIdLabel() val type = useType(c.type) diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll index e026048f2ca..c883f8ea56d 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll @@ -205,11 +205,6 @@ private predicate canContainBool(Type t) { any(BooleanType b).(RefType).getASourceSupertype+() = t } -private predicate isArray(Type t) { - t instanceof Array or - t.(RefType).getSourceDeclaration().hasQualifiedName("kotlin", "Array") -} - /** * Holds if `t1` and `t2` are compatible, that is, whether data can flow from * a node of type `t1` to a node of type `t2`. @@ -226,9 +221,6 @@ predicate compatibleTypes(Type t1, Type t2) { erasedHaveIntersection(e1, e2) or canContainBool(e1) and canContainBool(e2) - or - // Make java array and `kotlin.Array` types compatible. - isArray(e1) and isArray(e2) ) } diff --git a/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll index b57ca706bb5..48934e00677 100644 --- a/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll +++ b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll @@ -5,6 +5,9 @@ private import semmle.code.java.dataflow.ExternalFlow private class KotlinStdLibSummaryCsv extends SummaryModelCsv { override predicate row(string row) { - row = ["kotlin;Array;false;iterator;();;Argument[-1].ArrayElement;ReturnValue.Element;value"] + row = + [ + "kotlin.jvm.internal;ArrayIteratorKt;false;iterator;(Object[]);;Argument[0].ArrayElement;ReturnValue.Element;value" + ] } } From 8d970a3cbddbd992449a51941ee0af568086db4d Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 28 Apr 2022 12:21:24 +0100 Subject: [PATCH 17/34] Don't extract private members of instantiated or external classes This is both consistent with the Java extractor's behaviour, and prevents us from trying to refer to anonymous types (e.g. anonymous objects that directly initialize properties) out of scope. --- .../src/main/kotlin/ExternalDeclExtractor.kt | 4 +-- .../src/main/kotlin/KotlinFileExtractor.kt | 33 ++++++++++++------- .../src/main/kotlin/KotlinUsesExtractor.kt | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt b/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt index d036fe2e27a..3ab8d8151a2 100644 --- a/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt @@ -93,9 +93,9 @@ class ExternalDeclExtractor(val logger: FileLogger, val invocationTrapFile: Stri ftw.writeHasLocation(ftw.fileId, ftw.getWholeFileLocation()) ftw.writeCupackage(ftw.fileId, pkgId) - fileExtractor.extractClassSource(irDecl, !irDecl.isFileClass, false) + fileExtractor.extractClassSource(irDecl, extractDeclarations = !irDecl.isFileClass, extractStaticInitializer = false, extractPrivateMembers = false) } else { - fileExtractor.extractDeclaration(irDecl) + fileExtractor.extractDeclaration(irDecl, extractPrivateMembers = false) } } diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 4f34b649525..7563c556f85 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -74,7 +74,7 @@ open class KotlinFileExtractor( } } - file.declarations.map { extractDeclaration(it) } + file.declarations.map { extractDeclaration(it, extractPrivateMembers = true) } extractStaticInitializer(file, null) CommentExtractor(this, file, tw.fileId).extract() } @@ -91,14 +91,23 @@ open class KotlinFileExtractor( return false } - fun extractDeclaration(declaration: IrDeclaration) { + private fun shouldExtractDecl(declaration: IrDeclaration, extractPrivateMembers: Boolean) = + extractPrivateMembers || + when(declaration) { + is IrDeclarationWithVisibility -> declaration.visibility.let { it != DescriptorVisibilities.PRIVATE && it != DescriptorVisibilities.PRIVATE_TO_THIS } + else -> true + } + + fun extractDeclaration(declaration: IrDeclaration, extractPrivateMembers: Boolean) { with("declaration", declaration) { + if (!shouldExtractDecl(declaration, extractPrivateMembers)) + return when (declaration) { is IrClass -> { if (isExternalDeclaration(declaration)) { extractExternalClassLater(declaration) } else { - extractClassSource(declaration, extractDeclarations = true, extractStaticInitializer = true) + extractClassSource(declaration, extractDeclarations = true, extractStaticInitializer = true, extractPrivateMembers = extractPrivateMembers) } } is IrFunction -> { @@ -320,7 +329,7 @@ open class KotlinFileExtractor( // `argsIncludingOuterClasses` can be null to describe a raw generic type. // For non-generic types it will be zero-length list. - fun extractMemberPrototypes(c: IrClass, argsIncludingOuterClasses: List?, id: Label) { + fun extractNonPrivateMemberPrototypes(c: IrClass, argsIncludingOuterClasses: List?, id: Label) { with("member prototypes", c) { val typeParamSubstitution = when (argsIncludingOuterClasses) { @@ -339,17 +348,19 @@ open class KotlinFileExtractor( } c.declarations.map { - when(it) { - is IrFunction -> extractFunction(it, id, false, typeParamSubstitution, argsIncludingOuterClasses) - is IrProperty -> extractProperty(it, id, false, typeParamSubstitution, argsIncludingOuterClasses) - else -> {} + if (shouldExtractDecl(it, false)) { + when(it) { + is IrFunction -> extractFunction(it, id, false, typeParamSubstitution, argsIncludingOuterClasses) + is IrProperty -> extractProperty(it, id, false, typeParamSubstitution, argsIncludingOuterClasses) + else -> {} + } } } } } private fun extractLocalTypeDeclStmt(c: IrClass, callable: Label, parent: Label, idx: Int) { - val id = extractClassSource(c, extractDeclarations = true, extractStaticInitializer = true).cast() + val id = extractClassSource(c, extractDeclarations = true, extractStaticInitializer = true, extractPrivateMembers = true).cast() extractLocalTypeDeclStmt(id, c, callable, parent, idx) } @@ -361,7 +372,7 @@ open class KotlinFileExtractor( tw.writeHasLocation(stmtId, locId) } - fun extractClassSource(c: IrClass, extractDeclarations: Boolean, extractStaticInitializer: Boolean): Label { + fun extractClassSource(c: IrClass, extractDeclarations: Boolean, extractStaticInitializer: Boolean, extractPrivateMembers: Boolean): Label { with("class source", c) { DeclarationStackAdjuster(c).use { @@ -399,7 +410,7 @@ open class KotlinFileExtractor( c.typeParameters.mapIndexed { idx, param -> extractTypeParameter(param, idx) } if (extractDeclarations) { - c.declarations.map { extractDeclaration(it) } + c.declarations.map { extractDeclaration(it, extractPrivateMembers) } if (extractStaticInitializer) extractStaticInitializer(c, id) } diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 57e58e2453a..9fd669001fa 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -410,7 +410,7 @@ open class KotlinUsesExtractor( if (inReceiverContext && globalExtensionState.genericSpecialisationsExtracted.add(classLabelResult.classLabel)) { val supertypeMode = if (argsIncludingOuterClasses == null) ExtractSupertypesMode.Raw else ExtractSupertypesMode.Specialised(argsIncludingOuterClasses) extractorWithCSource.extractClassSupertypes(c, classLabel, supertypeMode, true) - extractorWithCSource.extractMemberPrototypes(c, argsIncludingOuterClasses, classLabel) + extractorWithCSource.extractNonPrivateMemberPrototypes(c, argsIncludingOuterClasses, classLabel) } } From 301fa11450d620fbaec158f686acb000fe6b0a3d Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 28 Apr 2022 14:29:15 +0100 Subject: [PATCH 18/34] Only extract parameter and method type-accesses once Previously we extracted them whenever something was non-external, but this led to re-extraction when an instance of a generic type defined in source was extracted multiple times. --- .../src/main/kotlin/ExternalDeclExtractor.kt | 4 +-- .../src/main/kotlin/KotlinFileExtractor.kt | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt b/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt index 3ab8d8151a2..61097aea593 100644 --- a/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/ExternalDeclExtractor.kt @@ -93,9 +93,9 @@ class ExternalDeclExtractor(val logger: FileLogger, val invocationTrapFile: Stri ftw.writeHasLocation(ftw.fileId, ftw.getWholeFileLocation()) ftw.writeCupackage(ftw.fileId, pkgId) - fileExtractor.extractClassSource(irDecl, extractDeclarations = !irDecl.isFileClass, extractStaticInitializer = false, extractPrivateMembers = false) + fileExtractor.extractClassSource(irDecl, extractDeclarations = !irDecl.isFileClass, extractStaticInitializer = false, extractPrivateMembers = false, extractFunctionBodies = false) } else { - fileExtractor.extractDeclaration(irDecl, extractPrivateMembers = false) + fileExtractor.extractDeclaration(irDecl, extractPrivateMembers = false, extractFunctionBodies = false) } } diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 7563c556f85..97ec79e9247 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -74,7 +74,7 @@ open class KotlinFileExtractor( } } - file.declarations.map { extractDeclaration(it, extractPrivateMembers = true) } + file.declarations.map { extractDeclaration(it, extractPrivateMembers = true, extractFunctionBodies = true) } extractStaticInitializer(file, null) CommentExtractor(this, file, tw.fileId).extract() } @@ -98,7 +98,7 @@ open class KotlinFileExtractor( else -> true } - fun extractDeclaration(declaration: IrDeclaration, extractPrivateMembers: Boolean) { + fun extractDeclaration(declaration: IrDeclaration, extractPrivateMembers: Boolean, extractFunctionBodies: Boolean) { with("declaration", declaration) { if (!shouldExtractDecl(declaration, extractPrivateMembers)) return @@ -107,13 +107,13 @@ open class KotlinFileExtractor( if (isExternalDeclaration(declaration)) { extractExternalClassLater(declaration) } else { - extractClassSource(declaration, extractDeclarations = true, extractStaticInitializer = true, extractPrivateMembers = extractPrivateMembers) + extractClassSource(declaration, extractDeclarations = true, extractStaticInitializer = true, extractPrivateMembers = extractPrivateMembers, extractFunctionBodies = extractFunctionBodies) } } is IrFunction -> { val parentId = useDeclarationParent(declaration.parent, false)?.cast() if (parentId != null) { - extractFunction(declaration, parentId, true, null, listOf()) + extractFunction(declaration, parentId, extractFunctionBodies, null, listOf()) } Unit } @@ -130,7 +130,7 @@ open class KotlinFileExtractor( is IrEnumEntry -> { val parentId = useDeclarationParent(declaration.parent, false)?.cast() if (parentId != null) { - extractEnumEntry(declaration, parentId) + extractEnumEntry(declaration, parentId, extractFunctionBodies) } Unit } @@ -360,7 +360,7 @@ open class KotlinFileExtractor( } private fun extractLocalTypeDeclStmt(c: IrClass, callable: Label, parent: Label, idx: Int) { - val id = extractClassSource(c, extractDeclarations = true, extractStaticInitializer = true, extractPrivateMembers = true).cast() + val id = extractClassSource(c, extractDeclarations = true, extractStaticInitializer = true, extractPrivateMembers = true, extractFunctionBodies = true).cast() extractLocalTypeDeclStmt(id, c, callable, parent, idx) } @@ -372,7 +372,7 @@ open class KotlinFileExtractor( tw.writeHasLocation(stmtId, locId) } - fun extractClassSource(c: IrClass, extractDeclarations: Boolean, extractStaticInitializer: Boolean, extractPrivateMembers: Boolean): Label { + fun extractClassSource(c: IrClass, extractDeclarations: Boolean, extractStaticInitializer: Boolean, extractPrivateMembers: Boolean, extractFunctionBodies: Boolean): Label { with("class source", c) { DeclarationStackAdjuster(c).use { @@ -410,7 +410,7 @@ open class KotlinFileExtractor( c.typeParameters.mapIndexed { idx, param -> extractTypeParameter(param, idx) } if (extractDeclarations) { - c.declarations.map { extractDeclaration(it, extractPrivateMembers) } + c.declarations.map { extractDeclaration(it, extractPrivateMembers = extractPrivateMembers, extractFunctionBodies = extractFunctionBodies) } if (extractStaticInitializer) extractStaticInitializer(c, id) } @@ -515,11 +515,11 @@ open class KotlinFileExtractor( return FieldResult(instanceId, instanceName) } - private fun extractValueParameter(vp: IrValueParameter, parent: Label, idx: Int, typeSubstitution: TypeSubstitution?, parentSourceDeclaration: Label, classTypeArgsIncludingOuterClasses: List?): TypeResults { + private fun extractValueParameter(vp: IrValueParameter, parent: Label, idx: Int, typeSubstitution: TypeSubstitution?, parentSourceDeclaration: Label, classTypeArgsIncludingOuterClasses: List?, extractTypeAccess: Boolean): TypeResults { with("value parameter", vp) { val location = getLocation(vp, classTypeArgsIncludingOuterClasses) val id = useValueParameter(vp, parent) - if (!isExternalDeclaration(vp)) { + if (extractTypeAccess) { extractTypeAccessRecursive(vp.type, location, id, -1) } return extractValueParameter(id, vp.type, vp.name.asString(), location, parent, idx, typeSubstitution, useValueParameter(vp, parentSourceDeclaration), vp.isVararg) @@ -706,13 +706,13 @@ open class KotlinFileExtractor( val extReceiver = f.extensionReceiverParameter val idxOffset = if (extReceiver != null) 1 else 0 val paramTypes = f.valueParameters.mapIndexed { i, vp -> - extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses) + extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractBody) } val allParamTypes = if (extReceiver != null) { val extendedType = useType(extReceiver.type) tw.writeKtExtensionFunctions(id.cast(), extendedType.javaResult.id, extendedType.kotlinResult.id) - val t = extractValueParameter(extReceiver, id, 0, null, sourceDeclaration, classTypeArgsIncludingOuterClasses) + val t = extractValueParameter(extReceiver, id, 0, null, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractBody) listOf(t) + paramTypes } else { paramTypes @@ -741,7 +741,7 @@ open class KotlinFileExtractor( tw.writeMethods(methodId, shortName.nameInDB, "${shortName.nameInDB}$paramsSignature", returnType.javaResult.id, parentId, sourceDeclaration.cast()) tw.writeMethodsKotlinType(methodId, returnType.kotlinResult.id) - if (!isExternalDeclaration(f)) { + if (extractBody) { extractTypeAccessRecursive(f.returnType, locId, id, -1) } @@ -874,7 +874,7 @@ open class KotlinFileExtractor( } } - fun extractEnumEntry(ee: IrEnumEntry, parentId: Label) { + fun extractEnumEntry(ee: IrEnumEntry, parentId: Label, extractTypeAccess: Boolean) { with("enum entry", ee) { DeclarationStackAdjuster(ee).use { val id = useEnumEntry(ee) @@ -884,7 +884,7 @@ open class KotlinFileExtractor( val locId = tw.getLocation(ee) tw.writeHasLocation(id, locId) - if (!isExternalDeclaration(ee)) { + if (extractTypeAccess) { val fieldDeclarationId = tw.getFreshIdLabel() tw.writeFielddecls(fieldDeclarationId, parentId) tw.writeFieldDeclaredIn(id, fieldDeclarationId, 0) From 2600dcd18210294f6b5461782506a32ae63a6827 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 28 Apr 2022 16:10:52 +0100 Subject: [PATCH 19/34] Fix extracting type accesses relating to proprerty getters/setters and SAM-converted methods These should be handled the same as regular methods: extract type accesses for parameters and methods only if we're extracting "from source", i.e. at some point we're descended from extractFileContents. --- .../src/main/kotlin/KotlinFileExtractor.kt | 26 +++--- .../kotlin/library-tests/exprs/exprs.expected | 80 ------------------- 2 files changed, 13 insertions(+), 93 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 97ec79e9247..9e0ec7413e7 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -113,7 +113,7 @@ open class KotlinFileExtractor( is IrFunction -> { val parentId = useDeclarationParent(declaration.parent, false)?.cast() if (parentId != null) { - extractFunction(declaration, parentId, extractFunctionBodies, null, listOf()) + extractFunction(declaration, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies, null, listOf()) } Unit } @@ -123,7 +123,7 @@ open class KotlinFileExtractor( is IrProperty -> { val parentId = useDeclarationParent(declaration.parent, false)?.cast() if (parentId != null) { - extractProperty(declaration, parentId, true, null, listOf()) + extractProperty(declaration, parentId, extractBackingField = true, extractFunctionBodies = extractFunctionBodies, null, listOf()) } Unit } @@ -350,8 +350,8 @@ open class KotlinFileExtractor( c.declarations.map { if (shouldExtractDecl(it, false)) { when(it) { - is IrFunction -> extractFunction(it, id, false, typeParamSubstitution, argsIncludingOuterClasses) - is IrProperty -> extractProperty(it, id, false, typeParamSubstitution, argsIncludingOuterClasses) + is IrFunction -> extractFunction(it, id, extractBody = false, extractMethodAndParameterTypeAccesses = false, typeParamSubstitution, argsIncludingOuterClasses) + is IrProperty -> extractProperty(it, id, extractBackingField = false, extractFunctionBodies = false, typeParamSubstitution, argsIncludingOuterClasses) else -> {} } } @@ -680,7 +680,7 @@ open class KotlinFileExtractor( } } - fun extractFunction(f: IrFunction, parentId: Label, extractBody: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?, idOverride: Label? = null): Label? { + fun extractFunction(f: IrFunction, parentId: Label, extractBody: Boolean, extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?, idOverride: Label? = null): Label? { if (isFake(f)) return null with("function", f) { @@ -706,13 +706,13 @@ open class KotlinFileExtractor( val extReceiver = f.extensionReceiverParameter val idxOffset = if (extReceiver != null) 1 else 0 val paramTypes = f.valueParameters.mapIndexed { i, vp -> - extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractBody) + extractValueParameter(vp, id, i + idxOffset, typeSubstitution, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses) } val allParamTypes = if (extReceiver != null) { val extendedType = useType(extReceiver.type) tw.writeKtExtensionFunctions(id.cast(), extendedType.javaResult.id, extendedType.kotlinResult.id) - val t = extractValueParameter(extReceiver, id, 0, null, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractBody) + val t = extractValueParameter(extReceiver, id, 0, null, sourceDeclaration, classTypeArgsIncludingOuterClasses, extractTypeAccess = extractMethodAndParameterTypeAccesses) listOf(t) + paramTypes } else { paramTypes @@ -741,7 +741,7 @@ open class KotlinFileExtractor( tw.writeMethods(methodId, shortName.nameInDB, "${shortName.nameInDB}$paramsSignature", returnType.javaResult.id, parentId, sourceDeclaration.cast()) tw.writeMethodsKotlinType(methodId, returnType.kotlinResult.id) - if (extractBody) { + if (extractMethodAndParameterTypeAccesses) { extractTypeAccessRecursive(f.returnType, locId, id, -1) } @@ -808,7 +808,7 @@ open class KotlinFileExtractor( return id } - fun extractProperty(p: IrProperty, parentId: Label, extractBackingField: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?) { + fun extractProperty(p: IrProperty, parentId: Label, extractBackingField: Boolean, extractFunctionBodies: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List?) { with("property", p) { if (isFake(p)) return @@ -824,7 +824,7 @@ open class KotlinFileExtractor( val setter = p.setter if (getter != null) { - val getterId = extractFunction(getter, parentId, extractBackingField, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast() + val getterId = extractFunction(getter, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast() if (getterId != null) { tw.writeKtPropertyGetters(id, getterId) } @@ -838,7 +838,7 @@ open class KotlinFileExtractor( if (!p.isVar) { logger.errorElement("!isVar property with a setter", p) } - val setterId = extractFunction(setter, parentId, extractBackingField, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast() + val setterId = extractFunction(setter, parentId, extractBody = extractFunctionBodies, extractMethodAndParameterTypeAccesses = extractFunctionBodies, typeSubstitution, classTypeArgsIncludingOuterClasses)?.cast() if (setterId != null) { tw.writeKtPropertySetters(id, setterId) } @@ -4015,7 +4015,7 @@ open class KotlinFileExtractor( helper.extractParameterToFieldAssignmentInConstructor("", functionType, fieldId, 0, 1) // add implementation function - extractFunction(samMember, classId, false, null, null, ids.function) + extractFunction(samMember, classId, extractBody = false, extractMethodAndParameterTypeAccesses = true, null, null, ids.function) //body val blockId = tw.getFreshIdLabel() @@ -4191,7 +4191,7 @@ open class KotlinFileExtractor( val id = extractGeneratedClass(ids, superTypes, tw.getLocation(localFunction), localFunction) // Extract local function as a member - extractFunction(localFunction, id, true, null, listOf()) + extractFunction(localFunction, id, extractBody = true, extractMethodAndParameterTypeAccesses = true, null, listOf()) return id } diff --git a/java/ql/test/kotlin/library-tests/exprs/exprs.expected b/java/ql/test/kotlin/library-tests/exprs/exprs.expected index 2d31bbf92cf..21548a78ed9 100644 --- a/java/ql/test/kotlin/library-tests/exprs/exprs.expected +++ b/java/ql/test/kotlin/library-tests/exprs/exprs.expected @@ -1717,86 +1717,6 @@ | exprs.kt:268:3:268:9 | updated | exprs.kt:261:1:270:1 | inPlaceOperators | VarAccess | | exprs.kt:268:3:268:14 | ...%=... | exprs.kt:261:1:270:1 | inPlaceOperators | AssignRemExpr | | exprs.kt:268:14:268:14 | 1 | exprs.kt:261:1:270:1 | inPlaceOperators | IntegerLiteral | -| file:///!unknown-binary-location/SomePredicate.class:0:0:0:0 | T | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/SomePredicate.class:0:0:0:0 | boolean | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function0.class:0:0:0:0 | R | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function1.class:0:0:0:0 | P1 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function1.class:0:0:0:0 | R | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function2.class:0:0:0:0 | P1 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function2.class:0:0:0:0 | P2 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function2.class:0:0:0:0 | R | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P1 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P2 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P3 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P4 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P5 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P6 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P7 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P8 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P9 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P10 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P11 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P12 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P13 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P14 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P15 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P16 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P17 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P18 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P19 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P20 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P21 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | P22 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function22.class:0:0:0:0 | R | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P1 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P2 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P3 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P4 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P5 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P6 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P7 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P8 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P9 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P10 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P11 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P12 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P13 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P14 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P15 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P16 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P17 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P18 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P19 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P20 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P21 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P22 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | P23 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function23.class:0:0:0:0 | R | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P1 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P2 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P3 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P4 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P5 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P6 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P7 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P8 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P9 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P10 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P11 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P12 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P13 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P14 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P15 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P16 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P17 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P18 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P19 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P20 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P21 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P22 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P23 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | P24 | file://:0:0:0:0 | | TypeAccess | -| file:///!unknown-binary-location/kotlin/Function24.class:0:0:0:0 | R | file://:0:0:0:0 | | TypeAccess | | funcExprs.kt:1:1:1:46 | Unit | file://:0:0:0:0 | | TypeAccess | | funcExprs.kt:1:26:1:37 | Function0 | file://:0:0:0:0 | | TypeAccess | | funcExprs.kt:1:26:1:37 | Integer | file://:0:0:0:0 | | TypeAccess | From 4ceb2f13c4ff35780d9b424b0af970a696b9f8a2 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 28 Apr 2022 16:12:40 +0100 Subject: [PATCH 20/34] Add test --- .../private-anonymous-types/other.kt | 1 + .../private-anonymous-types/test.expected | 18 ++++++++++++++++++ .../private-anonymous-types/test.kt | 19 +++++++++++++++++++ .../private-anonymous-types/test.ql | 5 +++++ 4 files changed, 43 insertions(+) create mode 100644 java/ql/test/kotlin/library-tests/private-anonymous-types/other.kt create mode 100644 java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected create mode 100644 java/ql/test/kotlin/library-tests/private-anonymous-types/test.kt create mode 100644 java/ql/test/kotlin/library-tests/private-anonymous-types/test.ql diff --git a/java/ql/test/kotlin/library-tests/private-anonymous-types/other.kt b/java/ql/test/kotlin/library-tests/private-anonymous-types/other.kt new file mode 100644 index 00000000000..ace100f9173 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/private-anonymous-types/other.kt @@ -0,0 +1 @@ +class Ext : A("Hello") { } diff --git a/java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected new file mode 100644 index 00000000000..ac6142182b5 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected @@ -0,0 +1,18 @@ +| file:///!unknown-binary-location/A.class:0:0:0:0 | A | file:///!unknown-binary-location/A.class:0:0:0:0 | A | +| file:///!unknown-binary-location/A.class:0:0:0:0 | A | file:///!unknown-binary-location/A.class:0:0:0:0 | getAnonType | +| file:///!unknown-binary-location/If.class:0:0:0:0 | If | file:///!unknown-binary-location/If.class:0:0:0:0 | getX | +| file:///!unknown-binary-location/If.class:0:0:0:0 | If | file:///!unknown-binary-location/If.class:0:0:0:0 | getX | +| other.kt:1:1:1:34 | Ext | other.kt:1:1:1:34 | Ext | +| test.kt:0:0:0:0 | TestKt | test.kt:19:1:19:38 | user | +| test.kt:1:1:5:1 | If | test.kt:3:3:3:11 | getX | +| test.kt:7:1:17:1 | A | test.kt:7:6:17:1 | A | +| test.kt:7:1:17:1 | A | test.kt:9:3:11:3 | anonType | +| test.kt:7:1:17:1 | A | test.kt:9:3:11:3 | getAnonType | +| test.kt:7:1:17:1 | A | test.kt:13:3:15:3 | privateAnonType | +| test.kt:7:1:17:1 | A | test.kt:13:11:15:3 | getPrivateAnonType | +| test.kt:9:18:11:3 | new If(...) { ... } | test.kt:9:18:11:3 | | +| test.kt:9:18:11:3 | new If(...) { ... } | test.kt:10:5:10:22 | x | +| test.kt:9:18:11:3 | new If(...) { ... } | test.kt:10:14:10:22 | getX | +| test.kt:13:33:15:3 | new If(...) { ... } | test.kt:13:33:15:3 | | +| test.kt:13:33:15:3 | new If(...) { ... } | test.kt:14:5:14:22 | x | +| test.kt:13:33:15:3 | new If(...) { ... } | test.kt:14:14:14:22 | getX | diff --git a/java/ql/test/kotlin/library-tests/private-anonymous-types/test.kt b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.kt new file mode 100644 index 00000000000..b0d49124eac --- /dev/null +++ b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.kt @@ -0,0 +1,19 @@ +interface If { + + val x : T + +} + +open class A(t: T) { + + val anonType = object : If { + override val x = t + } + + private val privateAnonType = object : If { + override val x = t + } + +} + +fun user(x: A) = x.anonType.x diff --git a/java/ql/test/kotlin/library-tests/private-anonymous-types/test.ql b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.ql new file mode 100644 index 00000000000..74bbc59a7fd --- /dev/null +++ b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.ql @@ -0,0 +1,5 @@ +import java + +from ClassOrInterface ci, Member m +where m = ci.getAMember() and ci.getSourceDeclaration().fromSource() +select ci, m From 394ec56d9d76d532656bea234381406cebb53626 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Thu, 5 May 2022 12:45:02 +0200 Subject: [PATCH 21/34] Add test case for local class declaration in field initializer --- .../library-tests/classes/DB-CHECK.expected | 20 + .../library-tests/classes/PrintAst.expected | 3522 +++++++++++++---- .../library-tests/classes/classes.expected | 3 + .../library-tests/classes/ctorCalls.expected | 3 + .../library-tests/classes/localClass.expected | 4 + .../library-tests/classes/localClassField.kt | 11 + .../library-tests/classes/superTypes.expected | 3 + 7 files changed, 2734 insertions(+), 832 deletions(-) create mode 100644 java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected create mode 100644 java/ql/test/kotlin/library-tests/classes/localClassField.kt diff --git a/java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected b/java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected new file mode 100644 index 00000000000..3de2e1a988a --- /dev/null +++ b/java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected @@ -0,0 +1,20 @@ +[INVALID_KEY_SET] predicate isLocalClassOrInterface(@classorinterface typeid, @localtypedeclstmt parent): The key set {typeid} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 1: +Tuple 1 in row 13: (1044,1050) +Tuple 2 in row 14: (1044,1075) + Relevant element: Tuple 1: typeid=1044 + Full ID for 1044: @"class;L" + Relevant element: Tuple 2: typeid=1044 + Full ID for 1044: @"class;L" +[INVALID_KEY_SET] predicate stmts(@stmt id, int kind, @stmtparent parent, int idx, @callable bodydecl): The key set {parent, idx} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 223: (1047,0,1046,0,1046) +Tuple 2 in row 233: (1072,0,1046,0,1046) + Relevant element: Tuple 1: parent=1046 + Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" + Relevant element: Tuple 2: parent=1046 + Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" + Relevant element: Tuple 1: bodydecl=1046 + Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" + Relevant element: Tuple 2: bodydecl=1046 + Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" diff --git a/java/ql/test/kotlin/library-tests/classes/PrintAst.expected b/java/ql/test/kotlin/library-tests/classes/PrintAst.expected index 4cbec7bf704..09490f642fa 100644 --- a/java/ql/test/kotlin/library-tests/classes/PrintAst.expected +++ b/java/ql/test/kotlin/library-tests/classes/PrintAst.expected @@ -1,840 +1,2698 @@ +classes.kt: +# 2| [Class] ClassOne +#-----| 1 -> [Constructor] ClassOne + +# 2| [Constructor] ClassOne +#-----| 5 -> [BlockStmt] { ... } + +# 2| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 2| [SuperConstructorInvocationStmt] super(...) + +# 2| [BlockStmt] { ... } + +# 4| [Class] ClassTwo +#-----| 1 -> [Constructor] ClassTwo +#-----| 2 -> [Method] getArg +#-----| 2 -> [FieldDeclaration] int arg; +#-----| 4 -> [Method] getX +#-----| 4 -> [FieldDeclaration] int x; + +# 4| [Constructor] ClassTwo +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 4| [Parameter] arg +#-----| 0 -> [TypeAccess] int + +# 4| [TypeAccess] int + +# 4| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 4| [SuperConstructorInvocationStmt] super(...) + +# 4| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; +#-----| 1 -> [ExprStmt] ; + +# 4| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 4| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] arg + +# 4| [VarAccess] arg + +# 4| [VarAccess] arg + +# 5| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 5| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] x + +# 5| [VarAccess] x + +# 5| [IntegerLiteral] 3 + +# 4| [Method] getArg +#-----| 3 -> [TypeAccess] int +#-----| 5 -> [BlockStmt] { ... } + +# 4| [TypeAccess] int + +# 4| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 4| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.arg + +# 4| [VarAccess] this.arg +#-----| -1 -> [ThisAccess] this + +# 4| [ThisAccess] this + +# 4| [FieldDeclaration] int arg; +#-----| -1 -> [TypeAccess] int +#-----| 0 -> [VarAccess] arg + +# 4| [TypeAccess] int + +# 5| [Method] getX +#-----| 3 -> [TypeAccess] int +#-----| 5 -> [BlockStmt] { ... } + +# 5| [TypeAccess] int + +# 5| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 5| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.x + +# 5| [VarAccess] this.x +#-----| -1 -> [ThisAccess] this + +# 5| [ThisAccess] this + +# 5| [FieldDeclaration] int x; +#-----| -1 -> [TypeAccess] int +#-----| 0 -> [IntegerLiteral] 3 + +# 5| [TypeAccess] int + +# 8| [Class] ClassThree +#-----| 1 -> [Constructor] ClassThree +#-----| 2 -> [Method] foo + +# 8| [Constructor] ClassThree +#-----| 5 -> [BlockStmt] { ... } + +# 8| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 8| [SuperConstructorInvocationStmt] super(...) + +# 8| [BlockStmt] { ... } + +# 9| [Method] foo +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) + +# 9| [Parameter] arg +#-----| 0 -> [TypeAccess] int + +# 9| [TypeAccess] int + +# 9| [TypeAccess] Unit + +# 12| [Class] ClassFour +#-----| 1 -> [Constructor] ClassFour +#-----| 2 -> [Method] foo + +# 12| [Constructor] ClassFour +#-----| 5 -> [BlockStmt] { ... } + +# 12| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 12| [SuperConstructorInvocationStmt] super(...) + +# 12| [BlockStmt] { ... } + +# 13| [Method] foo +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 13| [Parameter] arg +#-----| 0 -> [TypeAccess] int + +# 13| [TypeAccess] int + +# 13| [TypeAccess] Unit + +# 13| [BlockStmt] { ... } + +# 17| [Class] ClassFive +#-----| 1 -> [Constructor] ClassFive + +# 17| [Constructor] ClassFive +#-----| 5 -> [BlockStmt] { ... } + +# 17| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 17| [SuperConstructorInvocationStmt] super(...) + +# 17| [BlockStmt] { ... } + +# 20| [Interface] IF1 +#-----| 1 -> [Method] funIF1 + +# 21| [Method] funIF1 +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 21| [TypeAccess] Unit + +# 21| [BlockStmt] { ... } + +# 24| [Interface] IF2 +#-----| 1 -> [Method] funIF2 + +# 25| [Method] funIF2 +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 25| [TypeAccess] Unit + +# 25| [BlockStmt] { ... } + +# 28| [Class] ClassSix +#-----| 1 -> [Constructor] ClassSix +#-----| 2 -> [Constructor] ClassSix + +# 28| [Constructor] ClassSix +#-----| 5 -> [BlockStmt] { ... } + +# 28| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 28| [SuperConstructorInvocationStmt] super(...) + +# 28| [BlockStmt] { ... } + +# 29| [Constructor] ClassSix +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 29| [Parameter] i +#-----| 0 -> [TypeAccess] int + +# 29| [TypeAccess] int + +# 29| [BlockStmt] { ... } +#-----| 0 -> [ThisConstructorInvocationStmt] this(...) + +# 29| [ThisConstructorInvocationStmt] this(...) + +# 0| [Class] ClassesKt +#-----| 1 -> [Method] f + +# 32| [Method] f +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 32| [Parameter] s +#-----| 0 -> [TypeAccess] String + +# 32| [TypeAccess] String + +# 32| [TypeAccess] Unit + +# 32| [BlockStmt] { ... } + +# 34| [Class] ClassSeven +#-----| 1 -> [Constructor] ClassSeven +#-----| 2 -> [Method] getX +#-----| 2 -> [FieldDeclaration] int x; + +# 35| [Constructor] ClassSeven +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 35| [Parameter] i +#-----| 0 -> [TypeAccess] String + +# 35| [TypeAccess] String + +# 35| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } +#-----| 2 -> [ExprStmt] ; + +# 35| [SuperConstructorInvocationStmt] super(...) + +# 35| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; +#-----| 1 -> [ExprStmt] ; +#-----| 2 -> [ExprStmt] ; + +# 39| [ExprStmt] ; +#-----| 0 -> [MethodAccess] f(...) + +# 39| [MethodAccess] f(...) +#-----| -1 -> [TypeAccess] ClassesKt +#-----| 0 -> [StringLiteral] init1 + +# 39| [TypeAccess] ClassesKt + +# 39| [StringLiteral] init1 + +# 42| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 42| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] x + +# 42| [VarAccess] x + +# 42| [IntegerLiteral] 3 + +# 45| [ExprStmt] ; +#-----| 0 -> [MethodAccess] f(...) + +# 45| [MethodAccess] f(...) +#-----| -1 -> [TypeAccess] ClassesKt +#-----| 0 -> [StringLiteral] init2 + +# 45| [TypeAccess] ClassesKt + +# 45| [StringLiteral] init2 + +# 36| [ExprStmt] ; +#-----| 0 -> [MethodAccess] f(...) + +# 36| [MethodAccess] f(...) +#-----| -1 -> [TypeAccess] ClassesKt +#-----| 0 -> [VarAccess] i + +# 36| [TypeAccess] ClassesKt + +# 36| [VarAccess] i + +# 42| [Method] getX +#-----| 3 -> [TypeAccess] int +#-----| 5 -> [BlockStmt] { ... } + +# 42| [TypeAccess] int + +# 42| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 42| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.x + +# 42| [VarAccess] this.x +#-----| -1 -> [ThisAccess] this + +# 42| [ThisAccess] this + +# 42| [FieldDeclaration] int x; +#-----| -1 -> [TypeAccess] int +#-----| 0 -> [IntegerLiteral] 3 + +# 42| [TypeAccess] int + +# 49| [Class] Direction +#-----| 1 -> [Method] values +#-----| 1 -> [Method] valueOf +#-----| 4 -> [Constructor] Direction +#-----| 5 -> [FieldDeclaration] Direction NORTH; +#-----| 6 -> [FieldDeclaration] Direction SOUTH; +#-----| 7 -> [FieldDeclaration] Direction WEST; +#-----| 8 -> [FieldDeclaration] Direction EAST; + +# 49| [Constructor] Direction +#-----| 5 -> [BlockStmt] { ... } + +# 49| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; +#-----| 1 -> [BlockStmt] { ... } + +# 49| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new Enum(...) + +# 49| [ClassInstanceExpr] new Enum(...) +#-----| -3 -> [TypeAccess] Unit + +# 49| [TypeAccess] Unit +#-----| 0 -> [TypeAccess] Direction + +# 49| [TypeAccess] Direction + +# 49| [BlockStmt] { ... } + +# 50| [FieldDeclaration] Direction NORTH; +#-----| -1 -> [TypeAccess] Direction +#-----| 0 -> [ClassInstanceExpr] new Direction(...) + +# 50| [TypeAccess] Direction + +# 50| [FieldDeclaration] Direction SOUTH; +#-----| -1 -> [TypeAccess] Direction +#-----| 0 -> [ClassInstanceExpr] new Direction(...) + +# 50| [TypeAccess] Direction + +# 50| [FieldDeclaration] Direction WEST; +#-----| -1 -> [TypeAccess] Direction +#-----| 0 -> [ClassInstanceExpr] new Direction(...) + +# 50| [TypeAccess] Direction + +# 50| [FieldDeclaration] Direction EAST; +#-----| -1 -> [TypeAccess] Direction +#-----| 0 -> [ClassInstanceExpr] new Direction(...) + +# 50| [TypeAccess] Direction + +# 0| [Method] values +#-----| 3 -> [TypeAccess] Direction[] + +# 0| [TypeAccess] Direction[] +#-----| 0 -> [TypeAccess] Direction + +# 0| [TypeAccess] Direction + +# 0| [Method] valueOf +#-----| 3 -> [TypeAccess] Direction +#-----| 4 -> (Parameters) + +# 0| [Parameter] value +#-----| 0 -> [TypeAccess] String + +# 0| [TypeAccess] String + +# 0| [TypeAccess] Direction + +# 50| [ClassInstanceExpr] new Direction(...) +#-----| -3 -> [TypeAccess] Direction + +# 50| [TypeAccess] Direction + +# 50| [ClassInstanceExpr] new Direction(...) +#-----| -3 -> [TypeAccess] Direction + +# 50| [TypeAccess] Direction + +# 50| [ClassInstanceExpr] new Direction(...) +#-----| -3 -> [TypeAccess] Direction + +# 50| [TypeAccess] Direction + +# 50| [ClassInstanceExpr] new Direction(...) +#-----| -3 -> [TypeAccess] Direction + +# 50| [TypeAccess] Direction + +# 53| [Class] Color +#-----| 1 -> [Method] values +#-----| 1 -> [Method] valueOf +#-----| 4 -> [Constructor] Color +#-----| 5 -> [Method] getRgb +#-----| 5 -> [FieldDeclaration] int rgb; +#-----| 7 -> [FieldDeclaration] Color RED; +#-----| 8 -> [FieldDeclaration] Color GREEN; +#-----| 9 -> [FieldDeclaration] Color BLUE; + +# 53| [Constructor] Color +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 53| [Parameter] rgb +#-----| 0 -> [TypeAccess] int + +# 53| [TypeAccess] int + +# 53| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; +#-----| 1 -> [BlockStmt] { ... } + +# 53| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new Enum(...) + +# 53| [ClassInstanceExpr] new Enum(...) +#-----| -3 -> [TypeAccess] Unit + +# 53| [TypeAccess] Unit +#-----| 0 -> [TypeAccess] Color + +# 53| [TypeAccess] Color + +# 53| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 53| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 53| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] rgb + +# 53| [VarAccess] rgb + +# 53| [VarAccess] rgb + +# 53| [Method] getRgb +#-----| 3 -> [TypeAccess] int +#-----| 5 -> [BlockStmt] { ... } + +# 53| [TypeAccess] int + +# 53| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 53| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.rgb + +# 53| [VarAccess] this.rgb +#-----| -1 -> [ThisAccess] this + +# 53| [ThisAccess] this + +# 53| [FieldDeclaration] int rgb; +#-----| -1 -> [TypeAccess] int +#-----| 0 -> [VarAccess] rgb + +# 53| [TypeAccess] int + +# 54| [FieldDeclaration] Color RED; +#-----| -1 -> [TypeAccess] Color +#-----| 0 -> [ClassInstanceExpr] new Color(...) + +# 54| [TypeAccess] Color + +# 55| [FieldDeclaration] Color GREEN; +#-----| -1 -> [TypeAccess] Color +#-----| 0 -> [ClassInstanceExpr] new Color(...) + +# 55| [TypeAccess] Color + +# 56| [FieldDeclaration] Color BLUE; +#-----| -1 -> [TypeAccess] Color +#-----| 0 -> [ClassInstanceExpr] new Color(...) + +# 56| [TypeAccess] Color + +# 0| [Method] values +#-----| 3 -> [TypeAccess] Color[] + +# 0| [TypeAccess] Color[] +#-----| 0 -> [TypeAccess] Color + +# 0| [TypeAccess] Color + +# 0| [Method] valueOf +#-----| 3 -> [TypeAccess] Color +#-----| 4 -> (Parameters) + +# 0| [Parameter] value +#-----| 0 -> [TypeAccess] String + +# 0| [TypeAccess] String + +# 0| [TypeAccess] Color + +# 54| [ClassInstanceExpr] new Color(...) +#-----| -3 -> [TypeAccess] Color +#-----| 0 -> [IntegerLiteral] 16711680 + +# 54| [IntegerLiteral] 16711680 + +# 54| [TypeAccess] Color + +# 55| [ClassInstanceExpr] new Color(...) +#-----| -3 -> [TypeAccess] Color +#-----| 0 -> [IntegerLiteral] 65280 + +# 55| [IntegerLiteral] 65280 + +# 55| [TypeAccess] Color + +# 56| [ClassInstanceExpr] new Color(...) +#-----| -3 -> [TypeAccess] Color +#-----| 0 -> [IntegerLiteral] 255 + +# 56| [IntegerLiteral] 255 + +# 56| [TypeAccess] Color + +# 59| [Interface] Interface1 + +# 60| [Interface] Interface2 + +# 61| [GenericType,Interface,ParameterizedType] Interface3 +#-----| -2 -> (Generic Parameters) + +# 61| [TypeVariable] T + +# 63| [Class] Class1 +#-----| 1 -> [Constructor] Class1 +#-----| 2 -> [Method] getObject1 +#-----| 3 -> [Method] getObject2 +#-----| 4 -> [Method] getObject3 +#-----| 5 -> [Method] getObject4 +#-----| 6 -> [Method] getObject5 + +# 63| [Constructor] Class1 +#-----| 5 -> [BlockStmt] { ... } + +# 63| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 63| [SuperConstructorInvocationStmt] super(...) + +# 63| [BlockStmt] { ... } + +# 64| [Method] getObject1 +#-----| 3 -> [TypeAccess] Object +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 64| [Parameter] b +#-----| 0 -> [TypeAccess] boolean + +# 64| [TypeAccess] boolean + +# 64| [TypeAccess] Object + +# 64| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 65| [ExprStmt] ; +#-----| 0 -> [WhenExpr] when ... + +# 65| [WhenExpr] when ... +#-----| 0 -> [WhenBranch] ... -> ... +#-----| 1 -> [WhenBranch] ... -> ... + +# 65| [WhenBranch] ... -> ... +#-----| 0 -> [VarAccess] b +#-----| 1 -> [ReturnStmt] return ... + +# 65| [VarAccess] b + +# 66| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 66| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 66| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] + +# 66| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 66| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 66| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 66| [SuperConstructorInvocationStmt] super(...) + +# 66| [BlockStmt] { ... } + +# 66| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 66| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 66| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 66| [TypeAccess] Object + +# 65| [WhenBranch] ... -> ... +#-----| 0 -> [BooleanLiteral] true +#-----| 1 -> [ReturnStmt] return ... + +# 65| [BooleanLiteral] true + +# 68| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 68| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 68| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] + +# 68| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 68| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 68| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 68| [SuperConstructorInvocationStmt] super(...) + +# 68| [BlockStmt] { ... } + +# 68| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 68| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 68| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 68| [TypeAccess] Object + +# 71| [Method] getObject2 +#-----| 3 -> [TypeAccess] Interface1 +#-----| 5 -> [BlockStmt] { ... } + +# 71| [TypeAccess] Interface1 + +# 71| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 72| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 72| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 72| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] +#-----| 2 -> [Method] getX +#-----| 2 -> [FieldDeclaration] int x; +#-----| 4 -> [Method] foo + +# 72| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 72| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 72| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 72| [SuperConstructorInvocationStmt] super(...) + +# 72| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 73| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 73| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] x + +# 73| [VarAccess] x + +# 73| [IntegerLiteral] 1 + +# 73| [Method] getX +#-----| 3 -> [TypeAccess] int +#-----| 5 -> [BlockStmt] { ... } + +# 73| [TypeAccess] int + +# 73| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 73| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.x + +# 73| [VarAccess] this.x +#-----| -1 -> [ThisAccess] this + +# 73| [ThisAccess] this + +# 73| [FieldDeclaration] int x; +#-----| -1 -> [TypeAccess] int +#-----| 0 -> [IntegerLiteral] 1 + +# 73| [TypeAccess] int + +# 74| [Method] foo +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 74| [TypeAccess] Object + +# 74| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 75| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 75| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 75| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] + +# 75| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 75| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 75| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 75| [SuperConstructorInvocationStmt] super(...) + +# 75| [BlockStmt] { ... } + +# 75| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 75| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 75| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 75| [TypeAccess] Object + +# 72| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 72| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 72| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 72| [TypeAccess] Object + +# 80| [Method] getObject3 +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 80| [TypeAccess] Object + +# 80| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 81| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 81| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 81| [AnonymousClass,LocalClass] new Interface1(...) { ... } +#-----| 1 -> [Constructor] + +# 81| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 81| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 81| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 81| [SuperConstructorInvocationStmt] super(...) + +# 81| [BlockStmt] { ... } + +# 81| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Interface1(...) { ... } + +# 81| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 81| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Interface1 + +# 81| [TypeAccess] Interface1 + +# 84| [Method] getObject4 +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 84| [TypeAccess] Object + +# 84| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 85| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 85| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 85| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] + +# 85| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 85| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 85| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 85| [SuperConstructorInvocationStmt] super(...) + +# 85| [BlockStmt] { ... } + +# 85| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 85| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 85| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 85| [TypeAccess] Object + +# 88| [Method] getObject5 +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 88| [TypeAccess] Object + +# 88| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 89| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 89| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 89| [AnonymousClass,LocalClass] new Interface3(...) { ... } +#-----| 1 -> [Constructor] + +# 89| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 89| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 89| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 89| [SuperConstructorInvocationStmt] super(...) + +# 89| [BlockStmt] { ... } + +# 89| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Interface3(...) { ... } + +# 89| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 89| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Interface3 + +# 89| [TypeAccess] Interface3 + +# 93| [Class] pulicClass +#-----| 1 -> [Constructor] pulicClass + +# 93| [Constructor] pulicClass +#-----| 5 -> [BlockStmt] { ... } + +# 93| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 93| [SuperConstructorInvocationStmt] super(...) + +# 93| [BlockStmt] { ... } + +# 94| [Class] privateClass +#-----| 1 -> [Constructor] privateClass + +# 94| [Constructor] privateClass +#-----| 5 -> [BlockStmt] { ... } + +# 94| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 94| [SuperConstructorInvocationStmt] super(...) + +# 94| [BlockStmt] { ... } + +# 95| [Class] internalClass +#-----| 1 -> [Constructor] internalClass + +# 95| [Constructor] internalClass +#-----| 5 -> [BlockStmt] { ... } + +# 95| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 95| [SuperConstructorInvocationStmt] super(...) + +# 95| [BlockStmt] { ... } + +# 96| [Class] noExplicitVisibilityClass +#-----| 1 -> [Constructor] noExplicitVisibilityClass + +# 96| [Constructor] noExplicitVisibilityClass +#-----| 5 -> [BlockStmt] { ... } + +# 96| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 96| [SuperConstructorInvocationStmt] super(...) + +# 96| [BlockStmt] { ... } + +# 98| [Class] nestedClassVisibilities +#-----| 1 -> [Constructor] nestedClassVisibilities +#-----| 2 -> [Class] pulicNestedClass +#-----| 3 -> [Class] protectedNestedClass +#-----| 4 -> [Class] privateNestedClass +#-----| 5 -> [Class] internalNestedClass +#-----| 6 -> [Class] noExplicitVisibilityNestedClass + +# 98| [Constructor] nestedClassVisibilities +#-----| 5 -> [BlockStmt] { ... } + +# 98| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 98| [SuperConstructorInvocationStmt] super(...) + +# 98| [BlockStmt] { ... } + +# 99| [Class] pulicNestedClass +#-----| 1 -> [Constructor] pulicNestedClass + +# 99| [Constructor] pulicNestedClass +#-----| 5 -> [BlockStmt] { ... } + +# 99| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 99| [SuperConstructorInvocationStmt] super(...) + +# 99| [BlockStmt] { ... } + +# 100| [Class] protectedNestedClass +#-----| 1 -> [Constructor] protectedNestedClass + +# 100| [Constructor] protectedNestedClass +#-----| 5 -> [BlockStmt] { ... } + +# 100| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 100| [SuperConstructorInvocationStmt] super(...) + +# 100| [BlockStmt] { ... } + +# 101| [Class] privateNestedClass +#-----| 1 -> [Constructor] privateNestedClass + +# 101| [Constructor] privateNestedClass +#-----| 5 -> [BlockStmt] { ... } + +# 101| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 101| [SuperConstructorInvocationStmt] super(...) + +# 101| [BlockStmt] { ... } + +# 102| [Class] internalNestedClass +#-----| 1 -> [Constructor] internalNestedClass + +# 102| [Constructor] internalNestedClass +#-----| 5 -> [BlockStmt] { ... } + +# 102| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 102| [SuperConstructorInvocationStmt] super(...) + +# 102| [BlockStmt] { ... } + +# 103| [Class] noExplicitVisibilityNestedClass +#-----| 1 -> [Constructor] noExplicitVisibilityNestedClass + +# 103| [Constructor] noExplicitVisibilityNestedClass +#-----| 5 -> [BlockStmt] { ... } + +# 103| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 103| [SuperConstructorInvocationStmt] super(...) + +# 103| [BlockStmt] { ... } + +# 106| [Class] sealedClass +#-----| 1 -> [Constructor] sealedClass + +# 106| [Constructor] sealedClass +#-----| 5 -> [BlockStmt] { ... } + +# 106| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 106| [SuperConstructorInvocationStmt] super(...) + +# 106| [BlockStmt] { ... } + +# 107| [Class] openClass +#-----| 1 -> [Constructor] openClass + +# 107| [Constructor] openClass +#-----| 5 -> [BlockStmt] { ... } + +# 107| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 107| [SuperConstructorInvocationStmt] super(...) + +# 107| [BlockStmt] { ... } + +# 109| [Class] C1 +#-----| 1 -> [Constructor] C1 +#-----| 2 -> [Method] fn1 +#-----| 3 -> [Method] fn2 +#-----| 4 -> [Method] fn3 + +# 109| [Constructor] C1 +#-----| 5 -> [BlockStmt] { ... } + +# 109| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 109| [SuperConstructorInvocationStmt] super(...) + +# 109| [BlockStmt] { ... } + +# 110| [Method] fn1 +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 110| [Parameter] p +#-----| 0 -> [TypeAccess] int + +# 110| [TypeAccess] int + +# 110| [TypeAccess] Unit + +# 110| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 111| [Class,GenericType,LocalClass,ParameterizedType] Local1 +#-----| -2 -> (Generic Parameters) +#-----| 1 -> [Constructor] Local1 +#-----| 2 -> [Method] foo + +# 111| [TypeVariable] T1 + +# 111| [Constructor] Local1 +#-----| 5 -> [BlockStmt] { ... } + +# 111| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 111| [SuperConstructorInvocationStmt] super(...) + +# 111| [BlockStmt] { ... } + +# 112| [Method] foo +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 112| [Parameter] p +#-----| 0 -> [TypeAccess] int + +# 112| [TypeAccess] int + +# 112| [TypeAccess] Unit + +# 112| [BlockStmt] { ... } + +# 111| [LocalTypeDeclStmt] class ... +#-----| 0 -> [Class,GenericType,LocalClass,ParameterizedType] Local1 + +# 114| [ExprStmt] ; +#-----| 0 -> [MethodAccess] foo(...) + +# 114| [MethodAccess] foo(...) +#-----| -1 -> [ClassInstanceExpr] new Local1(...) +#-----| 0 -> [VarAccess] p + +# 114| [ClassInstanceExpr] new Local1(...) +#-----| -3 -> [TypeAccess] Local1 + +# 114| [TypeAccess] Local1 +#-----| 0 -> [TypeAccess] Integer + +# 114| [TypeAccess] Integer + +# 114| [VarAccess] p + +# 117| [Method] fn2 +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 117| [Parameter] p +#-----| 0 -> [TypeAccess] int + +# 117| [TypeAccess] int + +# 117| [TypeAccess] Unit + +# 117| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... + +# 118| [LocalClass] +#-----| 1 -> [Constructor] +#-----| 1 -> [Method] localFn + +# 118| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 118| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) + +# 118| [Method] localFn +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 118| [SuperConstructorInvocationStmt] super(...) + +# 118| [TypeAccess] Unit + +# 118| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 119| [Class,GenericType,LocalClass,ParameterizedType] Local2 +#-----| -2 -> (Generic Parameters) +#-----| 1 -> [Constructor] Local2 +#-----| 2 -> [Method] foo + +# 119| [TypeVariable] T1 + +# 119| [Constructor] Local2 +#-----| 5 -> [BlockStmt] { ... } + +# 119| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 119| [SuperConstructorInvocationStmt] super(...) + +# 119| [BlockStmt] { ... } + +# 120| [Method] foo +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 120| [Parameter] p +#-----| 0 -> [TypeAccess] int + +# 120| [TypeAccess] int + +# 120| [TypeAccess] Unit + +# 120| [BlockStmt] { ... } + +# 119| [LocalTypeDeclStmt] class ... +#-----| 0 -> [Class,GenericType,LocalClass,ParameterizedType] Local2 + +# 122| [ExprStmt] ; +#-----| 0 -> [MethodAccess] foo(...) + +# 122| [MethodAccess] foo(...) +#-----| -1 -> [ClassInstanceExpr] new Local2(...) +#-----| 0 -> [VarAccess] p + +# 122| [ClassInstanceExpr] new Local2(...) +#-----| -3 -> [TypeAccess] Local2 + +# 122| [TypeAccess] Local2 +#-----| 0 -> [TypeAccess] Integer + +# 122| [TypeAccess] Integer + +# 122| [VarAccess] p + +# 118| [LocalTypeDeclStmt] class ... +#-----| 0 -> [LocalClass] + +# 126| [Method] fn3 +#-----| 3 -> [TypeAccess] Object +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 126| [Parameter] p +#-----| 0 -> [TypeAccess] int + +# 126| [TypeAccess] int + +# 126| [TypeAccess] Object + +# 126| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 127| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 127| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 127| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] +#-----| 2 -> [Method] fn + +# 127| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 127| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 127| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 127| [SuperConstructorInvocationStmt] super(...) + +# 127| [BlockStmt] { ... } + +# 128| [Method] fn +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 128| [TypeAccess] Unit + +# 128| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 129| [Class,GenericType,LocalClass,ParameterizedType] Local3 +#-----| -2 -> (Generic Parameters) +#-----| 1 -> [Constructor] Local3 +#-----| 2 -> [Method] foo + +# 129| [TypeVariable] T1 + +# 129| [Constructor] Local3 +#-----| 5 -> [BlockStmt] { ... } + +# 129| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 129| [SuperConstructorInvocationStmt] super(...) + +# 129| [BlockStmt] { ... } + +# 130| [Method] foo +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 130| [Parameter] p +#-----| 0 -> [TypeAccess] int + +# 130| [TypeAccess] int + +# 130| [TypeAccess] Unit + +# 130| [BlockStmt] { ... } + +# 129| [LocalTypeDeclStmt] class ... +#-----| 0 -> [Class,GenericType,LocalClass,ParameterizedType] Local3 + +# 132| [ExprStmt] ; +#-----| 0 -> [MethodAccess] foo(...) + +# 132| [MethodAccess] foo(...) +#-----| -1 -> [ClassInstanceExpr] new Local3(...) +#-----| 0 -> [VarAccess] p + +# 132| [ClassInstanceExpr] new Local3(...) +#-----| -3 -> [TypeAccess] Local3 + +# 132| [TypeAccess] Local3 +#-----| 0 -> [TypeAccess] Integer + +# 132| [TypeAccess] Integer + +# 132| [VarAccess] p + +# 127| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 127| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 127| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 127| [TypeAccess] Object + +generic_anonymous.kt: +# 1| [Class,GenericType,ParameterizedType] Generic +#-----| -2 -> (Generic Parameters) +#-----| 1 -> [Constructor] Generic +#-----| 2 -> [Method] getT +#-----| 2 -> [FieldDeclaration] T t; +#-----| 4 -> [FieldDeclaration] new Object(...) { ... } x; +#-----| 5 -> [Method] getX +#-----| 6 -> [Method] get + +# 1| [TypeVariable] T + +# 1| [Constructor] Generic +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 1| [Parameter] t +#-----| 0 -> [TypeAccess] T + +# 1| [TypeAccess] T + +# 1| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 1| [SuperConstructorInvocationStmt] super(...) + +# 1| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; +#-----| 1 -> [ExprStmt] ; + +# 1| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 1| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] t + +# 1| [VarAccess] t + +# 1| [VarAccess] t + +# 3| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] +#-----| 2 -> [Method] getMember +#-----| 2 -> [FieldDeclaration] T member; + +# 3| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 3| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] x + +# 3| [VarAccess] x + +# 3| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 3| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 3| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 3| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 3| [SuperConstructorInvocationStmt] super(...) + +# 3| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 4| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 4| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] member + +# 4| [VarAccess] member + +# 4| [MethodAccess] getT(...) +#-----| -1 -> [ThisAccess] Generic.this + +# 1| [Method] getT +#-----| 3 -> [TypeAccess] T +#-----| 5 -> [BlockStmt] { ... } + +# 4| [ThisAccess] Generic.this +#-----| 0 -> [TypeAccess] Generic + +# 4| [TypeAccess] Generic + +# 4| [Method] getMember +#-----| 3 -> [TypeAccess] T +#-----| 5 -> [BlockStmt] { ... } + +# 4| [TypeAccess] T + +# 4| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 4| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.member + +# 4| [VarAccess] this.member +#-----| -1 -> [ThisAccess] this + +# 4| [ThisAccess] this + +# 4| [FieldDeclaration] T member; +#-----| -1 -> [TypeAccess] T +#-----| 0 -> [MethodAccess] getT(...) + +# 4| [TypeAccess] T + +# 3| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 3| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 3| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 3| [TypeAccess] Object + +# 1| [TypeAccess] T + +# 1| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 1| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.t + +# 1| [VarAccess] this.t +#-----| -1 -> [ThisAccess] this + +# 1| [ThisAccess] this + +# 1| [FieldDeclaration] T t; +#-----| -1 -> [TypeAccess] T +#-----| 0 -> [VarAccess] t + +# 1| [TypeAccess] T + +# 3| [Method] getX +#-----| 3 -> [TypeAccess] new Object(...) { ... } +#-----| 5 -> [BlockStmt] { ... } + +# 3| [TypeAccess] new Object(...) { ... } +#-----| 0 -> [TypeAccess] T + +# 3| [TypeAccess] T + +# 3| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 3| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.x + +# 3| [VarAccess] this.x +#-----| -1 -> [ThisAccess] this + +# 3| [ThisAccess] this + +# 3| [FieldDeclaration] new Object(...) { ... } x; +#-----| -1 -> [TypeAccess] new Object(...) { ... } +#-----| 0 -> [StmtExpr] + +# 3| [TypeAccess] new Object(...) { ... } +#-----| 0 -> [TypeAccess] T + +# 3| [TypeAccess] T + +# 7| [Method] get +#-----| 3 -> [TypeAccess] T +#-----| 5 -> [BlockStmt] { ... } + +# 7| [TypeAccess] T + +# 7| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 7| [ReturnStmt] return ... +#-----| 0 -> [MethodAccess] getMember(...) + +# 7| [MethodAccess] getMember(...) +#-----| -1 -> [MethodAccess] getX(...) + +# 7| [MethodAccess] getX(...) +#-----| -1 -> [ThisAccess] this + +# 7| [ThisAccess] this + +# 0| [Class] Generic_anonymousKt +#-----| 1 -> [Method] stringIdentity +#-----| 2 -> [Method] intIdentity + +# 11| [Method] stringIdentity +#-----| 3 -> [TypeAccess] String +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 11| [Parameter] s +#-----| 0 -> [TypeAccess] String + +# 11| [TypeAccess] String + +# 11| [TypeAccess] String + +# 11| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 11| [ReturnStmt] return ... +#-----| 0 -> [MethodAccess] get(...) + +# 11| [MethodAccess] get(...) +#-----| -1 -> [ClassInstanceExpr] new Generic(...) + +# 11| [ClassInstanceExpr] new Generic(...) +#-----| -3 -> [TypeAccess] Generic +#-----| 0 -> [VarAccess] s + +# 11| [VarAccess] s + +# 11| [TypeAccess] Generic +#-----| 0 -> [TypeAccess] String + +# 11| [TypeAccess] String + +# 13| [Method] intIdentity +#-----| 3 -> [TypeAccess] int +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 13| [Parameter] i +#-----| 0 -> [TypeAccess] int + +# 13| [TypeAccess] int + +# 13| [TypeAccess] int + +# 13| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 13| [ReturnStmt] return ... +#-----| 0 -> [MethodAccess] get(...) + +# 13| [MethodAccess] get(...) +#-----| -1 -> [ClassInstanceExpr] new Generic(...) + +# 13| [ClassInstanceExpr] new Generic(...) +#-----| -3 -> [TypeAccess] Generic +#-----| 0 -> [VarAccess] i + +# 13| [VarAccess] i + +# 13| [TypeAccess] Generic +#-----| 0 -> [TypeAccess] Integer + +# 13| [TypeAccess] Integer + +localClassField.kt: +# 1| [Class] A +#-----| 1 -> [Constructor] A +#-----| 2 -> [Method] getX +#-----| 2 -> [FieldDeclaration] Object x; +#-----| 4 -> [Method] getY +#-----| 4 -> [FieldDeclaration] Object y; + +# 1| [Constructor] A +#-----| 5 -> [BlockStmt] { ... } + +# 1| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 1| [SuperConstructorInvocationStmt] super(...) + +# 1| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; +#-----| 1 -> [ExprStmt] ; + +# 2| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 2| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] x + +# 2| [VarAccess] x + +# 2| [WhenExpr] when ... +#-----| 0 -> [WhenBranch] ... -> ... +#-----| 1 -> [WhenBranch] ... -> ... + +# 2| [WhenBranch] ... -> ... +#-----| 0 -> [BooleanLiteral] true +#-----| 1 -> [BlockStmt] { ... } + +# 2| [BooleanLiteral] true + +# 2| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 3| [LocalClass] L +#-----| 2 -> [Constructor] L +#-----| 2 -> [Constructor] L + +# 8| [LocalClass] L +#-----| 2 -> [Constructor] L +#-----| 2 -> [Constructor] L + +# 3| [Constructor] L +#-----| 5 -> [BlockStmt] { ... } +#-----| 5 -> [BlockStmt] { ... } + +# 8| [Constructor] L +#-----| 5 -> [BlockStmt] { ... } +#-----| 5 -> [BlockStmt] { ... } + +# 3| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 3| [SuperConstructorInvocationStmt] super(...) + +# 3| [BlockStmt] { ... } + +# 3| [LocalTypeDeclStmt] class ... +#-----| 0 -> [LocalClass] L +#-----| 0 -> [LocalClass] L + +# 4| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new L(...) + +# 4| [ClassInstanceExpr] new L(...) +#-----| -3 -> [TypeAccess] L + +# 4| [TypeAccess] L + +# 2| [WhenBranch] ... -> ... +#-----| 0 -> [BooleanLiteral] true +#-----| 1 -> [BlockStmt] { ... } + +# 2| [BooleanLiteral] true + +# 5| [BlockStmt] { ... } + +# 7| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 7| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] y + +# 7| [VarAccess] y + +# 7| [WhenExpr] when ... +#-----| 0 -> [WhenBranch] ... -> ... +#-----| 1 -> [WhenBranch] ... -> ... + +# 7| [WhenBranch] ... -> ... +#-----| 0 -> [BooleanLiteral] true +#-----| 1 -> [BlockStmt] { ... } + +# 7| [BooleanLiteral] true + +# 7| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 8| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 8| [SuperConstructorInvocationStmt] super(...) + +# 8| [BlockStmt] { ... } + +# 8| [LocalTypeDeclStmt] class ... +#-----| 0 -> [LocalClass] L +#-----| 0 -> [LocalClass] L + +# 9| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new L(...) + +# 9| [ClassInstanceExpr] new L(...) +#-----| -3 -> [TypeAccess] L + +# 9| [TypeAccess] L + +# 7| [WhenBranch] ... -> ... +#-----| 0 -> [BooleanLiteral] true +#-----| 1 -> [BlockStmt] { ... } + +# 7| [BooleanLiteral] true + +# 10| [BlockStmt] { ... } + +# 2| [Method] getX +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 2| [TypeAccess] Object + +# 2| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 2| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.x + +# 2| [VarAccess] this.x +#-----| -1 -> [ThisAccess] this + +# 2| [ThisAccess] this + +# 2| [FieldDeclaration] Object x; +#-----| -1 -> [TypeAccess] Object +#-----| 0 -> [WhenExpr] when ... + +# 2| [TypeAccess] Object + +# 7| [Method] getY +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 7| [TypeAccess] Object + +# 7| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 7| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.y + +# 7| [VarAccess] this.y +#-----| -1 -> [ThisAccess] this + +# 7| [ThisAccess] this + +# 7| [FieldDeclaration] Object y; +#-----| -1 -> [TypeAccess] Object +#-----| 0 -> [WhenExpr] when ... + +# 7| [TypeAccess] Object + +local_anonymous.kt: +# 3| [Class] Class1 +#-----| 1 -> [Constructor] Class1 +#-----| 2 -> [Method] fn1 +#-----| 3 -> [Method] fn2 +#-----| 4 -> [Method] fn3 +#-----| 5 -> [Method] fn4 +#-----| 6 -> [Method] fn5 +#-----| 7 -> [Method] nullableAnonymous + +# 3| [Constructor] Class1 +#-----| 5 -> [BlockStmt] { ... } + +# 3| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 3| [SuperConstructorInvocationStmt] super(...) + +# 3| [BlockStmt] { ... } + +# 4| [Method] fn1 +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 4| [TypeAccess] Object + +# 4| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 5| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 5| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 5| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] +#-----| 2 -> [Method] fn + +# 5| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 5| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 5| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 5| [SuperConstructorInvocationStmt] super(...) + +# 5| [BlockStmt] { ... } + +# 6| [Method] fn +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 6| [TypeAccess] Unit + +# 6| [BlockStmt] { ... } + +# 5| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 5| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 5| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 5| [TypeAccess] Object + +# 10| [Method] fn2 +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 10| [TypeAccess] Unit + +# 10| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 11| [LocalClass] +#-----| 1 -> [Constructor] +#-----| 1 -> [Method] fnLocal + +# 11| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 11| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) + +# 11| [Method] fnLocal +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 11| [SuperConstructorInvocationStmt] super(...) + +# 11| [TypeAccess] Unit + +# 11| [BlockStmt] { ... } + +# 11| [LocalTypeDeclStmt] class ... +#-----| 0 -> [LocalClass] + +# 12| [ExprStmt] ; +#-----| 0 -> [MethodAccess] fnLocal(...) + +# 12| [MethodAccess] fnLocal(...) +#-----| -1 -> [ClassInstanceExpr] new (...) + +# 12| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 12| [TypeAccess] Object + +# 15| [Method] fn3 +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 15| [TypeAccess] Unit + +# 15| [BlockStmt] { ... } +#-----| 0 -> [LocalVariableDeclStmt] var ...; +#-----| 1 -> [LocalVariableDeclStmt] var ...; + +# 16| [LocalVariableDeclStmt] var ...; +#-----| 1 -> [LocalVariableDeclExpr] lambda1 + +# 16| [LocalVariableDeclExpr] lambda1 +#-----| 0 -> [LambdaExpr] ...->... + +# 16| [AnonymousClass] new Function2(...) { ... } +#-----| 1 -> [Constructor] +#-----| 1 -> [Method] invoke + +# 16| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 16| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) + +# 16| [Method] invoke +#-----| 3 -> [TypeAccess] int +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 16| [SuperConstructorInvocationStmt] super(...) + +# 16| [Parameter] a +#-----| 0 -> [TypeAccess] int + +# 16| [TypeAccess] int + +# 16| [Parameter] b +#-----| 0 -> [TypeAccess] int + +# 16| [TypeAccess] int + +# 16| [TypeAccess] int + +# 16| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 16| [ReturnStmt] return ... +#-----| 0 -> [AddExpr] ... + ... + +# 16| [AddExpr] ... + ... +#-----| 0 -> [VarAccess] a +#-----| 1 -> [VarAccess] b + +# 16| [VarAccess] a + +# 16| [VarAccess] b + +# 16| [LambdaExpr] ...->... +#-----| -4 -> [AnonymousClass] new Function2(...) { ... } +#-----| -3 -> [TypeAccess] Function2 + +# 16| [TypeAccess] Function2 +#-----| 0 -> [TypeAccess] Integer +#-----| 1 -> [TypeAccess] Integer +#-----| 2 -> [TypeAccess] Integer + +# 16| [TypeAccess] Integer + +# 16| [TypeAccess] Integer + +# 16| [TypeAccess] Integer + +# 17| [LocalVariableDeclStmt] var ...; +#-----| 1 -> [LocalVariableDeclExpr] lambda2 + +# 17| [LocalVariableDeclExpr] lambda2 +#-----| 0 -> [LambdaExpr] ...->... + +# 17| [AnonymousClass] new Function2(...) { ... } +#-----| 1 -> [Constructor] +#-----| 1 -> [Method] invoke + +# 17| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 17| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) + +# 17| [Method] invoke +#-----| 3 -> [TypeAccess] int +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 17| [SuperConstructorInvocationStmt] super(...) + +# 17| [Parameter] a +#-----| 0 -> [TypeAccess] int + +# 17| [TypeAccess] int + +# 17| [Parameter] b +#-----| 0 -> [TypeAccess] int + +# 17| [TypeAccess] int + +# 17| [TypeAccess] int + +# 17| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 17| [ReturnStmt] return ... +#-----| 0 -> [AddExpr] ... + ... + +# 17| [AddExpr] ... + ... +#-----| 0 -> [VarAccess] a +#-----| 1 -> [VarAccess] b + +# 17| [VarAccess] a + +# 17| [VarAccess] b + +# 17| [LambdaExpr] ...->... +#-----| -4 -> [AnonymousClass] new Function2(...) { ... } +#-----| -3 -> [TypeAccess] Function2 + +# 17| [TypeAccess] Function2 +#-----| 0 -> [TypeAccess] Integer +#-----| 1 -> [TypeAccess] Integer +#-----| 2 -> [TypeAccess] Integer + +# 17| [TypeAccess] Integer + +# 17| [TypeAccess] Integer + +# 17| [TypeAccess] Integer + +# 20| [Method] fn4 +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 20| [TypeAccess] Unit + +# 20| [BlockStmt] { ... } +#-----| 0 -> [LocalVariableDeclStmt] var ...; + +# 21| [LocalVariableDeclStmt] var ...; +#-----| 1 -> [LocalVariableDeclExpr] fnRef + +# 21| [LocalVariableDeclExpr] fnRef +#-----| 0 -> [MemberRefExpr] ...::... + +# 21| [AnonymousClass] new Function1(...) { ... } +#-----| 1 -> [Constructor] +#-----| 1 -> [Method] invoke + +# 21| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 21| [Method] invoke +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 21| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) + +# 21| [SuperConstructorInvocationStmt] super(...) + +# 21| [Parameter] a0 + +# 21| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 21| [ReturnStmt] return ... +#-----| 0 -> [MethodAccess] fn3(...) + +# 21| [MethodAccess] fn3(...) +#-----| -1 -> [VarAccess] a0 + +# 21| [VarAccess] a0 + +# 21| [MemberRefExpr] ...::... +#-----| -4 -> [AnonymousClass] new Function1(...) { ... } +#-----| -3 -> [TypeAccess] Function1 + +# 21| [TypeAccess] Function1 +#-----| 0 -> [TypeAccess] Class1 +#-----| 1 -> [TypeAccess] Unit + +# 21| [TypeAccess] Class1 + +# 21| [TypeAccess] Unit + +# 24| [Method] fn5 +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 24| [TypeAccess] Unit + +# 24| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 25| [LocalClass] LocalClass +#-----| 1 -> [Constructor] LocalClass + +# 25| [Constructor] LocalClass +#-----| 5 -> [BlockStmt] { ... } + +# 25| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 25| [SuperConstructorInvocationStmt] super(...) + +# 25| [BlockStmt] { ... } + +# 25| [LocalTypeDeclStmt] class ... +#-----| 0 -> [LocalClass] LocalClass + +# 26| [ExprStmt] ; +#-----| 0 -> [ImplicitCoercionToUnitExpr] + +# 26| [ImplicitCoercionToUnitExpr] +#-----| 0 -> [TypeAccess] Unit +#-----| 1 -> [ClassInstanceExpr] new LocalClass(...) + +# 26| [TypeAccess] Unit + +# 26| [ClassInstanceExpr] new LocalClass(...) +#-----| -3 -> [TypeAccess] LocalClass + +# 26| [TypeAccess] LocalClass + +# 29| [Method] nullableAnonymous +#-----| 3 -> [TypeAccess] Object +#-----| 5 -> [BlockStmt] { ... } + +# 29| [TypeAccess] Object + +# 29| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 35| [ReturnStmt] return ... +#-----| 0 -> [StmtExpr] + +# 29| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 29| [AnonymousClass,LocalClass] new Object(...) { ... } +#-----| 1 -> [Constructor] +#-----| 2 -> [Method] getX +#-----| 2 -> [Method] setX +#-----| 2 -> [FieldDeclaration] int x; +#-----| 5 -> [Method] member + +# 29| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 29| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 29| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 29| [SuperConstructorInvocationStmt] super(...) + +# 29| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 30| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 30| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] x + +# 30| [VarAccess] x + +# 30| [IntegerLiteral] 1 + +# 30| [Method] getX +#-----| 3 -> [TypeAccess] int +#-----| 5 -> [BlockStmt] { ... } + +# 30| [TypeAccess] int + +# 30| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 30| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.x + +# 30| [VarAccess] this.x +#-----| -1 -> [ThisAccess] this + +# 30| [ThisAccess] this + +# 30| [Method] setX +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 30| [Parameter] +#-----| 0 -> [TypeAccess] int + +# 30| [TypeAccess] int + +# 30| [TypeAccess] Unit + +# 30| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 30| [ExprStmt] ; +#-----| 0 -> [AssignExpr] ...=... + +# 30| [AssignExpr] ...=... +#-----| 0 -> [VarAccess] this.x +#-----| 1 -> [VarAccess] + +# 30| [VarAccess] this.x +#-----| -1 -> [ThisAccess] this + +# 30| [VarAccess] + +# 30| [ThisAccess] this + +# 30| [FieldDeclaration] int x; +#-----| -1 -> [TypeAccess] int +#-----| 0 -> [IntegerLiteral] 1 + +# 30| [TypeAccess] int + +# 32| [Method] member +#-----| 3 -> [TypeAccess] Unit +#-----| 5 -> [BlockStmt] { ... } + +# 32| [TypeAccess] Unit + +# 32| [BlockStmt] { ... } +#-----| 0 -> [LocalVariableDeclStmt] var ...; + +# 33| [LocalVariableDeclStmt] var ...; +#-----| 1 -> [LocalVariableDeclExpr] maybeThis + +# 33| [LocalVariableDeclExpr] maybeThis +#-----| 0 -> [WhenExpr] when ... + +# 33| [WhenExpr] when ... +#-----| 0 -> [WhenBranch] ... -> ... +#-----| 1 -> [WhenBranch] ... -> ... + +# 33| [WhenBranch] ... -> ... +#-----| 0 -> [ValueEQExpr] ... (value equals) ... +#-----| 1 -> [ExprStmt] ; + +# 33| [ValueEQExpr] ... (value equals) ... +#-----| 0 -> [MethodAccess] getX(...) +#-----| 1 -> [IntegerLiteral] 1 + +# 33| [MethodAccess] getX(...) +#-----| -1 -> [ThisAccess] this + +# 33| [ThisAccess] this + +# 33| [IntegerLiteral] 1 + +# 33| [ExprStmt] ; +#-----| 0 -> [ThisAccess] this + +# 33| [ThisAccess] this + +# 33| [WhenBranch] ... -> ... +#-----| 0 -> [BooleanLiteral] true +#-----| 1 -> [ExprStmt] ; + +# 33| [BooleanLiteral] true + +# 33| [ExprStmt] ; +#-----| 0 -> [NullLiteral] null + +# 33| [NullLiteral] null + +# 29| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } + +# 29| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 29| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Object + +# 29| [TypeAccess] Object + +# 38| [Interface] Interface2 + +# 39| [Class] Class2 +#-----| 1 -> [Constructor] Class2 +#-----| 2 -> [Method] getI +#-----| 2 -> [Method] setI +#-----| 2 -> [FieldDeclaration] Interface2 i; + +# 39| [Constructor] Class2 +#-----| 5 -> [BlockStmt] { ... } + +# 39| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 39| [SuperConstructorInvocationStmt] super(...) + +# 39| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 40| [ExprStmt] ; +#-----| 0 -> [KtInitializerAssignExpr] ...=... + +# 40| [KtInitializerAssignExpr] ...=... +#-----| 0 -> [VarAccess] i + +# 40| [AnonymousClass,LocalClass] new Interface2(...) { ... } +#-----| 1 -> [Constructor] + +# 40| [VarAccess] i + +# 40| [StmtExpr] +#-----| 0 -> [BlockStmt] { ... } + +# 40| [BlockStmt] { ... } +#-----| 0 -> [LocalTypeDeclStmt] class ... +#-----| 1 -> [ExprStmt] ; + +# 40| [Constructor] +#-----| 5 -> [BlockStmt] { ... } + +# 40| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 40| [SuperConstructorInvocationStmt] super(...) + +# 40| [BlockStmt] { ... } +#-----| 0 -> [LocalVariableDeclStmt] var ...; + +# 42| [LocalVariableDeclStmt] var ...; +#-----| 1 -> [LocalVariableDeclExpr] answer + +# 42| [LocalVariableDeclExpr] answer +#-----| 0 -> [StringLiteral] 42 + +# 42| [StringLiteral] 42 + +# 40| [LocalTypeDeclStmt] class ... +#-----| 0 -> [AnonymousClass,LocalClass] new Interface2(...) { ... } + +# 40| [ExprStmt] ; +#-----| 0 -> [ClassInstanceExpr] new (...) + +# 40| [ClassInstanceExpr] new (...) +#-----| -3 -> [TypeAccess] Interface2 + +# 40| [TypeAccess] Interface2 + +# 40| [Method] getI +#-----| 3 -> [TypeAccess] Interface2 +#-----| 5 -> [BlockStmt] { ... } + +# 40| [TypeAccess] Interface2 + +# 40| [BlockStmt] { ... } +#-----| 0 -> [ReturnStmt] return ... + +# 40| [ReturnStmt] return ... +#-----| 0 -> [VarAccess] this.i + +# 40| [VarAccess] this.i +#-----| -1 -> [ThisAccess] this + +# 40| [ThisAccess] this + +# 40| [Method] setI +#-----| 3 -> [TypeAccess] Unit +#-----| 4 -> (Parameters) +#-----| 5 -> [BlockStmt] { ... } + +# 40| [Parameter] +#-----| 0 -> [TypeAccess] Interface2 + +# 40| [TypeAccess] Interface2 + +# 40| [TypeAccess] Unit + +# 40| [BlockStmt] { ... } +#-----| 0 -> [ExprStmt] ; + +# 40| [ExprStmt] ; +#-----| 0 -> [AssignExpr] ...=... + +# 40| [AssignExpr] ...=... +#-----| 0 -> [VarAccess] this.i +#-----| 1 -> [VarAccess] + +# 40| [VarAccess] this.i +#-----| -1 -> [ThisAccess] this + +# 40| [VarAccess] + +# 40| [ThisAccess] this + +# 40| [FieldDeclaration] Interface2 i; +#-----| -1 -> [TypeAccess] Interface2 +#-----| 0 -> [StmtExpr] + +# 40| [TypeAccess] Interface2 + +superChain.kt: +# 1| [Class,GenericType,ParameterizedType] SuperChain1 +#-----| -2 -> (Generic Parameters) +#-----| 1 -> [Constructor] SuperChain1 + +# 1| [TypeVariable] T1 + +# 1| [TypeVariable] T2 + +# 1| [Constructor] SuperChain1 +#-----| 5 -> [BlockStmt] { ... } + +# 1| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 1| [SuperConstructorInvocationStmt] super(...) + +# 1| [BlockStmt] { ... } + +# 2| [Class,GenericType,ParameterizedType] SuperChain2 +#-----| -2 -> (Generic Parameters) +#-----| 1 -> [Constructor] SuperChain2 + +# 2| [TypeVariable] T3 + +# 2| [TypeVariable] T4 + +# 2| [Constructor] SuperChain2 +#-----| 5 -> [BlockStmt] { ... } + +# 2| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 2| [SuperConstructorInvocationStmt] super(...) + +# 2| [BlockStmt] { ... } + +# 3| [Class,GenericType,ParameterizedType] SuperChain3 +#-----| -2 -> (Generic Parameters) +#-----| 1 -> [Constructor] SuperChain3 + +# 3| [TypeVariable] T5 + +# 3| [TypeVariable] T6 + +# 3| [Constructor] SuperChain3 +#-----| 5 -> [BlockStmt] { ... } + +# 3| [BlockStmt] { ... } +#-----| 0 -> [SuperConstructorInvocationStmt] super(...) +#-----| 1 -> [BlockStmt] { ... } + +# 3| [SuperConstructorInvocationStmt] super(...) + +# 3| [BlockStmt] { ... } + +#-----| (Parameters) +#-----| 0 -> [Parameter] arg + +#-----| (Parameters) +#-----| 0 -> [Parameter] arg + +#-----| (Parameters) +#-----| 0 -> [Parameter] arg + +#-----| (Parameters) +#-----| 0 -> [Parameter] i + +#-----| (Parameters) +#-----| 0 -> [Parameter] s + +#-----| (Parameters) +#-----| 0 -> [Parameter] i + +#-----| (Parameters) +#-----| 0 -> [Parameter] value + +#-----| (Parameters) +#-----| 0 -> [Parameter] rgb + +#-----| (Parameters) +#-----| 0 -> [Parameter] value + +#-----| (Parameters) +#-----| 0 -> [Parameter] b + +#-----| (Parameters) +#-----| 0 -> [Parameter] p + +#-----| (Parameters) +#-----| 0 -> [Parameter] p + +#-----| (Parameters) +#-----| 0 -> [Parameter] p + +#-----| (Parameters) +#-----| 0 -> [Parameter] p + +#-----| (Parameters) +#-----| 0 -> [Parameter] p + +#-----| (Parameters) +#-----| 0 -> [Parameter] p + +#-----| (Parameters) +#-----| 0 -> [Parameter] t + +#-----| (Parameters) +#-----| 0 -> [Parameter] s + +#-----| (Parameters) +#-----| 0 -> [Parameter] i + +#-----| (Parameters) +#-----| 0 -> [Parameter] a +#-----| 1 -> [Parameter] b + +#-----| (Parameters) +#-----| 0 -> [Parameter] a +#-----| 1 -> [Parameter] b + +#-----| (Parameters) +#-----| 0 -> [Parameter] a0 + +#-----| (Parameters) +#-----| 0 -> [Parameter] + +#-----| (Parameters) +#-----| 0 -> [Parameter] + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T1 + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T1 + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T1 + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T1 +#-----| 1 -> [TypeVariable] T2 + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T3 +#-----| 1 -> [TypeVariable] T4 + +#-----| (Generic Parameters) +#-----| 0 -> [TypeVariable] T5 +#-----| 1 -> [TypeVariable] T6 + classes.kt: # 0| [CompilationUnit] classes -# 0| 1: [Class] ClassesKt -# 32| 1: [Method] f -# 32| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 32| 0: [Parameter] s -# 32| 0: [TypeAccess] String -# 32| 5: [BlockStmt] { ... } -# 2| 2: [Class] ClassOne -# 2| 1: [Constructor] ClassOne -# 2| 5: [BlockStmt] { ... } -# 2| 0: [SuperConstructorInvocationStmt] super(...) -# 2| 1: [BlockStmt] { ... } -# 4| 3: [Class] ClassTwo -# 4| 1: [Constructor] ClassTwo -#-----| 4: (Parameters) -# 4| 0: [Parameter] arg -# 4| 0: [TypeAccess] int -# 4| 5: [BlockStmt] { ... } -# 4| 0: [SuperConstructorInvocationStmt] super(...) -# 4| 1: [BlockStmt] { ... } -# 4| 0: [ExprStmt] ; -# 4| 0: [KtInitializerAssignExpr] ...=... -# 4| 0: [VarAccess] arg -# 5| 1: [ExprStmt] ; -# 5| 0: [KtInitializerAssignExpr] ...=... -# 5| 0: [VarAccess] x -# 4| 2: [Method] getArg -# 4| 3: [TypeAccess] int -# 4| 5: [BlockStmt] { ... } -# 4| 0: [ReturnStmt] return ... -# 4| 0: [VarAccess] this.arg -# 4| -1: [ThisAccess] this -# 4| 2: [FieldDeclaration] int arg; -# 4| -1: [TypeAccess] int -# 4| 0: [VarAccess] arg -# 5| 4: [Method] getX -# 5| 3: [TypeAccess] int -# 5| 5: [BlockStmt] { ... } -# 5| 0: [ReturnStmt] return ... -# 5| 0: [VarAccess] this.x -# 5| -1: [ThisAccess] this -# 5| 4: [FieldDeclaration] int x; -# 5| -1: [TypeAccess] int -# 5| 0: [IntegerLiteral] 3 -# 8| 4: [Class] ClassThree -# 8| 1: [Constructor] ClassThree -# 8| 5: [BlockStmt] { ... } -# 8| 0: [SuperConstructorInvocationStmt] super(...) -# 8| 1: [BlockStmt] { ... } -# 9| 2: [Method] foo -# 9| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 9| 0: [Parameter] arg -# 9| 0: [TypeAccess] int -# 12| 5: [Class] ClassFour -# 12| 1: [Constructor] ClassFour -# 12| 5: [BlockStmt] { ... } -# 12| 0: [SuperConstructorInvocationStmt] super(...) -# 12| 1: [BlockStmt] { ... } -# 13| 2: [Method] foo -# 13| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 13| 0: [Parameter] arg -# 13| 0: [TypeAccess] int -# 13| 5: [BlockStmt] { ... } -# 17| 6: [Class] ClassFive -# 17| 1: [Constructor] ClassFive -# 17| 5: [BlockStmt] { ... } -# 17| 0: [SuperConstructorInvocationStmt] super(...) -# 17| 1: [BlockStmt] { ... } -# 20| 7: [Interface] IF1 -# 21| 1: [Method] funIF1 -# 21| 3: [TypeAccess] Unit -# 21| 5: [BlockStmt] { ... } -# 24| 8: [Interface] IF2 -# 25| 1: [Method] funIF2 -# 25| 3: [TypeAccess] Unit -# 25| 5: [BlockStmt] { ... } -# 28| 9: [Class] ClassSix -# 28| 1: [Constructor] ClassSix -# 28| 5: [BlockStmt] { ... } -# 28| 0: [SuperConstructorInvocationStmt] super(...) -# 28| 1: [BlockStmt] { ... } -# 29| 2: [Constructor] ClassSix -#-----| 4: (Parameters) -# 29| 0: [Parameter] i -# 29| 0: [TypeAccess] int -# 29| 5: [BlockStmt] { ... } -# 29| 0: [ThisConstructorInvocationStmt] this(...) -# 34| 10: [Class] ClassSeven -# 35| 1: [Constructor] ClassSeven -#-----| 4: (Parameters) -# 35| 0: [Parameter] i -# 35| 0: [TypeAccess] String -# 35| 5: [BlockStmt] { ... } -# 35| 0: [SuperConstructorInvocationStmt] super(...) -# 35| 1: [BlockStmt] { ... } -# 39| 0: [ExprStmt] ; -# 39| 0: [MethodAccess] f(...) -# 39| -1: [TypeAccess] ClassesKt -# 39| 0: [StringLiteral] init1 -# 42| 1: [ExprStmt] ; -# 42| 0: [KtInitializerAssignExpr] ...=... -# 42| 0: [VarAccess] x -# 45| 2: [ExprStmt] ; -# 45| 0: [MethodAccess] f(...) -# 45| -1: [TypeAccess] ClassesKt -# 45| 0: [StringLiteral] init2 -# 36| 2: [ExprStmt] ; -# 36| 0: [MethodAccess] f(...) -# 36| -1: [TypeAccess] ClassesKt -# 36| 0: [VarAccess] i -# 42| 2: [Method] getX -# 42| 3: [TypeAccess] int -# 42| 5: [BlockStmt] { ... } -# 42| 0: [ReturnStmt] return ... -# 42| 0: [VarAccess] this.x -# 42| -1: [ThisAccess] this -# 42| 2: [FieldDeclaration] int x; -# 42| -1: [TypeAccess] int -# 42| 0: [IntegerLiteral] 3 -# 49| 11: [Class] Direction -# 0| 1: [Method] values -# 0| 3: [TypeAccess] Direction[] -# 0| 0: [TypeAccess] Direction -# 0| 1: [Method] valueOf -# 0| 3: [TypeAccess] Direction -#-----| 4: (Parameters) -# 0| 0: [Parameter] value -# 0| 0: [TypeAccess] String -# 49| 4: [Constructor] Direction -# 49| 5: [BlockStmt] { ... } -# 49| 0: [ExprStmt] ; -# 49| 0: [ClassInstanceExpr] new Enum(...) -# 49| -3: [TypeAccess] Unit -# 49| 0: [TypeAccess] Direction -# 49| 1: [BlockStmt] { ... } -# 50| 5: [FieldDeclaration] Direction NORTH; -# 50| -1: [TypeAccess] Direction -# 50| 0: [ClassInstanceExpr] new Direction(...) -# 50| -3: [TypeAccess] Direction -# 50| 6: [FieldDeclaration] Direction SOUTH; -# 50| -1: [TypeAccess] Direction -# 50| 0: [ClassInstanceExpr] new Direction(...) -# 50| -3: [TypeAccess] Direction -# 50| 7: [FieldDeclaration] Direction WEST; -# 50| -1: [TypeAccess] Direction -# 50| 0: [ClassInstanceExpr] new Direction(...) -# 50| -3: [TypeAccess] Direction -# 50| 8: [FieldDeclaration] Direction EAST; -# 50| -1: [TypeAccess] Direction -# 50| 0: [ClassInstanceExpr] new Direction(...) -# 50| -3: [TypeAccess] Direction -# 53| 12: [Class] Color -# 0| 1: [Method] values -# 0| 3: [TypeAccess] Color[] -# 0| 0: [TypeAccess] Color -# 0| 1: [Method] valueOf -# 0| 3: [TypeAccess] Color -#-----| 4: (Parameters) -# 0| 0: [Parameter] value -# 0| 0: [TypeAccess] String -# 53| 4: [Constructor] Color -#-----| 4: (Parameters) -# 53| 0: [Parameter] rgb -# 53| 0: [TypeAccess] int -# 53| 5: [BlockStmt] { ... } -# 53| 0: [ExprStmt] ; -# 53| 0: [ClassInstanceExpr] new Enum(...) -# 53| -3: [TypeAccess] Unit -# 53| 0: [TypeAccess] Color -# 53| 1: [BlockStmt] { ... } -# 53| 0: [ExprStmt] ; -# 53| 0: [KtInitializerAssignExpr] ...=... -# 53| 0: [VarAccess] rgb -# 53| 5: [Method] getRgb -# 53| 3: [TypeAccess] int -# 53| 5: [BlockStmt] { ... } -# 53| 0: [ReturnStmt] return ... -# 53| 0: [VarAccess] this.rgb -# 53| -1: [ThisAccess] this -# 53| 5: [FieldDeclaration] int rgb; -# 53| -1: [TypeAccess] int -# 53| 0: [VarAccess] rgb -# 54| 7: [FieldDeclaration] Color RED; -# 54| -1: [TypeAccess] Color -# 54| 0: [ClassInstanceExpr] new Color(...) -# 54| -3: [TypeAccess] Color -# 54| 0: [IntegerLiteral] 16711680 -# 55| 8: [FieldDeclaration] Color GREEN; -# 55| -1: [TypeAccess] Color -# 55| 0: [ClassInstanceExpr] new Color(...) -# 55| -3: [TypeAccess] Color -# 55| 0: [IntegerLiteral] 65280 -# 56| 9: [FieldDeclaration] Color BLUE; -# 56| -1: [TypeAccess] Color -# 56| 0: [ClassInstanceExpr] new Color(...) -# 56| -3: [TypeAccess] Color -# 56| 0: [IntegerLiteral] 255 -# 59| 13: [Interface] Interface1 -# 60| 14: [Interface] Interface2 -# 61| 15: [GenericType,Interface,ParameterizedType] Interface3 -#-----| -2: (Generic Parameters) -# 61| 0: [TypeVariable] T -# 63| 16: [Class] Class1 -# 63| 1: [Constructor] Class1 -# 63| 5: [BlockStmt] { ... } -# 63| 0: [SuperConstructorInvocationStmt] super(...) -# 63| 1: [BlockStmt] { ... } -# 64| 2: [Method] getObject1 -# 64| 3: [TypeAccess] Object -#-----| 4: (Parameters) -# 64| 0: [Parameter] b -# 64| 0: [TypeAccess] boolean -# 64| 5: [BlockStmt] { ... } -# 65| 0: [ExprStmt] ; -# 65| 0: [WhenExpr] when ... -# 65| 0: [WhenBranch] ... -> ... -# 65| 0: [VarAccess] b -# 66| 1: [ReturnStmt] return ... -# 66| 0: [StmtExpr] -# 66| 0: [BlockStmt] { ... } -# 66| 0: [LocalTypeDeclStmt] class ... -# 66| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 66| 1: [Constructor] -# 66| 5: [BlockStmt] { ... } -# 66| 0: [SuperConstructorInvocationStmt] super(...) -# 66| 1: [BlockStmt] { ... } -# 66| 1: [ExprStmt] ; -# 66| 0: [ClassInstanceExpr] new (...) -# 66| -3: [TypeAccess] Object -# 65| 1: [WhenBranch] ... -> ... -# 65| 0: [BooleanLiteral] true -# 68| 1: [ReturnStmt] return ... -# 68| 0: [StmtExpr] -# 68| 0: [BlockStmt] { ... } -# 68| 0: [LocalTypeDeclStmt] class ... -# 68| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 68| 1: [Constructor] -# 68| 5: [BlockStmt] { ... } -# 68| 0: [SuperConstructorInvocationStmt] super(...) -# 68| 1: [BlockStmt] { ... } -# 68| 1: [ExprStmt] ; -# 68| 0: [ClassInstanceExpr] new (...) -# 68| -3: [TypeAccess] Object -# 71| 3: [Method] getObject2 -# 71| 3: [TypeAccess] Interface1 -# 71| 5: [BlockStmt] { ... } -# 72| 0: [ReturnStmt] return ... -# 72| 0: [StmtExpr] -# 72| 0: [BlockStmt] { ... } -# 72| 0: [LocalTypeDeclStmt] class ... -# 72| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 72| 1: [Constructor] -# 72| 5: [BlockStmt] { ... } -# 72| 0: [SuperConstructorInvocationStmt] super(...) -# 72| 1: [BlockStmt] { ... } -# 73| 0: [ExprStmt] ; -# 73| 0: [KtInitializerAssignExpr] ...=... -# 73| 0: [VarAccess] x -# 73| 2: [Method] getX -# 73| 3: [TypeAccess] int -# 73| 5: [BlockStmt] { ... } -# 73| 0: [ReturnStmt] return ... -# 73| 0: [VarAccess] this.x -# 73| -1: [ThisAccess] this -# 73| 2: [FieldDeclaration] int x; -# 73| -1: [TypeAccess] int -# 73| 0: [IntegerLiteral] 1 -# 74| 4: [Method] foo -# 74| 3: [TypeAccess] Object -# 74| 5: [BlockStmt] { ... } -# 75| 0: [ReturnStmt] return ... -# 75| 0: [StmtExpr] -# 75| 0: [BlockStmt] { ... } -# 75| 0: [LocalTypeDeclStmt] class ... -# 75| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 75| 1: [Constructor] -# 75| 5: [BlockStmt] { ... } -# 75| 0: [SuperConstructorInvocationStmt] super(...) -# 75| 1: [BlockStmt] { ... } -# 75| 1: [ExprStmt] ; -# 75| 0: [ClassInstanceExpr] new (...) -# 75| -3: [TypeAccess] Object -# 72| 1: [ExprStmt] ; -# 72| 0: [ClassInstanceExpr] new (...) -# 72| -3: [TypeAccess] Object -# 80| 4: [Method] getObject3 -# 80| 3: [TypeAccess] Object -# 80| 5: [BlockStmt] { ... } -# 81| 0: [ReturnStmt] return ... -# 81| 0: [StmtExpr] -# 81| 0: [BlockStmt] { ... } -# 81| 0: [LocalTypeDeclStmt] class ... -# 81| 0: [AnonymousClass,LocalClass] new Interface1(...) { ... } -# 81| 1: [Constructor] -# 81| 5: [BlockStmt] { ... } -# 81| 0: [SuperConstructorInvocationStmt] super(...) -# 81| 1: [BlockStmt] { ... } -# 81| 1: [ExprStmt] ; -# 81| 0: [ClassInstanceExpr] new (...) -# 81| -3: [TypeAccess] Interface1 -# 84| 5: [Method] getObject4 -# 84| 3: [TypeAccess] Object -# 84| 5: [BlockStmt] { ... } -# 85| 0: [ReturnStmt] return ... -# 85| 0: [StmtExpr] -# 85| 0: [BlockStmt] { ... } -# 85| 0: [LocalTypeDeclStmt] class ... -# 85| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 85| 1: [Constructor] -# 85| 5: [BlockStmt] { ... } -# 85| 0: [SuperConstructorInvocationStmt] super(...) -# 85| 1: [BlockStmt] { ... } -# 85| 1: [ExprStmt] ; -# 85| 0: [ClassInstanceExpr] new (...) -# 85| -3: [TypeAccess] Object -# 88| 6: [Method] getObject5 -# 88| 3: [TypeAccess] Object -# 88| 5: [BlockStmt] { ... } -# 89| 0: [ReturnStmt] return ... -# 89| 0: [StmtExpr] -# 89| 0: [BlockStmt] { ... } -# 89| 0: [LocalTypeDeclStmt] class ... -# 89| 0: [AnonymousClass,LocalClass] new Interface3(...) { ... } -# 89| 1: [Constructor] -# 89| 5: [BlockStmt] { ... } -# 89| 0: [SuperConstructorInvocationStmt] super(...) -# 89| 1: [BlockStmt] { ... } -# 89| 1: [ExprStmt] ; -# 89| 0: [ClassInstanceExpr] new (...) -# 89| -3: [TypeAccess] Interface3 -# 93| 17: [Class] pulicClass -# 93| 1: [Constructor] pulicClass -# 93| 5: [BlockStmt] { ... } -# 93| 0: [SuperConstructorInvocationStmt] super(...) -# 93| 1: [BlockStmt] { ... } -# 94| 18: [Class] privateClass -# 94| 1: [Constructor] privateClass -# 94| 5: [BlockStmt] { ... } -# 94| 0: [SuperConstructorInvocationStmt] super(...) -# 94| 1: [BlockStmt] { ... } -# 95| 19: [Class] internalClass -# 95| 1: [Constructor] internalClass -# 95| 5: [BlockStmt] { ... } -# 95| 0: [SuperConstructorInvocationStmt] super(...) -# 95| 1: [BlockStmt] { ... } -# 96| 20: [Class] noExplicitVisibilityClass -# 96| 1: [Constructor] noExplicitVisibilityClass -# 96| 5: [BlockStmt] { ... } -# 96| 0: [SuperConstructorInvocationStmt] super(...) -# 96| 1: [BlockStmt] { ... } -# 98| 21: [Class] nestedClassVisibilities -# 98| 1: [Constructor] nestedClassVisibilities -# 98| 5: [BlockStmt] { ... } -# 98| 0: [SuperConstructorInvocationStmt] super(...) -# 98| 1: [BlockStmt] { ... } -# 99| 2: [Class] pulicNestedClass -# 99| 1: [Constructor] pulicNestedClass -# 99| 5: [BlockStmt] { ... } -# 99| 0: [SuperConstructorInvocationStmt] super(...) -# 99| 1: [BlockStmt] { ... } -# 100| 3: [Class] protectedNestedClass -# 100| 1: [Constructor] protectedNestedClass -# 100| 5: [BlockStmt] { ... } -# 100| 0: [SuperConstructorInvocationStmt] super(...) -# 100| 1: [BlockStmt] { ... } -# 101| 4: [Class] privateNestedClass -# 101| 1: [Constructor] privateNestedClass -# 101| 5: [BlockStmt] { ... } -# 101| 0: [SuperConstructorInvocationStmt] super(...) -# 101| 1: [BlockStmt] { ... } -# 102| 5: [Class] internalNestedClass -# 102| 1: [Constructor] internalNestedClass -# 102| 5: [BlockStmt] { ... } -# 102| 0: [SuperConstructorInvocationStmt] super(...) -# 102| 1: [BlockStmt] { ... } -# 103| 6: [Class] noExplicitVisibilityNestedClass -# 103| 1: [Constructor] noExplicitVisibilityNestedClass -# 103| 5: [BlockStmt] { ... } -# 103| 0: [SuperConstructorInvocationStmt] super(...) -# 103| 1: [BlockStmt] { ... } -# 106| 22: [Class] sealedClass -# 106| 1: [Constructor] sealedClass -# 106| 5: [BlockStmt] { ... } -# 106| 0: [SuperConstructorInvocationStmt] super(...) -# 106| 1: [BlockStmt] { ... } -# 107| 23: [Class] openClass -# 107| 1: [Constructor] openClass -# 107| 5: [BlockStmt] { ... } -# 107| 0: [SuperConstructorInvocationStmt] super(...) -# 107| 1: [BlockStmt] { ... } -# 109| 24: [Class] C1 -# 109| 1: [Constructor] C1 -# 109| 5: [BlockStmt] { ... } -# 109| 0: [SuperConstructorInvocationStmt] super(...) -# 109| 1: [BlockStmt] { ... } -# 110| 2: [Method] fn1 -# 110| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 110| 0: [Parameter] p -# 110| 0: [TypeAccess] int -# 110| 5: [BlockStmt] { ... } -# 111| 0: [LocalTypeDeclStmt] class ... -# 111| 0: [Class,GenericType,LocalClass,ParameterizedType] Local1 -#-----| -2: (Generic Parameters) -# 111| 0: [TypeVariable] T1 -# 111| 1: [Constructor] Local1 -# 111| 5: [BlockStmt] { ... } -# 111| 0: [SuperConstructorInvocationStmt] super(...) -# 111| 1: [BlockStmt] { ... } -# 112| 2: [Method] foo -# 112| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 112| 0: [Parameter] p -# 112| 0: [TypeAccess] int -# 112| 5: [BlockStmt] { ... } -# 114| 1: [ExprStmt] ; -# 114| 0: [MethodAccess] foo(...) -# 114| -1: [ClassInstanceExpr] new Local1(...) -# 114| -3: [TypeAccess] Local1 -# 114| 0: [TypeAccess] Integer -# 114| 0: [VarAccess] p -# 117| 3: [Method] fn2 -# 117| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 117| 0: [Parameter] p -# 117| 0: [TypeAccess] int -# 117| 5: [BlockStmt] { ... } -# 118| 0: [LocalTypeDeclStmt] class ... -# 118| 0: [LocalClass] -# 118| 1: [Constructor] -# 118| 5: [BlockStmt] { ... } -# 118| 0: [SuperConstructorInvocationStmt] super(...) -# 118| 1: [Method] localFn -# 118| 3: [TypeAccess] Unit -# 118| 5: [BlockStmt] { ... } -# 119| 0: [LocalTypeDeclStmt] class ... -# 119| 0: [Class,GenericType,LocalClass,ParameterizedType] Local2 -#-----| -2: (Generic Parameters) -# 119| 0: [TypeVariable] T1 -# 119| 1: [Constructor] Local2 -# 119| 5: [BlockStmt] { ... } -# 119| 0: [SuperConstructorInvocationStmt] super(...) -# 119| 1: [BlockStmt] { ... } -# 120| 2: [Method] foo -# 120| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 120| 0: [Parameter] p -# 120| 0: [TypeAccess] int -# 120| 5: [BlockStmt] { ... } -# 122| 1: [ExprStmt] ; -# 122| 0: [MethodAccess] foo(...) -# 122| -1: [ClassInstanceExpr] new Local2(...) -# 122| -3: [TypeAccess] Local2 -# 122| 0: [TypeAccess] Integer -# 122| 0: [VarAccess] p -# 126| 4: [Method] fn3 -# 126| 3: [TypeAccess] Object -#-----| 4: (Parameters) -# 126| 0: [Parameter] p -# 126| 0: [TypeAccess] int -# 126| 5: [BlockStmt] { ... } -# 127| 0: [ReturnStmt] return ... -# 127| 0: [StmtExpr] -# 127| 0: [BlockStmt] { ... } -# 127| 0: [LocalTypeDeclStmt] class ... -# 127| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 127| 1: [Constructor] -# 127| 5: [BlockStmt] { ... } -# 127| 0: [SuperConstructorInvocationStmt] super(...) -# 127| 1: [BlockStmt] { ... } -# 128| 2: [Method] fn -# 128| 3: [TypeAccess] Unit -# 128| 5: [BlockStmt] { ... } -# 129| 0: [LocalTypeDeclStmt] class ... -# 129| 0: [Class,GenericType,LocalClass,ParameterizedType] Local3 -#-----| -2: (Generic Parameters) -# 129| 0: [TypeVariable] T1 -# 129| 1: [Constructor] Local3 -# 129| 5: [BlockStmt] { ... } -# 129| 0: [SuperConstructorInvocationStmt] super(...) -# 129| 1: [BlockStmt] { ... } -# 130| 2: [Method] foo -# 130| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 130| 0: [Parameter] p -# 130| 0: [TypeAccess] int -# 130| 5: [BlockStmt] { ... } -# 132| 1: [ExprStmt] ; -# 132| 0: [MethodAccess] foo(...) -# 132| -1: [ClassInstanceExpr] new Local3(...) -# 132| -3: [TypeAccess] Local3 -# 132| 0: [TypeAccess] Integer -# 132| 0: [VarAccess] p -# 127| 1: [ExprStmt] ; -# 127| 0: [ClassInstanceExpr] new (...) -# 127| -3: [TypeAccess] Object +#-----| 1 -> [Class] ClassesKt +#-----| 2 -> [Class] ClassOne +#-----| 3 -> [Class] ClassTwo +#-----| 4 -> [Class] ClassThree +#-----| 5 -> [Class] ClassFour +#-----| 6 -> [Class] ClassFive +#-----| 7 -> [Interface] IF1 +#-----| 8 -> [Interface] IF2 +#-----| 9 -> [Class] ClassSix +#-----| 10 -> [Class] ClassSeven +#-----| 11 -> [Class] Direction +#-----| 12 -> [Class] Color +#-----| 13 -> [Interface] Interface1 +#-----| 14 -> [Interface] Interface2 +#-----| 15 -> [GenericType,Interface,ParameterizedType] Interface3 +#-----| 16 -> [Class] Class1 +#-----| 17 -> [Class] pulicClass +#-----| 18 -> [Class] privateClass +#-----| 19 -> [Class] internalClass +#-----| 20 -> [Class] noExplicitVisibilityClass +#-----| 21 -> [Class] nestedClassVisibilities +#-----| 22 -> [Class] sealedClass +#-----| 23 -> [Class] openClass +#-----| 24 -> [Class] C1 + generic_anonymous.kt: # 0| [CompilationUnit] generic_anonymous -# 0| 1: [Class] Generic_anonymousKt -# 11| 1: [Method] stringIdentity -# 11| 3: [TypeAccess] String -#-----| 4: (Parameters) -# 11| 0: [Parameter] s -# 11| 0: [TypeAccess] String -# 11| 5: [BlockStmt] { ... } -# 11| 0: [ReturnStmt] return ... -# 11| 0: [MethodAccess] get(...) -# 11| -1: [ClassInstanceExpr] new Generic(...) -# 11| -3: [TypeAccess] Generic -# 11| 0: [TypeAccess] String -# 11| 0: [VarAccess] s -# 13| 2: [Method] intIdentity -# 13| 3: [TypeAccess] int -#-----| 4: (Parameters) -# 13| 0: [Parameter] i -# 13| 0: [TypeAccess] int -# 13| 5: [BlockStmt] { ... } -# 13| 0: [ReturnStmt] return ... -# 13| 0: [MethodAccess] get(...) -# 13| -1: [ClassInstanceExpr] new Generic(...) -# 13| -3: [TypeAccess] Generic -# 13| 0: [TypeAccess] Integer -# 13| 0: [VarAccess] i -# 1| 2: [Class,GenericType,ParameterizedType] Generic -#-----| -2: (Generic Parameters) -# 1| 0: [TypeVariable] T -# 1| 1: [Constructor] Generic -#-----| 4: (Parameters) -# 1| 0: [Parameter] t -# 1| 0: [TypeAccess] T -# 1| 5: [BlockStmt] { ... } -# 1| 0: [SuperConstructorInvocationStmt] super(...) -# 1| 1: [BlockStmt] { ... } -# 1| 0: [ExprStmt] ; -# 1| 0: [KtInitializerAssignExpr] ...=... -# 1| 0: [VarAccess] t -# 3| 1: [ExprStmt] ; -# 3| 0: [KtInitializerAssignExpr] ...=... -# 3| 0: [VarAccess] x -# 1| 2: [Method] getT -# 1| 3: [TypeAccess] T -# 1| 5: [BlockStmt] { ... } -# 1| 0: [ReturnStmt] return ... -# 1| 0: [VarAccess] this.t -# 1| -1: [ThisAccess] this -# 1| 2: [FieldDeclaration] T t; -# 1| -1: [TypeAccess] T -# 1| 0: [VarAccess] t -# 3| 4: [FieldDeclaration] new Object(...) { ... } x; -# 3| -1: [TypeAccess] new Object(...) { ... } -# 3| 0: [TypeAccess] T -# 3| 0: [StmtExpr] -# 3| 0: [BlockStmt] { ... } -# 3| 0: [LocalTypeDeclStmt] class ... -# 3| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 3| 1: [Constructor] -# 3| 5: [BlockStmt] { ... } -# 3| 0: [SuperConstructorInvocationStmt] super(...) -# 3| 1: [BlockStmt] { ... } -# 4| 0: [ExprStmt] ; -# 4| 0: [KtInitializerAssignExpr] ...=... -# 4| 0: [VarAccess] member -# 4| 2: [Method] getMember -# 4| 3: [TypeAccess] T -# 4| 5: [BlockStmt] { ... } -# 4| 0: [ReturnStmt] return ... -# 4| 0: [VarAccess] this.member -# 4| -1: [ThisAccess] this -# 4| 2: [FieldDeclaration] T member; -# 4| -1: [TypeAccess] T -# 4| 0: [MethodAccess] getT(...) -# 4| -1: [ThisAccess] Generic.this -# 4| 0: [TypeAccess] Generic -# 3| 1: [ExprStmt] ; -# 3| 0: [ClassInstanceExpr] new (...) -# 3| -3: [TypeAccess] Object -# 3| 5: [Method] getX -# 3| 3: [TypeAccess] new Object(...) { ... } -# 3| 0: [TypeAccess] T -# 3| 5: [BlockStmt] { ... } -# 3| 0: [ReturnStmt] return ... -# 3| 0: [VarAccess] this.x -# 3| -1: [ThisAccess] this -# 7| 6: [Method] get -# 7| 3: [TypeAccess] T -# 7| 5: [BlockStmt] { ... } -# 7| 0: [ReturnStmt] return ... -# 7| 0: [MethodAccess] getMember(...) -# 7| -1: [MethodAccess] getX(...) -# 7| -1: [ThisAccess] this +#-----| 1 -> [Class] Generic_anonymousKt +#-----| 2 -> [Class,GenericType,ParameterizedType] Generic + +localClassField.kt: +# 0| [CompilationUnit] localClassField +#-----| 1 -> [Class] A + local_anonymous.kt: # 0| [CompilationUnit] local_anonymous -# 3| 1: [Class] Class1 -# 3| 1: [Constructor] Class1 -# 3| 5: [BlockStmt] { ... } -# 3| 0: [SuperConstructorInvocationStmt] super(...) -# 3| 1: [BlockStmt] { ... } -# 4| 2: [Method] fn1 -# 4| 3: [TypeAccess] Object -# 4| 5: [BlockStmt] { ... } -# 5| 0: [ReturnStmt] return ... -# 5| 0: [StmtExpr] -# 5| 0: [BlockStmt] { ... } -# 5| 0: [LocalTypeDeclStmt] class ... -# 5| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 5| 1: [Constructor] -# 5| 5: [BlockStmt] { ... } -# 5| 0: [SuperConstructorInvocationStmt] super(...) -# 5| 1: [BlockStmt] { ... } -# 6| 2: [Method] fn -# 6| 3: [TypeAccess] Unit -# 6| 5: [BlockStmt] { ... } -# 5| 1: [ExprStmt] ; -# 5| 0: [ClassInstanceExpr] new (...) -# 5| -3: [TypeAccess] Object -# 10| 3: [Method] fn2 -# 10| 3: [TypeAccess] Unit -# 10| 5: [BlockStmt] { ... } -# 11| 0: [LocalTypeDeclStmt] class ... -# 11| 0: [LocalClass] -# 11| 1: [Constructor] -# 11| 5: [BlockStmt] { ... } -# 11| 0: [SuperConstructorInvocationStmt] super(...) -# 11| 1: [Method] fnLocal -# 11| 3: [TypeAccess] Unit -# 11| 5: [BlockStmt] { ... } -# 12| 1: [ExprStmt] ; -# 12| 0: [MethodAccess] fnLocal(...) -# 12| -1: [ClassInstanceExpr] new (...) -# 12| -3: [TypeAccess] Object -# 15| 4: [Method] fn3 -# 15| 3: [TypeAccess] Unit -# 15| 5: [BlockStmt] { ... } -# 16| 0: [LocalVariableDeclStmt] var ...; -# 16| 1: [LocalVariableDeclExpr] lambda1 -# 16| 0: [LambdaExpr] ...->... -# 16| -4: [AnonymousClass] new Function2(...) { ... } -# 16| 1: [Constructor] -# 16| 5: [BlockStmt] { ... } -# 16| 0: [SuperConstructorInvocationStmt] super(...) -# 16| 1: [Method] invoke -# 16| 3: [TypeAccess] int -#-----| 4: (Parameters) -# 16| 0: [Parameter] a -# 16| 0: [TypeAccess] int -# 16| 1: [Parameter] b -# 16| 0: [TypeAccess] int -# 16| 5: [BlockStmt] { ... } -# 16| 0: [ReturnStmt] return ... -# 16| 0: [AddExpr] ... + ... -# 16| 0: [VarAccess] a -# 16| 1: [VarAccess] b -# 16| -3: [TypeAccess] Function2 -# 16| 0: [TypeAccess] Integer -# 16| 1: [TypeAccess] Integer -# 16| 2: [TypeAccess] Integer -# 17| 1: [LocalVariableDeclStmt] var ...; -# 17| 1: [LocalVariableDeclExpr] lambda2 -# 17| 0: [LambdaExpr] ...->... -# 17| -4: [AnonymousClass] new Function2(...) { ... } -# 17| 1: [Constructor] -# 17| 5: [BlockStmt] { ... } -# 17| 0: [SuperConstructorInvocationStmt] super(...) -# 17| 1: [Method] invoke -# 17| 3: [TypeAccess] int -#-----| 4: (Parameters) -# 17| 0: [Parameter] a -# 17| 0: [TypeAccess] int -# 17| 1: [Parameter] b -# 17| 0: [TypeAccess] int -# 17| 5: [BlockStmt] { ... } -# 17| 0: [ReturnStmt] return ... -# 17| 0: [AddExpr] ... + ... -# 17| 0: [VarAccess] a -# 17| 1: [VarAccess] b -# 17| -3: [TypeAccess] Function2 -# 17| 0: [TypeAccess] Integer -# 17| 1: [TypeAccess] Integer -# 17| 2: [TypeAccess] Integer -# 20| 5: [Method] fn4 -# 20| 3: [TypeAccess] Unit -# 20| 5: [BlockStmt] { ... } -# 21| 0: [LocalVariableDeclStmt] var ...; -# 21| 1: [LocalVariableDeclExpr] fnRef -# 21| 0: [MemberRefExpr] ...::... -# 21| -4: [AnonymousClass] new Function1(...) { ... } -# 21| 1: [Constructor] -# 21| 5: [BlockStmt] { ... } -# 21| 0: [SuperConstructorInvocationStmt] super(...) -# 21| 1: [Method] invoke -#-----| 4: (Parameters) -# 21| 0: [Parameter] a0 -# 21| 5: [BlockStmt] { ... } -# 21| 0: [ReturnStmt] return ... -# 21| 0: [MethodAccess] fn3(...) -# 21| -1: [VarAccess] a0 -# 21| -3: [TypeAccess] Function1 -# 21| 0: [TypeAccess] Class1 -# 21| 1: [TypeAccess] Unit -# 24| 6: [Method] fn5 -# 24| 3: [TypeAccess] Unit -# 24| 5: [BlockStmt] { ... } -# 25| 0: [LocalTypeDeclStmt] class ... -# 25| 0: [LocalClass] LocalClass -# 25| 1: [Constructor] LocalClass -# 25| 5: [BlockStmt] { ... } -# 25| 0: [SuperConstructorInvocationStmt] super(...) -# 25| 1: [BlockStmt] { ... } -# 26| 1: [ExprStmt] ; -# 26| 0: [ImplicitCoercionToUnitExpr] -# 26| 0: [TypeAccess] Unit -# 26| 1: [ClassInstanceExpr] new LocalClass(...) -# 26| -3: [TypeAccess] LocalClass -# 29| 7: [Method] nullableAnonymous -# 29| 3: [TypeAccess] Object -# 29| 5: [BlockStmt] { ... } -# 35| 0: [ReturnStmt] return ... -# 29| 0: [StmtExpr] -# 29| 0: [BlockStmt] { ... } -# 29| 0: [LocalTypeDeclStmt] class ... -# 29| 0: [AnonymousClass,LocalClass] new Object(...) { ... } -# 29| 1: [Constructor] -# 29| 5: [BlockStmt] { ... } -# 29| 0: [SuperConstructorInvocationStmt] super(...) -# 29| 1: [BlockStmt] { ... } -# 30| 0: [ExprStmt] ; -# 30| 0: [KtInitializerAssignExpr] ...=... -# 30| 0: [VarAccess] x -# 30| 2: [Method] getX -# 30| 3: [TypeAccess] int -# 30| 5: [BlockStmt] { ... } -# 30| 0: [ReturnStmt] return ... -# 30| 0: [VarAccess] this.x -# 30| -1: [ThisAccess] this -# 30| 2: [Method] setX -# 30| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 30| 0: [Parameter] -# 30| 0: [TypeAccess] int -# 30| 5: [BlockStmt] { ... } -# 30| 0: [ExprStmt] ; -# 30| 0: [AssignExpr] ...=... -# 30| 0: [VarAccess] this.x -# 30| -1: [ThisAccess] this -# 30| 1: [VarAccess] -# 30| 2: [FieldDeclaration] int x; -# 30| -1: [TypeAccess] int -# 30| 0: [IntegerLiteral] 1 -# 32| 5: [Method] member -# 32| 3: [TypeAccess] Unit -# 32| 5: [BlockStmt] { ... } -# 33| 0: [LocalVariableDeclStmt] var ...; -# 33| 1: [LocalVariableDeclExpr] maybeThis -# 33| 0: [WhenExpr] when ... -# 33| 0: [WhenBranch] ... -> ... -# 33| 0: [ValueEQExpr] ... (value equals) ... -# 33| 0: [MethodAccess] getX(...) -# 33| -1: [ThisAccess] this -# 33| 1: [IntegerLiteral] 1 -# 33| 1: [ExprStmt] ; -# 33| 0: [ThisAccess] this -# 33| 1: [WhenBranch] ... -> ... -# 33| 0: [BooleanLiteral] true -# 33| 1: [ExprStmt] ; -# 33| 0: [NullLiteral] null -# 29| 1: [ExprStmt] ; -# 29| 0: [ClassInstanceExpr] new (...) -# 29| -3: [TypeAccess] Object -# 38| 2: [Interface] Interface2 -# 39| 3: [Class] Class2 -# 39| 1: [Constructor] Class2 -# 39| 5: [BlockStmt] { ... } -# 39| 0: [SuperConstructorInvocationStmt] super(...) -# 39| 1: [BlockStmt] { ... } -# 40| 0: [ExprStmt] ; -# 40| 0: [KtInitializerAssignExpr] ...=... -# 40| 0: [VarAccess] i -# 40| 2: [Method] getI -# 40| 3: [TypeAccess] Interface2 -# 40| 5: [BlockStmt] { ... } -# 40| 0: [ReturnStmt] return ... -# 40| 0: [VarAccess] this.i -# 40| -1: [ThisAccess] this -# 40| 2: [Method] setI -# 40| 3: [TypeAccess] Unit -#-----| 4: (Parameters) -# 40| 0: [Parameter] -# 40| 0: [TypeAccess] Interface2 -# 40| 5: [BlockStmt] { ... } -# 40| 0: [ExprStmt] ; -# 40| 0: [AssignExpr] ...=... -# 40| 0: [VarAccess] this.i -# 40| -1: [ThisAccess] this -# 40| 1: [VarAccess] -# 40| 2: [FieldDeclaration] Interface2 i; -# 40| -1: [TypeAccess] Interface2 -# 40| 0: [StmtExpr] -# 40| 0: [BlockStmt] { ... } -# 40| 0: [LocalTypeDeclStmt] class ... -# 40| 0: [AnonymousClass,LocalClass] new Interface2(...) { ... } -# 40| 1: [Constructor] -# 40| 5: [BlockStmt] { ... } -# 40| 0: [SuperConstructorInvocationStmt] super(...) -# 40| 1: [BlockStmt] { ... } -# 42| 0: [LocalVariableDeclStmt] var ...; -# 42| 1: [LocalVariableDeclExpr] answer -# 42| 0: [StringLiteral] 42 -# 40| 1: [ExprStmt] ; -# 40| 0: [ClassInstanceExpr] new (...) -# 40| -3: [TypeAccess] Interface2 +#-----| 1 -> [Class] Class1 +#-----| 2 -> [Interface] Interface2 +#-----| 3 -> [Class] Class2 + superChain.kt: # 0| [CompilationUnit] superChain -# 1| 1: [Class,GenericType,ParameterizedType] SuperChain1 -#-----| -2: (Generic Parameters) -# 1| 0: [TypeVariable] T1 -# 1| 1: [TypeVariable] T2 -# 1| 1: [Constructor] SuperChain1 -# 1| 5: [BlockStmt] { ... } -# 1| 0: [SuperConstructorInvocationStmt] super(...) -# 1| 1: [BlockStmt] { ... } -# 2| 2: [Class,GenericType,ParameterizedType] SuperChain2 -#-----| -2: (Generic Parameters) -# 2| 0: [TypeVariable] T3 -# 2| 1: [TypeVariable] T4 -# 2| 1: [Constructor] SuperChain2 -# 2| 5: [BlockStmt] { ... } -# 2| 0: [SuperConstructorInvocationStmt] super(...) -# 2| 1: [BlockStmt] { ... } -# 3| 3: [Class,GenericType,ParameterizedType] SuperChain3 -#-----| -2: (Generic Parameters) -# 3| 0: [TypeVariable] T5 -# 3| 1: [TypeVariable] T6 -# 3| 1: [Constructor] SuperChain3 -# 3| 5: [BlockStmt] { ... } -# 3| 0: [SuperConstructorInvocationStmt] super(...) -# 3| 1: [BlockStmt] { ... } +#-----| 1 -> [Class,GenericType,ParameterizedType] SuperChain1 +#-----| 2 -> [Class,GenericType,ParameterizedType] SuperChain2 +#-----| 3 -> [Class,GenericType,ParameterizedType] SuperChain3 diff --git a/java/ql/test/kotlin/library-tests/classes/classes.expected b/java/ql/test/kotlin/library-tests/classes/classes.expected index 9f67caca2e1..2e3fd5a4305 100644 --- a/java/ql/test/kotlin/library-tests/classes/classes.expected +++ b/java/ql/test/kotlin/library-tests/classes/classes.expected @@ -37,6 +37,9 @@ | generic_anonymous.kt:0:0:0:0 | Generic_anonymousKt | Generic_anonymousKt | final, public | | generic_anonymous.kt:1:1:9:1 | Generic | Generic | final, private | | generic_anonymous.kt:3:19:5:3 | new Object(...) { ... } | | final, private | +| localClassField.kt:1:1:11:1 | A | A | final, public | +| localClassField.kt:3:9:3:19 | L | A$L | final, private | +| localClassField.kt:8:9:8:19 | L | A$L | final, private | | local_anonymous.kt:3:1:36:1 | Class1 | LocalAnonymous.Class1 | final, public | | local_anonymous.kt:5:16:7:9 | new Object(...) { ... } | | final, private | | local_anonymous.kt:11:9:11:24 | | Class1$ | final, private | diff --git a/java/ql/test/kotlin/library-tests/classes/ctorCalls.expected b/java/ql/test/kotlin/library-tests/classes/ctorCalls.expected index 691a1e84d4d..6567b235b6c 100644 --- a/java/ql/test/kotlin/library-tests/classes/ctorCalls.expected +++ b/java/ql/test/kotlin/library-tests/classes/ctorCalls.expected @@ -36,6 +36,9 @@ superCall | classes.kt:129:17:131:17 | super(...) | | generic_anonymous.kt:1:1:9:1 | super(...) | | generic_anonymous.kt:3:19:5:3 | super(...) | +| localClassField.kt:1:1:11:1 | super(...) | +| localClassField.kt:3:9:3:19 | super(...) | +| localClassField.kt:8:9:8:19 | super(...) | | local_anonymous.kt:3:1:36:1 | super(...) | | local_anonymous.kt:5:16:7:9 | super(...) | | local_anonymous.kt:11:9:11:24 | super(...) | diff --git a/java/ql/test/kotlin/library-tests/classes/localClass.expected b/java/ql/test/kotlin/library-tests/classes/localClass.expected index 53548310414..ebce3e75992 100644 --- a/java/ql/test/kotlin/library-tests/classes/localClass.expected +++ b/java/ql/test/kotlin/library-tests/classes/localClass.expected @@ -2,5 +2,9 @@ | classes.kt:118:9:123:9 | class ... | classes.kt:118:9:123:9 | | classes.kt:117:5:124:5 | fn2 | classes.kt:109:1:136:1 | C1 | | classes.kt:119:13:121:13 | class ... | classes.kt:119:13:121:13 | Local2 | classes.kt:118:9:123:9 | localFn | classes.kt:109:1:136:1 | C1 | | classes.kt:129:17:131:17 | class ... | classes.kt:129:17:131:17 | Local3 | classes.kt:128:13:133:13 | fn | classes.kt:127:16:134:9 | new Object(...) { ... } | +| localClassField.kt:3:9:3:19 | class ... | localClassField.kt:3:9:3:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | +| localClassField.kt:3:9:3:19 | class ... | localClassField.kt:8:9:8:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | +| localClassField.kt:8:9:8:19 | class ... | localClassField.kt:3:9:3:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | +| localClassField.kt:8:9:8:19 | class ... | localClassField.kt:8:9:8:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | | local_anonymous.kt:11:9:11:24 | class ... | local_anonymous.kt:11:9:11:24 | | local_anonymous.kt:10:5:13:5 | fn2 | local_anonymous.kt:3:1:36:1 | Class1 | | local_anonymous.kt:25:9:25:27 | class ... | local_anonymous.kt:25:9:25:27 | LocalClass | local_anonymous.kt:24:5:27:5 | fn5 | local_anonymous.kt:3:1:36:1 | Class1 | diff --git a/java/ql/test/kotlin/library-tests/classes/localClassField.kt b/java/ql/test/kotlin/library-tests/classes/localClassField.kt new file mode 100644 index 00000000000..f1db3f45a79 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/classes/localClassField.kt @@ -0,0 +1,11 @@ +class A { + val x = if (true) { + class L { } + L() + } else {} + + val y = if (true) { + class L { } + L() + } else {} +} diff --git a/java/ql/test/kotlin/library-tests/classes/superTypes.expected b/java/ql/test/kotlin/library-tests/classes/superTypes.expected index 3fa2b881183..f0b7f0ca3e9 100644 --- a/java/ql/test/kotlin/library-tests/classes/superTypes.expected +++ b/java/ql/test/kotlin/library-tests/classes/superTypes.expected @@ -49,6 +49,9 @@ | file:///SuperChain2.class:0:0:0:0 | SuperChain2 | file:///SuperChain1.class:0:0:0:0 | SuperChain1 | | generic_anonymous.kt:1:1:9:1 | Generic | file:///Object.class:0:0:0:0 | Object | | generic_anonymous.kt:3:19:5:3 | new Object(...) { ... } | file:///Object.class:0:0:0:0 | Object | +| localClassField.kt:1:1:11:1 | A | file:///Object.class:0:0:0:0 | Object | +| localClassField.kt:3:9:3:19 | L | file:///Object.class:0:0:0:0 | Object | +| localClassField.kt:8:9:8:19 | L | file:///Object.class:0:0:0:0 | Object | | local_anonymous.kt:3:1:36:1 | Class1 | file:///Object.class:0:0:0:0 | Object | | local_anonymous.kt:5:16:7:9 | new Object(...) { ... } | file:///Object.class:0:0:0:0 | Object | | local_anonymous.kt:11:9:11:24 | | file:///Object.class:0:0:0:0 | Object | From 857a74cf14b8d86d904d4329c6b9c707f4ce37a4 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Thu, 5 May 2022 12:45:59 +0200 Subject: [PATCH 22/34] Adjust class label generation to handle classes in field initializers --- .../src/main/kotlin/KotlinUsesExtractor.kt | 3 + .../library-tests/classes/DB-CHECK.expected | 20 - .../library-tests/classes/PrintAst.expected | 3579 ++++------------- .../library-tests/classes/localClass.expected | 2 - 4 files changed, 894 insertions(+), 2710 deletions(-) delete mode 100644 java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 9fd669001fa..ec06942b66e 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -1018,6 +1018,9 @@ open class KotlinUsesExtractor( is IrFunction -> { "{${useFunction(parent)}}.$cls" } + is IrField -> { + "{${useField(parent)}}.$cls" + } else -> { if (pkg.isEmpty()) cls else "$pkg.$cls" } diff --git a/java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected b/java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected deleted file mode 100644 index 3de2e1a988a..00000000000 --- a/java/ql/test/kotlin/library-tests/classes/DB-CHECK.expected +++ /dev/null @@ -1,20 +0,0 @@ -[INVALID_KEY_SET] predicate isLocalClassOrInterface(@classorinterface typeid, @localtypedeclstmt parent): The key set {typeid} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 1: -Tuple 1 in row 13: (1044,1050) -Tuple 2 in row 14: (1044,1075) - Relevant element: Tuple 1: typeid=1044 - Full ID for 1044: @"class;L" - Relevant element: Tuple 2: typeid=1044 - Full ID for 1044: @"class;L" -[INVALID_KEY_SET] predicate stmts(@stmt id, int kind, @stmtparent parent, int idx, @callable bodydecl): The key set {parent, idx} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 223: (1047,0,1046,0,1046) -Tuple 2 in row 233: (1072,0,1046,0,1046) - Relevant element: Tuple 1: parent=1046 - Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" - Relevant element: Tuple 2: parent=1046 - Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" - Relevant element: Tuple 1: bodydecl=1046 - Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" - Relevant element: Tuple 2: bodydecl=1046 - Full ID for 1046: @"callable;(1044).()(17)". The ID may expand to @"callable;{@"class;L"}.(){@"type;void"}" diff --git a/java/ql/test/kotlin/library-tests/classes/PrintAst.expected b/java/ql/test/kotlin/library-tests/classes/PrintAst.expected index 09490f642fa..f1fae7f584f 100644 --- a/java/ql/test/kotlin/library-tests/classes/PrintAst.expected +++ b/java/ql/test/kotlin/library-tests/classes/PrintAst.expected @@ -1,2698 +1,901 @@ -classes.kt: -# 2| [Class] ClassOne -#-----| 1 -> [Constructor] ClassOne - -# 2| [Constructor] ClassOne -#-----| 5 -> [BlockStmt] { ... } - -# 2| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 2| [SuperConstructorInvocationStmt] super(...) - -# 2| [BlockStmt] { ... } - -# 4| [Class] ClassTwo -#-----| 1 -> [Constructor] ClassTwo -#-----| 2 -> [Method] getArg -#-----| 2 -> [FieldDeclaration] int arg; -#-----| 4 -> [Method] getX -#-----| 4 -> [FieldDeclaration] int x; - -# 4| [Constructor] ClassTwo -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 4| [Parameter] arg -#-----| 0 -> [TypeAccess] int - -# 4| [TypeAccess] int - -# 4| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 4| [SuperConstructorInvocationStmt] super(...) - -# 4| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; -#-----| 1 -> [ExprStmt] ; - -# 4| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 4| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] arg - -# 4| [VarAccess] arg - -# 4| [VarAccess] arg - -# 5| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 5| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] x - -# 5| [VarAccess] x - -# 5| [IntegerLiteral] 3 - -# 4| [Method] getArg -#-----| 3 -> [TypeAccess] int -#-----| 5 -> [BlockStmt] { ... } - -# 4| [TypeAccess] int - -# 4| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 4| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.arg - -# 4| [VarAccess] this.arg -#-----| -1 -> [ThisAccess] this - -# 4| [ThisAccess] this - -# 4| [FieldDeclaration] int arg; -#-----| -1 -> [TypeAccess] int -#-----| 0 -> [VarAccess] arg - -# 4| [TypeAccess] int - -# 5| [Method] getX -#-----| 3 -> [TypeAccess] int -#-----| 5 -> [BlockStmt] { ... } - -# 5| [TypeAccess] int - -# 5| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 5| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.x - -# 5| [VarAccess] this.x -#-----| -1 -> [ThisAccess] this - -# 5| [ThisAccess] this - -# 5| [FieldDeclaration] int x; -#-----| -1 -> [TypeAccess] int -#-----| 0 -> [IntegerLiteral] 3 - -# 5| [TypeAccess] int - -# 8| [Class] ClassThree -#-----| 1 -> [Constructor] ClassThree -#-----| 2 -> [Method] foo - -# 8| [Constructor] ClassThree -#-----| 5 -> [BlockStmt] { ... } - -# 8| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 8| [SuperConstructorInvocationStmt] super(...) - -# 8| [BlockStmt] { ... } - -# 9| [Method] foo -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) - -# 9| [Parameter] arg -#-----| 0 -> [TypeAccess] int - -# 9| [TypeAccess] int - -# 9| [TypeAccess] Unit - -# 12| [Class] ClassFour -#-----| 1 -> [Constructor] ClassFour -#-----| 2 -> [Method] foo - -# 12| [Constructor] ClassFour -#-----| 5 -> [BlockStmt] { ... } - -# 12| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 12| [SuperConstructorInvocationStmt] super(...) - -# 12| [BlockStmt] { ... } - -# 13| [Method] foo -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 13| [Parameter] arg -#-----| 0 -> [TypeAccess] int - -# 13| [TypeAccess] int - -# 13| [TypeAccess] Unit - -# 13| [BlockStmt] { ... } - -# 17| [Class] ClassFive -#-----| 1 -> [Constructor] ClassFive - -# 17| [Constructor] ClassFive -#-----| 5 -> [BlockStmt] { ... } - -# 17| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 17| [SuperConstructorInvocationStmt] super(...) - -# 17| [BlockStmt] { ... } - -# 20| [Interface] IF1 -#-----| 1 -> [Method] funIF1 - -# 21| [Method] funIF1 -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 21| [TypeAccess] Unit - -# 21| [BlockStmt] { ... } - -# 24| [Interface] IF2 -#-----| 1 -> [Method] funIF2 - -# 25| [Method] funIF2 -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 25| [TypeAccess] Unit - -# 25| [BlockStmt] { ... } - -# 28| [Class] ClassSix -#-----| 1 -> [Constructor] ClassSix -#-----| 2 -> [Constructor] ClassSix - -# 28| [Constructor] ClassSix -#-----| 5 -> [BlockStmt] { ... } - -# 28| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 28| [SuperConstructorInvocationStmt] super(...) - -# 28| [BlockStmt] { ... } - -# 29| [Constructor] ClassSix -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 29| [Parameter] i -#-----| 0 -> [TypeAccess] int - -# 29| [TypeAccess] int - -# 29| [BlockStmt] { ... } -#-----| 0 -> [ThisConstructorInvocationStmt] this(...) - -# 29| [ThisConstructorInvocationStmt] this(...) - -# 0| [Class] ClassesKt -#-----| 1 -> [Method] f - -# 32| [Method] f -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 32| [Parameter] s -#-----| 0 -> [TypeAccess] String - -# 32| [TypeAccess] String - -# 32| [TypeAccess] Unit - -# 32| [BlockStmt] { ... } - -# 34| [Class] ClassSeven -#-----| 1 -> [Constructor] ClassSeven -#-----| 2 -> [Method] getX -#-----| 2 -> [FieldDeclaration] int x; - -# 35| [Constructor] ClassSeven -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 35| [Parameter] i -#-----| 0 -> [TypeAccess] String - -# 35| [TypeAccess] String - -# 35| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } -#-----| 2 -> [ExprStmt] ; - -# 35| [SuperConstructorInvocationStmt] super(...) - -# 35| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; -#-----| 1 -> [ExprStmt] ; -#-----| 2 -> [ExprStmt] ; - -# 39| [ExprStmt] ; -#-----| 0 -> [MethodAccess] f(...) - -# 39| [MethodAccess] f(...) -#-----| -1 -> [TypeAccess] ClassesKt -#-----| 0 -> [StringLiteral] init1 - -# 39| [TypeAccess] ClassesKt - -# 39| [StringLiteral] init1 - -# 42| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 42| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] x - -# 42| [VarAccess] x - -# 42| [IntegerLiteral] 3 - -# 45| [ExprStmt] ; -#-----| 0 -> [MethodAccess] f(...) - -# 45| [MethodAccess] f(...) -#-----| -1 -> [TypeAccess] ClassesKt -#-----| 0 -> [StringLiteral] init2 - -# 45| [TypeAccess] ClassesKt - -# 45| [StringLiteral] init2 - -# 36| [ExprStmt] ; -#-----| 0 -> [MethodAccess] f(...) - -# 36| [MethodAccess] f(...) -#-----| -1 -> [TypeAccess] ClassesKt -#-----| 0 -> [VarAccess] i - -# 36| [TypeAccess] ClassesKt - -# 36| [VarAccess] i - -# 42| [Method] getX -#-----| 3 -> [TypeAccess] int -#-----| 5 -> [BlockStmt] { ... } - -# 42| [TypeAccess] int - -# 42| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 42| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.x - -# 42| [VarAccess] this.x -#-----| -1 -> [ThisAccess] this - -# 42| [ThisAccess] this - -# 42| [FieldDeclaration] int x; -#-----| -1 -> [TypeAccess] int -#-----| 0 -> [IntegerLiteral] 3 - -# 42| [TypeAccess] int - -# 49| [Class] Direction -#-----| 1 -> [Method] values -#-----| 1 -> [Method] valueOf -#-----| 4 -> [Constructor] Direction -#-----| 5 -> [FieldDeclaration] Direction NORTH; -#-----| 6 -> [FieldDeclaration] Direction SOUTH; -#-----| 7 -> [FieldDeclaration] Direction WEST; -#-----| 8 -> [FieldDeclaration] Direction EAST; - -# 49| [Constructor] Direction -#-----| 5 -> [BlockStmt] { ... } - -# 49| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; -#-----| 1 -> [BlockStmt] { ... } - -# 49| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new Enum(...) - -# 49| [ClassInstanceExpr] new Enum(...) -#-----| -3 -> [TypeAccess] Unit - -# 49| [TypeAccess] Unit -#-----| 0 -> [TypeAccess] Direction - -# 49| [TypeAccess] Direction - -# 49| [BlockStmt] { ... } - -# 50| [FieldDeclaration] Direction NORTH; -#-----| -1 -> [TypeAccess] Direction -#-----| 0 -> [ClassInstanceExpr] new Direction(...) - -# 50| [TypeAccess] Direction - -# 50| [FieldDeclaration] Direction SOUTH; -#-----| -1 -> [TypeAccess] Direction -#-----| 0 -> [ClassInstanceExpr] new Direction(...) - -# 50| [TypeAccess] Direction - -# 50| [FieldDeclaration] Direction WEST; -#-----| -1 -> [TypeAccess] Direction -#-----| 0 -> [ClassInstanceExpr] new Direction(...) - -# 50| [TypeAccess] Direction - -# 50| [FieldDeclaration] Direction EAST; -#-----| -1 -> [TypeAccess] Direction -#-----| 0 -> [ClassInstanceExpr] new Direction(...) - -# 50| [TypeAccess] Direction - -# 0| [Method] values -#-----| 3 -> [TypeAccess] Direction[] - -# 0| [TypeAccess] Direction[] -#-----| 0 -> [TypeAccess] Direction - -# 0| [TypeAccess] Direction - -# 0| [Method] valueOf -#-----| 3 -> [TypeAccess] Direction -#-----| 4 -> (Parameters) - -# 0| [Parameter] value -#-----| 0 -> [TypeAccess] String - -# 0| [TypeAccess] String - -# 0| [TypeAccess] Direction - -# 50| [ClassInstanceExpr] new Direction(...) -#-----| -3 -> [TypeAccess] Direction - -# 50| [TypeAccess] Direction - -# 50| [ClassInstanceExpr] new Direction(...) -#-----| -3 -> [TypeAccess] Direction - -# 50| [TypeAccess] Direction - -# 50| [ClassInstanceExpr] new Direction(...) -#-----| -3 -> [TypeAccess] Direction - -# 50| [TypeAccess] Direction - -# 50| [ClassInstanceExpr] new Direction(...) -#-----| -3 -> [TypeAccess] Direction - -# 50| [TypeAccess] Direction - -# 53| [Class] Color -#-----| 1 -> [Method] values -#-----| 1 -> [Method] valueOf -#-----| 4 -> [Constructor] Color -#-----| 5 -> [Method] getRgb -#-----| 5 -> [FieldDeclaration] int rgb; -#-----| 7 -> [FieldDeclaration] Color RED; -#-----| 8 -> [FieldDeclaration] Color GREEN; -#-----| 9 -> [FieldDeclaration] Color BLUE; - -# 53| [Constructor] Color -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 53| [Parameter] rgb -#-----| 0 -> [TypeAccess] int - -# 53| [TypeAccess] int - -# 53| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; -#-----| 1 -> [BlockStmt] { ... } - -# 53| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new Enum(...) - -# 53| [ClassInstanceExpr] new Enum(...) -#-----| -3 -> [TypeAccess] Unit - -# 53| [TypeAccess] Unit -#-----| 0 -> [TypeAccess] Color - -# 53| [TypeAccess] Color - -# 53| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 53| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 53| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] rgb - -# 53| [VarAccess] rgb - -# 53| [VarAccess] rgb - -# 53| [Method] getRgb -#-----| 3 -> [TypeAccess] int -#-----| 5 -> [BlockStmt] { ... } - -# 53| [TypeAccess] int - -# 53| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 53| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.rgb - -# 53| [VarAccess] this.rgb -#-----| -1 -> [ThisAccess] this - -# 53| [ThisAccess] this - -# 53| [FieldDeclaration] int rgb; -#-----| -1 -> [TypeAccess] int -#-----| 0 -> [VarAccess] rgb - -# 53| [TypeAccess] int - -# 54| [FieldDeclaration] Color RED; -#-----| -1 -> [TypeAccess] Color -#-----| 0 -> [ClassInstanceExpr] new Color(...) - -# 54| [TypeAccess] Color - -# 55| [FieldDeclaration] Color GREEN; -#-----| -1 -> [TypeAccess] Color -#-----| 0 -> [ClassInstanceExpr] new Color(...) - -# 55| [TypeAccess] Color - -# 56| [FieldDeclaration] Color BLUE; -#-----| -1 -> [TypeAccess] Color -#-----| 0 -> [ClassInstanceExpr] new Color(...) - -# 56| [TypeAccess] Color - -# 0| [Method] values -#-----| 3 -> [TypeAccess] Color[] - -# 0| [TypeAccess] Color[] -#-----| 0 -> [TypeAccess] Color - -# 0| [TypeAccess] Color - -# 0| [Method] valueOf -#-----| 3 -> [TypeAccess] Color -#-----| 4 -> (Parameters) - -# 0| [Parameter] value -#-----| 0 -> [TypeAccess] String - -# 0| [TypeAccess] String - -# 0| [TypeAccess] Color - -# 54| [ClassInstanceExpr] new Color(...) -#-----| -3 -> [TypeAccess] Color -#-----| 0 -> [IntegerLiteral] 16711680 - -# 54| [IntegerLiteral] 16711680 - -# 54| [TypeAccess] Color - -# 55| [ClassInstanceExpr] new Color(...) -#-----| -3 -> [TypeAccess] Color -#-----| 0 -> [IntegerLiteral] 65280 - -# 55| [IntegerLiteral] 65280 - -# 55| [TypeAccess] Color - -# 56| [ClassInstanceExpr] new Color(...) -#-----| -3 -> [TypeAccess] Color -#-----| 0 -> [IntegerLiteral] 255 - -# 56| [IntegerLiteral] 255 - -# 56| [TypeAccess] Color - -# 59| [Interface] Interface1 - -# 60| [Interface] Interface2 - -# 61| [GenericType,Interface,ParameterizedType] Interface3 -#-----| -2 -> (Generic Parameters) - -# 61| [TypeVariable] T - -# 63| [Class] Class1 -#-----| 1 -> [Constructor] Class1 -#-----| 2 -> [Method] getObject1 -#-----| 3 -> [Method] getObject2 -#-----| 4 -> [Method] getObject3 -#-----| 5 -> [Method] getObject4 -#-----| 6 -> [Method] getObject5 - -# 63| [Constructor] Class1 -#-----| 5 -> [BlockStmt] { ... } - -# 63| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 63| [SuperConstructorInvocationStmt] super(...) - -# 63| [BlockStmt] { ... } - -# 64| [Method] getObject1 -#-----| 3 -> [TypeAccess] Object -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 64| [Parameter] b -#-----| 0 -> [TypeAccess] boolean - -# 64| [TypeAccess] boolean - -# 64| [TypeAccess] Object - -# 64| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 65| [ExprStmt] ; -#-----| 0 -> [WhenExpr] when ... - -# 65| [WhenExpr] when ... -#-----| 0 -> [WhenBranch] ... -> ... -#-----| 1 -> [WhenBranch] ... -> ... - -# 65| [WhenBranch] ... -> ... -#-----| 0 -> [VarAccess] b -#-----| 1 -> [ReturnStmt] return ... - -# 65| [VarAccess] b - -# 66| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 66| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 66| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] - -# 66| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 66| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 66| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 66| [SuperConstructorInvocationStmt] super(...) - -# 66| [BlockStmt] { ... } - -# 66| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 66| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 66| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 66| [TypeAccess] Object - -# 65| [WhenBranch] ... -> ... -#-----| 0 -> [BooleanLiteral] true -#-----| 1 -> [ReturnStmt] return ... - -# 65| [BooleanLiteral] true - -# 68| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 68| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 68| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] - -# 68| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 68| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 68| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 68| [SuperConstructorInvocationStmt] super(...) - -# 68| [BlockStmt] { ... } - -# 68| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 68| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 68| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 68| [TypeAccess] Object - -# 71| [Method] getObject2 -#-----| 3 -> [TypeAccess] Interface1 -#-----| 5 -> [BlockStmt] { ... } - -# 71| [TypeAccess] Interface1 - -# 71| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 72| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 72| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 72| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] -#-----| 2 -> [Method] getX -#-----| 2 -> [FieldDeclaration] int x; -#-----| 4 -> [Method] foo - -# 72| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 72| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 72| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 72| [SuperConstructorInvocationStmt] super(...) - -# 72| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 73| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 73| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] x - -# 73| [VarAccess] x - -# 73| [IntegerLiteral] 1 - -# 73| [Method] getX -#-----| 3 -> [TypeAccess] int -#-----| 5 -> [BlockStmt] { ... } - -# 73| [TypeAccess] int - -# 73| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 73| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.x - -# 73| [VarAccess] this.x -#-----| -1 -> [ThisAccess] this - -# 73| [ThisAccess] this - -# 73| [FieldDeclaration] int x; -#-----| -1 -> [TypeAccess] int -#-----| 0 -> [IntegerLiteral] 1 - -# 73| [TypeAccess] int - -# 74| [Method] foo -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 74| [TypeAccess] Object - -# 74| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 75| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 75| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 75| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] - -# 75| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 75| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 75| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 75| [SuperConstructorInvocationStmt] super(...) - -# 75| [BlockStmt] { ... } - -# 75| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 75| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 75| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 75| [TypeAccess] Object - -# 72| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 72| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 72| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 72| [TypeAccess] Object - -# 80| [Method] getObject3 -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 80| [TypeAccess] Object - -# 80| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 81| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 81| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 81| [AnonymousClass,LocalClass] new Interface1(...) { ... } -#-----| 1 -> [Constructor] - -# 81| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 81| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 81| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 81| [SuperConstructorInvocationStmt] super(...) - -# 81| [BlockStmt] { ... } - -# 81| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Interface1(...) { ... } - -# 81| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 81| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Interface1 - -# 81| [TypeAccess] Interface1 - -# 84| [Method] getObject4 -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 84| [TypeAccess] Object - -# 84| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 85| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 85| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 85| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] - -# 85| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 85| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 85| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 85| [SuperConstructorInvocationStmt] super(...) - -# 85| [BlockStmt] { ... } - -# 85| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 85| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 85| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 85| [TypeAccess] Object - -# 88| [Method] getObject5 -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 88| [TypeAccess] Object - -# 88| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 89| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 89| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 89| [AnonymousClass,LocalClass] new Interface3(...) { ... } -#-----| 1 -> [Constructor] - -# 89| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 89| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 89| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 89| [SuperConstructorInvocationStmt] super(...) - -# 89| [BlockStmt] { ... } - -# 89| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Interface3(...) { ... } - -# 89| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 89| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Interface3 - -# 89| [TypeAccess] Interface3 - -# 93| [Class] pulicClass -#-----| 1 -> [Constructor] pulicClass - -# 93| [Constructor] pulicClass -#-----| 5 -> [BlockStmt] { ... } - -# 93| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 93| [SuperConstructorInvocationStmt] super(...) - -# 93| [BlockStmt] { ... } - -# 94| [Class] privateClass -#-----| 1 -> [Constructor] privateClass - -# 94| [Constructor] privateClass -#-----| 5 -> [BlockStmt] { ... } - -# 94| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 94| [SuperConstructorInvocationStmt] super(...) - -# 94| [BlockStmt] { ... } - -# 95| [Class] internalClass -#-----| 1 -> [Constructor] internalClass - -# 95| [Constructor] internalClass -#-----| 5 -> [BlockStmt] { ... } - -# 95| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 95| [SuperConstructorInvocationStmt] super(...) - -# 95| [BlockStmt] { ... } - -# 96| [Class] noExplicitVisibilityClass -#-----| 1 -> [Constructor] noExplicitVisibilityClass - -# 96| [Constructor] noExplicitVisibilityClass -#-----| 5 -> [BlockStmt] { ... } - -# 96| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 96| [SuperConstructorInvocationStmt] super(...) - -# 96| [BlockStmt] { ... } - -# 98| [Class] nestedClassVisibilities -#-----| 1 -> [Constructor] nestedClassVisibilities -#-----| 2 -> [Class] pulicNestedClass -#-----| 3 -> [Class] protectedNestedClass -#-----| 4 -> [Class] privateNestedClass -#-----| 5 -> [Class] internalNestedClass -#-----| 6 -> [Class] noExplicitVisibilityNestedClass - -# 98| [Constructor] nestedClassVisibilities -#-----| 5 -> [BlockStmt] { ... } - -# 98| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 98| [SuperConstructorInvocationStmt] super(...) - -# 98| [BlockStmt] { ... } - -# 99| [Class] pulicNestedClass -#-----| 1 -> [Constructor] pulicNestedClass - -# 99| [Constructor] pulicNestedClass -#-----| 5 -> [BlockStmt] { ... } - -# 99| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 99| [SuperConstructorInvocationStmt] super(...) - -# 99| [BlockStmt] { ... } - -# 100| [Class] protectedNestedClass -#-----| 1 -> [Constructor] protectedNestedClass - -# 100| [Constructor] protectedNestedClass -#-----| 5 -> [BlockStmt] { ... } - -# 100| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 100| [SuperConstructorInvocationStmt] super(...) - -# 100| [BlockStmt] { ... } - -# 101| [Class] privateNestedClass -#-----| 1 -> [Constructor] privateNestedClass - -# 101| [Constructor] privateNestedClass -#-----| 5 -> [BlockStmt] { ... } - -# 101| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 101| [SuperConstructorInvocationStmt] super(...) - -# 101| [BlockStmt] { ... } - -# 102| [Class] internalNestedClass -#-----| 1 -> [Constructor] internalNestedClass - -# 102| [Constructor] internalNestedClass -#-----| 5 -> [BlockStmt] { ... } - -# 102| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 102| [SuperConstructorInvocationStmt] super(...) - -# 102| [BlockStmt] { ... } - -# 103| [Class] noExplicitVisibilityNestedClass -#-----| 1 -> [Constructor] noExplicitVisibilityNestedClass - -# 103| [Constructor] noExplicitVisibilityNestedClass -#-----| 5 -> [BlockStmt] { ... } - -# 103| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 103| [SuperConstructorInvocationStmt] super(...) - -# 103| [BlockStmt] { ... } - -# 106| [Class] sealedClass -#-----| 1 -> [Constructor] sealedClass - -# 106| [Constructor] sealedClass -#-----| 5 -> [BlockStmt] { ... } - -# 106| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 106| [SuperConstructorInvocationStmt] super(...) - -# 106| [BlockStmt] { ... } - -# 107| [Class] openClass -#-----| 1 -> [Constructor] openClass - -# 107| [Constructor] openClass -#-----| 5 -> [BlockStmt] { ... } - -# 107| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 107| [SuperConstructorInvocationStmt] super(...) - -# 107| [BlockStmt] { ... } - -# 109| [Class] C1 -#-----| 1 -> [Constructor] C1 -#-----| 2 -> [Method] fn1 -#-----| 3 -> [Method] fn2 -#-----| 4 -> [Method] fn3 - -# 109| [Constructor] C1 -#-----| 5 -> [BlockStmt] { ... } - -# 109| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 109| [SuperConstructorInvocationStmt] super(...) - -# 109| [BlockStmt] { ... } - -# 110| [Method] fn1 -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 110| [Parameter] p -#-----| 0 -> [TypeAccess] int - -# 110| [TypeAccess] int - -# 110| [TypeAccess] Unit - -# 110| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 111| [Class,GenericType,LocalClass,ParameterizedType] Local1 -#-----| -2 -> (Generic Parameters) -#-----| 1 -> [Constructor] Local1 -#-----| 2 -> [Method] foo - -# 111| [TypeVariable] T1 - -# 111| [Constructor] Local1 -#-----| 5 -> [BlockStmt] { ... } - -# 111| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 111| [SuperConstructorInvocationStmt] super(...) - -# 111| [BlockStmt] { ... } - -# 112| [Method] foo -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 112| [Parameter] p -#-----| 0 -> [TypeAccess] int - -# 112| [TypeAccess] int - -# 112| [TypeAccess] Unit - -# 112| [BlockStmt] { ... } - -# 111| [LocalTypeDeclStmt] class ... -#-----| 0 -> [Class,GenericType,LocalClass,ParameterizedType] Local1 - -# 114| [ExprStmt] ; -#-----| 0 -> [MethodAccess] foo(...) - -# 114| [MethodAccess] foo(...) -#-----| -1 -> [ClassInstanceExpr] new Local1(...) -#-----| 0 -> [VarAccess] p - -# 114| [ClassInstanceExpr] new Local1(...) -#-----| -3 -> [TypeAccess] Local1 - -# 114| [TypeAccess] Local1 -#-----| 0 -> [TypeAccess] Integer - -# 114| [TypeAccess] Integer - -# 114| [VarAccess] p - -# 117| [Method] fn2 -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 117| [Parameter] p -#-----| 0 -> [TypeAccess] int - -# 117| [TypeAccess] int - -# 117| [TypeAccess] Unit - -# 117| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... - -# 118| [LocalClass] -#-----| 1 -> [Constructor] -#-----| 1 -> [Method] localFn - -# 118| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 118| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) - -# 118| [Method] localFn -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 118| [SuperConstructorInvocationStmt] super(...) - -# 118| [TypeAccess] Unit - -# 118| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 119| [Class,GenericType,LocalClass,ParameterizedType] Local2 -#-----| -2 -> (Generic Parameters) -#-----| 1 -> [Constructor] Local2 -#-----| 2 -> [Method] foo - -# 119| [TypeVariable] T1 - -# 119| [Constructor] Local2 -#-----| 5 -> [BlockStmt] { ... } - -# 119| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 119| [SuperConstructorInvocationStmt] super(...) - -# 119| [BlockStmt] { ... } - -# 120| [Method] foo -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 120| [Parameter] p -#-----| 0 -> [TypeAccess] int - -# 120| [TypeAccess] int - -# 120| [TypeAccess] Unit - -# 120| [BlockStmt] { ... } - -# 119| [LocalTypeDeclStmt] class ... -#-----| 0 -> [Class,GenericType,LocalClass,ParameterizedType] Local2 - -# 122| [ExprStmt] ; -#-----| 0 -> [MethodAccess] foo(...) - -# 122| [MethodAccess] foo(...) -#-----| -1 -> [ClassInstanceExpr] new Local2(...) -#-----| 0 -> [VarAccess] p - -# 122| [ClassInstanceExpr] new Local2(...) -#-----| -3 -> [TypeAccess] Local2 - -# 122| [TypeAccess] Local2 -#-----| 0 -> [TypeAccess] Integer - -# 122| [TypeAccess] Integer - -# 122| [VarAccess] p - -# 118| [LocalTypeDeclStmt] class ... -#-----| 0 -> [LocalClass] - -# 126| [Method] fn3 -#-----| 3 -> [TypeAccess] Object -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 126| [Parameter] p -#-----| 0 -> [TypeAccess] int - -# 126| [TypeAccess] int - -# 126| [TypeAccess] Object - -# 126| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 127| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 127| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 127| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] -#-----| 2 -> [Method] fn - -# 127| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 127| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 127| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 127| [SuperConstructorInvocationStmt] super(...) - -# 127| [BlockStmt] { ... } - -# 128| [Method] fn -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 128| [TypeAccess] Unit - -# 128| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 129| [Class,GenericType,LocalClass,ParameterizedType] Local3 -#-----| -2 -> (Generic Parameters) -#-----| 1 -> [Constructor] Local3 -#-----| 2 -> [Method] foo - -# 129| [TypeVariable] T1 - -# 129| [Constructor] Local3 -#-----| 5 -> [BlockStmt] { ... } - -# 129| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 129| [SuperConstructorInvocationStmt] super(...) - -# 129| [BlockStmt] { ... } - -# 130| [Method] foo -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 130| [Parameter] p -#-----| 0 -> [TypeAccess] int - -# 130| [TypeAccess] int - -# 130| [TypeAccess] Unit - -# 130| [BlockStmt] { ... } - -# 129| [LocalTypeDeclStmt] class ... -#-----| 0 -> [Class,GenericType,LocalClass,ParameterizedType] Local3 - -# 132| [ExprStmt] ; -#-----| 0 -> [MethodAccess] foo(...) - -# 132| [MethodAccess] foo(...) -#-----| -1 -> [ClassInstanceExpr] new Local3(...) -#-----| 0 -> [VarAccess] p - -# 132| [ClassInstanceExpr] new Local3(...) -#-----| -3 -> [TypeAccess] Local3 - -# 132| [TypeAccess] Local3 -#-----| 0 -> [TypeAccess] Integer - -# 132| [TypeAccess] Integer - -# 132| [VarAccess] p - -# 127| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 127| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 127| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 127| [TypeAccess] Object - -generic_anonymous.kt: -# 1| [Class,GenericType,ParameterizedType] Generic -#-----| -2 -> (Generic Parameters) -#-----| 1 -> [Constructor] Generic -#-----| 2 -> [Method] getT -#-----| 2 -> [FieldDeclaration] T t; -#-----| 4 -> [FieldDeclaration] new Object(...) { ... } x; -#-----| 5 -> [Method] getX -#-----| 6 -> [Method] get - -# 1| [TypeVariable] T - -# 1| [Constructor] Generic -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 1| [Parameter] t -#-----| 0 -> [TypeAccess] T - -# 1| [TypeAccess] T - -# 1| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 1| [SuperConstructorInvocationStmt] super(...) - -# 1| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; -#-----| 1 -> [ExprStmt] ; - -# 1| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 1| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] t - -# 1| [VarAccess] t - -# 1| [VarAccess] t - -# 3| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] -#-----| 2 -> [Method] getMember -#-----| 2 -> [FieldDeclaration] T member; - -# 3| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 3| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] x - -# 3| [VarAccess] x - -# 3| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 3| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 3| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 3| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 3| [SuperConstructorInvocationStmt] super(...) - -# 3| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 4| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 4| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] member - -# 4| [VarAccess] member - -# 4| [MethodAccess] getT(...) -#-----| -1 -> [ThisAccess] Generic.this - -# 1| [Method] getT -#-----| 3 -> [TypeAccess] T -#-----| 5 -> [BlockStmt] { ... } - -# 4| [ThisAccess] Generic.this -#-----| 0 -> [TypeAccess] Generic - -# 4| [TypeAccess] Generic - -# 4| [Method] getMember -#-----| 3 -> [TypeAccess] T -#-----| 5 -> [BlockStmt] { ... } - -# 4| [TypeAccess] T - -# 4| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 4| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.member - -# 4| [VarAccess] this.member -#-----| -1 -> [ThisAccess] this - -# 4| [ThisAccess] this - -# 4| [FieldDeclaration] T member; -#-----| -1 -> [TypeAccess] T -#-----| 0 -> [MethodAccess] getT(...) - -# 4| [TypeAccess] T - -# 3| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 3| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 3| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 3| [TypeAccess] Object - -# 1| [TypeAccess] T - -# 1| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 1| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.t - -# 1| [VarAccess] this.t -#-----| -1 -> [ThisAccess] this - -# 1| [ThisAccess] this - -# 1| [FieldDeclaration] T t; -#-----| -1 -> [TypeAccess] T -#-----| 0 -> [VarAccess] t - -# 1| [TypeAccess] T - -# 3| [Method] getX -#-----| 3 -> [TypeAccess] new Object(...) { ... } -#-----| 5 -> [BlockStmt] { ... } - -# 3| [TypeAccess] new Object(...) { ... } -#-----| 0 -> [TypeAccess] T - -# 3| [TypeAccess] T - -# 3| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 3| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.x - -# 3| [VarAccess] this.x -#-----| -1 -> [ThisAccess] this - -# 3| [ThisAccess] this - -# 3| [FieldDeclaration] new Object(...) { ... } x; -#-----| -1 -> [TypeAccess] new Object(...) { ... } -#-----| 0 -> [StmtExpr] - -# 3| [TypeAccess] new Object(...) { ... } -#-----| 0 -> [TypeAccess] T - -# 3| [TypeAccess] T - -# 7| [Method] get -#-----| 3 -> [TypeAccess] T -#-----| 5 -> [BlockStmt] { ... } - -# 7| [TypeAccess] T - -# 7| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 7| [ReturnStmt] return ... -#-----| 0 -> [MethodAccess] getMember(...) - -# 7| [MethodAccess] getMember(...) -#-----| -1 -> [MethodAccess] getX(...) - -# 7| [MethodAccess] getX(...) -#-----| -1 -> [ThisAccess] this - -# 7| [ThisAccess] this - -# 0| [Class] Generic_anonymousKt -#-----| 1 -> [Method] stringIdentity -#-----| 2 -> [Method] intIdentity - -# 11| [Method] stringIdentity -#-----| 3 -> [TypeAccess] String -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 11| [Parameter] s -#-----| 0 -> [TypeAccess] String - -# 11| [TypeAccess] String - -# 11| [TypeAccess] String - -# 11| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 11| [ReturnStmt] return ... -#-----| 0 -> [MethodAccess] get(...) - -# 11| [MethodAccess] get(...) -#-----| -1 -> [ClassInstanceExpr] new Generic(...) - -# 11| [ClassInstanceExpr] new Generic(...) -#-----| -3 -> [TypeAccess] Generic -#-----| 0 -> [VarAccess] s - -# 11| [VarAccess] s - -# 11| [TypeAccess] Generic -#-----| 0 -> [TypeAccess] String - -# 11| [TypeAccess] String - -# 13| [Method] intIdentity -#-----| 3 -> [TypeAccess] int -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 13| [Parameter] i -#-----| 0 -> [TypeAccess] int - -# 13| [TypeAccess] int - -# 13| [TypeAccess] int - -# 13| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 13| [ReturnStmt] return ... -#-----| 0 -> [MethodAccess] get(...) - -# 13| [MethodAccess] get(...) -#-----| -1 -> [ClassInstanceExpr] new Generic(...) - -# 13| [ClassInstanceExpr] new Generic(...) -#-----| -3 -> [TypeAccess] Generic -#-----| 0 -> [VarAccess] i - -# 13| [VarAccess] i - -# 13| [TypeAccess] Generic -#-----| 0 -> [TypeAccess] Integer - -# 13| [TypeAccess] Integer - -localClassField.kt: -# 1| [Class] A -#-----| 1 -> [Constructor] A -#-----| 2 -> [Method] getX -#-----| 2 -> [FieldDeclaration] Object x; -#-----| 4 -> [Method] getY -#-----| 4 -> [FieldDeclaration] Object y; - -# 1| [Constructor] A -#-----| 5 -> [BlockStmt] { ... } - -# 1| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 1| [SuperConstructorInvocationStmt] super(...) - -# 1| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; -#-----| 1 -> [ExprStmt] ; - -# 2| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 2| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] x - -# 2| [VarAccess] x - -# 2| [WhenExpr] when ... -#-----| 0 -> [WhenBranch] ... -> ... -#-----| 1 -> [WhenBranch] ... -> ... - -# 2| [WhenBranch] ... -> ... -#-----| 0 -> [BooleanLiteral] true -#-----| 1 -> [BlockStmt] { ... } - -# 2| [BooleanLiteral] true - -# 2| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 3| [LocalClass] L -#-----| 2 -> [Constructor] L -#-----| 2 -> [Constructor] L - -# 8| [LocalClass] L -#-----| 2 -> [Constructor] L -#-----| 2 -> [Constructor] L - -# 3| [Constructor] L -#-----| 5 -> [BlockStmt] { ... } -#-----| 5 -> [BlockStmt] { ... } - -# 8| [Constructor] L -#-----| 5 -> [BlockStmt] { ... } -#-----| 5 -> [BlockStmt] { ... } - -# 3| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 3| [SuperConstructorInvocationStmt] super(...) - -# 3| [BlockStmt] { ... } - -# 3| [LocalTypeDeclStmt] class ... -#-----| 0 -> [LocalClass] L -#-----| 0 -> [LocalClass] L - -# 4| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new L(...) - -# 4| [ClassInstanceExpr] new L(...) -#-----| -3 -> [TypeAccess] L - -# 4| [TypeAccess] L - -# 2| [WhenBranch] ... -> ... -#-----| 0 -> [BooleanLiteral] true -#-----| 1 -> [BlockStmt] { ... } - -# 2| [BooleanLiteral] true - -# 5| [BlockStmt] { ... } - -# 7| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 7| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] y - -# 7| [VarAccess] y - -# 7| [WhenExpr] when ... -#-----| 0 -> [WhenBranch] ... -> ... -#-----| 1 -> [WhenBranch] ... -> ... - -# 7| [WhenBranch] ... -> ... -#-----| 0 -> [BooleanLiteral] true -#-----| 1 -> [BlockStmt] { ... } - -# 7| [BooleanLiteral] true - -# 7| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 8| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 8| [SuperConstructorInvocationStmt] super(...) - -# 8| [BlockStmt] { ... } - -# 8| [LocalTypeDeclStmt] class ... -#-----| 0 -> [LocalClass] L -#-----| 0 -> [LocalClass] L - -# 9| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new L(...) - -# 9| [ClassInstanceExpr] new L(...) -#-----| -3 -> [TypeAccess] L - -# 9| [TypeAccess] L - -# 7| [WhenBranch] ... -> ... -#-----| 0 -> [BooleanLiteral] true -#-----| 1 -> [BlockStmt] { ... } - -# 7| [BooleanLiteral] true - -# 10| [BlockStmt] { ... } - -# 2| [Method] getX -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 2| [TypeAccess] Object - -# 2| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 2| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.x - -# 2| [VarAccess] this.x -#-----| -1 -> [ThisAccess] this - -# 2| [ThisAccess] this - -# 2| [FieldDeclaration] Object x; -#-----| -1 -> [TypeAccess] Object -#-----| 0 -> [WhenExpr] when ... - -# 2| [TypeAccess] Object - -# 7| [Method] getY -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 7| [TypeAccess] Object - -# 7| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 7| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.y - -# 7| [VarAccess] this.y -#-----| -1 -> [ThisAccess] this - -# 7| [ThisAccess] this - -# 7| [FieldDeclaration] Object y; -#-----| -1 -> [TypeAccess] Object -#-----| 0 -> [WhenExpr] when ... - -# 7| [TypeAccess] Object - -local_anonymous.kt: -# 3| [Class] Class1 -#-----| 1 -> [Constructor] Class1 -#-----| 2 -> [Method] fn1 -#-----| 3 -> [Method] fn2 -#-----| 4 -> [Method] fn3 -#-----| 5 -> [Method] fn4 -#-----| 6 -> [Method] fn5 -#-----| 7 -> [Method] nullableAnonymous - -# 3| [Constructor] Class1 -#-----| 5 -> [BlockStmt] { ... } - -# 3| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 3| [SuperConstructorInvocationStmt] super(...) - -# 3| [BlockStmt] { ... } - -# 4| [Method] fn1 -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 4| [TypeAccess] Object - -# 4| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 5| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 5| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 5| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] -#-----| 2 -> [Method] fn - -# 5| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 5| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 5| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 5| [SuperConstructorInvocationStmt] super(...) - -# 5| [BlockStmt] { ... } - -# 6| [Method] fn -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 6| [TypeAccess] Unit - -# 6| [BlockStmt] { ... } - -# 5| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 5| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 5| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 5| [TypeAccess] Object - -# 10| [Method] fn2 -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 10| [TypeAccess] Unit - -# 10| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 11| [LocalClass] -#-----| 1 -> [Constructor] -#-----| 1 -> [Method] fnLocal - -# 11| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 11| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) - -# 11| [Method] fnLocal -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 11| [SuperConstructorInvocationStmt] super(...) - -# 11| [TypeAccess] Unit - -# 11| [BlockStmt] { ... } - -# 11| [LocalTypeDeclStmt] class ... -#-----| 0 -> [LocalClass] - -# 12| [ExprStmt] ; -#-----| 0 -> [MethodAccess] fnLocal(...) - -# 12| [MethodAccess] fnLocal(...) -#-----| -1 -> [ClassInstanceExpr] new (...) - -# 12| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 12| [TypeAccess] Object - -# 15| [Method] fn3 -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 15| [TypeAccess] Unit - -# 15| [BlockStmt] { ... } -#-----| 0 -> [LocalVariableDeclStmt] var ...; -#-----| 1 -> [LocalVariableDeclStmt] var ...; - -# 16| [LocalVariableDeclStmt] var ...; -#-----| 1 -> [LocalVariableDeclExpr] lambda1 - -# 16| [LocalVariableDeclExpr] lambda1 -#-----| 0 -> [LambdaExpr] ...->... - -# 16| [AnonymousClass] new Function2(...) { ... } -#-----| 1 -> [Constructor] -#-----| 1 -> [Method] invoke - -# 16| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 16| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) - -# 16| [Method] invoke -#-----| 3 -> [TypeAccess] int -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 16| [SuperConstructorInvocationStmt] super(...) - -# 16| [Parameter] a -#-----| 0 -> [TypeAccess] int - -# 16| [TypeAccess] int - -# 16| [Parameter] b -#-----| 0 -> [TypeAccess] int - -# 16| [TypeAccess] int - -# 16| [TypeAccess] int - -# 16| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 16| [ReturnStmt] return ... -#-----| 0 -> [AddExpr] ... + ... - -# 16| [AddExpr] ... + ... -#-----| 0 -> [VarAccess] a -#-----| 1 -> [VarAccess] b - -# 16| [VarAccess] a - -# 16| [VarAccess] b - -# 16| [LambdaExpr] ...->... -#-----| -4 -> [AnonymousClass] new Function2(...) { ... } -#-----| -3 -> [TypeAccess] Function2 - -# 16| [TypeAccess] Function2 -#-----| 0 -> [TypeAccess] Integer -#-----| 1 -> [TypeAccess] Integer -#-----| 2 -> [TypeAccess] Integer - -# 16| [TypeAccess] Integer - -# 16| [TypeAccess] Integer - -# 16| [TypeAccess] Integer - -# 17| [LocalVariableDeclStmt] var ...; -#-----| 1 -> [LocalVariableDeclExpr] lambda2 - -# 17| [LocalVariableDeclExpr] lambda2 -#-----| 0 -> [LambdaExpr] ...->... - -# 17| [AnonymousClass] new Function2(...) { ... } -#-----| 1 -> [Constructor] -#-----| 1 -> [Method] invoke - -# 17| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 17| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) - -# 17| [Method] invoke -#-----| 3 -> [TypeAccess] int -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 17| [SuperConstructorInvocationStmt] super(...) - -# 17| [Parameter] a -#-----| 0 -> [TypeAccess] int - -# 17| [TypeAccess] int - -# 17| [Parameter] b -#-----| 0 -> [TypeAccess] int - -# 17| [TypeAccess] int - -# 17| [TypeAccess] int - -# 17| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 17| [ReturnStmt] return ... -#-----| 0 -> [AddExpr] ... + ... - -# 17| [AddExpr] ... + ... -#-----| 0 -> [VarAccess] a -#-----| 1 -> [VarAccess] b - -# 17| [VarAccess] a - -# 17| [VarAccess] b - -# 17| [LambdaExpr] ...->... -#-----| -4 -> [AnonymousClass] new Function2(...) { ... } -#-----| -3 -> [TypeAccess] Function2 - -# 17| [TypeAccess] Function2 -#-----| 0 -> [TypeAccess] Integer -#-----| 1 -> [TypeAccess] Integer -#-----| 2 -> [TypeAccess] Integer - -# 17| [TypeAccess] Integer - -# 17| [TypeAccess] Integer - -# 17| [TypeAccess] Integer - -# 20| [Method] fn4 -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 20| [TypeAccess] Unit - -# 20| [BlockStmt] { ... } -#-----| 0 -> [LocalVariableDeclStmt] var ...; - -# 21| [LocalVariableDeclStmt] var ...; -#-----| 1 -> [LocalVariableDeclExpr] fnRef - -# 21| [LocalVariableDeclExpr] fnRef -#-----| 0 -> [MemberRefExpr] ...::... - -# 21| [AnonymousClass] new Function1(...) { ... } -#-----| 1 -> [Constructor] -#-----| 1 -> [Method] invoke - -# 21| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 21| [Method] invoke -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 21| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) - -# 21| [SuperConstructorInvocationStmt] super(...) - -# 21| [Parameter] a0 - -# 21| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 21| [ReturnStmt] return ... -#-----| 0 -> [MethodAccess] fn3(...) - -# 21| [MethodAccess] fn3(...) -#-----| -1 -> [VarAccess] a0 - -# 21| [VarAccess] a0 - -# 21| [MemberRefExpr] ...::... -#-----| -4 -> [AnonymousClass] new Function1(...) { ... } -#-----| -3 -> [TypeAccess] Function1 - -# 21| [TypeAccess] Function1 -#-----| 0 -> [TypeAccess] Class1 -#-----| 1 -> [TypeAccess] Unit - -# 21| [TypeAccess] Class1 - -# 21| [TypeAccess] Unit - -# 24| [Method] fn5 -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 24| [TypeAccess] Unit - -# 24| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 25| [LocalClass] LocalClass -#-----| 1 -> [Constructor] LocalClass - -# 25| [Constructor] LocalClass -#-----| 5 -> [BlockStmt] { ... } - -# 25| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 25| [SuperConstructorInvocationStmt] super(...) - -# 25| [BlockStmt] { ... } - -# 25| [LocalTypeDeclStmt] class ... -#-----| 0 -> [LocalClass] LocalClass - -# 26| [ExprStmt] ; -#-----| 0 -> [ImplicitCoercionToUnitExpr] - -# 26| [ImplicitCoercionToUnitExpr] -#-----| 0 -> [TypeAccess] Unit -#-----| 1 -> [ClassInstanceExpr] new LocalClass(...) - -# 26| [TypeAccess] Unit - -# 26| [ClassInstanceExpr] new LocalClass(...) -#-----| -3 -> [TypeAccess] LocalClass - -# 26| [TypeAccess] LocalClass - -# 29| [Method] nullableAnonymous -#-----| 3 -> [TypeAccess] Object -#-----| 5 -> [BlockStmt] { ... } - -# 29| [TypeAccess] Object - -# 29| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 35| [ReturnStmt] return ... -#-----| 0 -> [StmtExpr] - -# 29| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 29| [AnonymousClass,LocalClass] new Object(...) { ... } -#-----| 1 -> [Constructor] -#-----| 2 -> [Method] getX -#-----| 2 -> [Method] setX -#-----| 2 -> [FieldDeclaration] int x; -#-----| 5 -> [Method] member - -# 29| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 29| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 29| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 29| [SuperConstructorInvocationStmt] super(...) - -# 29| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 30| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 30| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] x - -# 30| [VarAccess] x - -# 30| [IntegerLiteral] 1 - -# 30| [Method] getX -#-----| 3 -> [TypeAccess] int -#-----| 5 -> [BlockStmt] { ... } - -# 30| [TypeAccess] int - -# 30| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 30| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.x - -# 30| [VarAccess] this.x -#-----| -1 -> [ThisAccess] this - -# 30| [ThisAccess] this - -# 30| [Method] setX -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 30| [Parameter] -#-----| 0 -> [TypeAccess] int - -# 30| [TypeAccess] int - -# 30| [TypeAccess] Unit - -# 30| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 30| [ExprStmt] ; -#-----| 0 -> [AssignExpr] ...=... - -# 30| [AssignExpr] ...=... -#-----| 0 -> [VarAccess] this.x -#-----| 1 -> [VarAccess] - -# 30| [VarAccess] this.x -#-----| -1 -> [ThisAccess] this - -# 30| [VarAccess] - -# 30| [ThisAccess] this - -# 30| [FieldDeclaration] int x; -#-----| -1 -> [TypeAccess] int -#-----| 0 -> [IntegerLiteral] 1 - -# 30| [TypeAccess] int - -# 32| [Method] member -#-----| 3 -> [TypeAccess] Unit -#-----| 5 -> [BlockStmt] { ... } - -# 32| [TypeAccess] Unit - -# 32| [BlockStmt] { ... } -#-----| 0 -> [LocalVariableDeclStmt] var ...; - -# 33| [LocalVariableDeclStmt] var ...; -#-----| 1 -> [LocalVariableDeclExpr] maybeThis - -# 33| [LocalVariableDeclExpr] maybeThis -#-----| 0 -> [WhenExpr] when ... - -# 33| [WhenExpr] when ... -#-----| 0 -> [WhenBranch] ... -> ... -#-----| 1 -> [WhenBranch] ... -> ... - -# 33| [WhenBranch] ... -> ... -#-----| 0 -> [ValueEQExpr] ... (value equals) ... -#-----| 1 -> [ExprStmt] ; - -# 33| [ValueEQExpr] ... (value equals) ... -#-----| 0 -> [MethodAccess] getX(...) -#-----| 1 -> [IntegerLiteral] 1 - -# 33| [MethodAccess] getX(...) -#-----| -1 -> [ThisAccess] this - -# 33| [ThisAccess] this - -# 33| [IntegerLiteral] 1 - -# 33| [ExprStmt] ; -#-----| 0 -> [ThisAccess] this - -# 33| [ThisAccess] this - -# 33| [WhenBranch] ... -> ... -#-----| 0 -> [BooleanLiteral] true -#-----| 1 -> [ExprStmt] ; - -# 33| [BooleanLiteral] true - -# 33| [ExprStmt] ; -#-----| 0 -> [NullLiteral] null - -# 33| [NullLiteral] null - -# 29| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Object(...) { ... } - -# 29| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 29| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Object - -# 29| [TypeAccess] Object - -# 38| [Interface] Interface2 - -# 39| [Class] Class2 -#-----| 1 -> [Constructor] Class2 -#-----| 2 -> [Method] getI -#-----| 2 -> [Method] setI -#-----| 2 -> [FieldDeclaration] Interface2 i; - -# 39| [Constructor] Class2 -#-----| 5 -> [BlockStmt] { ... } - -# 39| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 39| [SuperConstructorInvocationStmt] super(...) - -# 39| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 40| [ExprStmt] ; -#-----| 0 -> [KtInitializerAssignExpr] ...=... - -# 40| [KtInitializerAssignExpr] ...=... -#-----| 0 -> [VarAccess] i - -# 40| [AnonymousClass,LocalClass] new Interface2(...) { ... } -#-----| 1 -> [Constructor] - -# 40| [VarAccess] i - -# 40| [StmtExpr] -#-----| 0 -> [BlockStmt] { ... } - -# 40| [BlockStmt] { ... } -#-----| 0 -> [LocalTypeDeclStmt] class ... -#-----| 1 -> [ExprStmt] ; - -# 40| [Constructor] -#-----| 5 -> [BlockStmt] { ... } - -# 40| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 40| [SuperConstructorInvocationStmt] super(...) - -# 40| [BlockStmt] { ... } -#-----| 0 -> [LocalVariableDeclStmt] var ...; - -# 42| [LocalVariableDeclStmt] var ...; -#-----| 1 -> [LocalVariableDeclExpr] answer - -# 42| [LocalVariableDeclExpr] answer -#-----| 0 -> [StringLiteral] 42 - -# 42| [StringLiteral] 42 - -# 40| [LocalTypeDeclStmt] class ... -#-----| 0 -> [AnonymousClass,LocalClass] new Interface2(...) { ... } - -# 40| [ExprStmt] ; -#-----| 0 -> [ClassInstanceExpr] new (...) - -# 40| [ClassInstanceExpr] new (...) -#-----| -3 -> [TypeAccess] Interface2 - -# 40| [TypeAccess] Interface2 - -# 40| [Method] getI -#-----| 3 -> [TypeAccess] Interface2 -#-----| 5 -> [BlockStmt] { ... } - -# 40| [TypeAccess] Interface2 - -# 40| [BlockStmt] { ... } -#-----| 0 -> [ReturnStmt] return ... - -# 40| [ReturnStmt] return ... -#-----| 0 -> [VarAccess] this.i - -# 40| [VarAccess] this.i -#-----| -1 -> [ThisAccess] this - -# 40| [ThisAccess] this - -# 40| [Method] setI -#-----| 3 -> [TypeAccess] Unit -#-----| 4 -> (Parameters) -#-----| 5 -> [BlockStmt] { ... } - -# 40| [Parameter] -#-----| 0 -> [TypeAccess] Interface2 - -# 40| [TypeAccess] Interface2 - -# 40| [TypeAccess] Unit - -# 40| [BlockStmt] { ... } -#-----| 0 -> [ExprStmt] ; - -# 40| [ExprStmt] ; -#-----| 0 -> [AssignExpr] ...=... - -# 40| [AssignExpr] ...=... -#-----| 0 -> [VarAccess] this.i -#-----| 1 -> [VarAccess] - -# 40| [VarAccess] this.i -#-----| -1 -> [ThisAccess] this - -# 40| [VarAccess] - -# 40| [ThisAccess] this - -# 40| [FieldDeclaration] Interface2 i; -#-----| -1 -> [TypeAccess] Interface2 -#-----| 0 -> [StmtExpr] - -# 40| [TypeAccess] Interface2 - -superChain.kt: -# 1| [Class,GenericType,ParameterizedType] SuperChain1 -#-----| -2 -> (Generic Parameters) -#-----| 1 -> [Constructor] SuperChain1 - -# 1| [TypeVariable] T1 - -# 1| [TypeVariable] T2 - -# 1| [Constructor] SuperChain1 -#-----| 5 -> [BlockStmt] { ... } - -# 1| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 1| [SuperConstructorInvocationStmt] super(...) - -# 1| [BlockStmt] { ... } - -# 2| [Class,GenericType,ParameterizedType] SuperChain2 -#-----| -2 -> (Generic Parameters) -#-----| 1 -> [Constructor] SuperChain2 - -# 2| [TypeVariable] T3 - -# 2| [TypeVariable] T4 - -# 2| [Constructor] SuperChain2 -#-----| 5 -> [BlockStmt] { ... } - -# 2| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 2| [SuperConstructorInvocationStmt] super(...) - -# 2| [BlockStmt] { ... } - -# 3| [Class,GenericType,ParameterizedType] SuperChain3 -#-----| -2 -> (Generic Parameters) -#-----| 1 -> [Constructor] SuperChain3 - -# 3| [TypeVariable] T5 - -# 3| [TypeVariable] T6 - -# 3| [Constructor] SuperChain3 -#-----| 5 -> [BlockStmt] { ... } - -# 3| [BlockStmt] { ... } -#-----| 0 -> [SuperConstructorInvocationStmt] super(...) -#-----| 1 -> [BlockStmt] { ... } - -# 3| [SuperConstructorInvocationStmt] super(...) - -# 3| [BlockStmt] { ... } - -#-----| (Parameters) -#-----| 0 -> [Parameter] arg - -#-----| (Parameters) -#-----| 0 -> [Parameter] arg - -#-----| (Parameters) -#-----| 0 -> [Parameter] arg - -#-----| (Parameters) -#-----| 0 -> [Parameter] i - -#-----| (Parameters) -#-----| 0 -> [Parameter] s - -#-----| (Parameters) -#-----| 0 -> [Parameter] i - -#-----| (Parameters) -#-----| 0 -> [Parameter] value - -#-----| (Parameters) -#-----| 0 -> [Parameter] rgb - -#-----| (Parameters) -#-----| 0 -> [Parameter] value - -#-----| (Parameters) -#-----| 0 -> [Parameter] b - -#-----| (Parameters) -#-----| 0 -> [Parameter] p - -#-----| (Parameters) -#-----| 0 -> [Parameter] p - -#-----| (Parameters) -#-----| 0 -> [Parameter] p - -#-----| (Parameters) -#-----| 0 -> [Parameter] p - -#-----| (Parameters) -#-----| 0 -> [Parameter] p - -#-----| (Parameters) -#-----| 0 -> [Parameter] p - -#-----| (Parameters) -#-----| 0 -> [Parameter] t - -#-----| (Parameters) -#-----| 0 -> [Parameter] s - -#-----| (Parameters) -#-----| 0 -> [Parameter] i - -#-----| (Parameters) -#-----| 0 -> [Parameter] a -#-----| 1 -> [Parameter] b - -#-----| (Parameters) -#-----| 0 -> [Parameter] a -#-----| 1 -> [Parameter] b - -#-----| (Parameters) -#-----| 0 -> [Parameter] a0 - -#-----| (Parameters) -#-----| 0 -> [Parameter] - -#-----| (Parameters) -#-----| 0 -> [Parameter] - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T1 - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T1 - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T1 - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T1 -#-----| 1 -> [TypeVariable] T2 - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T3 -#-----| 1 -> [TypeVariable] T4 - -#-----| (Generic Parameters) -#-----| 0 -> [TypeVariable] T5 -#-----| 1 -> [TypeVariable] T6 - classes.kt: # 0| [CompilationUnit] classes -#-----| 1 -> [Class] ClassesKt -#-----| 2 -> [Class] ClassOne -#-----| 3 -> [Class] ClassTwo -#-----| 4 -> [Class] ClassThree -#-----| 5 -> [Class] ClassFour -#-----| 6 -> [Class] ClassFive -#-----| 7 -> [Interface] IF1 -#-----| 8 -> [Interface] IF2 -#-----| 9 -> [Class] ClassSix -#-----| 10 -> [Class] ClassSeven -#-----| 11 -> [Class] Direction -#-----| 12 -> [Class] Color -#-----| 13 -> [Interface] Interface1 -#-----| 14 -> [Interface] Interface2 -#-----| 15 -> [GenericType,Interface,ParameterizedType] Interface3 -#-----| 16 -> [Class] Class1 -#-----| 17 -> [Class] pulicClass -#-----| 18 -> [Class] privateClass -#-----| 19 -> [Class] internalClass -#-----| 20 -> [Class] noExplicitVisibilityClass -#-----| 21 -> [Class] nestedClassVisibilities -#-----| 22 -> [Class] sealedClass -#-----| 23 -> [Class] openClass -#-----| 24 -> [Class] C1 - +# 0| 1: [Class] ClassesKt +# 32| 1: [Method] f +# 32| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 32| 0: [Parameter] s +# 32| 0: [TypeAccess] String +# 32| 5: [BlockStmt] { ... } +# 2| 2: [Class] ClassOne +# 2| 1: [Constructor] ClassOne +# 2| 5: [BlockStmt] { ... } +# 2| 0: [SuperConstructorInvocationStmt] super(...) +# 2| 1: [BlockStmt] { ... } +# 4| 3: [Class] ClassTwo +# 4| 1: [Constructor] ClassTwo +#-----| 4: (Parameters) +# 4| 0: [Parameter] arg +# 4| 0: [TypeAccess] int +# 4| 5: [BlockStmt] { ... } +# 4| 0: [SuperConstructorInvocationStmt] super(...) +# 4| 1: [BlockStmt] { ... } +# 4| 0: [ExprStmt] ; +# 4| 0: [KtInitializerAssignExpr] ...=... +# 4| 0: [VarAccess] arg +# 5| 1: [ExprStmt] ; +# 5| 0: [KtInitializerAssignExpr] ...=... +# 5| 0: [VarAccess] x +# 4| 2: [Method] getArg +# 4| 3: [TypeAccess] int +# 4| 5: [BlockStmt] { ... } +# 4| 0: [ReturnStmt] return ... +# 4| 0: [VarAccess] this.arg +# 4| -1: [ThisAccess] this +# 4| 2: [FieldDeclaration] int arg; +# 4| -1: [TypeAccess] int +# 4| 0: [VarAccess] arg +# 5| 4: [Method] getX +# 5| 3: [TypeAccess] int +# 5| 5: [BlockStmt] { ... } +# 5| 0: [ReturnStmt] return ... +# 5| 0: [VarAccess] this.x +# 5| -1: [ThisAccess] this +# 5| 4: [FieldDeclaration] int x; +# 5| -1: [TypeAccess] int +# 5| 0: [IntegerLiteral] 3 +# 8| 4: [Class] ClassThree +# 8| 1: [Constructor] ClassThree +# 8| 5: [BlockStmt] { ... } +# 8| 0: [SuperConstructorInvocationStmt] super(...) +# 8| 1: [BlockStmt] { ... } +# 9| 2: [Method] foo +# 9| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 9| 0: [Parameter] arg +# 9| 0: [TypeAccess] int +# 12| 5: [Class] ClassFour +# 12| 1: [Constructor] ClassFour +# 12| 5: [BlockStmt] { ... } +# 12| 0: [SuperConstructorInvocationStmt] super(...) +# 12| 1: [BlockStmt] { ... } +# 13| 2: [Method] foo +# 13| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 13| 0: [Parameter] arg +# 13| 0: [TypeAccess] int +# 13| 5: [BlockStmt] { ... } +# 17| 6: [Class] ClassFive +# 17| 1: [Constructor] ClassFive +# 17| 5: [BlockStmt] { ... } +# 17| 0: [SuperConstructorInvocationStmt] super(...) +# 17| 1: [BlockStmt] { ... } +# 20| 7: [Interface] IF1 +# 21| 1: [Method] funIF1 +# 21| 3: [TypeAccess] Unit +# 21| 5: [BlockStmt] { ... } +# 24| 8: [Interface] IF2 +# 25| 1: [Method] funIF2 +# 25| 3: [TypeAccess] Unit +# 25| 5: [BlockStmt] { ... } +# 28| 9: [Class] ClassSix +# 28| 1: [Constructor] ClassSix +# 28| 5: [BlockStmt] { ... } +# 28| 0: [SuperConstructorInvocationStmt] super(...) +# 28| 1: [BlockStmt] { ... } +# 29| 2: [Constructor] ClassSix +#-----| 4: (Parameters) +# 29| 0: [Parameter] i +# 29| 0: [TypeAccess] int +# 29| 5: [BlockStmt] { ... } +# 29| 0: [ThisConstructorInvocationStmt] this(...) +# 34| 10: [Class] ClassSeven +# 35| 1: [Constructor] ClassSeven +#-----| 4: (Parameters) +# 35| 0: [Parameter] i +# 35| 0: [TypeAccess] String +# 35| 5: [BlockStmt] { ... } +# 35| 0: [SuperConstructorInvocationStmt] super(...) +# 35| 1: [BlockStmt] { ... } +# 39| 0: [ExprStmt] ; +# 39| 0: [MethodAccess] f(...) +# 39| -1: [TypeAccess] ClassesKt +# 39| 0: [StringLiteral] init1 +# 42| 1: [ExprStmt] ; +# 42| 0: [KtInitializerAssignExpr] ...=... +# 42| 0: [VarAccess] x +# 45| 2: [ExprStmt] ; +# 45| 0: [MethodAccess] f(...) +# 45| -1: [TypeAccess] ClassesKt +# 45| 0: [StringLiteral] init2 +# 36| 2: [ExprStmt] ; +# 36| 0: [MethodAccess] f(...) +# 36| -1: [TypeAccess] ClassesKt +# 36| 0: [VarAccess] i +# 42| 2: [Method] getX +# 42| 3: [TypeAccess] int +# 42| 5: [BlockStmt] { ... } +# 42| 0: [ReturnStmt] return ... +# 42| 0: [VarAccess] this.x +# 42| -1: [ThisAccess] this +# 42| 2: [FieldDeclaration] int x; +# 42| -1: [TypeAccess] int +# 42| 0: [IntegerLiteral] 3 +# 49| 11: [Class] Direction +# 0| 1: [Method] values +# 0| 3: [TypeAccess] Direction[] +# 0| 0: [TypeAccess] Direction +# 0| 1: [Method] valueOf +# 0| 3: [TypeAccess] Direction +#-----| 4: (Parameters) +# 0| 0: [Parameter] value +# 0| 0: [TypeAccess] String +# 49| 4: [Constructor] Direction +# 49| 5: [BlockStmt] { ... } +# 49| 0: [ExprStmt] ; +# 49| 0: [ClassInstanceExpr] new Enum(...) +# 49| -3: [TypeAccess] Unit +# 49| 0: [TypeAccess] Direction +# 49| 1: [BlockStmt] { ... } +# 50| 5: [FieldDeclaration] Direction NORTH; +# 50| -1: [TypeAccess] Direction +# 50| 0: [ClassInstanceExpr] new Direction(...) +# 50| -3: [TypeAccess] Direction +# 50| 6: [FieldDeclaration] Direction SOUTH; +# 50| -1: [TypeAccess] Direction +# 50| 0: [ClassInstanceExpr] new Direction(...) +# 50| -3: [TypeAccess] Direction +# 50| 7: [FieldDeclaration] Direction WEST; +# 50| -1: [TypeAccess] Direction +# 50| 0: [ClassInstanceExpr] new Direction(...) +# 50| -3: [TypeAccess] Direction +# 50| 8: [FieldDeclaration] Direction EAST; +# 50| -1: [TypeAccess] Direction +# 50| 0: [ClassInstanceExpr] new Direction(...) +# 50| -3: [TypeAccess] Direction +# 53| 12: [Class] Color +# 0| 1: [Method] values +# 0| 3: [TypeAccess] Color[] +# 0| 0: [TypeAccess] Color +# 0| 1: [Method] valueOf +# 0| 3: [TypeAccess] Color +#-----| 4: (Parameters) +# 0| 0: [Parameter] value +# 0| 0: [TypeAccess] String +# 53| 4: [Constructor] Color +#-----| 4: (Parameters) +# 53| 0: [Parameter] rgb +# 53| 0: [TypeAccess] int +# 53| 5: [BlockStmt] { ... } +# 53| 0: [ExprStmt] ; +# 53| 0: [ClassInstanceExpr] new Enum(...) +# 53| -3: [TypeAccess] Unit +# 53| 0: [TypeAccess] Color +# 53| 1: [BlockStmt] { ... } +# 53| 0: [ExprStmt] ; +# 53| 0: [KtInitializerAssignExpr] ...=... +# 53| 0: [VarAccess] rgb +# 53| 5: [Method] getRgb +# 53| 3: [TypeAccess] int +# 53| 5: [BlockStmt] { ... } +# 53| 0: [ReturnStmt] return ... +# 53| 0: [VarAccess] this.rgb +# 53| -1: [ThisAccess] this +# 53| 5: [FieldDeclaration] int rgb; +# 53| -1: [TypeAccess] int +# 53| 0: [VarAccess] rgb +# 54| 7: [FieldDeclaration] Color RED; +# 54| -1: [TypeAccess] Color +# 54| 0: [ClassInstanceExpr] new Color(...) +# 54| -3: [TypeAccess] Color +# 54| 0: [IntegerLiteral] 16711680 +# 55| 8: [FieldDeclaration] Color GREEN; +# 55| -1: [TypeAccess] Color +# 55| 0: [ClassInstanceExpr] new Color(...) +# 55| -3: [TypeAccess] Color +# 55| 0: [IntegerLiteral] 65280 +# 56| 9: [FieldDeclaration] Color BLUE; +# 56| -1: [TypeAccess] Color +# 56| 0: [ClassInstanceExpr] new Color(...) +# 56| -3: [TypeAccess] Color +# 56| 0: [IntegerLiteral] 255 +# 59| 13: [Interface] Interface1 +# 60| 14: [Interface] Interface2 +# 61| 15: [GenericType,Interface,ParameterizedType] Interface3 +#-----| -2: (Generic Parameters) +# 61| 0: [TypeVariable] T +# 63| 16: [Class] Class1 +# 63| 1: [Constructor] Class1 +# 63| 5: [BlockStmt] { ... } +# 63| 0: [SuperConstructorInvocationStmt] super(...) +# 63| 1: [BlockStmt] { ... } +# 64| 2: [Method] getObject1 +# 64| 3: [TypeAccess] Object +#-----| 4: (Parameters) +# 64| 0: [Parameter] b +# 64| 0: [TypeAccess] boolean +# 64| 5: [BlockStmt] { ... } +# 65| 0: [ExprStmt] ; +# 65| 0: [WhenExpr] when ... +# 65| 0: [WhenBranch] ... -> ... +# 65| 0: [VarAccess] b +# 66| 1: [ReturnStmt] return ... +# 66| 0: [StmtExpr] +# 66| 0: [BlockStmt] { ... } +# 66| 0: [LocalTypeDeclStmt] class ... +# 66| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 66| 1: [Constructor] +# 66| 5: [BlockStmt] { ... } +# 66| 0: [SuperConstructorInvocationStmt] super(...) +# 66| 1: [BlockStmt] { ... } +# 66| 1: [ExprStmt] ; +# 66| 0: [ClassInstanceExpr] new (...) +# 66| -3: [TypeAccess] Object +# 65| 1: [WhenBranch] ... -> ... +# 65| 0: [BooleanLiteral] true +# 68| 1: [ReturnStmt] return ... +# 68| 0: [StmtExpr] +# 68| 0: [BlockStmt] { ... } +# 68| 0: [LocalTypeDeclStmt] class ... +# 68| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 68| 1: [Constructor] +# 68| 5: [BlockStmt] { ... } +# 68| 0: [SuperConstructorInvocationStmt] super(...) +# 68| 1: [BlockStmt] { ... } +# 68| 1: [ExprStmt] ; +# 68| 0: [ClassInstanceExpr] new (...) +# 68| -3: [TypeAccess] Object +# 71| 3: [Method] getObject2 +# 71| 3: [TypeAccess] Interface1 +# 71| 5: [BlockStmt] { ... } +# 72| 0: [ReturnStmt] return ... +# 72| 0: [StmtExpr] +# 72| 0: [BlockStmt] { ... } +# 72| 0: [LocalTypeDeclStmt] class ... +# 72| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 72| 1: [Constructor] +# 72| 5: [BlockStmt] { ... } +# 72| 0: [SuperConstructorInvocationStmt] super(...) +# 72| 1: [BlockStmt] { ... } +# 73| 0: [ExprStmt] ; +# 73| 0: [KtInitializerAssignExpr] ...=... +# 73| 0: [VarAccess] x +# 73| 2: [Method] getX +# 73| 3: [TypeAccess] int +# 73| 5: [BlockStmt] { ... } +# 73| 0: [ReturnStmt] return ... +# 73| 0: [VarAccess] this.x +# 73| -1: [ThisAccess] this +# 73| 2: [FieldDeclaration] int x; +# 73| -1: [TypeAccess] int +# 73| 0: [IntegerLiteral] 1 +# 74| 4: [Method] foo +# 74| 3: [TypeAccess] Object +# 74| 5: [BlockStmt] { ... } +# 75| 0: [ReturnStmt] return ... +# 75| 0: [StmtExpr] +# 75| 0: [BlockStmt] { ... } +# 75| 0: [LocalTypeDeclStmt] class ... +# 75| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 75| 1: [Constructor] +# 75| 5: [BlockStmt] { ... } +# 75| 0: [SuperConstructorInvocationStmt] super(...) +# 75| 1: [BlockStmt] { ... } +# 75| 1: [ExprStmt] ; +# 75| 0: [ClassInstanceExpr] new (...) +# 75| -3: [TypeAccess] Object +# 72| 1: [ExprStmt] ; +# 72| 0: [ClassInstanceExpr] new (...) +# 72| -3: [TypeAccess] Object +# 80| 4: [Method] getObject3 +# 80| 3: [TypeAccess] Object +# 80| 5: [BlockStmt] { ... } +# 81| 0: [ReturnStmt] return ... +# 81| 0: [StmtExpr] +# 81| 0: [BlockStmt] { ... } +# 81| 0: [LocalTypeDeclStmt] class ... +# 81| 0: [AnonymousClass,LocalClass] new Interface1(...) { ... } +# 81| 1: [Constructor] +# 81| 5: [BlockStmt] { ... } +# 81| 0: [SuperConstructorInvocationStmt] super(...) +# 81| 1: [BlockStmt] { ... } +# 81| 1: [ExprStmt] ; +# 81| 0: [ClassInstanceExpr] new (...) +# 81| -3: [TypeAccess] Interface1 +# 84| 5: [Method] getObject4 +# 84| 3: [TypeAccess] Object +# 84| 5: [BlockStmt] { ... } +# 85| 0: [ReturnStmt] return ... +# 85| 0: [StmtExpr] +# 85| 0: [BlockStmt] { ... } +# 85| 0: [LocalTypeDeclStmt] class ... +# 85| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 85| 1: [Constructor] +# 85| 5: [BlockStmt] { ... } +# 85| 0: [SuperConstructorInvocationStmt] super(...) +# 85| 1: [BlockStmt] { ... } +# 85| 1: [ExprStmt] ; +# 85| 0: [ClassInstanceExpr] new (...) +# 85| -3: [TypeAccess] Object +# 88| 6: [Method] getObject5 +# 88| 3: [TypeAccess] Object +# 88| 5: [BlockStmt] { ... } +# 89| 0: [ReturnStmt] return ... +# 89| 0: [StmtExpr] +# 89| 0: [BlockStmt] { ... } +# 89| 0: [LocalTypeDeclStmt] class ... +# 89| 0: [AnonymousClass,LocalClass] new Interface3(...) { ... } +# 89| 1: [Constructor] +# 89| 5: [BlockStmt] { ... } +# 89| 0: [SuperConstructorInvocationStmt] super(...) +# 89| 1: [BlockStmt] { ... } +# 89| 1: [ExprStmt] ; +# 89| 0: [ClassInstanceExpr] new (...) +# 89| -3: [TypeAccess] Interface3 +# 93| 17: [Class] pulicClass +# 93| 1: [Constructor] pulicClass +# 93| 5: [BlockStmt] { ... } +# 93| 0: [SuperConstructorInvocationStmt] super(...) +# 93| 1: [BlockStmt] { ... } +# 94| 18: [Class] privateClass +# 94| 1: [Constructor] privateClass +# 94| 5: [BlockStmt] { ... } +# 94| 0: [SuperConstructorInvocationStmt] super(...) +# 94| 1: [BlockStmt] { ... } +# 95| 19: [Class] internalClass +# 95| 1: [Constructor] internalClass +# 95| 5: [BlockStmt] { ... } +# 95| 0: [SuperConstructorInvocationStmt] super(...) +# 95| 1: [BlockStmt] { ... } +# 96| 20: [Class] noExplicitVisibilityClass +# 96| 1: [Constructor] noExplicitVisibilityClass +# 96| 5: [BlockStmt] { ... } +# 96| 0: [SuperConstructorInvocationStmt] super(...) +# 96| 1: [BlockStmt] { ... } +# 98| 21: [Class] nestedClassVisibilities +# 98| 1: [Constructor] nestedClassVisibilities +# 98| 5: [BlockStmt] { ... } +# 98| 0: [SuperConstructorInvocationStmt] super(...) +# 98| 1: [BlockStmt] { ... } +# 99| 2: [Class] pulicNestedClass +# 99| 1: [Constructor] pulicNestedClass +# 99| 5: [BlockStmt] { ... } +# 99| 0: [SuperConstructorInvocationStmt] super(...) +# 99| 1: [BlockStmt] { ... } +# 100| 3: [Class] protectedNestedClass +# 100| 1: [Constructor] protectedNestedClass +# 100| 5: [BlockStmt] { ... } +# 100| 0: [SuperConstructorInvocationStmt] super(...) +# 100| 1: [BlockStmt] { ... } +# 101| 4: [Class] privateNestedClass +# 101| 1: [Constructor] privateNestedClass +# 101| 5: [BlockStmt] { ... } +# 101| 0: [SuperConstructorInvocationStmt] super(...) +# 101| 1: [BlockStmt] { ... } +# 102| 5: [Class] internalNestedClass +# 102| 1: [Constructor] internalNestedClass +# 102| 5: [BlockStmt] { ... } +# 102| 0: [SuperConstructorInvocationStmt] super(...) +# 102| 1: [BlockStmt] { ... } +# 103| 6: [Class] noExplicitVisibilityNestedClass +# 103| 1: [Constructor] noExplicitVisibilityNestedClass +# 103| 5: [BlockStmt] { ... } +# 103| 0: [SuperConstructorInvocationStmt] super(...) +# 103| 1: [BlockStmt] { ... } +# 106| 22: [Class] sealedClass +# 106| 1: [Constructor] sealedClass +# 106| 5: [BlockStmt] { ... } +# 106| 0: [SuperConstructorInvocationStmt] super(...) +# 106| 1: [BlockStmt] { ... } +# 107| 23: [Class] openClass +# 107| 1: [Constructor] openClass +# 107| 5: [BlockStmt] { ... } +# 107| 0: [SuperConstructorInvocationStmt] super(...) +# 107| 1: [BlockStmt] { ... } +# 109| 24: [Class] C1 +# 109| 1: [Constructor] C1 +# 109| 5: [BlockStmt] { ... } +# 109| 0: [SuperConstructorInvocationStmt] super(...) +# 109| 1: [BlockStmt] { ... } +# 110| 2: [Method] fn1 +# 110| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 110| 0: [Parameter] p +# 110| 0: [TypeAccess] int +# 110| 5: [BlockStmt] { ... } +# 111| 0: [LocalTypeDeclStmt] class ... +# 111| 0: [Class,GenericType,LocalClass,ParameterizedType] Local1 +#-----| -2: (Generic Parameters) +# 111| 0: [TypeVariable] T1 +# 111| 1: [Constructor] Local1 +# 111| 5: [BlockStmt] { ... } +# 111| 0: [SuperConstructorInvocationStmt] super(...) +# 111| 1: [BlockStmt] { ... } +# 112| 2: [Method] foo +# 112| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 112| 0: [Parameter] p +# 112| 0: [TypeAccess] int +# 112| 5: [BlockStmt] { ... } +# 114| 1: [ExprStmt] ; +# 114| 0: [MethodAccess] foo(...) +# 114| -1: [ClassInstanceExpr] new Local1(...) +# 114| -3: [TypeAccess] Local1 +# 114| 0: [TypeAccess] Integer +# 114| 0: [VarAccess] p +# 117| 3: [Method] fn2 +# 117| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 117| 0: [Parameter] p +# 117| 0: [TypeAccess] int +# 117| 5: [BlockStmt] { ... } +# 118| 0: [LocalTypeDeclStmt] class ... +# 118| 0: [LocalClass] +# 118| 1: [Constructor] +# 118| 5: [BlockStmt] { ... } +# 118| 0: [SuperConstructorInvocationStmt] super(...) +# 118| 1: [Method] localFn +# 118| 3: [TypeAccess] Unit +# 118| 5: [BlockStmt] { ... } +# 119| 0: [LocalTypeDeclStmt] class ... +# 119| 0: [Class,GenericType,LocalClass,ParameterizedType] Local2 +#-----| -2: (Generic Parameters) +# 119| 0: [TypeVariable] T1 +# 119| 1: [Constructor] Local2 +# 119| 5: [BlockStmt] { ... } +# 119| 0: [SuperConstructorInvocationStmt] super(...) +# 119| 1: [BlockStmt] { ... } +# 120| 2: [Method] foo +# 120| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 120| 0: [Parameter] p +# 120| 0: [TypeAccess] int +# 120| 5: [BlockStmt] { ... } +# 122| 1: [ExprStmt] ; +# 122| 0: [MethodAccess] foo(...) +# 122| -1: [ClassInstanceExpr] new Local2(...) +# 122| -3: [TypeAccess] Local2 +# 122| 0: [TypeAccess] Integer +# 122| 0: [VarAccess] p +# 126| 4: [Method] fn3 +# 126| 3: [TypeAccess] Object +#-----| 4: (Parameters) +# 126| 0: [Parameter] p +# 126| 0: [TypeAccess] int +# 126| 5: [BlockStmt] { ... } +# 127| 0: [ReturnStmt] return ... +# 127| 0: [StmtExpr] +# 127| 0: [BlockStmt] { ... } +# 127| 0: [LocalTypeDeclStmt] class ... +# 127| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 127| 1: [Constructor] +# 127| 5: [BlockStmt] { ... } +# 127| 0: [SuperConstructorInvocationStmt] super(...) +# 127| 1: [BlockStmt] { ... } +# 128| 2: [Method] fn +# 128| 3: [TypeAccess] Unit +# 128| 5: [BlockStmt] { ... } +# 129| 0: [LocalTypeDeclStmt] class ... +# 129| 0: [Class,GenericType,LocalClass,ParameterizedType] Local3 +#-----| -2: (Generic Parameters) +# 129| 0: [TypeVariable] T1 +# 129| 1: [Constructor] Local3 +# 129| 5: [BlockStmt] { ... } +# 129| 0: [SuperConstructorInvocationStmt] super(...) +# 129| 1: [BlockStmt] { ... } +# 130| 2: [Method] foo +# 130| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 130| 0: [Parameter] p +# 130| 0: [TypeAccess] int +# 130| 5: [BlockStmt] { ... } +# 132| 1: [ExprStmt] ; +# 132| 0: [MethodAccess] foo(...) +# 132| -1: [ClassInstanceExpr] new Local3(...) +# 132| -3: [TypeAccess] Local3 +# 132| 0: [TypeAccess] Integer +# 132| 0: [VarAccess] p +# 127| 1: [ExprStmt] ; +# 127| 0: [ClassInstanceExpr] new (...) +# 127| -3: [TypeAccess] Object generic_anonymous.kt: # 0| [CompilationUnit] generic_anonymous -#-----| 1 -> [Class] Generic_anonymousKt -#-----| 2 -> [Class,GenericType,ParameterizedType] Generic - +# 0| 1: [Class] Generic_anonymousKt +# 11| 1: [Method] stringIdentity +# 11| 3: [TypeAccess] String +#-----| 4: (Parameters) +# 11| 0: [Parameter] s +# 11| 0: [TypeAccess] String +# 11| 5: [BlockStmt] { ... } +# 11| 0: [ReturnStmt] return ... +# 11| 0: [MethodAccess] get(...) +# 11| -1: [ClassInstanceExpr] new Generic(...) +# 11| -3: [TypeAccess] Generic +# 11| 0: [TypeAccess] String +# 11| 0: [VarAccess] s +# 13| 2: [Method] intIdentity +# 13| 3: [TypeAccess] int +#-----| 4: (Parameters) +# 13| 0: [Parameter] i +# 13| 0: [TypeAccess] int +# 13| 5: [BlockStmt] { ... } +# 13| 0: [ReturnStmt] return ... +# 13| 0: [MethodAccess] get(...) +# 13| -1: [ClassInstanceExpr] new Generic(...) +# 13| -3: [TypeAccess] Generic +# 13| 0: [TypeAccess] Integer +# 13| 0: [VarAccess] i +# 1| 2: [Class,GenericType,ParameterizedType] Generic +#-----| -2: (Generic Parameters) +# 1| 0: [TypeVariable] T +# 1| 1: [Constructor] Generic +#-----| 4: (Parameters) +# 1| 0: [Parameter] t +# 1| 0: [TypeAccess] T +# 1| 5: [BlockStmt] { ... } +# 1| 0: [SuperConstructorInvocationStmt] super(...) +# 1| 1: [BlockStmt] { ... } +# 1| 0: [ExprStmt] ; +# 1| 0: [KtInitializerAssignExpr] ...=... +# 1| 0: [VarAccess] t +# 3| 1: [ExprStmt] ; +# 3| 0: [KtInitializerAssignExpr] ...=... +# 3| 0: [VarAccess] x +# 1| 2: [Method] getT +# 1| 3: [TypeAccess] T +# 1| 5: [BlockStmt] { ... } +# 1| 0: [ReturnStmt] return ... +# 1| 0: [VarAccess] this.t +# 1| -1: [ThisAccess] this +# 1| 2: [FieldDeclaration] T t; +# 1| -1: [TypeAccess] T +# 1| 0: [VarAccess] t +# 3| 4: [FieldDeclaration] new Object(...) { ... } x; +# 3| -1: [TypeAccess] new Object(...) { ... } +# 3| 0: [TypeAccess] T +# 3| 0: [StmtExpr] +# 3| 0: [BlockStmt] { ... } +# 3| 0: [LocalTypeDeclStmt] class ... +# 3| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 3| 1: [Constructor] +# 3| 5: [BlockStmt] { ... } +# 3| 0: [SuperConstructorInvocationStmt] super(...) +# 3| 1: [BlockStmt] { ... } +# 4| 0: [ExprStmt] ; +# 4| 0: [KtInitializerAssignExpr] ...=... +# 4| 0: [VarAccess] member +# 4| 2: [Method] getMember +# 4| 3: [TypeAccess] T +# 4| 5: [BlockStmt] { ... } +# 4| 0: [ReturnStmt] return ... +# 4| 0: [VarAccess] this.member +# 4| -1: [ThisAccess] this +# 4| 2: [FieldDeclaration] T member; +# 4| -1: [TypeAccess] T +# 4| 0: [MethodAccess] getT(...) +# 4| -1: [ThisAccess] Generic.this +# 4| 0: [TypeAccess] Generic +# 3| 1: [ExprStmt] ; +# 3| 0: [ClassInstanceExpr] new (...) +# 3| -3: [TypeAccess] Object +# 3| 5: [Method] getX +# 3| 3: [TypeAccess] new Object(...) { ... } +# 3| 0: [TypeAccess] T +# 3| 5: [BlockStmt] { ... } +# 3| 0: [ReturnStmt] return ... +# 3| 0: [VarAccess] this.x +# 3| -1: [ThisAccess] this +# 7| 6: [Method] get +# 7| 3: [TypeAccess] T +# 7| 5: [BlockStmt] { ... } +# 7| 0: [ReturnStmt] return ... +# 7| 0: [MethodAccess] getMember(...) +# 7| -1: [MethodAccess] getX(...) +# 7| -1: [ThisAccess] this localClassField.kt: # 0| [CompilationUnit] localClassField -#-----| 1 -> [Class] A - +# 1| 1: [Class] A +# 1| 1: [Constructor] A +# 1| 5: [BlockStmt] { ... } +# 1| 0: [SuperConstructorInvocationStmt] super(...) +# 1| 1: [BlockStmt] { ... } +# 2| 0: [ExprStmt] ; +# 2| 0: [KtInitializerAssignExpr] ...=... +# 2| 0: [VarAccess] x +# 7| 1: [ExprStmt] ; +# 7| 0: [KtInitializerAssignExpr] ...=... +# 7| 0: [VarAccess] y +# 2| 2: [Method] getX +# 2| 3: [TypeAccess] Object +# 2| 5: [BlockStmt] { ... } +# 2| 0: [ReturnStmt] return ... +# 2| 0: [VarAccess] this.x +# 2| -1: [ThisAccess] this +# 2| 2: [FieldDeclaration] Object x; +# 2| -1: [TypeAccess] Object +# 2| 0: [WhenExpr] when ... +# 2| 0: [WhenBranch] ... -> ... +# 2| 0: [BooleanLiteral] true +# 2| 1: [BlockStmt] { ... } +# 3| 0: [LocalTypeDeclStmt] class ... +# 3| 0: [LocalClass] L +# 3| 1: [Constructor] L +# 3| 5: [BlockStmt] { ... } +# 3| 0: [SuperConstructorInvocationStmt] super(...) +# 3| 1: [BlockStmt] { ... } +# 4| 1: [ExprStmt] ; +# 4| 0: [ClassInstanceExpr] new L(...) +# 4| -3: [TypeAccess] L +# 2| 1: [WhenBranch] ... -> ... +# 2| 0: [BooleanLiteral] true +# 5| 1: [BlockStmt] { ... } +# 7| 4: [Method] getY +# 7| 3: [TypeAccess] Object +# 7| 5: [BlockStmt] { ... } +# 7| 0: [ReturnStmt] return ... +# 7| 0: [VarAccess] this.y +# 7| -1: [ThisAccess] this +# 7| 4: [FieldDeclaration] Object y; +# 7| -1: [TypeAccess] Object +# 7| 0: [WhenExpr] when ... +# 7| 0: [WhenBranch] ... -> ... +# 7| 0: [BooleanLiteral] true +# 7| 1: [BlockStmt] { ... } +# 8| 0: [LocalTypeDeclStmt] class ... +# 8| 0: [LocalClass] L +# 8| 1: [Constructor] L +# 8| 5: [BlockStmt] { ... } +# 8| 0: [SuperConstructorInvocationStmt] super(...) +# 8| 1: [BlockStmt] { ... } +# 9| 1: [ExprStmt] ; +# 9| 0: [ClassInstanceExpr] new L(...) +# 9| -3: [TypeAccess] L +# 7| 1: [WhenBranch] ... -> ... +# 7| 0: [BooleanLiteral] true +# 10| 1: [BlockStmt] { ... } local_anonymous.kt: # 0| [CompilationUnit] local_anonymous -#-----| 1 -> [Class] Class1 -#-----| 2 -> [Interface] Interface2 -#-----| 3 -> [Class] Class2 - +# 3| 1: [Class] Class1 +# 3| 1: [Constructor] Class1 +# 3| 5: [BlockStmt] { ... } +# 3| 0: [SuperConstructorInvocationStmt] super(...) +# 3| 1: [BlockStmt] { ... } +# 4| 2: [Method] fn1 +# 4| 3: [TypeAccess] Object +# 4| 5: [BlockStmt] { ... } +# 5| 0: [ReturnStmt] return ... +# 5| 0: [StmtExpr] +# 5| 0: [BlockStmt] { ... } +# 5| 0: [LocalTypeDeclStmt] class ... +# 5| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 5| 1: [Constructor] +# 5| 5: [BlockStmt] { ... } +# 5| 0: [SuperConstructorInvocationStmt] super(...) +# 5| 1: [BlockStmt] { ... } +# 6| 2: [Method] fn +# 6| 3: [TypeAccess] Unit +# 6| 5: [BlockStmt] { ... } +# 5| 1: [ExprStmt] ; +# 5| 0: [ClassInstanceExpr] new (...) +# 5| -3: [TypeAccess] Object +# 10| 3: [Method] fn2 +# 10| 3: [TypeAccess] Unit +# 10| 5: [BlockStmt] { ... } +# 11| 0: [LocalTypeDeclStmt] class ... +# 11| 0: [LocalClass] +# 11| 1: [Constructor] +# 11| 5: [BlockStmt] { ... } +# 11| 0: [SuperConstructorInvocationStmt] super(...) +# 11| 1: [Method] fnLocal +# 11| 3: [TypeAccess] Unit +# 11| 5: [BlockStmt] { ... } +# 12| 1: [ExprStmt] ; +# 12| 0: [MethodAccess] fnLocal(...) +# 12| -1: [ClassInstanceExpr] new (...) +# 12| -3: [TypeAccess] Object +# 15| 4: [Method] fn3 +# 15| 3: [TypeAccess] Unit +# 15| 5: [BlockStmt] { ... } +# 16| 0: [LocalVariableDeclStmt] var ...; +# 16| 1: [LocalVariableDeclExpr] lambda1 +# 16| 0: [LambdaExpr] ...->... +# 16| -4: [AnonymousClass] new Function2(...) { ... } +# 16| 1: [Constructor] +# 16| 5: [BlockStmt] { ... } +# 16| 0: [SuperConstructorInvocationStmt] super(...) +# 16| 1: [Method] invoke +# 16| 3: [TypeAccess] int +#-----| 4: (Parameters) +# 16| 0: [Parameter] a +# 16| 0: [TypeAccess] int +# 16| 1: [Parameter] b +# 16| 0: [TypeAccess] int +# 16| 5: [BlockStmt] { ... } +# 16| 0: [ReturnStmt] return ... +# 16| 0: [AddExpr] ... + ... +# 16| 0: [VarAccess] a +# 16| 1: [VarAccess] b +# 16| -3: [TypeAccess] Function2 +# 16| 0: [TypeAccess] Integer +# 16| 1: [TypeAccess] Integer +# 16| 2: [TypeAccess] Integer +# 17| 1: [LocalVariableDeclStmt] var ...; +# 17| 1: [LocalVariableDeclExpr] lambda2 +# 17| 0: [LambdaExpr] ...->... +# 17| -4: [AnonymousClass] new Function2(...) { ... } +# 17| 1: [Constructor] +# 17| 5: [BlockStmt] { ... } +# 17| 0: [SuperConstructorInvocationStmt] super(...) +# 17| 1: [Method] invoke +# 17| 3: [TypeAccess] int +#-----| 4: (Parameters) +# 17| 0: [Parameter] a +# 17| 0: [TypeAccess] int +# 17| 1: [Parameter] b +# 17| 0: [TypeAccess] int +# 17| 5: [BlockStmt] { ... } +# 17| 0: [ReturnStmt] return ... +# 17| 0: [AddExpr] ... + ... +# 17| 0: [VarAccess] a +# 17| 1: [VarAccess] b +# 17| -3: [TypeAccess] Function2 +# 17| 0: [TypeAccess] Integer +# 17| 1: [TypeAccess] Integer +# 17| 2: [TypeAccess] Integer +# 20| 5: [Method] fn4 +# 20| 3: [TypeAccess] Unit +# 20| 5: [BlockStmt] { ... } +# 21| 0: [LocalVariableDeclStmt] var ...; +# 21| 1: [LocalVariableDeclExpr] fnRef +# 21| 0: [MemberRefExpr] ...::... +# 21| -4: [AnonymousClass] new Function1(...) { ... } +# 21| 1: [Constructor] +# 21| 5: [BlockStmt] { ... } +# 21| 0: [SuperConstructorInvocationStmt] super(...) +# 21| 1: [Method] invoke +#-----| 4: (Parameters) +# 21| 0: [Parameter] a0 +# 21| 5: [BlockStmt] { ... } +# 21| 0: [ReturnStmt] return ... +# 21| 0: [MethodAccess] fn3(...) +# 21| -1: [VarAccess] a0 +# 21| -3: [TypeAccess] Function1 +# 21| 0: [TypeAccess] Class1 +# 21| 1: [TypeAccess] Unit +# 24| 6: [Method] fn5 +# 24| 3: [TypeAccess] Unit +# 24| 5: [BlockStmt] { ... } +# 25| 0: [LocalTypeDeclStmt] class ... +# 25| 0: [LocalClass] LocalClass +# 25| 1: [Constructor] LocalClass +# 25| 5: [BlockStmt] { ... } +# 25| 0: [SuperConstructorInvocationStmt] super(...) +# 25| 1: [BlockStmt] { ... } +# 26| 1: [ExprStmt] ; +# 26| 0: [ImplicitCoercionToUnitExpr] +# 26| 0: [TypeAccess] Unit +# 26| 1: [ClassInstanceExpr] new LocalClass(...) +# 26| -3: [TypeAccess] LocalClass +# 29| 7: [Method] nullableAnonymous +# 29| 3: [TypeAccess] Object +# 29| 5: [BlockStmt] { ... } +# 35| 0: [ReturnStmt] return ... +# 29| 0: [StmtExpr] +# 29| 0: [BlockStmt] { ... } +# 29| 0: [LocalTypeDeclStmt] class ... +# 29| 0: [AnonymousClass,LocalClass] new Object(...) { ... } +# 29| 1: [Constructor] +# 29| 5: [BlockStmt] { ... } +# 29| 0: [SuperConstructorInvocationStmt] super(...) +# 29| 1: [BlockStmt] { ... } +# 30| 0: [ExprStmt] ; +# 30| 0: [KtInitializerAssignExpr] ...=... +# 30| 0: [VarAccess] x +# 30| 2: [Method] getX +# 30| 3: [TypeAccess] int +# 30| 5: [BlockStmt] { ... } +# 30| 0: [ReturnStmt] return ... +# 30| 0: [VarAccess] this.x +# 30| -1: [ThisAccess] this +# 30| 2: [Method] setX +# 30| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 30| 0: [Parameter] +# 30| 0: [TypeAccess] int +# 30| 5: [BlockStmt] { ... } +# 30| 0: [ExprStmt] ; +# 30| 0: [AssignExpr] ...=... +# 30| 0: [VarAccess] this.x +# 30| -1: [ThisAccess] this +# 30| 1: [VarAccess] +# 30| 2: [FieldDeclaration] int x; +# 30| -1: [TypeAccess] int +# 30| 0: [IntegerLiteral] 1 +# 32| 5: [Method] member +# 32| 3: [TypeAccess] Unit +# 32| 5: [BlockStmt] { ... } +# 33| 0: [LocalVariableDeclStmt] var ...; +# 33| 1: [LocalVariableDeclExpr] maybeThis +# 33| 0: [WhenExpr] when ... +# 33| 0: [WhenBranch] ... -> ... +# 33| 0: [ValueEQExpr] ... (value equals) ... +# 33| 0: [MethodAccess] getX(...) +# 33| -1: [ThisAccess] this +# 33| 1: [IntegerLiteral] 1 +# 33| 1: [ExprStmt] ; +# 33| 0: [ThisAccess] this +# 33| 1: [WhenBranch] ... -> ... +# 33| 0: [BooleanLiteral] true +# 33| 1: [ExprStmt] ; +# 33| 0: [NullLiteral] null +# 29| 1: [ExprStmt] ; +# 29| 0: [ClassInstanceExpr] new (...) +# 29| -3: [TypeAccess] Object +# 38| 2: [Interface] Interface2 +# 39| 3: [Class] Class2 +# 39| 1: [Constructor] Class2 +# 39| 5: [BlockStmt] { ... } +# 39| 0: [SuperConstructorInvocationStmt] super(...) +# 39| 1: [BlockStmt] { ... } +# 40| 0: [ExprStmt] ; +# 40| 0: [KtInitializerAssignExpr] ...=... +# 40| 0: [VarAccess] i +# 40| 2: [Method] getI +# 40| 3: [TypeAccess] Interface2 +# 40| 5: [BlockStmt] { ... } +# 40| 0: [ReturnStmt] return ... +# 40| 0: [VarAccess] this.i +# 40| -1: [ThisAccess] this +# 40| 2: [Method] setI +# 40| 3: [TypeAccess] Unit +#-----| 4: (Parameters) +# 40| 0: [Parameter] +# 40| 0: [TypeAccess] Interface2 +# 40| 5: [BlockStmt] { ... } +# 40| 0: [ExprStmt] ; +# 40| 0: [AssignExpr] ...=... +# 40| 0: [VarAccess] this.i +# 40| -1: [ThisAccess] this +# 40| 1: [VarAccess] +# 40| 2: [FieldDeclaration] Interface2 i; +# 40| -1: [TypeAccess] Interface2 +# 40| 0: [StmtExpr] +# 40| 0: [BlockStmt] { ... } +# 40| 0: [LocalTypeDeclStmt] class ... +# 40| 0: [AnonymousClass,LocalClass] new Interface2(...) { ... } +# 40| 1: [Constructor] +# 40| 5: [BlockStmt] { ... } +# 40| 0: [SuperConstructorInvocationStmt] super(...) +# 40| 1: [BlockStmt] { ... } +# 42| 0: [LocalVariableDeclStmt] var ...; +# 42| 1: [LocalVariableDeclExpr] answer +# 42| 0: [StringLiteral] 42 +# 40| 1: [ExprStmt] ; +# 40| 0: [ClassInstanceExpr] new (...) +# 40| -3: [TypeAccess] Interface2 superChain.kt: # 0| [CompilationUnit] superChain -#-----| 1 -> [Class,GenericType,ParameterizedType] SuperChain1 -#-----| 2 -> [Class,GenericType,ParameterizedType] SuperChain2 -#-----| 3 -> [Class,GenericType,ParameterizedType] SuperChain3 +# 1| 1: [Class,GenericType,ParameterizedType] SuperChain1 +#-----| -2: (Generic Parameters) +# 1| 0: [TypeVariable] T1 +# 1| 1: [TypeVariable] T2 +# 1| 1: [Constructor] SuperChain1 +# 1| 5: [BlockStmt] { ... } +# 1| 0: [SuperConstructorInvocationStmt] super(...) +# 1| 1: [BlockStmt] { ... } +# 2| 2: [Class,GenericType,ParameterizedType] SuperChain2 +#-----| -2: (Generic Parameters) +# 2| 0: [TypeVariable] T3 +# 2| 1: [TypeVariable] T4 +# 2| 1: [Constructor] SuperChain2 +# 2| 5: [BlockStmt] { ... } +# 2| 0: [SuperConstructorInvocationStmt] super(...) +# 2| 1: [BlockStmt] { ... } +# 3| 3: [Class,GenericType,ParameterizedType] SuperChain3 +#-----| -2: (Generic Parameters) +# 3| 0: [TypeVariable] T5 +# 3| 1: [TypeVariable] T6 +# 3| 1: [Constructor] SuperChain3 +# 3| 5: [BlockStmt] { ... } +# 3| 0: [SuperConstructorInvocationStmt] super(...) +# 3| 1: [BlockStmt] { ... } diff --git a/java/ql/test/kotlin/library-tests/classes/localClass.expected b/java/ql/test/kotlin/library-tests/classes/localClass.expected index ebce3e75992..751b6649982 100644 --- a/java/ql/test/kotlin/library-tests/classes/localClass.expected +++ b/java/ql/test/kotlin/library-tests/classes/localClass.expected @@ -3,8 +3,6 @@ | classes.kt:119:13:121:13 | class ... | classes.kt:119:13:121:13 | Local2 | classes.kt:118:9:123:9 | localFn | classes.kt:109:1:136:1 | C1 | | classes.kt:129:17:131:17 | class ... | classes.kt:129:17:131:17 | Local3 | classes.kt:128:13:133:13 | fn | classes.kt:127:16:134:9 | new Object(...) { ... } | | localClassField.kt:3:9:3:19 | class ... | localClassField.kt:3:9:3:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | -| localClassField.kt:3:9:3:19 | class ... | localClassField.kt:8:9:8:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | -| localClassField.kt:8:9:8:19 | class ... | localClassField.kt:3:9:3:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | | localClassField.kt:8:9:8:19 | class ... | localClassField.kt:8:9:8:19 | L | localClassField.kt:1:1:11:1 | A | localClassField.kt:1:1:11:1 | A | | local_anonymous.kt:11:9:11:24 | class ... | local_anonymous.kt:11:9:11:24 | | local_anonymous.kt:10:5:13:5 | fn2 | local_anonymous.kt:3:1:36:1 | Class1 | | local_anonymous.kt:25:9:25:27 | class ... | local_anonymous.kt:25:9:25:27 | LocalClass | local_anonymous.kt:24:5:27:5 | fn5 | local_anonymous.kt:3:1:36:1 | Class1 | From a51c2c496f8f119d931800bfd74ffa47260cd259 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Thu, 5 May 2022 13:30:10 +0200 Subject: [PATCH 23/34] Add test with colliding property accessor and function names --- .../properties/CONSISTENCY/children.expected | 4 ++ .../properties/CONSISTENCY/toString.expected | 1 + .../properties/DB-CHECK.expected | 40 +++++++++++++++++++ .../properties/properties.expected | 3 ++ .../library-tests/properties/properties.kt | 8 ++++ 5 files changed, 56 insertions(+) create mode 100644 java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected create mode 100644 java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected create mode 100644 java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected diff --git a/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected b/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected new file mode 100644 index 00000000000..93de7bf98b7 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected @@ -0,0 +1,4 @@ +| properties.kt:84:13:84:29 | | Parameter | -1 | duplicate | -1 | +| properties.kt:84:13:84:29 | p | Parameter | -1 | duplicate | -1 | +| properties.kt:86:17:86:22 | | Parameter | -1 | duplicate | -1 | +| properties.kt:86:17:86:22 | p | Parameter | -1 | duplicate | -1 | diff --git a/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected b/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected new file mode 100644 index 00000000000..39b5a73a200 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected @@ -0,0 +1 @@ +| Top which doesn't have exactly 1 toString | diff --git a/java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected b/java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected new file mode 100644 index 00000000000..3f0edbc3052 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected @@ -0,0 +1,40 @@ +[INVALID_KEY] predicate paramName(@param id, string nodeName): The key set {id} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 1: +Tuple 1 in row 14: (747,"") +Tuple 2 in row 15: (747,"p") + Relevant element: Tuple 1: id=747 + Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" + Relevant element: Tuple 2: id=747 + Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" +[INVALID_KEY_SET] predicate stmts(@stmt id, int kind, @stmtparent parent, int idx, @callable bodydecl): The key set {parent, idx} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 106: (750,0,746,0,746) +Tuple 2 in row 108: (762,0,746,0,746) + Relevant element: Tuple 1: parent=746 + Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" + Relevant element: Tuple 2: parent=746 + Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" + Relevant element: Tuple 1: bodydecl=746 + Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" + Relevant element: Tuple 2: bodydecl=746 + Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" +[INVALID_KEY_SET] predicate exprs(@expr id, int kind, @type typeid, @exprparent parent, int idx): The key set {parent, idx} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 303: (749,62,23,746,-1) +Tuple 2 in row 310: (761,62,23,746,-1) + Relevant element: typeid=23 + Full ID for 23: @"class;kotlin.Unit" + Relevant element: Tuple 1: parent=746 + Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" + Relevant element: Tuple 2: parent=746 + Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" +[INVALID_KEY_SET] predicate exprs(@expr id, int kind, @type typeid, @exprparent parent, int idx): The key set {parent, idx} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 302: (748,62,17,747,-1) +Tuple 2 in row 309: (759,62,17,747,-1) + Relevant element: typeid=17 + Full ID for 17: @"type;int" + Relevant element: Tuple 1: parent=747 + Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" + Relevant element: Tuple 2: parent=747 + Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" diff --git a/java/ql/test/kotlin/library-tests/properties/properties.expected b/java/ql/test/kotlin/library-tests/properties/properties.expected index b98fcd92b43..fcc2792110b 100644 --- a/java/ql/test/kotlin/library-tests/properties/properties.expected +++ b/java/ql/test/kotlin/library-tests/properties/properties.expected @@ -20,6 +20,7 @@ fieldDeclarations | properties.kt:38:5:38:34 | int internalProp; | properties.kt:38:5:38:34 | internalProp | 0 | | properties.kt:67:1:67:23 | int constVal; | properties.kt:67:1:67:23 | constVal | 0 | | properties.kt:70:5:70:16 | int prop; | properties.kt:70:5:70:16 | prop | 0 | +| properties.kt:84:5:84:29 | int data; | properties.kt:84:5:84:29 | data | 0 | #select | properties.kt:2:27:2:50 | constructorProp | properties.kt:2:27:2:50 | getConstructorProp | file://:0:0:0:0 | | properties.kt:2:27:2:50 | constructorProp | public | | properties.kt:2:53:2:83 | mutableConstructorProp | properties.kt:2:53:2:83 | getMutableConstructorProp | properties.kt:2:53:2:83 | setMutableConstructorProp | properties.kt:2:53:2:83 | mutableConstructorProp | public | @@ -48,3 +49,5 @@ fieldDeclarations | properties.kt:70:5:70:16 | prop | properties.kt:70:5:70:16 | getProp | file://:0:0:0:0 | | properties.kt:70:5:70:16 | prop | public | | properties.kt:78:1:79:13 | x | properties.kt:79:5:79:13 | getX | file://:0:0:0:0 | | file://:0:0:0:0 | | public | | properties.kt:80:1:81:13 | x | properties.kt:81:5:81:13 | getX | file://:0:0:0:0 | | file://:0:0:0:0 | | public | +| properties.kt:84:5:84:29 | data | properties.kt:84:13:84:29 | getData | properties.kt:84:13:84:29 | setData | properties.kt:84:5:84:29 | data | private | +| properties.kt:84:5:84:29 | data | properties.kt:84:13:84:29 | getData | properties.kt:86:5:88:5 | setData | properties.kt:84:5:84:29 | data | private | diff --git a/java/ql/test/kotlin/library-tests/properties/properties.kt b/java/ql/test/kotlin/library-tests/properties/properties.kt index e435eb3f553..d07d062d96e 100644 --- a/java/ql/test/kotlin/library-tests/properties/properties.kt +++ b/java/ql/test/kotlin/library-tests/properties/properties.kt @@ -79,3 +79,11 @@ val Int.x : Int get() = 5 val Double.x : Int get() = 5 + +class A { + private var data: Int = 0 + + fun setData(p: Int) { + data = p + } +} From 59581439dd05473d67fa19677cd3549a55c4b4a8 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Thu, 5 May 2022 13:31:29 +0200 Subject: [PATCH 24/34] Fix colliding property accessor and function names --- .../src/main/kotlin/KotlinUsesExtractor.kt | 22 +++++++++- .../properties/CONSISTENCY/children.expected | 4 -- .../properties/CONSISTENCY/toString.expected | 1 - .../properties/DB-CHECK.expected | 40 ------------------- .../properties/properties.expected | 7 ++-- .../library-tests/properties/properties.kt | 9 +++++ 6 files changed, 33 insertions(+), 50 deletions(-) delete mode 100644 java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected delete mode 100644 java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected delete mode 100644 java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index ec06942b66e..818343adf91 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -726,8 +726,26 @@ open class KotlinUsesExtractor( } when (f) { - getter -> return FunctionNames(getJvmName(getter) ?: JvmAbi.getterName(propName), JvmAbi.getterName(propName)) - setter -> return FunctionNames(getJvmName(setter) ?: JvmAbi.setterName(propName), JvmAbi.setterName(propName)) + getter -> { + val defaultFunctionName = JvmAbi.getterName(propName) + val defaultDbName = if (getter.visibility == DescriptorVisibilities.PRIVATE && getter.origin == IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR) { + // In JVM these functions don't exist, instead the backing field is accessed directly + defaultFunctionName + "\$private" + } else { + defaultFunctionName + } + return FunctionNames(getJvmName(getter) ?: defaultDbName, defaultFunctionName) + } + setter -> { + val defaultFunctionName = JvmAbi.setterName(propName) + val defaultDbName = if (setter.visibility == DescriptorVisibilities.PRIVATE && setter.origin == IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR) { + // In JVM these functions don't exist, instead the backing field is accessed directly + defaultFunctionName + "\$private" + } else { + defaultFunctionName + } + return FunctionNames(getJvmName(setter) ?: defaultDbName, defaultFunctionName) + } else -> { logger.error( "Function has a corresponding property, but is neither the getter nor the setter" diff --git a/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected b/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected deleted file mode 100644 index 93de7bf98b7..00000000000 --- a/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/children.expected +++ /dev/null @@ -1,4 +0,0 @@ -| properties.kt:84:13:84:29 | | Parameter | -1 | duplicate | -1 | -| properties.kt:84:13:84:29 | p | Parameter | -1 | duplicate | -1 | -| properties.kt:86:17:86:22 | | Parameter | -1 | duplicate | -1 | -| properties.kt:86:17:86:22 | p | Parameter | -1 | duplicate | -1 | diff --git a/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected b/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected deleted file mode 100644 index 39b5a73a200..00000000000 --- a/java/ql/test/kotlin/library-tests/properties/CONSISTENCY/toString.expected +++ /dev/null @@ -1 +0,0 @@ -| Top which doesn't have exactly 1 toString | diff --git a/java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected b/java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected deleted file mode 100644 index 3f0edbc3052..00000000000 --- a/java/ql/test/kotlin/library-tests/properties/DB-CHECK.expected +++ /dev/null @@ -1,40 +0,0 @@ -[INVALID_KEY] predicate paramName(@param id, string nodeName): The key set {id} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 1: -Tuple 1 in row 14: (747,"") -Tuple 2 in row 15: (747,"p") - Relevant element: Tuple 1: id=747 - Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" - Relevant element: Tuple 2: id=747 - Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" -[INVALID_KEY_SET] predicate stmts(@stmt id, int kind, @stmtparent parent, int idx, @callable bodydecl): The key set {parent, idx} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 106: (750,0,746,0,746) -Tuple 2 in row 108: (762,0,746,0,746) - Relevant element: Tuple 1: parent=746 - Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" - Relevant element: Tuple 2: parent=746 - Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" - Relevant element: Tuple 1: bodydecl=746 - Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" - Relevant element: Tuple 2: bodydecl=746 - Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" -[INVALID_KEY_SET] predicate exprs(@expr id, int kind, @type typeid, @exprparent parent, int idx): The key set {parent, idx} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 303: (749,62,23,746,-1) -Tuple 2 in row 310: (761,62,23,746,-1) - Relevant element: typeid=23 - Full ID for 23: @"class;kotlin.Unit" - Relevant element: Tuple 1: parent=746 - Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" - Relevant element: Tuple 2: parent=746 - Full ID for 746: @"callable;(725).setData((17))(22)". The ID may expand to @"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}" -[INVALID_KEY_SET] predicate exprs(@expr id, int kind, @type typeid, @exprparent parent, int idx): The key set {parent, idx} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 302: (748,62,17,747,-1) -Tuple 2 in row 309: (759,62,17,747,-1) - Relevant element: typeid=17 - Full ID for 17: @"type;int" - Relevant element: Tuple 1: parent=747 - Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" - Relevant element: Tuple 2: parent=747 - Full ID for 747: @"params;(746);0". The ID may expand to @"params;{@"callable;{@"class;A"}.setData({@"type;int"}){@"type;void"}"};0" diff --git a/java/ql/test/kotlin/library-tests/properties/properties.expected b/java/ql/test/kotlin/library-tests/properties/properties.expected index fcc2792110b..05870c7b6e1 100644 --- a/java/ql/test/kotlin/library-tests/properties/properties.expected +++ b/java/ql/test/kotlin/library-tests/properties/properties.expected @@ -21,6 +21,7 @@ fieldDeclarations | properties.kt:67:1:67:23 | int constVal; | properties.kt:67:1:67:23 | constVal | 0 | | properties.kt:70:5:70:16 | int prop; | properties.kt:70:5:70:16 | prop | 0 | | properties.kt:84:5:84:29 | int data; | properties.kt:84:5:84:29 | data | 0 | +| properties.kt:92:5:93:18 | int data; | properties.kt:92:5:93:18 | data | 0 | #select | properties.kt:2:27:2:50 | constructorProp | properties.kt:2:27:2:50 | getConstructorProp | file://:0:0:0:0 | | properties.kt:2:27:2:50 | constructorProp | public | | properties.kt:2:53:2:83 | mutableConstructorProp | properties.kt:2:53:2:83 | getMutableConstructorProp | properties.kt:2:53:2:83 | setMutableConstructorProp | properties.kt:2:53:2:83 | mutableConstructorProp | public | @@ -41,7 +42,7 @@ fieldDeclarations | properties.kt:30:5:31:29 | overrideGetterUseField | properties.kt:31:13:31:29 | getOverrideGetterUseField | properties.kt:30:5:31:29 | setOverrideGetterUseField | properties.kt:30:5:31:29 | overrideGetterUseField | public | | properties.kt:32:5:33:29 | useField | properties.kt:33:13:33:29 | getUseField | file://:0:0:0:0 | | properties.kt:32:5:33:29 | useField | public | | properties.kt:34:5:34:36 | lateInitVar | properties.kt:34:14:34:36 | getLateInitVar | properties.kt:34:14:34:36 | setLateInitVar | properties.kt:34:5:34:36 | lateInitVar | public | -| properties.kt:35:5:35:32 | privateProp | properties.kt:35:13:35:32 | getPrivateProp | file://:0:0:0:0 | | properties.kt:35:5:35:32 | privateProp | private | +| properties.kt:35:5:35:32 | privateProp | properties.kt:35:13:35:32 | getPrivateProp$private | file://:0:0:0:0 | | properties.kt:35:5:35:32 | privateProp | private | | properties.kt:36:5:36:36 | protectedProp | properties.kt:36:15:36:36 | getProtectedProp | file://:0:0:0:0 | | properties.kt:36:5:36:36 | protectedProp | protected | | properties.kt:37:5:37:30 | publicProp | properties.kt:37:12:37:30 | getPublicProp | file://:0:0:0:0 | | properties.kt:37:5:37:30 | publicProp | public | | properties.kt:38:5:38:34 | internalProp | properties.kt:38:14:38:34 | getInternalProp | file://:0:0:0:0 | | properties.kt:38:5:38:34 | internalProp | internal | @@ -49,5 +50,5 @@ fieldDeclarations | properties.kt:70:5:70:16 | prop | properties.kt:70:5:70:16 | getProp | file://:0:0:0:0 | | properties.kt:70:5:70:16 | prop | public | | properties.kt:78:1:79:13 | x | properties.kt:79:5:79:13 | getX | file://:0:0:0:0 | | file://:0:0:0:0 | | public | | properties.kt:80:1:81:13 | x | properties.kt:81:5:81:13 | getX | file://:0:0:0:0 | | file://:0:0:0:0 | | public | -| properties.kt:84:5:84:29 | data | properties.kt:84:13:84:29 | getData | properties.kt:84:13:84:29 | setData | properties.kt:84:5:84:29 | data | private | -| properties.kt:84:5:84:29 | data | properties.kt:84:13:84:29 | getData | properties.kt:86:5:88:5 | setData | properties.kt:84:5:84:29 | data | private | +| properties.kt:84:5:84:29 | data | properties.kt:84:13:84:29 | getData$private | properties.kt:84:13:84:29 | setData$private | properties.kt:84:5:84:29 | data | private | +| properties.kt:92:5:93:18 | data | properties.kt:93:9:93:18 | getData | properties.kt:92:13:93:18 | setData$private | properties.kt:92:5:93:18 | data | private | diff --git a/java/ql/test/kotlin/library-tests/properties/properties.kt b/java/ql/test/kotlin/library-tests/properties/properties.kt index d07d062d96e..bde7994f990 100644 --- a/java/ql/test/kotlin/library-tests/properties/properties.kt +++ b/java/ql/test/kotlin/library-tests/properties/properties.kt @@ -87,3 +87,12 @@ class A { data = p } } + +class B { + private var data: Int = 5 + get() = 42 + + fun setData(p: Int) { + data = p + } +} From b0ee557a51136114da7ac786359d2f0f661bdb71 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Mon, 9 May 2022 09:20:50 +0200 Subject: [PATCH 25/34] Fix expected test files --- java/ql/test/kotlin/library-tests/classes/PrintAst.expected | 4 ++-- .../kotlin/library-tests/classes/genericExprTypes.expected | 2 +- java/ql/test/kotlin/library-tests/comments/comments.expected | 2 +- .../ql/test/kotlin/library-tests/modifiers/modifiers.expected | 2 +- .../library-tests/private-anonymous-types/test.expected | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/java/ql/test/kotlin/library-tests/classes/PrintAst.expected b/java/ql/test/kotlin/library-tests/classes/PrintAst.expected index f1fae7f584f..0346a4e0292 100644 --- a/java/ql/test/kotlin/library-tests/classes/PrintAst.expected +++ b/java/ql/test/kotlin/library-tests/classes/PrintAst.expected @@ -578,7 +578,7 @@ generic_anonymous.kt: # 3| 1: [ExprStmt] ; # 3| 0: [ClassInstanceExpr] new (...) # 3| -3: [TypeAccess] Object -# 3| 5: [Method] getX +# 3| 5: [Method] getX$private # 3| 3: [TypeAccess] new Object(...) { ... } # 3| 0: [TypeAccess] T # 3| 5: [BlockStmt] { ... } @@ -590,7 +590,7 @@ generic_anonymous.kt: # 7| 5: [BlockStmt] { ... } # 7| 0: [ReturnStmt] return ... # 7| 0: [MethodAccess] getMember(...) -# 7| -1: [MethodAccess] getX(...) +# 7| -1: [MethodAccess] getX$private(...) # 7| -1: [ThisAccess] this localClassField.kt: # 0| [CompilationUnit] localClassField diff --git a/java/ql/test/kotlin/library-tests/classes/genericExprTypes.expected b/java/ql/test/kotlin/library-tests/classes/genericExprTypes.expected index 1443bcd5e69..aa9514774a6 100644 --- a/java/ql/test/kotlin/library-tests/classes/genericExprTypes.expected +++ b/java/ql/test/kotlin/library-tests/classes/genericExprTypes.expected @@ -27,7 +27,7 @@ | generic_anonymous.kt:4:20:4:20 | Generic.this | Generic | | generic_anonymous.kt:4:20:4:20 | getT(...) | T | | generic_anonymous.kt:7:3:7:22 | T | T | -| generic_anonymous.kt:7:15:7:15 | getX(...) | new Object(...) { ... } | +| generic_anonymous.kt:7:15:7:15 | getX$private(...) | new Object(...) { ... } | | generic_anonymous.kt:7:15:7:15 | this | Generic | | generic_anonymous.kt:7:17:7:22 | getMember(...) | T | | generic_anonymous.kt:11:1:11:56 | String | String | diff --git a/java/ql/test/kotlin/library-tests/comments/comments.expected b/java/ql/test/kotlin/library-tests/comments/comments.expected index 10d2cb46e73..043a7bbdf73 100644 --- a/java/ql/test/kotlin/library-tests/comments/comments.expected +++ b/java/ql/test/kotlin/library-tests/comments/comments.expected @@ -12,7 +12,7 @@ commentOwners | comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:31:1 | Group | | comments.kt:14:5:16:7 | /**\n * Members of this group.\n */ | comments.kt:17:5:17:46 | members | | comments.kt:14:5:16:7 | /**\n * Members of this group.\n */ | comments.kt:17:5:17:46 | members | -| comments.kt:14:5:16:7 | /**\n * Members of this group.\n */ | comments.kt:17:13:17:46 | getMembers | +| comments.kt:14:5:16:7 | /**\n * Members of this group.\n */ | comments.kt:17:13:17:46 | getMembers$private | | comments.kt:19:5:22:7 | /**\n * Adds a [member] to this group.\n * @return the new size of the group.\n */ | comments.kt:23:5:26:5 | add | | comments.kt:35:5:35:34 | /** Medium is in the middle */ | comments.kt:36:5:36:14 | Medium | | comments.kt:37:5:37:23 | /** This is high */ | comments.kt:38:5:38:11 | High | diff --git a/java/ql/test/kotlin/library-tests/modifiers/modifiers.expected b/java/ql/test/kotlin/library-tests/modifiers/modifiers.expected index b499378e07c..7f56350444a 100644 --- a/java/ql/test/kotlin/library-tests/modifiers/modifiers.expected +++ b/java/ql/test/kotlin/library-tests/modifiers/modifiers.expected @@ -2,7 +2,7 @@ | modifiers.kt:1:6:25:1 | X | Constructor | public | | modifiers.kt:2:5:2:21 | a | Field | private | | modifiers.kt:2:5:2:21 | a | Property | private | -| modifiers.kt:2:13:2:21 | getA | Method | private | +| modifiers.kt:2:13:2:21 | getA$private | Method | private | | modifiers.kt:3:5:3:23 | b | Field | private | | modifiers.kt:3:5:3:23 | b | Property | protected | | modifiers.kt:3:15:3:23 | getB | Method | protected | diff --git a/java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected index ac6142182b5..4c6907f99d4 100644 --- a/java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected +++ b/java/ql/test/kotlin/library-tests/private-anonymous-types/test.expected @@ -9,7 +9,7 @@ | test.kt:7:1:17:1 | A | test.kt:9:3:11:3 | anonType | | test.kt:7:1:17:1 | A | test.kt:9:3:11:3 | getAnonType | | test.kt:7:1:17:1 | A | test.kt:13:3:15:3 | privateAnonType | -| test.kt:7:1:17:1 | A | test.kt:13:11:15:3 | getPrivateAnonType | +| test.kt:7:1:17:1 | A | test.kt:13:11:15:3 | getPrivateAnonType$private | | test.kt:9:18:11:3 | new If(...) { ... } | test.kt:9:18:11:3 | | | test.kt:9:18:11:3 | new If(...) { ... } | test.kt:10:5:10:22 | x | | test.kt:9:18:11:3 | new If(...) { ... } | test.kt:10:14:10:22 | getX | From de003fd1221959babdd2aaeadcffe40b058e460a Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 10 May 2022 10:38:59 +0200 Subject: [PATCH 26/34] Add test for return type of `` methods --- .../kotlin/library-tests/methods/clinit.expected | 1 + .../ql/test/kotlin/library-tests/methods/clinit.kt | 3 +++ .../ql/test/kotlin/library-tests/methods/clinit.ql | 5 +++++ .../kotlin/library-tests/methods/exprs.expected | 14 ++++++++++++++ .../kotlin/library-tests/methods/methods.expected | 3 +++ .../library-tests/methods/parameters.expected | 1 + 6 files changed, 27 insertions(+) create mode 100644 java/ql/test/kotlin/library-tests/methods/clinit.expected create mode 100644 java/ql/test/kotlin/library-tests/methods/clinit.kt create mode 100644 java/ql/test/kotlin/library-tests/methods/clinit.ql diff --git a/java/ql/test/kotlin/library-tests/methods/clinit.expected b/java/ql/test/kotlin/library-tests/methods/clinit.expected new file mode 100644 index 00000000000..923291bbf8b --- /dev/null +++ b/java/ql/test/kotlin/library-tests/methods/clinit.expected @@ -0,0 +1 @@ +| clinit.kt:0:0:0:0 | | file:///usr/local/Cellar/kotlin/1.6.20/libexec/lib/kotlin-stdlib.jar/kotlin/Unit.class:0:0:0:0 | Unit | diff --git a/java/ql/test/kotlin/library-tests/methods/clinit.kt b/java/ql/test/kotlin/library-tests/methods/clinit.kt new file mode 100644 index 00000000000..291dc7cad4b --- /dev/null +++ b/java/ql/test/kotlin/library-tests/methods/clinit.kt @@ -0,0 +1,3 @@ +package foo.bar + +var topLevelInt: Int = 0 \ No newline at end of file diff --git a/java/ql/test/kotlin/library-tests/methods/clinit.ql b/java/ql/test/kotlin/library-tests/methods/clinit.ql new file mode 100644 index 00000000000..11ea8515abb --- /dev/null +++ b/java/ql/test/kotlin/library-tests/methods/clinit.ql @@ -0,0 +1,5 @@ +import java + +from Method m +where m.getName() = "" +select m, m.getReturnType() diff --git a/java/ql/test/kotlin/library-tests/methods/exprs.expected b/java/ql/test/kotlin/library-tests/methods/exprs.expected index 7b3f15f512b..a08c7cda44e 100644 --- a/java/ql/test/kotlin/library-tests/methods/exprs.expected +++ b/java/ql/test/kotlin/library-tests/methods/exprs.expected @@ -1,3 +1,17 @@ +| clinit.kt:3:1:3:24 | ...=... | AssignExpr | +| clinit.kt:3:1:3:24 | ...=... | KtInitializerAssignExpr | +| clinit.kt:3:1:3:24 | | VarAccess | +| clinit.kt:3:1:3:24 | ClinitKt | TypeAccess | +| clinit.kt:3:1:3:24 | ClinitKt | TypeAccess | +| clinit.kt:3:1:3:24 | ClinitKt | TypeAccess | +| clinit.kt:3:1:3:24 | ClinitKt.topLevelInt | VarAccess | +| clinit.kt:3:1:3:24 | ClinitKt.topLevelInt | VarAccess | +| clinit.kt:3:1:3:24 | ClinitKt.topLevelInt | VarAccess | +| clinit.kt:3:1:3:24 | Unit | TypeAccess | +| clinit.kt:3:1:3:24 | int | TypeAccess | +| clinit.kt:3:1:3:24 | int | TypeAccess | +| clinit.kt:3:1:3:24 | int | TypeAccess | +| clinit.kt:3:24:3:24 | 0 | IntegerLiteral | | methods2.kt:4:1:5:1 | Unit | TypeAccess | | methods2.kt:4:26:4:31 | int | TypeAccess | | methods2.kt:4:34:4:39 | int | TypeAccess | diff --git a/java/ql/test/kotlin/library-tests/methods/methods.expected b/java/ql/test/kotlin/library-tests/methods/methods.expected index b48a979dc33..87832f2ed87 100644 --- a/java/ql/test/kotlin/library-tests/methods/methods.expected +++ b/java/ql/test/kotlin/library-tests/methods/methods.expected @@ -1,4 +1,7 @@ methods +| clinit.kt:0:0:0:0 | ClinitKt | clinit.kt:0:0:0:0 | | () | | +| clinit.kt:0:0:0:0 | ClinitKt | clinit.kt:3:1:3:24 | getTopLevelInt | getTopLevelInt() | public, static | +| clinit.kt:0:0:0:0 | ClinitKt | clinit.kt:3:1:3:24 | setTopLevelInt | setTopLevelInt(int) | public, static | | methods2.kt:0:0:0:0 | Methods2Kt | methods2.kt:4:1:5:1 | fooBarTopLevelMethod | fooBarTopLevelMethod(int,int) | public, static | | methods2.kt:7:1:10:1 | Class2 | methods2.kt:8:5:9:5 | fooBarClassMethod | fooBarClassMethod(int,int) | public | | methods3.kt:0:0:0:0 | Methods3Kt | methods3.kt:3:1:3:42 | fooBarTopLevelMethodExt | fooBarTopLevelMethodExt(int,int) | public, static | diff --git a/java/ql/test/kotlin/library-tests/methods/parameters.expected b/java/ql/test/kotlin/library-tests/methods/parameters.expected index 75f8eea234b..3e34c2c3b86 100644 --- a/java/ql/test/kotlin/library-tests/methods/parameters.expected +++ b/java/ql/test/kotlin/library-tests/methods/parameters.expected @@ -1,3 +1,4 @@ +| clinit.kt:3:1:3:24 | setTopLevelInt | clinit.kt:3:1:3:24 | | 0 | | methods2.kt:4:1:5:1 | fooBarTopLevelMethod | methods2.kt:4:26:4:31 | x | 0 | | methods2.kt:4:1:5:1 | fooBarTopLevelMethod | methods2.kt:4:34:4:39 | y | 1 | | methods2.kt:8:5:9:5 | fooBarClassMethod | methods2.kt:8:27:8:32 | x | 0 | From 8b1a7c845c7e9ef5b93171c252e8eed0b00534d5 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 10 May 2022 10:39:40 +0200 Subject: [PATCH 27/34] Fix return type of `` methods --- java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt | 2 +- java/ql/test/kotlin/library-tests/methods/clinit.expected | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index 9e0ec7413e7..a694fc55492 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -554,7 +554,7 @@ open class KotlinFileExtractor( classTypeArgsIncludingOuterClasses = listOf() ) val clinitId = tw.getLabelFor(clinitLabel) - val returnType = useType(pluginContext.irBuiltIns.unitType) + val returnType = useType(pluginContext.irBuiltIns.unitType, TypeContext.RETURN) tw.writeMethods(clinitId, "", "()", returnType.javaResult.id, parentId, clinitId) tw.writeMethodsKotlinType(clinitId, returnType.kotlinResult.id) diff --git a/java/ql/test/kotlin/library-tests/methods/clinit.expected b/java/ql/test/kotlin/library-tests/methods/clinit.expected index 923291bbf8b..8e4a65ab39a 100644 --- a/java/ql/test/kotlin/library-tests/methods/clinit.expected +++ b/java/ql/test/kotlin/library-tests/methods/clinit.expected @@ -1 +1 @@ -| clinit.kt:0:0:0:0 | | file:///usr/local/Cellar/kotlin/1.6.20/libexec/lib/kotlin-stdlib.jar/kotlin/Unit.class:0:0:0:0 | Unit | +| clinit.kt:0:0:0:0 | | file://:0:0:0:0 | void | From a8cf0383cf52f321d252fe3ac41878dbee6aa6e9 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 10 May 2022 14:37:48 +0200 Subject: [PATCH 28/34] Add test for companion field declaring type --- .../companion_objects/companion_objects.expected | 4 ++-- .../library-tests/companion_objects/companion_objects.ql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected b/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected index b3a594cbc57..70df0dbf3a1 100644 --- a/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected +++ b/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected @@ -1,2 +1,2 @@ -| companion_objects.kt:1:1:6:1 | MyClass | companion_objects.kt:3:5:5:5 | MyClassCompanion | companion_objects.kt:3:5:5:5 | MyClassCompanion | final,public,static | -| companion_objects.kt:8:1:13:1 | MyInterface | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | final,public,static | +| companion_objects.kt:1:1:6:1 | MyClass | companion_objects.kt:3:5:5:5 | MyClassCompanion | companion_objects.kt:3:5:5:5 | MyClassCompanion | companion_objects.kt:3:5:5:5 | MyClassCompanion | final,public,static | +| companion_objects.kt:8:1:13:1 | MyInterface | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | final,public,static | diff --git a/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.ql b/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.ql index a170248eaae..a6df9bb27b6 100644 --- a/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.ql +++ b/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.ql @@ -5,4 +5,4 @@ where c.fromSource() and cco = c.getCompanionObject() and f = cco.getInstance() -select c, f, cco, concat(f.getAModifier().toString(), ",") +select c, f, cco, f.getDeclaringType(), concat(f.getAModifier().toString(), ",") From ccaafd74f3b545a1f4ef75b13cba68ed45bfdaae Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 10 May 2022 14:38:09 +0200 Subject: [PATCH 29/34] Fix declaring type of companion field --- java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt | 2 +- .../companion_objects/companion_objects.expected | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index a694fc55492..b20cd37e32b 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -457,7 +457,7 @@ open class KotlinFileExtractor( val instance = useCompanionObjectClassInstance(innerDeclaration) if (instance != null) { val type = useSimpleTypeClass(innerDeclaration, emptyList(), false) - tw.writeFields(instance.id, instance.name, type.javaResult.id, innerId, instance.id) + tw.writeFields(instance.id, instance.name, type.javaResult.id, parentId, instance.id) tw.writeFieldsKotlinType(instance.id, type.kotlinResult.id) tw.writeHasLocation(instance.id, innerLocId) addModifiers(instance.id, "public", "static", "final") diff --git a/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected b/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected index 70df0dbf3a1..1766f462578 100644 --- a/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected +++ b/java/ql/test/kotlin/library-tests/companion_objects/companion_objects.expected @@ -1,2 +1,2 @@ -| companion_objects.kt:1:1:6:1 | MyClass | companion_objects.kt:3:5:5:5 | MyClassCompanion | companion_objects.kt:3:5:5:5 | MyClassCompanion | companion_objects.kt:3:5:5:5 | MyClassCompanion | final,public,static | -| companion_objects.kt:8:1:13:1 | MyInterface | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | final,public,static | +| companion_objects.kt:1:1:6:1 | MyClass | companion_objects.kt:3:5:5:5 | MyClassCompanion | companion_objects.kt:3:5:5:5 | MyClassCompanion | companion_objects.kt:1:1:6:1 | MyClass | final,public,static | +| companion_objects.kt:8:1:13:1 | MyInterface | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | companion_objects.kt:10:5:12:5 | MyInterfaceCompanion | companion_objects.kt:8:1:13:1 | MyInterface | final,public,static | From a0f4960e31c766d3ba1d5bdf913274d20744924a Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 10 May 2022 11:12:21 +0200 Subject: [PATCH 30/34] Add test case for extension function called from java --- .../kotlin/library-tests/extensions/A.java | 5 + .../extensions/DB-CHECK.expected | 158 ++++++++++++++++++ .../extensions/methodaccesses.expected | 2 + .../library-tests/extensions/methods.expected | 1 + .../extensions/parameters.expected | 31 ++++ 5 files changed, 197 insertions(+) create mode 100644 java/ql/test/kotlin/library-tests/extensions/A.java create mode 100644 java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected diff --git a/java/ql/test/kotlin/library-tests/extensions/A.java b/java/ql/test/kotlin/library-tests/extensions/A.java new file mode 100644 index 00000000000..acb3b819de5 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/extensions/A.java @@ -0,0 +1,5 @@ +class A { + void method() { + ExtensionsKt.someFun(new SomeClass(), ""); + } +} \ No newline at end of file diff --git a/java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected b/java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected new file mode 100644 index 00000000000..a5762b1bae6 --- /dev/null +++ b/java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected @@ -0,0 +1,158 @@ +[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 2: (87,42,0,44,87) +Tuple 2 in row 4: (90,42,0,44,90) + Relevant element: Tuple 1: id=87 + Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: id=90 + Full ID for 90: @"params;(44);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" + Relevant element: typeid=42 + Full ID for 42: @"class;SomeClass" + Relevant element: parentid=44 + Full ID for 44: @"callable;(40).someFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: Tuple 1: sourceid=87 + Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: sourceid=90 + Full ID for 90: @"params;(44);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" +[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 3: (87,43,1,44,87) +Tuple 2 in row 31: (329,43,1,44,329) + Relevant element: Tuple 1: id=87 + Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: id=329 + Full ID for 329: @"params;(44);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};1" + Relevant element: typeid=43 + Full ID for 43: @"class;java.lang.String" + Relevant element: parentid=44 + Full ID for 44: @"callable;(40).someFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: Tuple 1: sourceid=87 + Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: sourceid=329 + Full ID for 329: @"params;(44);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};1" +[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 6: (99,72,0,97,99) +Tuple 2 in row 7: (102,72,0,97,102) + Relevant element: Tuple 1: id=99 + Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: id=102 + Full ID for 102: @"params;(97);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" + Relevant element: typeid=72 + Full ID for 72: @"class;AnotherClass" + Relevant element: parentid=97 + Full ID for 97: @"callable;(40).anotherFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: Tuple 1: sourceid=99 + Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: sourceid=102 + Full ID for 102: @"params;(97);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" +[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 5: (99,43,1,97,99) +Tuple 2 in row 30: (326,43,1,97,326) + Relevant element: Tuple 1: id=99 + Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: id=326 + Full ID for 326: @"params;(97);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};1" + Relevant element: typeid=43 + Full ID for 43: @"class;java.lang.String" + Relevant element: parentid=97 + Full ID for 97: @"callable;(40).anotherFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: Tuple 1: sourceid=99 + Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: sourceid=326 + Full ID for 326: @"params;(97);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};1" +[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 0: +Tuple 1 in row 8: (110,42,0,108,110) +Tuple 2 in row 10: (113,42,0,108,113) + Relevant element: Tuple 1: id=110 + Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: id=113 + Full ID for 113: @"params;(108);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" + Relevant element: typeid=42 + Full ID for 42: @"class;SomeClass" + Relevant element: parentid=108 + Full ID for 108: @"callable;(40).bothFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: Tuple 1: sourceid=110 + Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 2: sourceid=113 + Full ID for 113: @"params;(108);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" +[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): More errors, not displayed. There are at least 14 pairs of tuples not satisfying the key dependency for a relation of size 10480 +[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 1: +Tuple 1 in row 2: (87,42,0,44,87) +Tuple 2 in row 3: (87,43,1,44,87) + Relevant element: id=87 + Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 1: typeid=42 + Full ID for 42: @"class;SomeClass" + Relevant element: Tuple 2: typeid=43 + Full ID for 43: @"class;java.lang.String" + Relevant element: parentid=44 + Full ID for 44: @"callable;(40).someFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: sourceid=87 + Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" +[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 1: +Tuple 1 in row 5: (99,43,1,97,99) +Tuple 2 in row 6: (99,72,0,97,99) + Relevant element: id=99 + Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 1: typeid=43 + Full ID for 43: @"class;java.lang.String" + Relevant element: Tuple 2: typeid=72 + Full ID for 72: @"class;AnotherClass" + Relevant element: parentid=97 + Full ID for 97: @"callable;(40).anotherFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: sourceid=99 + Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" +[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 1: +Tuple 1 in row 8: (110,42,0,108,110) +Tuple 2 in row 9: (110,43,1,108,110) + Relevant element: id=110 + Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 1: typeid=42 + Full ID for 42: @"class;SomeClass" + Relevant element: Tuple 2: typeid=43 + Full ID for 43: @"class;java.lang.String" + Relevant element: parentid=108 + Full ID for 108: @"callable;(40).bothFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: sourceid=110 + Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" +[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 1: +Tuple 1 in row 11: (121,43,1,119,121) +Tuple 2 in row 12: (121,72,0,119,121) + Relevant element: id=121 + Full ID for 121: @"params;(119);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" + Relevant element: Tuple 1: typeid=43 + Full ID for 43: @"class;java.lang.String" + Relevant element: Tuple 2: typeid=72 + Full ID for 72: @"class;AnotherClass" + Relevant element: parentid=119 + Full ID for 119: @"callable;(40).bothFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" + Relevant element: sourceid=121 + Full ID for 121: @"params;(119);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" +[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. +Here is a pair of tuples that agree on the key set but differ at index 1: +Tuple 1 in row 14: (134,42,0,132,134) +Tuple 2 in row 15: (134,130,1,132,134) + Relevant element: Tuple 1: id=134 + Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" + Relevant element: Tuple 2: id=134 + Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" + Relevant element: Tuple 1: typeid=42 + Full ID for 42: @"class;SomeClass" + Relevant element: Tuple 2: typeid=130 + Full ID for 130: @"type;int" + Relevant element: Tuple 1: parentid=132 + Full ID for 132: @"callable;(40).bothFunDiffTypes((42),(130))(130)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}" + Relevant element: Tuple 2: parentid=132 + Full ID for 132: @"callable;(40).bothFunDiffTypes((42),(130))(130)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}" + Relevant element: Tuple 1: sourceid=134 + Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" + Relevant element: Tuple 2: sourceid=134 + Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" +[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): More errors, not displayed. There are at least 7 pairs of tuples not satisfying the key dependency for a relation of size 10480 diff --git a/java/ql/test/kotlin/library-tests/extensions/methodaccesses.expected b/java/ql/test/kotlin/library-tests/extensions/methodaccesses.expected index ba9440a9bc2..e2864ed1fdb 100644 --- a/java/ql/test/kotlin/library-tests/extensions/methodaccesses.expected +++ b/java/ql/test/kotlin/library-tests/extensions/methodaccesses.expected @@ -1,3 +1,5 @@ +| A.java:3:9:3:49 | someFun(...) | A.java:3:9:3:20 | ExtensionsKt | A.java:3:30:3:44 | new SomeClass(...) | +| A.java:3:9:3:49 | someFun(...) | A.java:3:9:3:20 | ExtensionsKt | A.java:3:47:3:48 | "" | | extensions.kt:21:17:21:38 | someClassMethod(...) | extensions.kt:21:5:21:15 | new SomeClass(...) | extensions.kt:21:34:21:36 | foo | | extensions.kt:22:17:22:30 | someFun(...) | extensions.kt:22:17:22:30 | ExtensionsKt | extensions.kt:22:5:22:15 | new SomeClass(...) | | extensions.kt:22:17:22:30 | someFun(...) | extensions.kt:22:17:22:30 | ExtensionsKt | extensions.kt:22:26:22:28 | foo | diff --git a/java/ql/test/kotlin/library-tests/extensions/methods.expected b/java/ql/test/kotlin/library-tests/extensions/methods.expected index 133477a047a..3c2e4114a78 100644 --- a/java/ql/test/kotlin/library-tests/extensions/methods.expected +++ b/java/ql/test/kotlin/library-tests/extensions/methods.expected @@ -1,3 +1,4 @@ +| A.java:2:10:2:15 | method | file://:0:0:0:0 | void | | extensions.kt:3:5:3:38 | someClassMethod | file://:0:0:0:0 | void | | extensions.kt:6:5:6:41 | anotherClassMethod | file://:0:0:0:0 | void | | extensions.kt:9:1:9:36 | someFun | file://:0:0:0:0 | void | diff --git a/java/ql/test/kotlin/library-tests/extensions/parameters.expected b/java/ql/test/kotlin/library-tests/extensions/parameters.expected index 8081534e885..78301a3194e 100644 --- a/java/ql/test/kotlin/library-tests/extensions/parameters.expected +++ b/java/ql/test/kotlin/library-tests/extensions/parameters.expected @@ -1,47 +1,78 @@ parametersWithArgs | extensions.kt:3:25:3:34 | p1 | 0 | extensions.kt:21:34:21:36 | foo | | extensions.kt:6:28:6:37 | p1 | 0 | extensions.kt:25:40:25:42 | foo | +| extensions.kt:9:5:9:13 | | 0 | A.java:3:30:3:44 | new SomeClass(...) | | extensions.kt:9:5:9:13 | | 0 | extensions.kt:22:5:22:15 | new SomeClass(...) | +| extensions.kt:9:23:9:32 | p1 | 0 | A.java:3:30:3:44 | new SomeClass(...) | +| extensions.kt:9:23:9:32 | p1 | 0 | extensions.kt:22:5:22:15 | new SomeClass(...) | +| extensions.kt:9:23:9:32 | p1 | 1 | A.java:3:47:3:48 | "" | | extensions.kt:9:23:9:32 | p1 | 1 | extensions.kt:22:26:22:28 | foo | | extensions.kt:10:5:10:16 | | 0 | extensions.kt:26:5:26:18 | new AnotherClass(...) | +| extensions.kt:10:29:10:38 | p1 | 0 | extensions.kt:26:5:26:18 | new AnotherClass(...) | | extensions.kt:10:29:10:38 | p1 | 1 | extensions.kt:26:32:26:34 | foo | | extensions.kt:12:5:12:13 | | 0 | extensions.kt:23:5:23:15 | new SomeClass(...) | +| extensions.kt:12:23:12:32 | p1 | 0 | extensions.kt:23:5:23:15 | new SomeClass(...) | | extensions.kt:12:23:12:32 | p1 | 1 | extensions.kt:23:26:23:28 | foo | | extensions.kt:13:5:13:16 | | 0 | extensions.kt:27:5:27:18 | new AnotherClass(...) | +| extensions.kt:13:26:13:35 | p1 | 0 | extensions.kt:27:5:27:18 | new AnotherClass(...) | | extensions.kt:13:26:13:35 | p1 | 1 | extensions.kt:27:29:27:31 | foo | | extensions.kt:15:5:15:13 | | 0 | extensions.kt:24:5:24:15 | new SomeClass(...) | +| extensions.kt:15:32:15:38 | p1 | 0 | extensions.kt:24:5:24:15 | new SomeClass(...) | | extensions.kt:15:32:15:38 | p1 | 1 | extensions.kt:24:34:24:34 | 1 | | extensions.kt:16:5:16:16 | | 0 | extensions.kt:28:5:28:18 | new AnotherClass(...) | +| extensions.kt:16:35:16:44 | p1 | 0 | extensions.kt:28:5:28:18 | new AnotherClass(...) | | extensions.kt:16:35:16:44 | p1 | 1 | extensions.kt:28:38:28:40 | foo | | extensions.kt:18:5:18:10 | | 0 | extensions.kt:29:6:29:15 | someString | +| extensions.kt:18:16:18:25 | p1 | 0 | extensions.kt:29:6:29:15 | someString | | extensions.kt:18:16:18:25 | p1 | 1 | extensions.kt:29:23:29:25 | foo | | extensions.kt:30:9:30:14 | | 0 | extensions.kt:31:6:31:15 | someString | | extensions.kt:30:20:30:29 | p1 | 1 | extensions.kt:31:23:31:30 | bazParam | extensionParameter | extensions.kt:9:5:9:13 | | +| extensions.kt:9:23:9:32 | p1 | | extensions.kt:10:5:10:16 | | +| extensions.kt:10:29:10:38 | p1 | | extensions.kt:12:5:12:13 | | +| extensions.kt:12:23:12:32 | p1 | | extensions.kt:13:5:13:16 | | +| extensions.kt:13:26:13:35 | p1 | | extensions.kt:15:5:15:13 | | +| extensions.kt:15:32:15:38 | p1 | | extensions.kt:16:5:16:16 | | +| extensions.kt:16:35:16:44 | p1 | | extensions.kt:18:5:18:10 | | +| extensions.kt:18:16:18:25 | p1 | | extensions.kt:30:9:30:14 | | #select | extensions.kt:3:5:3:38 | someClassMethod | extensions.kt:3:25:3:34 | p1 | 0 | | extensions.kt:6:5:6:41 | anotherClassMethod | extensions.kt:6:28:6:37 | p1 | 0 | | extensions.kt:9:1:9:36 | someFun | extensions.kt:9:5:9:13 | | 0 | +| extensions.kt:9:1:9:36 | someFun | extensions.kt:9:23:9:32 | p1 | 0 | | extensions.kt:9:1:9:36 | someFun | extensions.kt:9:23:9:32 | p1 | 1 | +| extensions.kt:9:1:9:36 | someFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:10:1:10:42 | anotherFun | extensions.kt:10:5:10:16 | | 0 | +| extensions.kt:10:1:10:42 | anotherFun | extensions.kt:10:29:10:38 | p1 | 0 | | extensions.kt:10:1:10:42 | anotherFun | extensions.kt:10:29:10:38 | p1 | 1 | +| extensions.kt:10:1:10:42 | anotherFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:12:1:12:36 | bothFun | extensions.kt:12:5:12:13 | | 0 | +| extensions.kt:12:1:12:36 | bothFun | extensions.kt:12:23:12:32 | p1 | 0 | | extensions.kt:12:1:12:36 | bothFun | extensions.kt:12:23:12:32 | p1 | 1 | +| extensions.kt:12:1:12:36 | bothFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:13:1:13:39 | bothFun | extensions.kt:13:5:13:16 | | 0 | +| extensions.kt:13:1:13:39 | bothFun | extensions.kt:13:26:13:35 | p1 | 0 | | extensions.kt:13:1:13:39 | bothFun | extensions.kt:13:26:13:35 | p1 | 1 | +| extensions.kt:13:1:13:39 | bothFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:15:1:15:57 | bothFunDiffTypes | extensions.kt:15:5:15:13 | | 0 | +| extensions.kt:15:1:15:57 | bothFunDiffTypes | extensions.kt:15:32:15:38 | p1 | 0 | | extensions.kt:15:1:15:57 | bothFunDiffTypes | extensions.kt:15:32:15:38 | p1 | 1 | +| extensions.kt:15:1:15:57 | bothFunDiffTypes | file://:0:0:0:0 | p1 | 1 | | extensions.kt:16:1:16:70 | bothFunDiffTypes | extensions.kt:16:5:16:16 | | 0 | +| extensions.kt:16:1:16:70 | bothFunDiffTypes | extensions.kt:16:35:16:44 | p1 | 0 | | extensions.kt:16:1:16:70 | bothFunDiffTypes | extensions.kt:16:35:16:44 | p1 | 1 | +| extensions.kt:16:1:16:70 | bothFunDiffTypes | file://:0:0:0:0 | p1 | 1 | | extensions.kt:18:1:18:51 | bar | extensions.kt:18:5:18:10 | | 0 | +| extensions.kt:18:1:18:51 | bar | extensions.kt:18:16:18:25 | p1 | 0 | | extensions.kt:18:1:18:51 | bar | extensions.kt:18:16:18:25 | p1 | 1 | +| extensions.kt:18:1:18:51 | bar | file://:0:0:0:0 | p1 | 1 | | extensions.kt:30:5:30:55 | baz | extensions.kt:30:9:30:14 | | 0 | | extensions.kt:30:5:30:55 | baz | extensions.kt:30:20:30:29 | p1 | 1 | From cc92c6517b177e9337b7b62a40a875e6c6bef815 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 10 May 2022 11:13:11 +0200 Subject: [PATCH 31/34] Fix labels of extension function parameters --- .../src/main/kotlin/KotlinUsesExtractor.kt | 19 ++- .../extensions/DB-CHECK.expected | 158 ------------------ .../extensions/parameters.expected | 29 ---- 3 files changed, 12 insertions(+), 194 deletions(-) delete mode 100644 java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 818343adf91..adaf5061e6c 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -1209,15 +1209,20 @@ open class KotlinUsesExtractor( * `parent` is null. */ fun getValueParameterLabel(vp: IrValueParameter, parent: Label?): String { - val parentId = parent ?: useDeclarationParent(vp.parent, false) - val idx = vp.index + val declarationParent = vp.parent + val parentId = parent ?: useDeclarationParent(declarationParent, false) + + val idx = if (declarationParent is IrFunction && declarationParent.extensionReceiverParameter != null) + // For extension functions increase the index to match what the java extractor sees: + vp.index + 1 + else + vp.index + if (idx < 0) { - val p = vp.parent - if (p !is IrFunction || p.extensionReceiverParameter != vp) { - // We're not extracting this and this@TYPE parameters of functions: - logger.error("Unexpected negative index for parameter") - } + // We're not extracting this and this@TYPE parameters of functions: + logger.error("Unexpected negative index for parameter") } + return "@\"params;{$parentId};$idx\"" } diff --git a/java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected b/java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected deleted file mode 100644 index a5762b1bae6..00000000000 --- a/java/ql/test/kotlin/library-tests/extensions/DB-CHECK.expected +++ /dev/null @@ -1,158 +0,0 @@ -[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 2: (87,42,0,44,87) -Tuple 2 in row 4: (90,42,0,44,90) - Relevant element: Tuple 1: id=87 - Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: id=90 - Full ID for 90: @"params;(44);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" - Relevant element: typeid=42 - Full ID for 42: @"class;SomeClass" - Relevant element: parentid=44 - Full ID for 44: @"callable;(40).someFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: Tuple 1: sourceid=87 - Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: sourceid=90 - Full ID for 90: @"params;(44);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" -[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 3: (87,43,1,44,87) -Tuple 2 in row 31: (329,43,1,44,329) - Relevant element: Tuple 1: id=87 - Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: id=329 - Full ID for 329: @"params;(44);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};1" - Relevant element: typeid=43 - Full ID for 43: @"class;java.lang.String" - Relevant element: parentid=44 - Full ID for 44: @"callable;(40).someFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: Tuple 1: sourceid=87 - Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: sourceid=329 - Full ID for 329: @"params;(44);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};1" -[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 6: (99,72,0,97,99) -Tuple 2 in row 7: (102,72,0,97,102) - Relevant element: Tuple 1: id=99 - Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: id=102 - Full ID for 102: @"params;(97);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" - Relevant element: typeid=72 - Full ID for 72: @"class;AnotherClass" - Relevant element: parentid=97 - Full ID for 97: @"callable;(40).anotherFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: Tuple 1: sourceid=99 - Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: sourceid=102 - Full ID for 102: @"params;(97);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" -[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 5: (99,43,1,97,99) -Tuple 2 in row 30: (326,43,1,97,326) - Relevant element: Tuple 1: id=99 - Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: id=326 - Full ID for 326: @"params;(97);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};1" - Relevant element: typeid=43 - Full ID for 43: @"class;java.lang.String" - Relevant element: parentid=97 - Full ID for 97: @"callable;(40).anotherFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: Tuple 1: sourceid=99 - Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: sourceid=326 - Full ID for 326: @"params;(97);1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};1" -[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {parentid, pos} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 0: -Tuple 1 in row 8: (110,42,0,108,110) -Tuple 2 in row 10: (113,42,0,108,113) - Relevant element: Tuple 1: id=110 - Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: id=113 - Full ID for 113: @"params;(108);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" - Relevant element: typeid=42 - Full ID for 42: @"class;SomeClass" - Relevant element: parentid=108 - Full ID for 108: @"callable;(40).bothFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: Tuple 1: sourceid=110 - Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 2: sourceid=113 - Full ID for 113: @"params;(108);-1". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};-1" -[INVALID_KEY_SET] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): More errors, not displayed. There are at least 14 pairs of tuples not satisfying the key dependency for a relation of size 10480 -[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 1: -Tuple 1 in row 2: (87,42,0,44,87) -Tuple 2 in row 3: (87,43,1,44,87) - Relevant element: id=87 - Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 1: typeid=42 - Full ID for 42: @"class;SomeClass" - Relevant element: Tuple 2: typeid=43 - Full ID for 43: @"class;java.lang.String" - Relevant element: parentid=44 - Full ID for 44: @"callable;(40).someFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: sourceid=87 - Full ID for 87: @"params;(44);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.someFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" -[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 1: -Tuple 1 in row 5: (99,43,1,97,99) -Tuple 2 in row 6: (99,72,0,97,99) - Relevant element: id=99 - Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 1: typeid=43 - Full ID for 43: @"class;java.lang.String" - Relevant element: Tuple 2: typeid=72 - Full ID for 72: @"class;AnotherClass" - Relevant element: parentid=97 - Full ID for 97: @"callable;(40).anotherFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: sourceid=99 - Full ID for 99: @"params;(97);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.anotherFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" -[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 1: -Tuple 1 in row 8: (110,42,0,108,110) -Tuple 2 in row 9: (110,43,1,108,110) - Relevant element: id=110 - Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 1: typeid=42 - Full ID for 42: @"class;SomeClass" - Relevant element: Tuple 2: typeid=43 - Full ID for 43: @"class;java.lang.String" - Relevant element: parentid=108 - Full ID for 108: @"callable;(40).bothFun((42),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: sourceid=110 - Full ID for 110: @"params;(108);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;SomeClass"},{@"class;java.lang.String"}){@"type;void"}"};0" -[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 1: -Tuple 1 in row 11: (121,43,1,119,121) -Tuple 2 in row 12: (121,72,0,119,121) - Relevant element: id=121 - Full ID for 121: @"params;(119);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" - Relevant element: Tuple 1: typeid=43 - Full ID for 43: @"class;java.lang.String" - Relevant element: Tuple 2: typeid=72 - Full ID for 72: @"class;AnotherClass" - Relevant element: parentid=119 - Full ID for 119: @"callable;(40).bothFun((72),(43))(16)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}" - Relevant element: sourceid=121 - Full ID for 121: @"params;(119);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFun({@"class;AnotherClass"},{@"class;java.lang.String"}){@"type;void"}"};0" -[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): The key set {id} does not functionally determine all fields. -Here is a pair of tuples that agree on the key set but differ at index 1: -Tuple 1 in row 14: (134,42,0,132,134) -Tuple 2 in row 15: (134,130,1,132,134) - Relevant element: Tuple 1: id=134 - Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" - Relevant element: Tuple 2: id=134 - Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" - Relevant element: Tuple 1: typeid=42 - Full ID for 42: @"class;SomeClass" - Relevant element: Tuple 2: typeid=130 - Full ID for 130: @"type;int" - Relevant element: Tuple 1: parentid=132 - Full ID for 132: @"callable;(40).bothFunDiffTypes((42),(130))(130)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}" - Relevant element: Tuple 2: parentid=132 - Full ID for 132: @"callable;(40).bothFunDiffTypes((42),(130))(130)". The ID may expand to @"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}" - Relevant element: Tuple 1: sourceid=134 - Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" - Relevant element: Tuple 2: sourceid=134 - Full ID for 134: @"params;(132);0". The ID may expand to @"params;{@"callable;{@"class;ExtensionsKt"}.bothFunDiffTypes({@"class;SomeClass"},{@"type;int"}){@"type;int"}"};0" -[INVALID_KEY] predicate params(@param id, @type typeid, int pos, @callable parentid, @param sourceid): More errors, not displayed. There are at least 7 pairs of tuples not satisfying the key dependency for a relation of size 10480 diff --git a/java/ql/test/kotlin/library-tests/extensions/parameters.expected b/java/ql/test/kotlin/library-tests/extensions/parameters.expected index 78301a3194e..5cb7e0986d3 100644 --- a/java/ql/test/kotlin/library-tests/extensions/parameters.expected +++ b/java/ql/test/kotlin/library-tests/extensions/parameters.expected @@ -3,76 +3,47 @@ parametersWithArgs | extensions.kt:6:28:6:37 | p1 | 0 | extensions.kt:25:40:25:42 | foo | | extensions.kt:9:5:9:13 | | 0 | A.java:3:30:3:44 | new SomeClass(...) | | extensions.kt:9:5:9:13 | | 0 | extensions.kt:22:5:22:15 | new SomeClass(...) | -| extensions.kt:9:23:9:32 | p1 | 0 | A.java:3:30:3:44 | new SomeClass(...) | -| extensions.kt:9:23:9:32 | p1 | 0 | extensions.kt:22:5:22:15 | new SomeClass(...) | | extensions.kt:9:23:9:32 | p1 | 1 | A.java:3:47:3:48 | "" | | extensions.kt:9:23:9:32 | p1 | 1 | extensions.kt:22:26:22:28 | foo | | extensions.kt:10:5:10:16 | | 0 | extensions.kt:26:5:26:18 | new AnotherClass(...) | -| extensions.kt:10:29:10:38 | p1 | 0 | extensions.kt:26:5:26:18 | new AnotherClass(...) | | extensions.kt:10:29:10:38 | p1 | 1 | extensions.kt:26:32:26:34 | foo | | extensions.kt:12:5:12:13 | | 0 | extensions.kt:23:5:23:15 | new SomeClass(...) | -| extensions.kt:12:23:12:32 | p1 | 0 | extensions.kt:23:5:23:15 | new SomeClass(...) | | extensions.kt:12:23:12:32 | p1 | 1 | extensions.kt:23:26:23:28 | foo | | extensions.kt:13:5:13:16 | | 0 | extensions.kt:27:5:27:18 | new AnotherClass(...) | -| extensions.kt:13:26:13:35 | p1 | 0 | extensions.kt:27:5:27:18 | new AnotherClass(...) | | extensions.kt:13:26:13:35 | p1 | 1 | extensions.kt:27:29:27:31 | foo | | extensions.kt:15:5:15:13 | | 0 | extensions.kt:24:5:24:15 | new SomeClass(...) | -| extensions.kt:15:32:15:38 | p1 | 0 | extensions.kt:24:5:24:15 | new SomeClass(...) | | extensions.kt:15:32:15:38 | p1 | 1 | extensions.kt:24:34:24:34 | 1 | | extensions.kt:16:5:16:16 | | 0 | extensions.kt:28:5:28:18 | new AnotherClass(...) | -| extensions.kt:16:35:16:44 | p1 | 0 | extensions.kt:28:5:28:18 | new AnotherClass(...) | | extensions.kt:16:35:16:44 | p1 | 1 | extensions.kt:28:38:28:40 | foo | | extensions.kt:18:5:18:10 | | 0 | extensions.kt:29:6:29:15 | someString | -| extensions.kt:18:16:18:25 | p1 | 0 | extensions.kt:29:6:29:15 | someString | | extensions.kt:18:16:18:25 | p1 | 1 | extensions.kt:29:23:29:25 | foo | | extensions.kt:30:9:30:14 | | 0 | extensions.kt:31:6:31:15 | someString | | extensions.kt:30:20:30:29 | p1 | 1 | extensions.kt:31:23:31:30 | bazParam | extensionParameter | extensions.kt:9:5:9:13 | | -| extensions.kt:9:23:9:32 | p1 | | extensions.kt:10:5:10:16 | | -| extensions.kt:10:29:10:38 | p1 | | extensions.kt:12:5:12:13 | | -| extensions.kt:12:23:12:32 | p1 | | extensions.kt:13:5:13:16 | | -| extensions.kt:13:26:13:35 | p1 | | extensions.kt:15:5:15:13 | | -| extensions.kt:15:32:15:38 | p1 | | extensions.kt:16:5:16:16 | | -| extensions.kt:16:35:16:44 | p1 | | extensions.kt:18:5:18:10 | | -| extensions.kt:18:16:18:25 | p1 | | extensions.kt:30:9:30:14 | | #select | extensions.kt:3:5:3:38 | someClassMethod | extensions.kt:3:25:3:34 | p1 | 0 | | extensions.kt:6:5:6:41 | anotherClassMethod | extensions.kt:6:28:6:37 | p1 | 0 | | extensions.kt:9:1:9:36 | someFun | extensions.kt:9:5:9:13 | | 0 | -| extensions.kt:9:1:9:36 | someFun | extensions.kt:9:23:9:32 | p1 | 0 | | extensions.kt:9:1:9:36 | someFun | extensions.kt:9:23:9:32 | p1 | 1 | -| extensions.kt:9:1:9:36 | someFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:10:1:10:42 | anotherFun | extensions.kt:10:5:10:16 | | 0 | -| extensions.kt:10:1:10:42 | anotherFun | extensions.kt:10:29:10:38 | p1 | 0 | | extensions.kt:10:1:10:42 | anotherFun | extensions.kt:10:29:10:38 | p1 | 1 | -| extensions.kt:10:1:10:42 | anotherFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:12:1:12:36 | bothFun | extensions.kt:12:5:12:13 | | 0 | -| extensions.kt:12:1:12:36 | bothFun | extensions.kt:12:23:12:32 | p1 | 0 | | extensions.kt:12:1:12:36 | bothFun | extensions.kt:12:23:12:32 | p1 | 1 | -| extensions.kt:12:1:12:36 | bothFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:13:1:13:39 | bothFun | extensions.kt:13:5:13:16 | | 0 | -| extensions.kt:13:1:13:39 | bothFun | extensions.kt:13:26:13:35 | p1 | 0 | | extensions.kt:13:1:13:39 | bothFun | extensions.kt:13:26:13:35 | p1 | 1 | -| extensions.kt:13:1:13:39 | bothFun | file://:0:0:0:0 | p1 | 1 | | extensions.kt:15:1:15:57 | bothFunDiffTypes | extensions.kt:15:5:15:13 | | 0 | -| extensions.kt:15:1:15:57 | bothFunDiffTypes | extensions.kt:15:32:15:38 | p1 | 0 | | extensions.kt:15:1:15:57 | bothFunDiffTypes | extensions.kt:15:32:15:38 | p1 | 1 | -| extensions.kt:15:1:15:57 | bothFunDiffTypes | file://:0:0:0:0 | p1 | 1 | | extensions.kt:16:1:16:70 | bothFunDiffTypes | extensions.kt:16:5:16:16 | | 0 | -| extensions.kt:16:1:16:70 | bothFunDiffTypes | extensions.kt:16:35:16:44 | p1 | 0 | | extensions.kt:16:1:16:70 | bothFunDiffTypes | extensions.kt:16:35:16:44 | p1 | 1 | -| extensions.kt:16:1:16:70 | bothFunDiffTypes | file://:0:0:0:0 | p1 | 1 | | extensions.kt:18:1:18:51 | bar | extensions.kt:18:5:18:10 | | 0 | -| extensions.kt:18:1:18:51 | bar | extensions.kt:18:16:18:25 | p1 | 0 | | extensions.kt:18:1:18:51 | bar | extensions.kt:18:16:18:25 | p1 | 1 | -| extensions.kt:18:1:18:51 | bar | file://:0:0:0:0 | p1 | 1 | | extensions.kt:30:5:30:55 | baz | extensions.kt:30:9:30:14 | | 0 | | extensions.kt:30:5:30:55 | baz | extensions.kt:30:20:30:29 | p1 | 1 | From e3c2656ef1a50a2060ca7d800501e965526d8de5 Mon Sep 17 00:00:00 2001 From: Tony Torralba Date: Thu, 12 May 2022 09:36:12 +0200 Subject: [PATCH 32/34] Update java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll --- java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll index 48934e00677..ed96ef99f41 100644 --- a/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll +++ b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll @@ -5,9 +5,6 @@ private import semmle.code.java.dataflow.ExternalFlow private class KotlinStdLibSummaryCsv extends SummaryModelCsv { override predicate row(string row) { - row = - [ - "kotlin.jvm.internal;ArrayIteratorKt;false;iterator;(Object[]);;Argument[0].ArrayElement;ReturnValue.Element;value" - ] + row = "kotlin.jvm.internal;ArrayIteratorKt;false;iterator;(Object[]);;Argument[0].ArrayElement;ReturnValue.Element;value" } } From 63dadd88aafffde16b5297135342b978163313f5 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 12 May 2022 12:37:36 +0100 Subject: [PATCH 33/34] Revert "Identify data classes during extraction" This reverts commit a61ba65c9f2182a578a7f4dbdb1c1657197f16cd, pending adding a proper upgrade script for the DB change. --- .../src/main/kotlin/KotlinFileExtractor.kt | 4 ---- java/ql/lib/config/semmlecode.dbscheme | 4 ---- java/ql/lib/semmle/code/java/Type.qll | 7 ------- .../library-tests/data-classes/data_classes.expected | 1 - .../test/kotlin/library-tests/data-classes/data_classes.ql | 5 ----- 5 files changed, 21 deletions(-) delete mode 100644 java/ql/test/kotlin/library-tests/data-classes/data_classes.expected delete mode 100644 java/ql/test/kotlin/library-tests/data-classes/data_classes.ql diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index b20cd37e32b..9a5149a392a 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -397,10 +397,6 @@ open class KotlinFileExtractor( } else if (kind != ClassKind.CLASS && kind != ClassKind.OBJECT) { logger.warnElement("Unrecognised class kind $kind", c) } - - if (c.isData) { - tw.writeKtDataClasses(classId) - } } val locId = tw.getLocation(c) diff --git a/java/ql/lib/config/semmlecode.dbscheme b/java/ql/lib/config/semmlecode.dbscheme index 4d08fc9cb3c..b9225587bc0 100755 --- a/java/ql/lib/config/semmlecode.dbscheme +++ b/java/ql/lib/config/semmlecode.dbscheme @@ -1232,7 +1232,3 @@ ktFunctionOriginalNames( unique int id: @method ref, string name: string ref ) - -ktDataClasses( - unique int id: @class ref -) diff --git a/java/ql/lib/semmle/code/java/Type.qll b/java/ql/lib/semmle/code/java/Type.qll index 1ad46f15640..d2c28f27936 100755 --- a/java/ql/lib/semmle/code/java/Type.qll +++ b/java/ql/lib/semmle/code/java/Type.qll @@ -714,13 +714,6 @@ class CompanionObject extends Class { Field getInstance() { type_companion_object(_, result, this) } } -/** - * A Kotlin data class declaration. - */ -class DataClass extends Class { - DataClass() { ktDataClasses(this) } -} - /** * A record declaration. */ diff --git a/java/ql/test/kotlin/library-tests/data-classes/data_classes.expected b/java/ql/test/kotlin/library-tests/data-classes/data_classes.expected deleted file mode 100644 index 83ca5b96184..00000000000 --- a/java/ql/test/kotlin/library-tests/data-classes/data_classes.expected +++ /dev/null @@ -1 +0,0 @@ -| dc.kt:1:1:1:71 | ProtoMapValue | diff --git a/java/ql/test/kotlin/library-tests/data-classes/data_classes.ql b/java/ql/test/kotlin/library-tests/data-classes/data_classes.ql deleted file mode 100644 index f42d9f76602..00000000000 --- a/java/ql/test/kotlin/library-tests/data-classes/data_classes.ql +++ /dev/null @@ -1,5 +0,0 @@ -import java - -from DataClass c -where c.fromSource() -select c From 5ec9390482605afd0c580d32a2da1f8d388a722b Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 12 May 2022 13:22:18 +0100 Subject: [PATCH 34/34] Autoformat --- java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll index ed96ef99f41..63cdb87acdf 100644 --- a/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll +++ b/java/ql/lib/semmle/code/java/frameworks/KotlinStdLib.qll @@ -5,6 +5,7 @@ private import semmle.code.java.dataflow.ExternalFlow private class KotlinStdLibSummaryCsv extends SummaryModelCsv { override predicate row(string row) { - row = "kotlin.jvm.internal;ArrayIteratorKt;false;iterator;(Object[]);;Argument[0].ArrayElement;ReturnValue.Element;value" + row = + "kotlin.jvm.internal;ArrayIteratorKt;false;iterator;(Object[]);;Argument[0].ArrayElement;ReturnValue.Element;value" } }