[FIR] Properly set isOperator flag for java functions
^KT-56875 Fixed
This commit is contained in:
committed by
Space Team
parent
df47581c5a
commit
244dbb37cf
@@ -569,9 +569,6 @@ abstract class FirJavaFacade(
|
||||
javaMethod.visibility.toEffectiveVisibility(dispatchReceiver.lookupTag)
|
||||
).apply {
|
||||
isStatic = javaMethod.isStatic
|
||||
// Approximation: all Java methods with name that allows to use it in operator form are considered operators
|
||||
// We need here more detailed checks (see modifierChecks.kt)
|
||||
isOperator = name in ALL_JAVA_OPERATION_NAMES || OperatorNameConventions.COMPONENT_REGEX.matches(name.asString())
|
||||
hasStableParameterNames = false
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -25,8 +25,8 @@ import org.jetbrains.kotlin.fir.declarations.utils.*
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
import org.jetbrains.kotlin.fir.expressions.FirConstExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.unexpandedClassId
|
||||
import org.jetbrains.kotlin.fir.java.*
|
||||
import org.jetbrains.kotlin.fir.java.FirJavaTypeConversionMode
|
||||
import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
|
||||
import org.jetbrains.kotlin.fir.java.declarations.*
|
||||
import org.jetbrains.kotlin.fir.java.resolveIfJavaType
|
||||
import org.jetbrains.kotlin.fir.java.symbols.FirJavaOverriddenSyntheticPropertySymbol
|
||||
@@ -339,11 +339,20 @@ class FirSignatureEnhancement(
|
||||
if (isJavaRecordComponent) {
|
||||
this.isJavaRecordComponent = true
|
||||
}
|
||||
updateIsOperatorFlagIfNeeded(this)
|
||||
}
|
||||
|
||||
return function.symbol
|
||||
}
|
||||
|
||||
private fun updateIsOperatorFlagIfNeeded(function: FirFunction) {
|
||||
if (function !is FirSimpleFunction) return
|
||||
val isOperator = OperatorFunctionChecks.isOperator(function, session, scopeSession = null).isSuccess
|
||||
if (!isOperator) return
|
||||
val newStatus = function.status.copy(isOperator = true)
|
||||
function.replaceStatus(newStatus)
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform first time initialization of bounds with FirResolvedTypeRef instances
|
||||
* But after that bounds are still not enhanced and more over might have not totally correct raw types bounds
|
||||
|
||||
Reference in New Issue
Block a user