Skip to content

Commit

Permalink
[FIR] Fix compact rendering of flexible collection types and arrays
Browse files Browse the repository at this point in the history
#KT-71160 Fixed
  • Loading branch information
cypressious authored and qodana-bot committed Sep 3, 2024
1 parent b59f7eb commit 63f7588
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class ConeTypeRendererForReadability(
return "$lowerRendered!"
}

val kotlinCollectionsPrefix = StandardNames.COLLECTIONS_PACKAGE_FQ_NAME.asString() + "."
val kotlinCollectionsPrefix = (StandardNames.COLLECTIONS_PACKAGE_FQ_NAME.asString() + ".").takeIf { lowerRendered.startsWith(it) } ?: ""
val mutablePrefix = "Mutable"
// java.util.List<Foo> -> (Mutable)List<Foo!>!
val simpleCollection = replacePrefixesInTypeRepresentations(
Expand All @@ -82,7 +82,7 @@ open class ConeTypeRendererForReadability(
)
if (mutableEntry != null) return mutableEntry

val kotlinPrefix = StandardNames.BUILT_INS_PACKAGE_FQ_NAME.asString() + "."
val kotlinPrefix = (StandardNames.BUILT_INS_PACKAGE_FQ_NAME.asString() + ".").takeIf { lowerRendered.startsWith(it) } ?: ""
// Foo[] -> Array<(out) Foo!>!
val array = replacePrefixesInTypeRepresentations(
lowerRendered = lowerRendered,
Expand Down
2 changes: 1 addition & 1 deletion compiler/testData/cli/jvm/firDeprecationJava.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ compiler/testData/cli/jvm/firDeprecationJava.kt:3:12: warning: 'fun stop(): Unit
compiler/testData/cli/jvm/firDeprecationJava.kt:4:17: warning: 'fun bar(a: String!, b: Int, c: Double): String!' is deprecated. Deprecated in Java.
JavaClass().bar("", 1, 2.0)
^^^
compiler/testData/cli/jvm/firDeprecationJava.kt:5:27: warning: 'field baz: (MutableList<String!>..List<String!>?)' is deprecated. Deprecated in Java.
compiler/testData/cli/jvm/firDeprecationJava.kt:5:27: warning: 'field baz: (Mutable)List<String!>!' is deprecated. Deprecated in Java.
val baz = JavaClass().baz
^^^
OK
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
fun takeV(value: X & Any): Unit

/main.kt:(137,145): error: 'takeVList' overrides nothing. Potential signatures for overriding:
fun takeVList(value: (MutableList<@NotNull() X & Any>..List<@NotNull() X & Any>)): Unit
fun takeVList(value: (Mutable)List<@NotNull() X & Any>): Unit
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
fun test1(a: String!): Unit

/test.kt:(129,137): error: 'test2' overrides nothing. Potential signatures for overriding:
fun test2(a: (MutableList<Int!>..List<Int!>?)): (MutableList<Int!>..List<Int!>?)
fun test2(a: (Mutable)List<Int!>!): (Mutable)List<Int!>!

/test.kt:(201,209): error: 'test3' overrides nothing. Potential signatures for overriding:
fun test3(a: (Array<String!>..Array<out String!>?)): (Array<String!>..Array<out String!>?)
fun test3(a: Array<(out) String!>!): Array<(out) String!>!

/test.kt:(287,295): error: 'test4' overrides nothing. Potential signatures for overriding:
fun test4(vararg indices: String!): Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/newListMethods.fir.kt:(724,731): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic.

/newListMethods.fir.kt:(799,806): warning: 'fun <T : Any!> toArray(p0: IntFunction<(Array<T!>..Array<out T!>?)>!): (Array<T!>..Array<out T!>?)' is deprecated. This declaration is redundant in Kotlin and might be removed soon.
/newListMethods.fir.kt:(799,806): warning: 'fun <T : Any!> toArray(p0: IntFunction<Array<(out) T!>!>!): Array<(out) T!>!' is deprecated. This declaration is redundant in Kotlin and might be removed soon.

/newListMethods.fir.kt:(875,883): warning: This declaration overrides a deprecated member but is not marked as deprecated itself. Please add the '@Deprecated' annotation or suppress the diagnostic.

Expand Down

0 comments on commit 63f7588

Please sign in to comment.