[FE] Return Name? instead of List<Name> from getBuiltinFunctionNamesByJvmName

This is much more correct, because we have one to one mapping for
  special java functions in this case, so using single nullable name
  instead of list of names makes code more readable
This commit is contained in:
Dmitriy Novozhilov
2021-12-13 11:57:44 +03:00
parent 09a7a1c09f
commit 17916d4a63
3 changed files with 25 additions and 29 deletions
@@ -127,13 +127,13 @@ open class SpecialGenericSignatures {
val ORIGINAL_SHORT_NAMES: List<Name> = NAME_AND_SIGNATURE_TO_JVM_REPRESENTATION_NAME_MAP.keys.map { it.name }
val JVM_SHORT_NAME_TO_BUILTIN_SHORT_NAMES_MAP: Map<Name, List<Name>> =
val JVM_SHORT_NAME_TO_BUILTIN_SHORT_NAMES_MAP: Map<Name, Name> =
NAME_AND_SIGNATURE_TO_JVM_REPRESENTATION_NAME_MAP.entries
.map { Pair(it.key.name, it.value) }
.groupBy({ it.second }, { it.first })
.associateBy({ it.second }, { it.first })
fun getBuiltinFunctionNamesByJvmName(name: Name): List<Name> =
JVM_SHORT_NAME_TO_BUILTIN_SHORT_NAMES_MAP[name] ?: emptyList()
fun getBuiltinFunctionNamesByJvmName(name: Name): Name? =
JVM_SHORT_NAME_TO_BUILTIN_SHORT_NAMES_MAP[name]
val Name.sameAsBuiltinMethodWithErasedValueParameters: Boolean
get() = this in ERASED_VALUE_PARAMETERS_SHORT_NAMES