[FIR] Introduce FirDeclarationStatus.hasStableParameterNames

This flag is true by default but is set to false for

- Java methods and constructors
- interface delegation methods that delegate to Java

The NAMED_ARGUMENTS_NOT_ALLOWED logic is mostly refactored to use the
new flag though some custom logic remains for determining the correct
message and to work around a corner case with fake overrides.

The flag is (de)serialized from/to metadata. For backward compatibility
with K1, delegated methods to Java types are deserialized as stable.

^KT-40480 Fixed
This commit is contained in:
Kirill Rakhman
2023-02-03 12:08:17 +01:00
committed by Space Team
parent 152e63b198
commit 314784f435
29 changed files with 156 additions and 51 deletions
@@ -74,13 +74,16 @@ abstract class FirSyntheticFunctionInterfaceProviderBase(
}
@FirSymbolProviderInternals
override fun getTopLevelCallableSymbolsTo(destination: MutableList<FirCallableSymbol<*>>, packageFqName: FqName, name: Name) {}
override fun getTopLevelCallableSymbolsTo(destination: MutableList<FirCallableSymbol<*>>, packageFqName: FqName, name: Name) {
}
@FirSymbolProviderInternals
override fun getTopLevelFunctionSymbolsTo(destination: MutableList<FirNamedFunctionSymbol>, packageFqName: FqName, name: Name) {}
override fun getTopLevelFunctionSymbolsTo(destination: MutableList<FirNamedFunctionSymbol>, packageFqName: FqName, name: Name) {
}
@FirSymbolProviderInternals
override fun getTopLevelPropertySymbolsTo(destination: MutableList<FirPropertySymbol>, packageFqName: FqName, name: Name) {}
override fun getTopLevelPropertySymbolsTo(destination: MutableList<FirPropertySymbol>, packageFqName: FqName, name: Name) {
}
override fun getPackage(fqName: FqName): FqName? {
return fqName.takeIf { session.functionTypeService.hasKindWithSpecificPackage(it) }
@@ -162,6 +165,7 @@ abstract class FirSyntheticFunctionInterfaceProviderBase(
).apply {
isOperator = true
isSuspend = kind.isSuspendOrKSuspendFunction
hasStableParameterNames = false
}
val typeArguments = typeParameters.map {
ConeTypeParameterTypeImpl(it.symbol.toLookupTag(), false).toFirResolvedTypeRef()