From 6a75a9072ce1a7da65e21ab468da60b5f1fc6963 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Tue, 10 Sep 2019 12:04:57 +0300 Subject: [PATCH] [FIR] Remove redundant resolution stage from resolution of synthetic function calls --- .../jetbrains/kotlin/fir/resolve/calls/CallKind.kt | 12 ++++++++++++ .../transformers/FirSyntheticCallGenerator.kt | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt index ef0ff27bbf2..ee43caadf59 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt @@ -8,6 +8,18 @@ package org.jetbrains.kotlin.fir.resolve.calls sealed class CallKind { abstract val resolutionSequence: List + /* + * Used for resolution of synthetic calls for `when` and `try` expression + * that are equal to `fun select(vararg values: K): K` + */ + object SyntheticSelect : CallKind() { + override val resolutionSequence: List = listOf( + MapArguments, + CreateFreshTypeVariableSubstitutorStage, + CheckArguments + ) + } + object Function : CallKind() { override val resolutionSequence: List = listOf( CheckVisibility, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt index 5071e654b8e..a00c869009a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt @@ -95,7 +95,7 @@ class FirSyntheticCallGenerator(private val transformer: FirBodyResolveTransform ) private fun generateCallInfo(arguments: List) = CallInfo( - callKind = CallKind.Function, + callKind = CallKind.SyntheticSelect, explicitReceiver = null, arguments = arguments, isSafeCall = false,