diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt index 4501fb2caf4..0f0fc619efe 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/KotlinUtils.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.psi2ir import com.intellij.psi.PsiElement +import com.intellij.psi.tree.TokenSet import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.incremental.components.NoLookupLocation @@ -32,7 +33,6 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils -import java.lang.Exception fun KotlinType.containsNull() = TypeUtils.isNullableType(this) @@ -84,4 +84,6 @@ val PropertyDescriptor.unwrappedSetMethod: FunctionDescriptor? get() = if (this is SyntheticPropertyDescriptor) this.setMethod else setter val KtPureElement?.pureStartOffsetOrUndefined get() = this?.psiOrParent?.startOffsetSkippingComments ?: UNDEFINED_OFFSET -val KtPureElement?.pureEndOffsetOrUndefined get() = this?.psiOrParent?.endOffset ?: UNDEFINED_OFFSET \ No newline at end of file +val KtPureElement?.pureEndOffsetOrUndefined get() = this?.psiOrParent?.endOffset ?: UNDEFINED_OFFSET + +fun KtElement.getChildTokenStartOffsetOrNull(tokenSet: TokenSet) = node.findChildByType(tokenSet)?.startOffset \ No newline at end of file diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt index 5ee38eef0b3..4a1f76bb84d 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt @@ -54,7 +54,7 @@ class ClassGenerator( fun generateClass(ktClassOrObject: KtPureClassOrObject): IrClass { val classDescriptor = ktClassOrObject.findClassDescriptor(this.context.bindingContext) - val startOffset = ktClassOrObject.pureStartOffset + val startOffset = ktClassOrObject.getStartOffsetOfClassDeclarationKeywordOrNull() ?: ktClassOrObject.pureStartOffset val endOffset = ktClassOrObject.pureEndOffset return context.symbolTable.declareClass( @@ -138,7 +138,7 @@ class ClassGenerator( val superType = getOrFail(BindingContext.TYPE, ktEntry.typeReference!!) val superTypeConstructorDescriptor = superType.constructor.declarationDescriptor val superClass = superTypeConstructorDescriptor as? ClassDescriptor - ?: throw AssertionError("Unexpected supertype constructor for delegation: $superTypeConstructorDescriptor") + ?: throw AssertionError("Unexpected supertype constructor for delegation: $superTypeConstructorDescriptor") val delegateDescriptor = IrImplementingDelegateDescriptorImpl(irClass.descriptor, delegateType, superType) val irDelegateField = context.symbolTable.declareField( ktDelegateExpression.startOffsetSkippingComments, ktDelegateExpression.endOffset, diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt index 87433b15bfc..c8cdca454e8 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/FunctionGenerator.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrBlockBody import org.jetbrains.kotlin.ir.expressions.IrBody @@ -24,13 +25,9 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.util.declareSimpleFunctionWithOverrides import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.pureEndOffset import org.jetbrains.kotlin.psi.psiUtil.pureStartOffset -import org.jetbrains.kotlin.psi.psiUtil.startOffsetSkippingComments import org.jetbrains.kotlin.psi2ir.isConstructorDelegatingToSuper -import org.jetbrains.kotlin.psi2ir.pureEndOffsetOrUndefined -import org.jetbrains.kotlin.psi2ir.pureStartOffsetOrUndefined import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.resolve.DescriptorUtils @@ -83,7 +80,9 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio origin: IrDeclarationOrigin ): IrSimpleFunction = context.symbolTable.declareSimpleFunctionWithOverrides( - ktElement.pureStartOffset, ktElement.pureEndOffset, origin, + ktElement.getStartOffsetOfFunctionDeclarationKeywordOrNull() ?: ktElement.pureStartOffset, + ktElement.pureEndOffset, + origin, descriptor ) @@ -115,7 +114,7 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio if (ktBodyExpression != null) createBodyGenerator(irAccessor.symbol).generateFunctionBody(ktBodyExpression) else - generateDefaultAccessorBody(ktProperty, descriptor, irAccessor) + generateDefaultAccessorBody(descriptor, irAccessor) } fun generateDefaultAccessorForPrimaryConstructorParameter( @@ -126,31 +125,33 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio declarationGenerator.generateScopedTypeParameterDeclarations(irAccessor, descriptor.typeParameters) irAccessor.returnType = descriptor.returnType!!.toIrType() FunctionGenerator(declarationGenerator).generateSyntheticFunctionParameterDeclarations(irAccessor) - irAccessor.body = generateDefaultAccessorBody(ktParameter, descriptor, irAccessor) + irAccessor.body = generateDefaultAccessorBody(descriptor, irAccessor) } - private fun generateDefaultAccessorBody(ktProperty: KtElement, accessor: PropertyAccessorDescriptor, irAccessor: IrSimpleFunction) = + private fun generateDefaultAccessorBody( + accessor: PropertyAccessorDescriptor, + irAccessor: IrSimpleFunction + ) = if (accessor.modality == Modality.ABSTRACT) null else when (accessor) { - is PropertyGetterDescriptor -> generateDefaultGetterBody(ktProperty, accessor, irAccessor) - is PropertySetterDescriptor -> generateDefaultSetterBody(ktProperty, accessor, irAccessor) + is PropertyGetterDescriptor -> generateDefaultGetterBody(accessor, irAccessor) + is PropertySetterDescriptor -> generateDefaultSetterBody(accessor, irAccessor) else -> throw AssertionError("Should be getter or setter: $accessor") } private fun generateDefaultGetterBody( - ktProperty: KtElement, getter: PropertyGetterDescriptor, irAccessor: IrSimpleFunction ): IrBlockBody { val property = getter.correspondingProperty - val startOffset = ktProperty.startOffsetSkippingComments - val endOffset = ktProperty.endOffset + val startOffset = irAccessor.startOffset + val endOffset = irAccessor.endOffset val irBody = IrBlockBodyImpl(startOffset, endOffset) - val receiver = generateReceiverExpressionForDefaultPropertyAccessor(ktProperty, property) + val receiver = generateReceiverExpressionForDefaultPropertyAccessor(property, irAccessor) irBody.statements.add( IrReturnImpl( @@ -168,17 +169,16 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio } private fun generateDefaultSetterBody( - ktProperty: KtElement, setter: PropertySetterDescriptor, irAccessor: IrSimpleFunction ): IrBlockBody { val property = setter.correspondingProperty - val startOffset = ktProperty.startOffsetSkippingComments - val endOffset = ktProperty.endOffset + val startOffset = irAccessor.startOffset + val endOffset = irAccessor.endOffset val irBody = IrBlockBodyImpl(startOffset, endOffset) - val receiver = generateReceiverExpressionForDefaultPropertyAccessor(ktProperty, property) + val receiver = generateReceiverExpressionForDefaultPropertyAccessor(property, irAccessor) val irValueParameter = irAccessor.valueParameters.single() irBody.statements.add( @@ -193,13 +193,16 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio return irBody } - private fun generateReceiverExpressionForDefaultPropertyAccessor(ktProperty: KtElement, property: PropertyDescriptor): IrExpression? { + private fun generateReceiverExpressionForDefaultPropertyAccessor( + property: PropertyDescriptor, + irAccessor: IrSimpleFunction + ): IrExpression? { val containingDeclaration = property.containingDeclaration return when (containingDeclaration) { is ClassDescriptor -> { val thisAsReceiverParameter = containingDeclaration.thisAsReceiverParameter IrGetValueImpl( - ktProperty.startOffsetSkippingComments, ktProperty.endOffset, + irAccessor.startOffset, irAccessor.endOffset, thisAsReceiverParameter.type.toIrType(), context.symbolTable.referenceValue(thisAsReceiverParameter) ) @@ -246,7 +249,9 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio generateBody: BodyGenerator.() -> IrBody? ): IrConstructor = context.symbolTable.declareConstructor( - ktConstructorElement.pureStartOffset, ktConstructorElement.pureEndOffset, IrDeclarationOrigin.DEFINED, + ktConstructorElement.getStartOffsetOfConstructorDeclarationKeywordOrNull() ?: ktConstructorElement.pureStartOffset, + ktConstructorElement.pureEndOffset, + IrDeclarationOrigin.DEFINED, constructorDescriptor ).buildWithScope { irConstructor -> generateValueParameterDeclarations(irConstructor, ktParametersElement, null) @@ -268,17 +273,17 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio val functionDescriptor = irFunction.descriptor irFunction.dispatchReceiverParameter = functionDescriptor.dispatchReceiverParameter?.let { - generateReceiverParameterDeclaration(it, ktParameterOwner) + generateReceiverParameterDeclaration(it, ktParameterOwner, irFunction) } irFunction.extensionReceiverParameter = functionDescriptor.extensionReceiverParameter?.let { - generateReceiverParameterDeclaration(it, ktReceiverParameterElement ?: ktParameterOwner) + generateReceiverParameterDeclaration(it, ktReceiverParameterElement ?: ktParameterOwner, irFunction) } val bodyGenerator = createBodyGenerator(irFunction.symbol) functionDescriptor.valueParameters.mapTo(irFunction.valueParameters) { valueParameterDescriptor -> val ktParameter = DescriptorToSourceUtils.getSourceFromDescriptor(valueParameterDescriptor) as? KtParameter - generateValueParameterDeclaration(valueParameterDescriptor, ktParameter, bodyGenerator, withDefaultValues) + generateValueParameterDeclaration(valueParameterDescriptor, ktParameter, bodyGenerator, withDefaultValues, irFunction) } } @@ -286,11 +291,12 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio valueParameterDescriptor: ValueParameterDescriptor, ktParameter: KtParameter?, bodyGenerator: BodyGenerator, - withDefaultValues: Boolean + withDefaultValues: Boolean, + irOwnerElement: IrElement ): IrValueParameter = - declareParameter(valueParameterDescriptor, ktParameter).also { + declareParameter(valueParameterDescriptor, ktParameter, irOwnerElement).also { irValueParameter -> if (withDefaultValues) { - it.defaultValue = ktParameter?.defaultValue?.let { + irValueParameter.defaultValue = ktParameter?.defaultValue?.let { bodyGenerator.generateExpressionBody(it) } } @@ -298,13 +304,15 @@ class FunctionGenerator(declarationGenerator: DeclarationGenerator) : Declaratio private fun generateReceiverParameterDeclaration( receiverParameterDescriptor: ReceiverParameterDescriptor, - ktElement: KtPureElement? + ktElement: KtPureElement?, + irOwnerElement: IrElement ): IrValueParameter = - declareParameter(receiverParameterDescriptor, ktElement) + declareParameter(receiverParameterDescriptor, ktElement, irOwnerElement) - private fun declareParameter(descriptor: ParameterDescriptor, ktElement: KtPureElement?) = + private fun declareParameter(descriptor: ParameterDescriptor, ktElement: KtPureElement?, irOwnerElement: IrElement) = context.symbolTable.declareValueParameter( - ktElement.pureStartOffsetOrUndefined, ktElement.pureEndOffsetOrUndefined, + ktElement?.pureStartOffset ?: irOwnerElement.startOffset, + ktElement?.pureEndOffset ?: irOwnerElement.endOffset, IrDeclarationOrigin.DEFINED, descriptor, descriptor.type.toIrType(), (descriptor as? ValueParameterDescriptor)?.varargElementType?.toIrType() diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/declarationStartOffset.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/declarationStartOffset.kt new file mode 100644 index 00000000000..f3e0ba65c89 --- /dev/null +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/declarationStartOffset.kt @@ -0,0 +1,47 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.psi2ir.generators + +import com.intellij.psi.tree.TokenSet +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi2ir.getChildTokenStartOffsetOrNull + +private val FUNCTION_DECL_TOKENS = TokenSet.create(KtTokens.FUN_KEYWORD) +private val ACCESSOR_DECL_TOKENS = TokenSet.create(KtTokens.GET_KEYWORD, KtTokens.SET_KEYWORD) +private val PROPERTY_DECL_TOKENS = TokenSet.create(KtTokens.VAL_KEYWORD, KtTokens.VAR_KEYWORD) +private val CLASS_DECL_TOKENS = TokenSet.create(KtTokens.CLASS_KEYWORD, KtTokens.INTERFACE_KEYWORD) +private val CONSTRUCTOR_DECL_TOKENS = TokenSet.create(KtTokens.CONSTRUCTOR_KEYWORD) + +internal fun KtPureElement.getStartOffsetOfFunctionDeclarationKeywordOrNull(): Int? = + when (this) { + is KtNamedFunction -> getChildTokenStartOffsetOrNull(FUNCTION_DECL_TOKENS) + is KtPropertyAccessor -> getChildTokenStartOffsetOrNull(ACCESSOR_DECL_TOKENS) + is KtProperty -> getChildTokenStartOffsetOrNull(PROPERTY_DECL_TOKENS) + is KtParameter -> getChildTokenStartOffsetOrNull(PROPERTY_DECL_TOKENS) + is KtClassOrObject -> getChildTokenStartOffsetOrNull(CLASS_DECL_TOKENS) + else -> null + } + +internal fun KtPureClassOrObject.getStartOffsetOfClassDeclarationKeywordOrNull(): Int? = + when (this) { + is KtClassOrObject -> getChildTokenStartOffsetOrNull(CLASS_DECL_TOKENS) + else -> null + } + +internal fun KtPureElement.getStartOffsetOfConstructorDeclarationKeywordOrNull(): Int? = + when (this) { + is KtPrimaryConstructor -> getChildTokenStartOffsetOrNull(CONSTRUCTOR_DECL_TOKENS) + + is KtSecondaryConstructor -> getChildTokenStartOffsetOrNull(CONSTRUCTOR_DECL_TOKENS) + + is KtClassOrObject -> + primaryConstructor?.getStartOffsetOfConstructorDeclarationKeywordOrNull() + ?: getChildTokenStartOffsetOrNull(CONSTRUCTOR_DECL_TOKENS) + ?: getChildTokenStartOffsetOrNull(CLASS_DECL_TOKENS) + + else -> null + } \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/augmentedAssignmentWithExpression.txt b/compiler/testData/ir/sourceRanges/augmentedAssignmentWithExpression.txt index 306e111ae89..784329f7a23 100644 --- a/compiler/testData/ir/sourceRanges/augmentedAssignmentWithExpression.txt +++ b/compiler/testData/ir/sourceRanges/augmentedAssignmentWithExpression.txt @@ -5,7 +5,7 @@ @2:0..8:1 BLOCK_BODY @2:0..8:1 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' @2:0..8:1 INSTANCE_INITIALIZER_CALL classDescriptor='Host' - @3:4..38 FUN name:plusAssign visibility:public modality:FINAL <> ($this:test.Host, x:kotlin.Int) returnType:kotlin.Unit flags: + @3:13..38 FUN name:plusAssign visibility:public modality:FINAL <> ($this:test.Host, x:kotlin.Int) returnType:kotlin.Unit flags: @3:4..38 VALUE_PARAMETER name: type:test.Host flags: @3:28..34 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: @3:36..38 BLOCK_BODY @@ -17,7 +17,7 @@ @6:16..17 CONST Int type=kotlin.Int value=1 @2:0..8:1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: @2:0..8:1 VALUE_PARAMETER name: type:kotlin.Any flags: - @-1:-1..-1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @2:0..8:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: @2:0..8:1 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: @2:0..8:1 VALUE_PARAMETER name: type:kotlin.Any flags: @2:0..8:1 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: diff --git a/compiler/testData/ir/sourceRanges/comments.txt b/compiler/testData/ir/sourceRanges/comments.txt index ba2e9c3590b..517510d5724 100644 --- a/compiler/testData/ir/sourceRanges/comments.txt +++ b/compiler/testData/ir/sourceRanges/comments.txt @@ -5,22 +5,22 @@ @1:0..33:1 BLOCK_BODY @1:0..33:1 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' @1:0..33:1 INSTANCE_INITIALIZER_CALL classDescriptor='Foo' - @8:4..10:36 CLASS CLASS name:Inner modality:FINAL visibility:public flags:inner superTypes:[kotlin.Any] - @8:4..10:36 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Foo.Inner flags: - @8:4..10:36 CONSTRUCTOR visibility:private <> ($this:Foo, x:kotlin.Int) returnType:Foo.Inner flags:primary + @8:10..10:36 CLASS CLASS name:Inner modality:FINAL visibility:public flags:inner superTypes:[kotlin.Any] + @8:10..10:36 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Foo.Inner flags: + @8:60..10:36 CONSTRUCTOR visibility:private <> ($this:Foo, x:kotlin.Int) returnType:Foo.Inner flags:primary @8:52..79 VALUE_PARAMETER name: type:Foo flags: @8:72..78 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: @8:4..10:36 BLOCK_BODY @8:4..10:36 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' @8:4..10:36 INSTANCE_INITIALIZER_CALL classDescriptor='Inner' - @8:4..10:36 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @8:10..10:36 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: @8:4..10:36 VALUE_PARAMETER name: type:kotlin.Any flags: - @-1:-1..-1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: - @8:4..10:36 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @8:10..10:36 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @8:10..10:36 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: @8:4..10:36 VALUE_PARAMETER name: type:kotlin.Any flags: - @8:4..10:36 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @8:10..10:36 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: @8:4..10:36 VALUE_PARAMETER name: type:kotlin.Any flags: - @18:4..20:39 FUN name:foo visibility:protected modality:OPEN <> ($this:Foo, y:kotlin.Int) returnType:kotlin.Unit flags: + @18:19..20:39 FUN name:foo visibility:protected modality:OPEN <> ($this:Foo, y:kotlin.Int) returnType:kotlin.Unit flags: @18:4..20:39 VALUE_PARAMETER name: type:Foo flags: @18:27..33 VALUE_PARAMETER name:y index:0 type:kotlin.Int flags: @18:35..20:39 BLOCK_BODY @@ -44,7 +44,7 @@ @31:38..40 CONST Int type=kotlin.Int value=42 @1:0..33:1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: @1:0..33:1 VALUE_PARAMETER name: type:kotlin.Any flags: - @-1:-1..-1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @1:0..33:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: @1:0..33:1 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: @1:0..33:1 VALUE_PARAMETER name: type:kotlin.Any flags: @1:0..33:1 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: diff --git a/compiler/testData/ir/sourceRanges/declarations/classFuns.kt b/compiler/testData/ir/sourceRanges/declarations/classFuns.kt new file mode 100644 index 00000000000..f4909ee11f8 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/classFuns.kt @@ -0,0 +1,24 @@ +package test + + +class Test { + + fun test0() {} + + + /** + * block comment + */ + fun test1() {} + + + @Suppress( + "UNUSED_VARIABLE" + ) + fun test2() {} + + + private + fun test3() {} + +} \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/classFuns.txt b/compiler/testData/ir/sourceRanges/declarations/classFuns.txt new file mode 100644 index 00000000000..9fdcaeaa55f --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/classFuns.txt @@ -0,0 +1,26 @@ +@0:0..23:1 FILE fqName:test fileName:/classFuns.kt + @3:0..23:1 CLASS CLASS name:Test modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @3:0..23:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:test.Test flags: + @3:0..23:1 CONSTRUCTOR visibility:public <> () returnType:test.Test flags:primary + @3:0..23:1 BLOCK_BODY + @3:0..23:1 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @3:0..23:1 INSTANCE_INITIALIZER_CALL classDescriptor='Test' + @5:4..18 FUN name:test0 visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Unit flags: + @5:4..18 VALUE_PARAMETER name: type:test.Test flags: + @5:16..18 BLOCK_BODY + @11:4..18 FUN name:test1 visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Unit flags: + @11:4..18 VALUE_PARAMETER name: type:test.Test flags: + @11:16..18 BLOCK_BODY + @17:4..18 FUN name:test2 visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Unit flags: + @14:4..17:18 VALUE_PARAMETER name: type:test.Test flags: + @17:16..18 BLOCK_BODY + @21:4..18 FUN name:test3 visibility:private modality:FINAL <> ($this:test.Test) returnType:kotlin.Unit flags: + @20:4..21:18 VALUE_PARAMETER name: type:test.Test flags: + @21:16..18 BLOCK_BODY + @3:0..23:1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @3:0..23:1 VALUE_PARAMETER name: type:kotlin.Any flags: + @3:0..23:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @3:0..23:1 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @3:0..23:1 VALUE_PARAMETER name: type:kotlin.Any flags: + @3:0..23:1 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @3:0..23:1 VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/testData/ir/sourceRanges/declarations/classProperties.kt b/compiler/testData/ir/sourceRanges/declarations/classProperties.kt new file mode 100644 index 00000000000..e50c4bcecc5 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/classProperties.kt @@ -0,0 +1,78 @@ +package test + +class Test { + + val test0 = 42 + + + /** + * comment + */ + val test1 = 42 + + + @Suppress( + "UNUSED_VARIABLE" + ) + val test2 = 42 + + + private + val test3 = 42 + + + val test4 get() = 42 + + + val test5 + get() = 42 + + + val test6 + /** + * comment + */ + get() = 42 + + + val test7 + @Suppress( + "UNUSED_VARIABLE" + ) + get() = 42 + + + var test8 = 42 + + + var test9 = 42; private set + + + var test10 = 42 + private set + + + var test11 = 42 + set(value) { + field = value + } + + + var test12 = 42 + /** + * comment + */ + set(value) { + field = value + } + + + var test13 = 42 + @Suppress( + "UNUSED_VARIABLE" + ) + set(value) { + field = value + } + +} \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/classProperties.txt b/compiler/testData/ir/sourceRanges/declarations/classProperties.txt new file mode 100644 index 00000000000..496f62f7fbe --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/classProperties.txt @@ -0,0 +1,180 @@ +@0:0..77:1 FILE fqName:test fileName:/classProperties.kt + @2:0..77:1 CLASS CLASS name:Test modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @2:0..77:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:test.Test flags: + @2:0..77:1 CONSTRUCTOR visibility:public <> () returnType:test.Test flags:primary + @2:0..77:1 BLOCK_BODY + @2:0..77:1 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @2:0..77:1 INSTANCE_INITIALIZER_CALL classDescriptor='Test' + @4:4..18 PROPERTY name:test0 visibility:public modality:FINAL flags:val + @4:4..18 FIELD PROPERTY_BACKING_FIELD name:test0 type:kotlin.Int visibility:public flags:final + @4:16..18 EXPRESSION_BODY + @4:16..18 CONST Int type=kotlin.Int value=42 + @4:4..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @4:4..18 VALUE_PARAMETER name: type:test.Test flags: + @4:4..18 BLOCK_BODY + @4:4..18 RETURN type=kotlin.Nothing from='(): Int' + @4:4..18 GET_FIELD 'test0: Int' type=kotlin.Int origin=null + @4:4..18 GET_VAR 'this@Test: Test' type=test.Test origin=null + @10:4..18 PROPERTY name:test1 visibility:public modality:FINAL flags:val + @10:4..18 FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Int visibility:public flags:final + @10:16..18 EXPRESSION_BODY + @10:16..18 CONST Int type=kotlin.Int value=42 + @10:4..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @10:4..18 VALUE_PARAMETER name: type:test.Test flags: + @10:4..18 BLOCK_BODY + @10:4..18 RETURN type=kotlin.Nothing from='(): Int' + @10:4..18 GET_FIELD 'test1: Int' type=kotlin.Int origin=null + @10:4..18 GET_VAR 'this@Test: Test' type=test.Test origin=null + @13:4..16:18 PROPERTY name:test2 visibility:public modality:FINAL flags:val + @13:4..16:18 FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Int visibility:public flags:final + @16:16..18 EXPRESSION_BODY + @16:16..18 CONST Int type=kotlin.Int value=42 + @16:4..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @13:4..16:18 VALUE_PARAMETER name: type:test.Test flags: + @16:4..18 BLOCK_BODY + @16:4..18 RETURN type=kotlin.Nothing from='(): Int' + @16:4..18 GET_FIELD 'test2: Int' type=kotlin.Int origin=null + @16:4..18 GET_VAR 'this@Test: Test' type=test.Test origin=null + @19:4..20:18 PROPERTY name:test3 visibility:private modality:FINAL flags:val + @19:4..20:18 FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Int visibility:private flags:final + @20:16..18 EXPRESSION_BODY + @20:16..18 CONST Int type=kotlin.Int value=42 + @20:4..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @19:4..20:18 VALUE_PARAMETER name: type:test.Test flags: + @20:4..18 BLOCK_BODY + @20:4..18 RETURN type=kotlin.Nothing from='(): Int' + @20:4..18 GET_FIELD 'test3: Int' type=kotlin.Int origin=null + @20:4..18 GET_VAR 'this@Test: Test' type=test.Test origin=null + @23:4..24 PROPERTY name:test4 visibility:public modality:FINAL flags:val + @23:14..24 FUN name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @23:14..24 VALUE_PARAMETER name: type:test.Test flags: + @23:22..24 BLOCK_BODY + @23:22..24 RETURN type=kotlin.Nothing from='(): Int' + @23:22..24 CONST Int type=kotlin.Int value=42 + @26:4..27:18 PROPERTY name:test5 visibility:public modality:FINAL flags:val + @27:8..18 FUN name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @27:8..18 VALUE_PARAMETER name: type:test.Test flags: + @27:16..18 BLOCK_BODY + @27:16..18 RETURN type=kotlin.Nothing from='(): Int' + @27:16..18 CONST Int type=kotlin.Int value=42 + @30:4..34:18 PROPERTY name:test6 visibility:public modality:FINAL flags:val + @34:8..18 FUN name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @34:8..18 VALUE_PARAMETER name: type:test.Test flags: + @34:16..18 BLOCK_BODY + @34:16..18 RETURN type=kotlin.Nothing from='(): Int' + @34:16..18 CONST Int type=kotlin.Int value=42 + @37:4..41:18 PROPERTY name:test7 visibility:public modality:FINAL flags:val + @41:8..18 FUN name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @38:8..41:18 VALUE_PARAMETER name: type:test.Test flags: + @41:16..18 BLOCK_BODY + @41:16..18 RETURN type=kotlin.Nothing from='(): Int' + @41:16..18 CONST Int type=kotlin.Int value=42 + @44:4..18 PROPERTY name:test8 visibility:public modality:FINAL flags:var + @44:4..18 FIELD PROPERTY_BACKING_FIELD name:test8 type:kotlin.Int visibility:public flags: + @44:16..18 EXPRESSION_BODY + @44:16..18 CONST Int type=kotlin.Int value=42 + @44:4..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @44:4..18 VALUE_PARAMETER name: type:test.Test flags: + @44:4..18 BLOCK_BODY + @44:4..18 RETURN type=kotlin.Nothing from='(): Int' + @44:4..18 GET_FIELD 'test8: Int' type=kotlin.Int origin=null + @44:4..18 GET_VAR 'this@Test: Test' type=test.Test origin=null + @44:4..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test, :kotlin.Int) returnType:kotlin.Unit flags: + @44:4..18 VALUE_PARAMETER name: type:test.Test flags: + @44:4..18 VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + @44:4..18 BLOCK_BODY + @44:4..18 SET_FIELD 'test8: Int' type=kotlin.Unit origin=null + @44:4..18 GET_VAR 'this@Test: Test' type=test.Test origin=null + @44:4..18 GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + @47:4..31 PROPERTY name:test9 visibility:public modality:FINAL flags:var + @47:4..31 FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.Int visibility:public flags: + @47:16..18 EXPRESSION_BODY + @47:16..18 CONST Int type=kotlin.Int value=42 + @47:4..31 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @47:4..31 VALUE_PARAMETER name: type:test.Test flags: + @47:4..31 BLOCK_BODY + @47:4..31 RETURN type=kotlin.Nothing from='(): Int' + @47:4..31 GET_FIELD 'test9: Int' type=kotlin.Int origin=null + @47:4..31 GET_VAR 'this@Test: Test' type=test.Test origin=null + @47:28..31 FUN name: visibility:private modality:FINAL <> ($this:test.Test, :kotlin.Int) returnType:kotlin.Unit flags: + @47:20..31 VALUE_PARAMETER name: type:test.Test flags: + @47:28..31 VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + @47:28..31 BLOCK_BODY + @47:28..31 SET_FIELD 'test9: Int' type=kotlin.Unit origin=null + @47:28..31 GET_VAR 'this@Test: Test' type=test.Test origin=null + @47:28..31 GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + @50:4..51:19 PROPERTY name:test10 visibility:public modality:FINAL flags:var + @50:4..51:19 FIELD PROPERTY_BACKING_FIELD name:test10 type:kotlin.Int visibility:public flags: + @50:17..19 EXPRESSION_BODY + @50:17..19 CONST Int type=kotlin.Int value=42 + @50:4..51:19 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @50:4..51:19 VALUE_PARAMETER name: type:test.Test flags: + @50:4..51:19 BLOCK_BODY + @50:4..51:19 RETURN type=kotlin.Nothing from='(): Int' + @50:4..51:19 GET_FIELD 'test10: Int' type=kotlin.Int origin=null + @50:4..51:19 GET_VAR 'this@Test: Test' type=test.Test origin=null + @51:16..19 FUN name: visibility:private modality:FINAL <> ($this:test.Test, :kotlin.Int) returnType:kotlin.Unit flags: + @51:8..19 VALUE_PARAMETER name: type:test.Test flags: + @51:16..19 VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + @51:16..19 BLOCK_BODY + @51:16..19 SET_FIELD 'test10: Int' type=kotlin.Unit origin=null + @51:16..19 GET_VAR 'this@Test: Test' type=test.Test origin=null + @51:16..19 GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + @54:4..57:9 PROPERTY name:test11 visibility:public modality:FINAL flags:var + @54:4..57:9 FIELD PROPERTY_BACKING_FIELD name:test11 type:kotlin.Int visibility:public flags: + @54:17..19 EXPRESSION_BODY + @54:17..19 CONST Int type=kotlin.Int value=42 + @54:4..57:9 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @54:4..57:9 VALUE_PARAMETER name: type:test.Test flags: + @54:4..57:9 BLOCK_BODY + @54:4..57:9 RETURN type=kotlin.Nothing from='(): Int' + @54:4..57:9 GET_FIELD 'test11: Int' type=kotlin.Int origin=null + @54:4..57:9 GET_VAR 'this@Test: Test' type=test.Test origin=null + @55:8..57:9 FUN name: visibility:public modality:FINAL <> ($this:test.Test, value:kotlin.Int) returnType:kotlin.Unit flags: + @55:8..57:9 VALUE_PARAMETER name: type:test.Test flags: + @55:12..17 VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + @55:19..57:9 BLOCK_BODY + @56:12..17 SET_FIELD 'test11: Int' type=kotlin.Unit origin=EQ + @56:12..17 GET_VAR 'this@Test: Test' type=test.Test origin=null + @56:20..25 GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null + @60:4..66:9 PROPERTY name:test12 visibility:public modality:FINAL flags:var + @60:4..66:9 FIELD PROPERTY_BACKING_FIELD name:test12 type:kotlin.Int visibility:public flags: + @60:17..19 EXPRESSION_BODY + @60:17..19 CONST Int type=kotlin.Int value=42 + @60:4..66:9 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @60:4..66:9 VALUE_PARAMETER name: type:test.Test flags: + @60:4..66:9 BLOCK_BODY + @60:4..66:9 RETURN type=kotlin.Nothing from='(): Int' + @60:4..66:9 GET_FIELD 'test12: Int' type=kotlin.Int origin=null + @60:4..66:9 GET_VAR 'this@Test: Test' type=test.Test origin=null + @64:8..66:9 FUN name: visibility:public modality:FINAL <> ($this:test.Test, value:kotlin.Int) returnType:kotlin.Unit flags: + @64:8..66:9 VALUE_PARAMETER name: type:test.Test flags: + @64:12..17 VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + @64:19..66:9 BLOCK_BODY + @65:12..17 SET_FIELD 'test12: Int' type=kotlin.Unit origin=EQ + @65:12..17 GET_VAR 'this@Test: Test' type=test.Test origin=null + @65:20..25 GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null + @69:4..75:9 PROPERTY name:test13 visibility:public modality:FINAL flags:var + @69:4..75:9 FIELD PROPERTY_BACKING_FIELD name:test13 type:kotlin.Int visibility:public flags: + @69:17..19 EXPRESSION_BODY + @69:17..19 CONST Int type=kotlin.Int value=42 + @69:4..75:9 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:test.Test) returnType:kotlin.Int flags: + @69:4..75:9 VALUE_PARAMETER name: type:test.Test flags: + @69:4..75:9 BLOCK_BODY + @69:4..75:9 RETURN type=kotlin.Nothing from='(): Int' + @69:4..75:9 GET_FIELD 'test13: Int' type=kotlin.Int origin=null + @69:4..75:9 GET_VAR 'this@Test: Test' type=test.Test origin=null + @73:8..75:9 FUN name: visibility:public modality:FINAL <> ($this:test.Test, value:kotlin.Int) returnType:kotlin.Unit flags: + @70:8..75:9 VALUE_PARAMETER name: type:test.Test flags: + @73:12..17 VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + @73:19..75:9 BLOCK_BODY + @74:12..17 SET_FIELD 'test13: Int' type=kotlin.Unit origin=EQ + @74:12..17 GET_VAR 'this@Test: Test' type=test.Test origin=null + @74:20..25 GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null + @2:0..77:1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @2:0..77:1 VALUE_PARAMETER name: type:kotlin.Any flags: + @2:0..77:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @2:0..77:1 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @2:0..77:1 VALUE_PARAMETER name: type:kotlin.Any flags: + @2:0..77:1 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @2:0..77:1 VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/testData/ir/sourceRanges/declarations/classes.kt b/compiler/testData/ir/sourceRanges/declarations/classes.kt new file mode 100644 index 00000000000..d424f11ab23 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/classes.kt @@ -0,0 +1,23 @@ +class Test1 + + +internal +class Test2 + + +/** + * comment + */ +class Test3 + + +@Suppress("UNUSED_VAR") +class Test4 + + +enum +class Test5 + + +annotation +class Test6 \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/classes.txt b/compiler/testData/ir/sourceRanges/declarations/classes.txt new file mode 100644 index 00000000000..e71805222ac --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/classes.txt @@ -0,0 +1,96 @@ +@0:0..22:11 FILE fqName: fileName:/classes.kt + @0:0..11 CLASS CLASS name:Test1 modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @0:0..11 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test1 flags: + @0:0..11 CONSTRUCTOR visibility:public <> () returnType:Test1 flags:primary + @0:0..11 BLOCK_BODY + @0:0..11 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @0:0..11 INSTANCE_INITIALIZER_CALL classDescriptor='Test1' + @0:0..11 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @0:0..11 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..11 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @0:0..11 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @0:0..11 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..11 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @0:0..11 VALUE_PARAMETER name: type:kotlin.Any flags: + @4:0..11 CLASS CLASS name:Test2 modality:FINAL visibility:internal flags: superTypes:[kotlin.Any] + @4:0..11 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test2 flags: + @4:0..11 CONSTRUCTOR visibility:public <> () returnType:Test2 flags:primary + @3:0..4:11 BLOCK_BODY + @3:0..4:11 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @3:0..4:11 INSTANCE_INITIALIZER_CALL classDescriptor='Test2' + @4:0..11 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @3:0..4:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @4:0..11 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @4:0..11 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @3:0..4:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @4:0..11 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @3:0..4:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @10:0..11 CLASS CLASS name:Test3 modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @10:0..11 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test3 flags: + @10:0..11 CONSTRUCTOR visibility:public <> () returnType:Test3 flags:primary + @10:0..11 BLOCK_BODY + @10:0..11 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @10:0..11 INSTANCE_INITIALIZER_CALL classDescriptor='Test3' + @10:0..11 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @10:0..11 VALUE_PARAMETER name: type:kotlin.Any flags: + @10:0..11 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @10:0..11 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @10:0..11 VALUE_PARAMETER name: type:kotlin.Any flags: + @10:0..11 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @10:0..11 VALUE_PARAMETER name: type:kotlin.Any flags: + @14:0..11 CLASS CLASS name:Test4 modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @14:0..11 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test4 flags: + @14:0..11 CONSTRUCTOR visibility:public <> () returnType:Test4 flags:primary + @13:0..14:11 BLOCK_BODY + @13:0..14:11 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @13:0..14:11 INSTANCE_INITIALIZER_CALL classDescriptor='Test4' + @14:0..11 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @13:0..14:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @14:0..11 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @14:0..11 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @13:0..14:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @14:0..11 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @13:0..14:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @18:0..11 CLASS ENUM_CLASS name:Test5 modality:FINAL visibility:public flags: superTypes:[kotlin.Enum] + @18:0..11 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test5 flags: + @18:0..11 CONSTRUCTOR visibility:private <> () returnType:Test5 flags:primary + @17:0..18:11 BLOCK_BODY + @17:0..18:11 ENUM_CONSTRUCTOR_CALL 'constructor Enum(String, Int)' + @17:0..18:11 INSTANCE_INITIALIZER_CALL classDescriptor='Test5' + @18:0..11 FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Any flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @18:0..11 FUN FAKE_OVERRIDE name:finalize visibility:protected/*protected and package*/ modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Unit flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @18:0..11 FUN FAKE_OVERRIDE name:getDeclaringClass visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:java.lang.Class? flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @18:0..11 FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum, other:Test5) returnType:kotlin.Int flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @18:0..11 VALUE_PARAMETER name:other index:0 type:Test5 flags: + @18:0..11 FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @18:0..11 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @18:0..11 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @17:0..18:11 PROPERTY FAKE_OVERRIDE name:name visibility:public modality:FINAL flags:val + @18:0..11 FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.String flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @17:0..18:11 PROPERTY FAKE_OVERRIDE name:ordinal visibility:public modality:FINAL flags:val + @18:0..11 FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:kotlin.Enum) returnType:kotlin.Int flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @18:0..11 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum) returnType:kotlin.String flags: + @17:0..18:11 VALUE_PARAMETER name: type:kotlin.Enum flags: + @18:0..11 FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array flags: + @18:0..11 SYNTHETIC_BODY kind=ENUM_VALUES + @-1:-1..-1 FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:Test5 flags: + @-1:-1..-1 VALUE_PARAMETER name:value index:0 type:kotlin.String flags: + @18:0..11 SYNTHETIC_BODY kind=ENUM_VALUEOF + @22:0..11 CLASS ANNOTATION_CLASS name:Test6 modality:FINAL visibility:public flags: superTypes:[kotlin.Annotation] + @22:0..11 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test6 flags: + @22:0..11 CONSTRUCTOR visibility:public <> () returnType:Test6 flags:primary + @22:0..11 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @21:0..22:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @22:0..11 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @22:0..11 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @21:0..22:11 VALUE_PARAMETER name: type:kotlin.Any flags: + @22:0..11 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @21:0..22:11 VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/testData/ir/sourceRanges/declarations/fakeOverrides.kt b/compiler/testData/ir/sourceRanges/declarations/fakeOverrides.kt new file mode 100644 index 00000000000..f7e70c7b871 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/fakeOverrides.kt @@ -0,0 +1 @@ +class Test \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/fakeOverrides.txt b/compiler/testData/ir/sourceRanges/declarations/fakeOverrides.txt new file mode 100644 index 00000000000..4b46a9e2fa6 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/fakeOverrides.txt @@ -0,0 +1,14 @@ +@0:0..10 FILE fqName: fileName:/fakeOverrides.kt + @0:0..10 CLASS CLASS name:Test modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @0:0..10 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test flags: + @0:0..10 CONSTRUCTOR visibility:public <> () returnType:Test flags:primary + @0:0..10 BLOCK_BODY + @0:0..10 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @0:0..10 INSTANCE_INITIALIZER_CALL classDescriptor='Test' + @0:0..10 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @0:0..10 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..10 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @0:0..10 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @0:0..10 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..10 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @0:0..10 VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.kt b/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.kt new file mode 100644 index 00000000000..1137ccfac0f --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.kt @@ -0,0 +1,14 @@ +class Test1(val x: Int) + +class Test2 +internal constructor(val x: Int) + +class Test3 +/** + * comment + */ +constructor(val x: Int) + +class Test4 +@Suppress("UNUSED_VARIABLE") +constructor(val x: Int) \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.txt b/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.txt new file mode 100644 index 00000000000..a8ec1e40483 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/primaryConstructors.txt @@ -0,0 +1,97 @@ +@0:0..13:23 FILE fqName: fileName:/primaryConstructors.kt + @0:0..23 CLASS CLASS name:Test1 modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @0:0..23 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test1 flags: + @0:0..23 CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:Test1 flags:primary + @0:12..22 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: + @0:0..23 BLOCK_BODY + @0:0..23 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @0:0..23 INSTANCE_INITIALIZER_CALL classDescriptor='Test1' + @0:12..22 PROPERTY name:x visibility:public modality:FINAL flags:val + @0:12..22 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public flags:final + @0:12..22 EXPRESSION_BODY + @0:12..22 GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + @0:12..22 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Test1) returnType:kotlin.Int flags: + @0:12..22 VALUE_PARAMETER name: type:Test1 flags: + @0:12..22 BLOCK_BODY + @0:12..22 RETURN type=kotlin.Nothing from='(): Int' + @0:12..22 GET_FIELD 'x: Int' type=kotlin.Int origin=null + @0:12..22 GET_VAR 'this@Test1: Test1' type=Test1 origin=null + @0:0..23 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @0:0..23 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..23 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @0:0..23 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @0:0..23 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..23 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @0:0..23 VALUE_PARAMETER name: type:kotlin.Any flags: + @2:0..3:32 CLASS CLASS name:Test2 modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @2:0..3:32 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test2 flags: + @3:9..32 CONSTRUCTOR visibility:internal <> (x:kotlin.Int) returnType:Test2 flags:primary + @3:21..31 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: + @2:0..3:32 BLOCK_BODY + @2:0..3:32 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @2:0..3:32 INSTANCE_INITIALIZER_CALL classDescriptor='Test2' + @3:21..31 PROPERTY name:x visibility:public modality:FINAL flags:val + @3:21..31 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public flags:final + @3:21..31 EXPRESSION_BODY + @3:21..31 GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + @3:21..31 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Test2) returnType:kotlin.Int flags: + @3:21..31 VALUE_PARAMETER name: type:Test2 flags: + @3:21..31 BLOCK_BODY + @3:21..31 RETURN type=kotlin.Nothing from='(): Int' + @3:21..31 GET_FIELD 'x: Int' type=kotlin.Int origin=null + @3:21..31 GET_VAR 'this@Test2: Test2' type=Test2 origin=null + @2:0..3:32 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @2:0..3:32 VALUE_PARAMETER name: type:kotlin.Any flags: + @2:0..3:32 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @2:0..3:32 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @2:0..3:32 VALUE_PARAMETER name: type:kotlin.Any flags: + @2:0..3:32 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @2:0..3:32 VALUE_PARAMETER name: type:kotlin.Any flags: + @5:0..9:23 CLASS CLASS name:Test3 modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @5:0..9:23 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test3 flags: + @9:0..23 CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:Test3 flags:primary + @9:12..22 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: + @5:0..9:23 BLOCK_BODY + @5:0..9:23 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @5:0..9:23 INSTANCE_INITIALIZER_CALL classDescriptor='Test3' + @9:12..22 PROPERTY name:x visibility:public modality:FINAL flags:val + @9:12..22 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public flags:final + @9:12..22 EXPRESSION_BODY + @9:12..22 GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + @9:12..22 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Test3) returnType:kotlin.Int flags: + @9:12..22 VALUE_PARAMETER name: type:Test3 flags: + @9:12..22 BLOCK_BODY + @9:12..22 RETURN type=kotlin.Nothing from='(): Int' + @9:12..22 GET_FIELD 'x: Int' type=kotlin.Int origin=null + @9:12..22 GET_VAR 'this@Test3: Test3' type=Test3 origin=null + @5:0..9:23 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @5:0..9:23 VALUE_PARAMETER name: type:kotlin.Any flags: + @5:0..9:23 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @5:0..9:23 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @5:0..9:23 VALUE_PARAMETER name: type:kotlin.Any flags: + @5:0..9:23 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @5:0..9:23 VALUE_PARAMETER name: type:kotlin.Any flags: + @11:0..13:23 CLASS CLASS name:Test4 modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @11:0..13:23 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Test4 flags: + @13:0..23 CONSTRUCTOR visibility:public <> (x:kotlin.Int) returnType:Test4 flags:primary + @13:12..22 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: + @11:0..13:23 BLOCK_BODY + @11:0..13:23 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @11:0..13:23 INSTANCE_INITIALIZER_CALL classDescriptor='Test4' + @13:12..22 PROPERTY name:x visibility:public modality:FINAL flags:val + @13:12..22 FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public flags:final + @13:12..22 EXPRESSION_BODY + @13:12..22 GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + @13:12..22 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:Test4) returnType:kotlin.Int flags: + @13:12..22 VALUE_PARAMETER name: type:Test4 flags: + @13:12..22 BLOCK_BODY + @13:12..22 RETURN type=kotlin.Nothing from='(): Int' + @13:12..22 GET_FIELD 'x: Int' type=kotlin.Int origin=null + @13:12..22 GET_VAR 'this@Test4: Test4' type=Test4 origin=null + @11:0..13:23 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @11:0..13:23 VALUE_PARAMETER name: type:kotlin.Any flags: + @11:0..13:23 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @11:0..13:23 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @11:0..13:23 VALUE_PARAMETER name: type:kotlin.Any flags: + @11:0..13:23 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @11:0..13:23 VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.kt b/compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.kt new file mode 100644 index 00000000000..a3a445eac78 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.kt @@ -0,0 +1,14 @@ +class C { + constructor() : super() + + private + constructor(x: Int): super() + + /** + * comment + */ + constructor(x: String) : super() + + @Suppress("UNUSED_VARIABLE") + constructor(x: Any): super() +} \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.txt b/compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.txt new file mode 100644 index 00000000000..0e444891845 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.txt @@ -0,0 +1,29 @@ +@0:0..13:1 FILE fqName: fileName:/secondaryConstructors.kt + @0:0..13:1 CLASS CLASS name:C modality:FINAL visibility:public flags: superTypes:[kotlin.Any] + @0:0..13:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:C flags: + @1:4..27 CONSTRUCTOR visibility:public <> () returnType:C flags: + @1:4..27 BLOCK_BODY + @1:20..27 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @1:4..27 INSTANCE_INITIALIZER_CALL classDescriptor='C' + @4:4..32 CONSTRUCTOR visibility:private <> (x:kotlin.Int) returnType:C flags: + @4:16..22 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: + @3:4..4:32 BLOCK_BODY + @4:25..32 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @3:4..4:32 INSTANCE_INITIALIZER_CALL classDescriptor='C' + @9:4..36 CONSTRUCTOR visibility:public <> (x:kotlin.String) returnType:C flags: + @9:16..25 VALUE_PARAMETER name:x index:0 type:kotlin.String flags: + @9:4..36 BLOCK_BODY + @9:29..36 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @9:4..36 INSTANCE_INITIALIZER_CALL classDescriptor='C' + @12:4..32 CONSTRUCTOR visibility:public <> (x:kotlin.Any) returnType:C flags: + @12:16..22 VALUE_PARAMETER name:x index:0 type:kotlin.Any flags: + @11:4..12:32 BLOCK_BODY + @12:25..32 DELEGATING_CONSTRUCTOR_CALL 'constructor Any()' + @11:4..12:32 INSTANCE_INITIALIZER_CALL classDescriptor='C' + @0:0..13:1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @0:0..13:1 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..13:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @0:0..13:1 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @0:0..13:1 VALUE_PARAMETER name: type:kotlin.Any flags: + @0:0..13:1 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @0:0..13:1 VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/testData/ir/sourceRanges/synthesizedDataClassMembers.kt b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.kt similarity index 100% rename from compiler/testData/ir/sourceRanges/synthesizedDataClassMembers.kt rename to compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.kt diff --git a/compiler/testData/ir/sourceRanges/synthesizedDataClassMembers.txt b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.txt similarity index 93% rename from compiler/testData/ir/sourceRanges/synthesizedDataClassMembers.txt rename to compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.txt index 5f52fb54662..3db9c2f0b9d 100644 --- a/compiler/testData/ir/sourceRanges/synthesizedDataClassMembers.txt +++ b/compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.txt @@ -1,7 +1,7 @@ @0:0..4:1 FILE fqName: fileName:/synthesizedDataClassMembers.kt - @0:0..4:1 CLASS CLASS name:C modality:FINAL visibility:public flags:data superTypes:[kotlin.Any] - @0:0..4:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:C flags: - @0:0..4:1 CONSTRUCTOR visibility:public <> (x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:C flags:primary + @0:5..4:1 CLASS CLASS name:C modality:FINAL visibility:public flags:data superTypes:[kotlin.Any] + @0:5..4:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:C flags: + @0:5..4:1 CONSTRUCTOR visibility:public <> (x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:C flags:primary @1:8..18 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: @2:8..21 VALUE_PARAMETER name:y index:1 type:kotlin.String flags: @3:8..18 VALUE_PARAMETER name:z index:2 type:kotlin.Any flags: @@ -13,7 +13,7 @@ @1:8..18 EXPRESSION_BODY @1:8..18 GET_VAR 'value-parameter x: Int' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER @1:8..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:C) returnType:kotlin.Int flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @1:8..18 VALUE_PARAMETER name: type:C flags: @1:8..18 BLOCK_BODY @1:8..18 RETURN type=kotlin.Nothing from='(): Int' @1:8..18 GET_FIELD 'x: Int' type=kotlin.Int origin=null @@ -23,7 +23,7 @@ @2:8..21 EXPRESSION_BODY @2:8..21 GET_VAR 'value-parameter y: String' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER @2:8..21 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:C) returnType:kotlin.String flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @2:8..21 VALUE_PARAMETER name: type:C flags: @2:8..21 BLOCK_BODY @2:8..21 RETURN type=kotlin.Nothing from='(): String' @2:8..21 GET_FIELD 'y: String' type=kotlin.String origin=null @@ -33,31 +33,31 @@ @3:8..18 EXPRESSION_BODY @3:8..18 GET_VAR 'value-parameter z: Any' type=kotlin.Any origin=INITIALIZE_PROPERTY_FROM_PARAMETER @3:8..18 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:C) returnType:kotlin.Any flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @3:8..18 VALUE_PARAMETER name: type:C flags: @3:8..18 BLOCK_BODY @3:8..18 RETURN type=kotlin.Nothing from='(): Any' @3:8..18 GET_FIELD 'z: Any' type=kotlin.Any origin=null @3:8..18 GET_VAR 'this@C: C' type=C origin=null @1:8..18 FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:C) returnType:kotlin.Int flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @1:8..18 VALUE_PARAMETER name: type:C flags: @1:8..18 BLOCK_BODY @1:8..18 RETURN type=kotlin.Nothing from='component1(): Int' @1:8..18 CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY @1:8..18 GET_VAR 'this@C: C' type=C origin=null @2:8..21 FUN GENERATED_DATA_CLASS_MEMBER name:component2 visibility:public modality:FINAL <> ($this:C) returnType:kotlin.String flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @2:8..21 VALUE_PARAMETER name: type:C flags: @2:8..21 BLOCK_BODY @2:8..21 RETURN type=kotlin.Nothing from='component2(): String' @2:8..21 CALL '(): String' type=kotlin.String origin=GET_PROPERTY @2:8..21 GET_VAR 'this@C: C' type=C origin=null @3:8..18 FUN GENERATED_DATA_CLASS_MEMBER name:component3 visibility:public modality:FINAL <> ($this:C) returnType:kotlin.Any flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @3:8..18 VALUE_PARAMETER name: type:C flags: @3:8..18 BLOCK_BODY @3:8..18 RETURN type=kotlin.Nothing from='component3(): Any' @3:8..18 CALL '(): Any' type=kotlin.Any origin=GET_PROPERTY @3:8..18 GET_VAR 'this@C: C' type=C origin=null @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:C, x:kotlin.Int, y:kotlin.String, z:kotlin.Any) returnType:C flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @0:0..4:1 VALUE_PARAMETER name: type:C flags: @1:8..18 VALUE_PARAMETER name:x index:0 type:kotlin.Int flags: @0:0..4:1 EXPRESSION_BODY @0:0..4:1 CALL '(): Int' type=kotlin.Int origin=GET_PROPERTY @@ -77,7 +77,7 @@ @0:0..4:1 GET_VAR 'value-parameter y: String = ...' type=kotlin.String origin=null @0:0..4:1 GET_VAR 'value-parameter z: Any = ...' type=kotlin.Any origin=null @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:C) returnType:kotlin.String flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @0:0..4:1 VALUE_PARAMETER name: type:C flags: @0:0..4:1 BLOCK_BODY @0:0..4:1 RETURN type=kotlin.Nothing from='toString(): String' @0:0..4:1 STRING_CONCATENATION type=kotlin.String @@ -95,7 +95,7 @@ @0:0..4:1 GET_VAR 'this@C: C' type=C origin=null @0:0..4:1 CONST String type=kotlin.String value=")" @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:C) returnType:kotlin.Int flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: + @0:0..4:1 VALUE_PARAMETER name: type:C flags: @0:0..4:1 BLOCK_BODY @0:0..4:1 VAR IR_TEMPORARY_VARIABLE name:tmp0_result type:kotlin.Int flags:var @0:0..4:1 CONST Int type=kotlin.Int value=0 @@ -122,8 +122,8 @@ @0:0..4:1 RETURN type=kotlin.Nothing from='hashCode(): Int' @0:0..4:1 GET_VAR 'tmp0_result: Int' type=kotlin.Int origin=null @0:0..4:1 FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:C, other:kotlin.Any?) returnType:kotlin.Boolean flags: - @-1:-1..-1 VALUE_PARAMETER name: type:C flags: - @-1:-1..-1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @0:0..4:1 VALUE_PARAMETER name: type:C flags: + @0:0..4:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: @0:0..4:1 BLOCK_BODY @0:0..4:1 WHEN type=kotlin.Unit origin=null @0:0..4:1 BRANCH diff --git a/compiler/testData/ir/sourceRanges/declarations/topLevelFuns.kt b/compiler/testData/ir/sourceRanges/declarations/topLevelFuns.kt new file mode 100644 index 00000000000..e5eb28fa5a4 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/topLevelFuns.kt @@ -0,0 +1,20 @@ +package test + + +fun test0() {} + + +/** + * block comment + */ +fun test1() {} + + +@Suppress( + "UNUSED_VARIABLE" +) +fun test2() {} + + +private +fun test3() {} \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/topLevelFuns.txt b/compiler/testData/ir/sourceRanges/declarations/topLevelFuns.txt new file mode 100644 index 00000000000..3adcd969070 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/topLevelFuns.txt @@ -0,0 +1,9 @@ +@0:0..19:14 FILE fqName:test fileName:/topLevelFuns.kt + @3:0..14 FUN name:test0 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: + @3:12..14 BLOCK_BODY + @9:0..14 FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: + @9:12..14 BLOCK_BODY + @15:0..14 FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit flags: + @15:12..14 BLOCK_BODY + @19:0..14 FUN name:test3 visibility:private modality:FINAL <> () returnType:kotlin.Unit flags: + @19:12..14 BLOCK_BODY diff --git a/compiler/testData/ir/sourceRanges/declarations/topLevelProperties.kt b/compiler/testData/ir/sourceRanges/declarations/topLevelProperties.kt new file mode 100644 index 00000000000..6feebaba818 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/topLevelProperties.kt @@ -0,0 +1,69 @@ +package test + + +val test0 = 42 + + +/** + * comment + */ +val test1 = 42 + + +@Suppress( + "UNUSED_VARIABLE" +) +val test2 = 42 + + +private +val test3 = 42 + + +val test4 get() = 42 + + +val test5 + get() = 42 + + +val test6 + /** + * comment + */ + get() = 42 + + +val test7 + @Suppress( + "UNUSED_VARIABLE" + ) + get() = 42 + + +var test8 = 42 + + +var test9 = 42; private set + + +var test10 = 42 + private set + + +var test11 = 42 + set(value) { field = value } + + +var test12 = 42 + /** + * comment + */ + set(value) { field = value } + + +var test13 = 42 + @Suppress( + "UNUSED_VARIABLE" + ) + set(value) { field = value } \ No newline at end of file diff --git a/compiler/testData/ir/sourceRanges/declarations/topLevelProperties.txt b/compiler/testData/ir/sourceRanges/declarations/topLevelProperties.txt new file mode 100644 index 00000000000..e4fb423eb6b --- /dev/null +++ b/compiler/testData/ir/sourceRanges/declarations/topLevelProperties.txt @@ -0,0 +1,131 @@ +@0:0..68:32 FILE fqName:test fileName:/topLevelProperties.kt + @3:0..14 PROPERTY name:test0 visibility:public modality:FINAL flags:val + @3:0..14 FIELD PROPERTY_BACKING_FIELD name:test0 type:kotlin.Int visibility:public flags:final,static + @3:12..14 EXPRESSION_BODY + @3:12..14 CONST Int type=kotlin.Int value=42 + @3:0..14 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @3:0..14 BLOCK_BODY + @3:0..14 RETURN type=kotlin.Nothing from='(): Int' + @3:0..14 GET_FIELD 'test0: Int' type=kotlin.Int origin=null + @9:0..14 PROPERTY name:test1 visibility:public modality:FINAL flags:val + @9:0..14 FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.Int visibility:public flags:final,static + @9:12..14 EXPRESSION_BODY + @9:12..14 CONST Int type=kotlin.Int value=42 + @9:0..14 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @9:0..14 BLOCK_BODY + @9:0..14 RETURN type=kotlin.Nothing from='(): Int' + @9:0..14 GET_FIELD 'test1: Int' type=kotlin.Int origin=null + @12:0..15:14 PROPERTY name:test2 visibility:public modality:FINAL flags:val + @12:0..15:14 FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Int visibility:public flags:final,static + @15:12..14 EXPRESSION_BODY + @15:12..14 CONST Int type=kotlin.Int value=42 + @15:0..14 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @15:0..14 BLOCK_BODY + @15:0..14 RETURN type=kotlin.Nothing from='(): Int' + @15:0..14 GET_FIELD 'test2: Int' type=kotlin.Int origin=null + @18:0..19:14 PROPERTY name:test3 visibility:private modality:FINAL flags:val + @18:0..19:14 FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.Int visibility:private flags:final,static + @19:12..14 EXPRESSION_BODY + @19:12..14 CONST Int type=kotlin.Int value=42 + @19:0..14 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> () returnType:kotlin.Int flags: + @19:0..14 BLOCK_BODY + @19:0..14 RETURN type=kotlin.Nothing from='(): Int' + @19:0..14 GET_FIELD 'test3: Int' type=kotlin.Int origin=null + @22:0..20 PROPERTY name:test4 visibility:public modality:FINAL flags:val + @22:10..20 FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @22:18..20 BLOCK_BODY + @22:18..20 RETURN type=kotlin.Nothing from='(): Int' + @22:18..20 CONST Int type=kotlin.Int value=42 + @25:0..26:14 PROPERTY name:test5 visibility:public modality:FINAL flags:val + @26:4..14 FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @26:12..14 BLOCK_BODY + @26:12..14 RETURN type=kotlin.Nothing from='(): Int' + @26:12..14 CONST Int type=kotlin.Int value=42 + @29:0..33:14 PROPERTY name:test6 visibility:public modality:FINAL flags:val + @33:4..14 FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @33:12..14 BLOCK_BODY + @33:12..14 RETURN type=kotlin.Nothing from='(): Int' + @33:12..14 CONST Int type=kotlin.Int value=42 + @36:0..40:14 PROPERTY name:test7 visibility:public modality:FINAL flags:val + @40:4..14 FUN name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @40:12..14 BLOCK_BODY + @40:12..14 RETURN type=kotlin.Nothing from='(): Int' + @40:12..14 CONST Int type=kotlin.Int value=42 + @43:0..14 PROPERTY name:test8 visibility:public modality:FINAL flags:var + @43:0..14 FIELD PROPERTY_BACKING_FIELD name:test8 type:kotlin.Int visibility:public flags:static + @43:12..14 EXPRESSION_BODY + @43:12..14 CONST Int type=kotlin.Int value=42 + @43:0..14 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @43:0..14 BLOCK_BODY + @43:0..14 RETURN type=kotlin.Nothing from='(): Int' + @43:0..14 GET_FIELD 'test8: Int' type=kotlin.Int origin=null + @43:0..14 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit flags: + @43:0..14 VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + @43:0..14 BLOCK_BODY + @43:0..14 SET_FIELD 'test8: Int' type=kotlin.Unit origin=null + @43:0..14 GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + @46:0..27 PROPERTY name:test9 visibility:public modality:FINAL flags:var + @46:0..27 FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.Int visibility:public flags:static + @46:12..14 EXPRESSION_BODY + @46:12..14 CONST Int type=kotlin.Int value=42 + @46:0..27 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @46:0..27 BLOCK_BODY + @46:0..27 RETURN type=kotlin.Nothing from='(): Int' + @46:0..27 GET_FIELD 'test9: Int' type=kotlin.Int origin=null + @46:24..27 FUN name: visibility:private modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit flags: + @46:24..27 VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + @46:24..27 BLOCK_BODY + @46:24..27 SET_FIELD 'test9: Int' type=kotlin.Unit origin=null + @46:24..27 GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + @49:0..50:15 PROPERTY name:test10 visibility:public modality:FINAL flags:var + @49:0..50:15 FIELD PROPERTY_BACKING_FIELD name:test10 type:kotlin.Int visibility:public flags:static + @49:13..15 EXPRESSION_BODY + @49:13..15 CONST Int type=kotlin.Int value=42 + @49:0..50:15 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @49:0..50:15 BLOCK_BODY + @49:0..50:15 RETURN type=kotlin.Nothing from='(): Int' + @49:0..50:15 GET_FIELD 'test10: Int' type=kotlin.Int origin=null + @50:12..15 FUN name: visibility:private modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit flags: + @50:12..15 VALUE_PARAMETER name: index:0 type:kotlin.Int flags: + @50:12..15 BLOCK_BODY + @50:12..15 SET_FIELD 'test10: Int' type=kotlin.Unit origin=null + @50:12..15 GET_VAR 'value-parameter : Int' type=kotlin.Int origin=null + @53:0..54:32 PROPERTY name:test11 visibility:public modality:FINAL flags:var + @53:0..54:32 FIELD PROPERTY_BACKING_FIELD name:test11 type:kotlin.Int visibility:public flags:static + @53:13..15 EXPRESSION_BODY + @53:13..15 CONST Int type=kotlin.Int value=42 + @53:0..54:32 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @53:0..54:32 BLOCK_BODY + @53:0..54:32 RETURN type=kotlin.Nothing from='(): Int' + @53:0..54:32 GET_FIELD 'test11: Int' type=kotlin.Int origin=null + @54:4..32 FUN name: visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit flags: + @54:8..13 VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + @54:15..32 BLOCK_BODY + @54:17..22 SET_FIELD 'test11: Int' type=kotlin.Unit origin=EQ + @54:25..30 GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null + @57:0..61:32 PROPERTY name:test12 visibility:public modality:FINAL flags:var + @57:0..61:32 FIELD PROPERTY_BACKING_FIELD name:test12 type:kotlin.Int visibility:public flags:static + @57:13..15 EXPRESSION_BODY + @57:13..15 CONST Int type=kotlin.Int value=42 + @57:0..61:32 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @57:0..61:32 BLOCK_BODY + @57:0..61:32 RETURN type=kotlin.Nothing from='(): Int' + @57:0..61:32 GET_FIELD 'test12: Int' type=kotlin.Int origin=null + @61:4..32 FUN name: visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit flags: + @61:8..13 VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + @61:15..32 BLOCK_BODY + @61:17..22 SET_FIELD 'test12: Int' type=kotlin.Unit origin=EQ + @61:25..30 GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null + @64:0..68:32 PROPERTY name:test13 visibility:public modality:FINAL flags:var + @64:0..68:32 FIELD PROPERTY_BACKING_FIELD name:test13 type:kotlin.Int visibility:public flags:static + @64:13..15 EXPRESSION_BODY + @64:13..15 CONST Int type=kotlin.Int value=42 + @64:0..68:32 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int flags: + @64:0..68:32 BLOCK_BODY + @64:0..68:32 RETURN type=kotlin.Nothing from='(): Int' + @64:0..68:32 GET_FIELD 'test13: Int' type=kotlin.Int origin=null + @68:4..32 FUN name: visibility:public modality:FINAL <> (value:kotlin.Int) returnType:kotlin.Unit flags: + @68:8..13 VALUE_PARAMETER name:value index:0 type:kotlin.Int flags: + @68:15..32 BLOCK_BODY + @68:17..22 SET_FIELD 'test13: Int' type=kotlin.Unit origin=EQ + @68:25..30 GET_VAR 'value-parameter value: Int' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/sourceRanges/kt17108.txt b/compiler/testData/ir/sourceRanges/kt17108.txt index 99bbafc1a93..c668b117bc8 100644 --- a/compiler/testData/ir/sourceRanges/kt17108.txt +++ b/compiler/testData/ir/sourceRanges/kt17108.txt @@ -1,24 +1,24 @@ @0:0..26:1 FILE fqName: fileName:/kt17108.kt - @4:0..26:1 CLASS INTERFACE name:Boolean modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any] - @4:0..26:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Boolean flags: - @8:4..38 FUN name:not visibility:public modality:ABSTRACT <> ($this:Boolean) returnType:Boolean flags: + @4:7..26:1 CLASS INTERFACE name:Boolean modality:ABSTRACT visibility:public flags: superTypes:[kotlin.Any] + @4:7..26:1 VALUE_PARAMETER INSTANCE_RECEIVER name: type:Boolean flags: + @8:20..38 FUN name:not visibility:public modality:ABSTRACT <> ($this:Boolean) returnType:Boolean flags: @8:4..38 VALUE_PARAMETER name: type:Boolean flags: - @13:4..42 FUN name:and visibility:public modality:ABSTRACT <> ($this:Boolean, other:Boolean) returnType:Boolean flags: + @13:10..42 FUN name:and visibility:public modality:ABSTRACT <> ($this:Boolean, other:Boolean) returnType:Boolean flags: @13:4..42 VALUE_PARAMETER name: type:Boolean flags: @13:18..32 VALUE_PARAMETER name:other index:0 type:Boolean flags: - @18:4..41 FUN name:or visibility:public modality:ABSTRACT <> ($this:Boolean, other:Boolean) returnType:Boolean flags: + @18:10..41 FUN name:or visibility:public modality:ABSTRACT <> ($this:Boolean, other:Boolean) returnType:Boolean flags: @18:4..41 VALUE_PARAMETER name: type:Boolean flags: @18:17..31 VALUE_PARAMETER name:other index:0 type:Boolean flags: - @23:4..42 FUN name:xor visibility:public modality:ABSTRACT <> ($this:Boolean, other:Boolean) returnType:Boolean flags: + @23:10..42 FUN name:xor visibility:public modality:ABSTRACT <> ($this:Boolean, other:Boolean) returnType:Boolean flags: @23:4..42 VALUE_PARAMETER name: type:Boolean flags: @23:18..32 VALUE_PARAMETER name:other index:0 type:Boolean flags: @25:4..38 FUN name:compareTo visibility:public modality:ABSTRACT <> ($this:Boolean, other:Boolean) returnType:kotlin.Int flags: @25:4..38 VALUE_PARAMETER name: type:Boolean flags: @25:18..32 VALUE_PARAMETER name:other index:0 type:Boolean flags: - @4:0..26:1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: + @4:7..26:1 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean flags: @4:0..26:1 VALUE_PARAMETER name: type:kotlin.Any flags: - @-1:-1..-1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: - @4:0..26:1 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: + @4:7..26:1 VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags: + @4:7..26:1 FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int flags: @4:0..26:1 VALUE_PARAMETER name: type:kotlin.Any flags: - @4:0..26:1 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: + @4:7..26:1 FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String flags: @4:0..26:1 VALUE_PARAMETER name: type:kotlin.Any flags: diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java index c6cdeae9111..9e086d8b2d8 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrSourceRangesTestCaseGenerated.java @@ -44,8 +44,61 @@ public class IrSourceRangesTestCaseGenerated extends AbstractIrSourceRangesTestC runTest("compiler/testData/ir/sourceRanges/kt17108.kt"); } - @TestMetadata("synthesizedDataClassMembers.kt") - public void testSynthesizedDataClassMembers() throws Exception { - runTest("compiler/testData/ir/sourceRanges/synthesizedDataClassMembers.kt"); + @TestMetadata("compiler/testData/ir/sourceRanges/declarations") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Declarations extends AbstractIrSourceRangesTestCase { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInDeclarations() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/ir/sourceRanges/declarations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("classFuns.kt") + public void testClassFuns() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/classFuns.kt"); + } + + @TestMetadata("classProperties.kt") + public void testClassProperties() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/classProperties.kt"); + } + + @TestMetadata("classes.kt") + public void testClasses() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/classes.kt"); + } + + @TestMetadata("fakeOverrides.kt") + public void testFakeOverrides() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/fakeOverrides.kt"); + } + + @TestMetadata("primaryConstructors.kt") + public void testPrimaryConstructors() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/primaryConstructors.kt"); + } + + @TestMetadata("secondaryConstructors.kt") + public void testSecondaryConstructors() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/secondaryConstructors.kt"); + } + + @TestMetadata("synthesizedDataClassMembers.kt") + public void testSynthesizedDataClassMembers() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/synthesizedDataClassMembers.kt"); + } + + @TestMetadata("topLevelFuns.kt") + public void testTopLevelFuns() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/topLevelFuns.kt"); + } + + @TestMetadata("topLevelProperties.kt") + public void testTopLevelProperties() throws Exception { + runTest("compiler/testData/ir/sourceRanges/declarations/topLevelProperties.kt"); + } } }