KTIJ-26024 [Analysis API] Add more tests for nested cases of reference shortening in class header

Account for `FirNestedClassifierScopeWithSubstitution` in the reference
shortener
This commit is contained in:
Roman Golyshev
2023-06-28 17:16:42 +02:00
committed by Space Team
parent 4adda42206
commit ab149e1053
25 changed files with 330 additions and 1 deletions
@@ -0,0 +1,11 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer()
annotation class Ann
<expr>@Outer.Ann</expr>
class Foo : Outer()
}
@@ -0,0 +1,8 @@
Before shortening: @Outer.Ann
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Ann
with SHORTEN_AND_IMPORT:
[type] Outer.Ann
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Ann
@@ -0,0 +1,7 @@
// FILE: main.kt
abstract class Outer {
annotation class Ann
class Foo <expr>@Outer.Ann</expr> constructor() : Outer()
}
@@ -0,0 +1,8 @@
Before shortening: @Outer.Ann
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Ann
with SHORTEN_AND_IMPORT:
[type] Outer.Ann
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Ann
@@ -0,0 +1,8 @@
// FILE: main.kt
abstract class Outer {
annotation class Ann
class Foo(<expr>@Outer.Ann</expr> val p: Any) : Outer()
}
@@ -0,0 +1,8 @@
Before shortening: @Outer.Ann
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Ann
with SHORTEN_AND_IMPORT:
[type] Outer.Ann
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Ann
@@ -0,0 +1,9 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer()
context(<expr>Outer.Nested</expr>)
class Foo : Outer.Nested()
}
@@ -0,0 +1,8 @@
Before shortening: Outer.Nested
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Nested
with SHORTEN_AND_IMPORT:
[type] Outer.Nested
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested
@@ -0,0 +1,7 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer()
class Foo(<expr>val param: Outer.Nested = Outer.Nested()</expr>) : Outer.Nested()
}
@@ -0,0 +1,11 @@
Before shortening: val param: Outer.Nested = Outer.Nested()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Nested
[qualifier] Outer.Nested()
with SHORTEN_AND_IMPORT:
[type] Outer.Nested
[qualifier] Outer.Nested()
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested
[qualifier] Outer.Nested()
@@ -0,0 +1,10 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested(a: Any) : Outer()
class OtherNested
class Foo : Outer.Nested(<expr>Outer.OtherNested()</expr>)
}
@@ -0,0 +1,8 @@
Before shortening: Outer.OtherNested()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[qualifier] Outer.OtherNested()
with SHORTEN_AND_IMPORT:
[qualifier] Outer.OtherNested()
with SHORTEN_AND_STAR_IMPORT:
[qualifier] Outer.OtherNested()
@@ -0,0 +1,7 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer()
<expr>class Foo : Outer.Nested()</expr>
}
@@ -0,0 +1,8 @@
Before shortening: class Foo : Outer.Nested()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Nested
with SHORTEN_AND_IMPORT:
[type] Outer.Nested
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested
@@ -0,0 +1,11 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer(), Marker
interface class Marker
class MarkerImpl() : Marker
class Foo : Outer.Nested(), <expr>Outer.Marker by Outer.MarkerImpl()</expr>
}
@@ -0,0 +1,11 @@
Before shortening: Outer.Marker by Outer.MarkerImpl()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Marker
[qualifier] Outer.MarkerImpl()
with SHORTEN_AND_IMPORT:
[type] Outer.Marker
[qualifier] Outer.MarkerImpl()
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Marker
[qualifier] Outer.MarkerImpl()
@@ -0,0 +1,9 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested<T> : Outer()
class OtherNested
class Foo : <expr>Outer.Nested<Outer.OtherNested></expr> { constructor(): super() }
}
@@ -0,0 +1,11 @@
Before shortening: Outer.Nested<Outer.OtherNested>
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Nested<Outer.OtherNested>
[type] Outer.OtherNested
with SHORTEN_AND_IMPORT:
[type] Outer.Nested<Outer.OtherNested>
[type] Outer.OtherNested
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested<Outer.OtherNested>
[type] Outer.OtherNested
@@ -0,0 +1,7 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer()
<expr>class Foo : Outer.Nested { constructor(): super() }</expr>
}
@@ -0,0 +1,8 @@
Before shortening: class Foo : Outer.Nested { constructor(): super() }
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Nested
with SHORTEN_AND_IMPORT:
[type] Outer.Nested
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested
@@ -0,0 +1,7 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer()
class Foo<T : <expr>Outer.Nested</expr>> : Outer.Nested()
}
@@ -0,0 +1,8 @@
Before shortening: Outer.Nested
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
[type] Outer.Nested
with SHORTEN_AND_IMPORT:
[type] Outer.Nested
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested