Make "Add annotation target" available on use-site annotation
So #KT-22861 Fixed So #KT-22862 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
442a89bc6c
commit
963e430b42
@@ -0,0 +1,6 @@
|
||||
// "Add annotation target" "true"
|
||||
<caret>@Ann
|
||||
package test
|
||||
|
||||
@Target
|
||||
annotation class Ann
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Add annotation target" "true"
|
||||
@Ann
|
||||
package test
|
||||
|
||||
@Target(AnnotationTarget.FILE)
|
||||
annotation class Ann
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
// WITH_RUNTIME
|
||||
@Target
|
||||
annotation class DelegateAnn
|
||||
|
||||
<caret>@delegate:DelegateAnn
|
||||
val foo by lazy { "" }
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
// WITH_RUNTIME
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
annotation class DelegateAnn
|
||||
|
||||
@delegate:DelegateAnn
|
||||
val foo by lazy { "" }
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target
|
||||
annotation class FieldAnn
|
||||
|
||||
class Field(<caret>@field:FieldAnn val foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
annotation class FieldAnn
|
||||
|
||||
class Field(@field:FieldAnn val foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
<caret>@file:FileAnn
|
||||
|
||||
@Target
|
||||
annotation class FileAnn
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@file:FileAnn
|
||||
|
||||
@Target(AnnotationTarget.FILE)
|
||||
annotation class FileAnn
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target
|
||||
annotation class GetAnn
|
||||
|
||||
class Get(<caret>@get:GetAnn val foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target(AnnotationTarget.PROPERTY_GETTER)
|
||||
annotation class GetAnn
|
||||
|
||||
class Get(@get:GetAnn val foo: String)
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add annotation target" "false"
|
||||
// ACTION: Create test
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
// ERROR: This annotation is not applicable to target 'class' and use site target '@get'
|
||||
annotation class Ann
|
||||
|
||||
<caret>@get:Ann
|
||||
class Test(val foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target
|
||||
annotation class ParamAnn
|
||||
|
||||
class Param(<caret>@param:ParamAnn val foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class ParamAnn
|
||||
|
||||
class Param(@param:ParamAnn val foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target
|
||||
annotation class PropertyAnn
|
||||
|
||||
class Property(<caret>@property:PropertyAnn val foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target(AnnotationTarget.PROPERTY)
|
||||
annotation class PropertyAnn
|
||||
|
||||
class Property(@property:PropertyAnn val foo: String)
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
class Foo
|
||||
|
||||
@Target
|
||||
annotation class ReceiverAnn
|
||||
|
||||
fun <caret>@receiver:ReceiverAnn Foo.test() {}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Add annotation target" "true"
|
||||
class Foo
|
||||
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class ReceiverAnn
|
||||
|
||||
fun @receiver:ReceiverAnn Foo.test() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target
|
||||
annotation class SetAnn
|
||||
|
||||
class Set(<caret>@set:SetAnn var foo: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target(AnnotationTarget.PROPERTY_SETTER)
|
||||
annotation class SetAnn
|
||||
|
||||
class Set(@set:SetAnn var foo: String)
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target
|
||||
annotation class SetParamAnn
|
||||
|
||||
class Bar {
|
||||
<caret>@setparam:SetParamAnn
|
||||
var foo = 1
|
||||
set(value) {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add annotation target" "true"
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class SetParamAnn
|
||||
|
||||
class Bar {
|
||||
@setparam:SetParamAnn
|
||||
var foo = 1
|
||||
set(value) {}
|
||||
}
|
||||
Reference in New Issue
Block a user