Fix flexible type rendering
Do not append "!" if bounds have same nullability
This commit is contained in:
Vendored
+1
-1
@@ -4,7 +4,7 @@ public interface InheritNotVararg {
|
|||||||
|
|
||||||
public interface Sub : test.InheritNotVararg.Super {
|
public interface Sub : test.InheritNotVararg.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ p0: (kotlin.Array<kotlin.String!>?..kotlin.Array<out kotlin.String!>?)): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ p0: kotlin.Array<(out) kotlin.String!>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Super {
|
public interface Super {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ public interface InheritNotVarargInteger {
|
|||||||
|
|
||||||
public interface Sub : test.InheritNotVarargInteger.Super {
|
public interface Sub : test.InheritNotVarargInteger.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ p0: (kotlin.Array<kotlin.Int!>?..kotlin.Array<out kotlin.Int!>?)): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ p0: kotlin.Array<(out) kotlin.Int!>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Super {
|
public interface Super {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ public interface InheritNotVarargNotNull {
|
|||||||
|
|
||||||
public interface Sub : test.InheritNotVarargNotNull.Super {
|
public interface Sub : test.InheritNotVarargNotNull.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ p: (kotlin.Array<kotlin.String!>?..kotlin.Array<out kotlin.String!>?)): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ p: kotlin.Array<(out) kotlin.String!>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Super {
|
public interface Super {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ public interface InheritVararg {
|
|||||||
|
|
||||||
public interface Sub : test.InheritVararg.Super {
|
public interface Sub : test.InheritVararg.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ vararg p0: kotlin.String! /*kotlin.Array<(out) kotlin.String!>!*/): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ vararg p0: kotlin.String! /*kotlin.Array<(out) kotlin.String!>*/): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Super {
|
public interface Super {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ public interface InheritVarargInteger {
|
|||||||
|
|
||||||
public interface Sub : test.InheritVarargInteger.Super {
|
public interface Sub : test.InheritVarargInteger.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ vararg p0: kotlin.Int! /*kotlin.Array<(out) kotlin.Int!>!*/): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ vararg p0: kotlin.Int! /*kotlin.Array<(out) kotlin.Int!>*/): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Super {
|
public interface Super {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ public interface InheritVarargNotNull {
|
|||||||
|
|
||||||
public interface Sub : test.InheritVarargNotNull.Super {
|
public interface Sub : test.InheritVarargNotNull.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun dummy(): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ vararg p: kotlin.String! /*kotlin.Array<(out) kotlin.String!>!*/): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ vararg p: kotlin.String! /*kotlin.Array<(out) kotlin.String!>*/): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Super {
|
public interface Super {
|
||||||
|
|||||||
@@ -870,8 +870,13 @@ internal class DescriptorRendererImpl(
|
|||||||
private fun replacePrefixes(lowerRendered: String, lowerPrefix: String, upperRendered: String, upperPrefix: String, foldedPrefix: String): String? {
|
private fun replacePrefixes(lowerRendered: String, lowerPrefix: String, upperRendered: String, upperPrefix: String, foldedPrefix: String): String? {
|
||||||
if (lowerRendered.startsWith(lowerPrefix) && upperRendered.startsWith(upperPrefix)) {
|
if (lowerRendered.startsWith(lowerPrefix) && upperRendered.startsWith(upperPrefix)) {
|
||||||
val lowerWithoutPrefix = lowerRendered.substring(lowerPrefix.length())
|
val lowerWithoutPrefix = lowerRendered.substring(lowerPrefix.length())
|
||||||
if (differsOnlyInNullability(lowerWithoutPrefix, upperRendered.substring(upperPrefix.length()))) {
|
val upperWithoutPrefix = upperRendered.substring(upperPrefix.length())
|
||||||
return foldedPrefix + lowerWithoutPrefix + "!"
|
val flexibleCollectionName = foldedPrefix + lowerWithoutPrefix
|
||||||
|
|
||||||
|
if (lowerWithoutPrefix == upperWithoutPrefix) return flexibleCollectionName
|
||||||
|
|
||||||
|
if (differsOnlyInNullability(lowerWithoutPrefix, upperWithoutPrefix)) {
|
||||||
|
return flexibleCollectionName + "!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user