KT-64186 [LL] Correctly handle anonymous objects' headers in ContextCollector

This bug spilled into reference shortener, and then to
"redundant qualifier inspection" and code completion from there;
it caused KTIJ-26024 to reproduce again (but only for anonymous objects)

^KT-64186 Fixed
This commit is contained in:
Roman Golyshev
2023-12-07 23:42:51 +01:00
committed by Space Team
parent 2eb1e65bbf
commit 78f492394c
16 changed files with 231 additions and 1 deletions
@@ -0,0 +1,10 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested(a: Any) : Outer()
class OtherNested
val foo = object : 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,9 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested(a: Any) : Outer()
class OtherNested
}
val foo = object : 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,8 @@
// FILE: main.kt
abstract class Outer {
abstract class Nested : Outer()
<expr>val foo = object : Outer.Nested() {}</expr>
}
@@ -0,0 +1,8 @@
Before shortening: val foo = object : 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()
}
<expr>val foo = object : Outer.Nested() {}</expr>
@@ -0,0 +1,7 @@
Before shortening: val foo = object : Outer.Nested() {}
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[type] Outer.Nested
with SHORTEN_AND_STAR_IMPORT:
[type] Outer.Nested