K2/Java: fix processing of built-in with value parameters to be erased in Java

In this commit we started to create and process a hidden copy
for a built-in functions, which value parameters are erased in Java,
in case we have an accidental Java override which value parameters
are not erased.

In this situation attempt to override such a Java override in Kotlin
again will lead to inaccessible functions
(see changes in containsAndOverload.fir.kt)

#KT-64846 In Progress
This commit is contained in:
Mikhail Glukhikh
2024-01-26 11:33:57 +01:00
committed by Space Team
parent 30ad532ff9
commit ac729e28da
3 changed files with 32 additions and 7 deletions
@@ -18,8 +18,8 @@ fun foo(a: A, ka: KA) {
"" in a
<!ARGUMENT_TYPE_MISMATCH!>1<!> in a
ka.contains("")
ka.contains(<!ARGUMENT_TYPE_MISMATCH!>1<!>)
"" in ka
<!ARGUMENT_TYPE_MISMATCH!>1<!> in ka
ka.<!UNRESOLVED_REFERENCE!>contains<!>("")
ka.<!UNRESOLVED_REFERENCE!>contains<!>(1)
"" <!UNRESOLVED_REFERENCE!>in<!> ka
1 <!UNRESOLVED_REFERENCE!>in<!> ka
}
@@ -5,3 +5,8 @@ KA:
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableCollection [id: 3]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/Collection] for type kotlin/collections/MutableCollection<E> [id: 3]
[Library]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Collection [id: 4]
[Enhancement]: /* hidden due to clash */ public open operator fun contains(x: R|kotlin/String!|): R|kotlin/Boolean| from Java enhancement scope for /A [id: 5]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|kotlin/String!|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/MutableCollection] for type A [id: 2]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/MutableCollection [id: 3]
[SubstitutionOverride(DeclarationSite)]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Substitution scope for [Use site scope of kotlin/collections/Collection] for type kotlin/collections/MutableCollection<E> [id: 3]
[Library]: public abstract operator fun contains(element: R|E|): R|kotlin/Boolean| from Use site scope of kotlin/collections/Collection [id: 4]