Add tests for deprecated properties

This commit is contained in:
Dmitry Petrov
2020-07-21 18:28:17 +03:00
parent e84339a0d3
commit d93885e71c
8 changed files with 312 additions and 0 deletions
@@ -289,6 +289,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/declarations/delegatedProperties.kt");
}
@TestMetadata("deprecatedProperty.kt")
public void testDeprecatedProperty() throws Exception {
runTest("compiler/testData/ir/irText/declarations/deprecatedProperty.kt");
}
@TestMetadata("extensionProperties.kt")
public void testExtensionProperties() throws Exception {
runTest("compiler/testData/ir/irText/declarations/extensionProperties.kt");
@@ -0,0 +1,53 @@
@Deprecated("")
val testVal = 1
@Deprecated("")
var testVar = 1
@Deprecated("")
val testValWithExplicitDefaultGet = 1
get
@Deprecated("")
val testValWithExplicitGet
get() = 1
@Deprecated("")
var testVarWithExplicitDefaultGet = 1
get
@Deprecated("")
var testVarWithExplicitDefaultSet = 1
set
@Deprecated("")
var testVarWithExplicitDefaultGetSet: Int = 1
get
set
@Deprecated("")
var testVarWithExplicitGetSet
get() = 1
set(v) {}
@Deprecated("")
lateinit var testLateinitVar: Any
@Deprecated("")
val Any.testExtVal
get() = 1
@Deprecated("")
var Any.textExtVar
get() = 1
set(v) {}
@Deprecated("")
val <T> List<T>.testGenExtVal
get() = 1
@Deprecated("")
var <T> List<T>.textGenExtVar
get() = 1
set(v) {}
@@ -0,0 +1,45 @@
@kotlin.Metadata
public final class DeprecatedPropertyKt {
public deprecated static field testLateinitVar: java.lang.Object
private deprecated final static field testVal: int
private deprecated final static field testValWithExplicitDefaultGet: int
private deprecated static field testVar: int
private deprecated static field testVarWithExplicitDefaultGet: int
private deprecated static field testVarWithExplicitDefaultGetSet: int
private deprecated static field testVarWithExplicitDefaultSet: int
static method <clinit>(): void
public synthetic deprecated static @kotlin.Deprecated method getTestExtVal$annotations(p0: java.lang.Object): void
public deprecated final static method getTestExtVal(@org.jetbrains.annotations.NotNull p0: java.lang.Object): int
public synthetic deprecated static @kotlin.Deprecated method getTestGenExtVal$annotations(p0: java.util.List): void
public deprecated final static method getTestGenExtVal(@org.jetbrains.annotations.NotNull p0: java.util.List): int
public synthetic deprecated static @kotlin.Deprecated method getTestLateinitVar$annotations(): void
public deprecated final static @org.jetbrains.annotations.NotNull method getTestLateinitVar(): java.lang.Object
public synthetic deprecated static @kotlin.Deprecated method getTestVal$annotations(): void
public deprecated final static method getTestVal(): int
public synthetic deprecated static @kotlin.Deprecated method getTestValWithExplicitDefaultGet$annotations(): void
public deprecated final static method getTestValWithExplicitDefaultGet(): int
public synthetic deprecated static @kotlin.Deprecated method getTestValWithExplicitGet$annotations(): void
public deprecated final static method getTestValWithExplicitGet(): int
public synthetic deprecated static @kotlin.Deprecated method getTestVar$annotations(): void
public deprecated final static method getTestVar(): int
public synthetic deprecated static @kotlin.Deprecated method getTestVarWithExplicitDefaultGet$annotations(): void
public deprecated final static method getTestVarWithExplicitDefaultGet(): int
public synthetic deprecated static @kotlin.Deprecated method getTestVarWithExplicitDefaultGetSet$annotations(): void
public deprecated final static method getTestVarWithExplicitDefaultGetSet(): int
public synthetic deprecated static @kotlin.Deprecated method getTestVarWithExplicitDefaultSet$annotations(): void
public deprecated final static method getTestVarWithExplicitDefaultSet(): int
public synthetic deprecated static @kotlin.Deprecated method getTestVarWithExplicitGetSet$annotations(): void
public deprecated final static method getTestVarWithExplicitGetSet(): int
public synthetic deprecated static @kotlin.Deprecated method getTextExtVar$annotations(p0: java.lang.Object): void
public deprecated final static method getTextExtVar(@org.jetbrains.annotations.NotNull p0: java.lang.Object): int
public synthetic deprecated static @kotlin.Deprecated method getTextGenExtVar$annotations(p0: java.util.List): void
public deprecated final static method getTextGenExtVar(@org.jetbrains.annotations.NotNull p0: java.util.List): int
public deprecated final static method setTestLateinitVar(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
public deprecated final static method setTestVar(p0: int): void
public deprecated final static method setTestVarWithExplicitDefaultGet(p0: int): void
public deprecated final static method setTestVarWithExplicitDefaultGetSet(p0: int): void
public deprecated final static method setTestVarWithExplicitDefaultSet(p0: int): void
public deprecated final static method setTestVarWithExplicitGetSet(p0: int): void
public deprecated final static method setTextExtVar(@org.jetbrains.annotations.NotNull p0: java.lang.Object, p1: int): void
public deprecated final static method setTextGenExtVar(@org.jetbrains.annotations.NotNull p0: java.util.List, p1: int): void
}
@@ -0,0 +1,45 @@
// FIR_IDENTICAL
@Deprecated("")
val testVal = 1
@Deprecated("")
var testVar = 1
@Deprecated("")
val testValWithExplicitDefaultGet = 1
get
@Deprecated("")
val testValWithExplicitGet
get() = 1
@Deprecated("")
var testVarWithExplicitDefaultGet = 1
get
@Deprecated("")
var testVarWithExplicitDefaultSet = 1
set
@Deprecated("")
var testVarWithExplicitDefaultGetSet: Int = 1
get
set
@Deprecated("")
var testVarWithExplicitGetSet
get() = 1
set(v) {}
@Deprecated("")
lateinit var testLateinitVar: Any
@Deprecated("")
val Any.testExtVal
get() = 1
@Deprecated("")
var Any.textExtVar
get() = 1
set(v) {}
@@ -0,0 +1,149 @@
FILE fqName:<root> fileName:/deprecatedProperty.kt
PROPERTY name:testVal visibility:public modality:FINAL [val]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FIELD PROPERTY_BACKING_FIELD name:testVal type:kotlin.Int visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testVal> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testVal visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testVal> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVal type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
PROPERTY name:testVar visibility:public modality:FINAL [var]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FIELD PROPERTY_BACKING_FIELD name:testVar type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testVar> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testVar visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testVar> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVar type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-testVar> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:testVar visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVar type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-testVar>' type=kotlin.Int origin=null
PROPERTY name:testValWithExplicitDefaultGet visibility:public modality:FINAL [val]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FIELD PROPERTY_BACKING_FIELD name:testValWithExplicitDefaultGet type:kotlin.Int visibility:private [final,static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testValWithExplicitDefaultGet> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testValWithExplicitDefaultGet visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testValWithExplicitDefaultGet> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testValWithExplicitDefaultGet type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
PROPERTY name:testValWithExplicitGet visibility:public modality:FINAL [val]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FUN name:<get-testValWithExplicitGet> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testValWithExplicitGet visibility:public modality:FINAL [val]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testValWithExplicitGet> (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
PROPERTY name:testVarWithExplicitDefaultGet visibility:public modality:FINAL [var]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultGet type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testVarWithExplicitDefaultGet> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testVarWithExplicitDefaultGet visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testVarWithExplicitDefaultGet> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultGet type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-testVarWithExplicitDefaultGet> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:testVarWithExplicitDefaultGet visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultGet type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-testVarWithExplicitDefaultGet>' type=kotlin.Int origin=null
PROPERTY name:testVarWithExplicitDefaultSet visibility:public modality:FINAL [var]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultSet type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testVarWithExplicitDefaultSet> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testVarWithExplicitDefaultSet visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testVarWithExplicitDefaultSet> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultSet type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-testVarWithExplicitDefaultSet> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:testVarWithExplicitDefaultSet visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultSet type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-testVarWithExplicitDefaultSet>' type=kotlin.Int origin=null
PROPERTY name:testVarWithExplicitDefaultGetSet visibility:public modality:FINAL [var]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultGetSet type:kotlin.Int visibility:private [static]
EXPRESSION_BODY
CONST Int type=kotlin.Int value=1
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testVarWithExplicitDefaultGetSet> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testVarWithExplicitDefaultGetSet visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testVarWithExplicitDefaultGetSet> (): kotlin.Int declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultGetSet type:kotlin.Int visibility:private [static]' type=kotlin.Int origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-testVarWithExplicitDefaultGetSet> visibility:public modality:FINAL <> (<set-?>:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:testVarWithExplicitDefaultGetSet visibility:public modality:FINAL [var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testVarWithExplicitDefaultGetSet type:kotlin.Int visibility:private [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Int declared in <root>.<set-testVarWithExplicitDefaultGetSet>' type=kotlin.Int origin=null
PROPERTY name:testVarWithExplicitGetSet visibility:public modality:FINAL [var]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FUN name:<get-testVarWithExplicitGetSet> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:testVarWithExplicitGetSet visibility:public modality:FINAL [var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testVarWithExplicitGetSet> (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:<set-testVarWithExplicitGetSet> visibility:public modality:FINAL <> (v:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:testVarWithExplicitGetSet visibility:public modality:FINAL [var]
VALUE_PARAMETER name:v index:0 type:kotlin.Int
BLOCK_BODY
PROPERTY name:testLateinitVar visibility:public modality:FINAL [lateinit,var]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FIELD PROPERTY_BACKING_FIELD name:testLateinitVar type:kotlin.Any visibility:public [static]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-testLateinitVar> visibility:public modality:FINAL <> () returnType:kotlin.Any
correspondingProperty: PROPERTY name:testLateinitVar visibility:public modality:FINAL [lateinit,var]
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testLateinitVar> (): kotlin.Any declared in <root>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testLateinitVar type:kotlin.Any visibility:public [static]' type=kotlin.Any origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<set-testLateinitVar> visibility:public modality:FINAL <> (<set-?>:kotlin.Any) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:testLateinitVar visibility:public modality:FINAL [lateinit,var]
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Any
BLOCK_BODY
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:testLateinitVar type:kotlin.Any visibility:public [static]' type=kotlin.Unit origin=null
value: GET_VAR '<set-?>: kotlin.Any declared in <root>.<set-testLateinitVar>' type=kotlin.Any origin=null
PROPERTY name:testExtVal visibility:public modality:FINAL [val]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FUN name:<get-testExtVal> visibility:public modality:FINAL <> ($receiver:kotlin.Any) returnType:kotlin.Int
correspondingProperty: PROPERTY name:testExtVal visibility:public modality:FINAL [val]
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-testExtVal> (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
PROPERTY name:textExtVar visibility:public modality:FINAL [var]
annotations:
Deprecated(message = '', replaceWith = <null>, level = <null>)
FUN name:<get-textExtVar> visibility:public modality:FINAL <> ($receiver:kotlin.Any) returnType:kotlin.Int
correspondingProperty: PROPERTY name:textExtVar visibility:public modality:FINAL [var]
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-textExtVar> (): kotlin.Int declared in <root>'
CONST Int type=kotlin.Int value=1
FUN name:<set-textExtVar> visibility:public modality:FINAL <> ($receiver:kotlin.Any, v:kotlin.Int) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:textExtVar visibility:public modality:FINAL [var]
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:v index:0 type:kotlin.Int
BLOCK_BODY
@@ -59,6 +59,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/deprecatedLateinitVar.kt");
}
@TestMetadata("deprecatedProperty.kt")
public void testDeprecatedProperty() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/deprecatedProperty.kt");
}
@TestMetadata("emptyMultifileFacade.kt")
public void testEmptyMultifileFacade() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/emptyMultifileFacade.kt");
@@ -59,6 +59,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
runTest("compiler/testData/codegen/bytecodeListing/deprecatedLateinitVar.kt");
}
@TestMetadata("deprecatedProperty.kt")
public void testDeprecatedProperty() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/deprecatedProperty.kt");
}
@TestMetadata("emptyMultifileFacade.kt")
public void testEmptyMultifileFacade() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/emptyMultifileFacade.kt");
@@ -288,6 +288,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/declarations/delegatedProperties.kt");
}
@TestMetadata("deprecatedProperty.kt")
public void testDeprecatedProperty() throws Exception {
runTest("compiler/testData/ir/irText/declarations/deprecatedProperty.kt");
}
@TestMetadata("extensionProperties.kt")
public void testExtensionProperties() throws Exception {
runTest("compiler/testData/ir/irText/declarations/extensionProperties.kt");