[FIR] add missed scope for annotations on property receiver, typealias and init and dangling list

Also, we shouldn't transform type alias during the implicit type phase

^KT-63042
^KT-63832 Fixed
This commit is contained in:
Dmitrii Gridin
2023-11-27 15:01:57 +01:00
committed by Space Team
parent aaaf35fcb8
commit 98e12b0d7b
14 changed files with 69 additions and 63 deletions
@@ -1,9 +0,0 @@
annotation class Anno(val position: String)
interface OriginalInterface {
companion object {
private const val prop = 0
}
@Anno("dangling $<!UNRESOLVED_REFERENCE!>prop<!>")<!SYNTAX!><!>
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
annotation class Anno(val position: String)
interface OriginalInterface {
@@ -1,11 +0,0 @@
annotation class Anno(val position: String)
class MyClass {
<!WRONG_ANNOTATION_TARGET!>@Anno("init $<!UNRESOLVED_REFERENCE!>prop<!>")<!> init {
}
companion object {
private const val prop = 0
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
annotation class Anno(val position: String)
class MyClass {
@@ -1,11 +0,0 @@
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE_PARAMETER)
annotation class Anno(val position: String)
interface OriginalInterface<T> {
<!TOPLEVEL_TYPEALIASES_ONLY!>@Anno("alias $<!UNRESOLVED_REFERENCE!>prop<!>")
typealias NestedTypeAlias <@Anno("type param $<!UNRESOLVED_REFERENCE!>prop<!>") A : <!BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED!>@Anno("bound $<!UNRESOLVED_REFERENCE!>prop<!>") Number<!>> = @Anno("type $<!UNRESOLVED_REFERENCE!>prop<!>") OriginalInterface<A><!>
companion object {
private const val prop = 0
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE_PARAMETER)
annotation class Anno(val position: String)
@@ -7,7 +7,7 @@ annotation class Anno(val position: String)
interface OriginalInterface {
@Anno("explicitType $prop")
fun <@Anno("type param $prop") F : @Anno("bound $prop") List<@Anno("nested bound $prop") List<@Anno("nested nested bound $prop") String>>> @receiver:Anno("receiver annotation: $prop") @Anno("receiver type $prop") Collection<@Anno("nested receiver type $prop") List<@Anno("nested nested receiver type $prop")String>>.explicitType(@Anno("parameter annotation $prop") param: @Anno("parameter type $prop") ListIterator<@Anno("nested parameter type $prop") List<@Anno("nested nested parameter type $prop")String>>): @Anno("explicitType return type $prop") List<@Anno("explicitType nested return type $prop") List<@Anno("explicitType nested nested return type $prop") Int>> = emptyList()
val <@Anno("type param $prop") F : @Anno("bound $prop") Number> @receiver:Anno("receiver annotation: $<!UNRESOLVED_REFERENCE!>prop<!>") @Anno("receiver type $<!UNRESOLVED_REFERENCE!>prop<!>") F.explicitType: @Anno("bound $prop") Int get() = 1
val <@Anno("type param $prop") F : @Anno("bound $prop") Number> @receiver:Anno("receiver annotation: $prop") @Anno("receiver type $prop") F.explicitType: @Anno("bound $prop") Int get() = 1
companion object {
private const val prop = 0