FIR: Refine processing special functions with erased parameters
This commit is contained in:
+2
-3
@@ -415,7 +415,7 @@ class JavaClassUseSiteMemberScope(
|
|||||||
?.symbol as? FirNamedFunctionSymbol
|
?.symbol as? FirNamedFunctionSymbol
|
||||||
?: unwrappedSubstitutionOverride.symbol
|
?: unwrappedSubstitutionOverride.symbol
|
||||||
val originalDeclaredFunction = declaredMemberScope.getFunctions(naturalName).firstOrNull {
|
val originalDeclaredFunction = declaredMemberScope.getFunctions(naturalName).firstOrNull {
|
||||||
it.hasSameJvmDescriptorButDoesNotOverride(functionFromSupertypeWithErasedParameterType)
|
it.hasSameJvmDescriptor(functionFromSupertypeWithErasedParameterType) && it.hasErasedParameters()
|
||||||
} ?: return false
|
} ?: return false
|
||||||
val renamedDeclaredFunction = buildJavaMethodCopy(originalDeclaredFunction.fir as FirJavaMethod) {
|
val renamedDeclaredFunction = buildJavaMethodCopy(originalDeclaredFunction.fir as FirJavaMethod) {
|
||||||
name = naturalName
|
name = naturalName
|
||||||
@@ -451,11 +451,10 @@ class JavaClassUseSiteMemberScope(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun FirNamedFunctionSymbol.hasSameJvmDescriptorButDoesNotOverride(
|
private fun FirNamedFunctionSymbol.hasSameJvmDescriptor(
|
||||||
builtinWithErasedParameters: FirNamedFunctionSymbol
|
builtinWithErasedParameters: FirNamedFunctionSymbol
|
||||||
): Boolean {
|
): Boolean {
|
||||||
return fir.computeJvmDescriptor(includeReturnType = false) == builtinWithErasedParameters.fir.computeJvmDescriptor(includeReturnType = false)
|
return fir.computeJvmDescriptor(includeReturnType = false) == builtinWithErasedParameters.fir.computeJvmDescriptor(includeReturnType = false)
|
||||||
&& overrideChecker.isOverriddenFunction(this, builtinWithErasedParameters)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processOverridesForFunctionsWithDifferentJvmName(
|
private fun processOverridesForFunctionsWithDifferentJvmName(
|
||||||
|
|||||||
Vendored
+1
-1
@@ -115,5 +115,5 @@ fun main() {
|
|||||||
x[0]
|
x[0]
|
||||||
x.size
|
x.size
|
||||||
x.remove("")
|
x.remove("")
|
||||||
x.remove(1)
|
x.remove(<!ARGUMENT_TYPE_MISMATCH!>1<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -102,5 +102,5 @@ fun main() {
|
|||||||
<!OPERATOR_MODIFIER_REQUIRED!>x[0]<!>
|
<!OPERATOR_MODIFIER_REQUIRED!>x[0]<!>
|
||||||
x.size
|
x.size
|
||||||
x.remove("")
|
x.remove("")
|
||||||
x.remove(1)
|
x.remove(<!ARGUMENT_TYPE_MISMATCH!>1<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user