From 5bb84f89d571dfea9d6a20525cb075d2289a71c2 Mon Sep 17 00:00:00 2001 From: Mark Punzalan Date: Fri, 24 Sep 2021 23:39:53 +0000 Subject: [PATCH] HighLevelParamInfoHandler: Substitute type parameter types. GitOrigin-RevId: c447d2424be697f92f2dba68b9e686531c30c504 --- ...inHighLevelFunctionParameterInfoHandler.kt | 29 +++++++++++++------ .../kotlin/idea/parameterInfo/utils.kt | 8 +++-- .../functionCall/SubstituteFromArguments2.kt | 1 - .../functionCall/SubstituteFromArguments3.kt | 1 - .../functionCall/SubstituteFromArguments4.kt | 2 ++ .../SubstituteFromArgumentsOnTyping.kt | 1 - .../functionCall/TypeInference.kt | 1 - 7 files changed, 27 insertions(+), 16 deletions(-) diff --git a/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinHighLevelFunctionParameterInfoHandler.kt b/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinHighLevelFunctionParameterInfoHandler.kt index 23db2be94bc7..b620789f1033 100644 --- a/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinHighLevelFunctionParameterInfoHandler.kt +++ b/plugins/kotlin/fir/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinHighLevelFunctionParameterInfoHandler.kt @@ -9,14 +9,16 @@ import com.intellij.lang.parameterInfo.UpdateParameterInfoContext import com.intellij.psi.util.PsiTreeUtil import com.intellij.ui.Gray import com.intellij.ui.JBColor -import org.jetbrains.kotlin.config.LanguageFeature -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.analysis.api.KtAnalysisSession import org.jetbrains.kotlin.analysis.api.analyse import org.jetbrains.kotlin.analysis.api.components.KtTypeRendererOptions import org.jetbrains.kotlin.analysis.api.symbols.KtFunctionLikeSymbol import org.jetbrains.kotlin.analysis.api.symbols.KtValueParameterSymbol import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer +import org.jetbrains.kotlin.analysis.api.types.KtClassErrorType +import org.jetbrains.kotlin.analysis.api.types.KtSubstitutor +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.lexer.KtSingleValueToken import org.jetbrains.kotlin.lexer.KtTokens @@ -146,14 +148,14 @@ abstract class KotlinHighLevelParameterInfoWithCallHandlerBase + val argumentMapping: LinkedHashMap, + val substitutor: KtSubstitutor, ) \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments2.kt b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments2.kt index 850fa95262b0..ed9ed05abf5a 100644 --- a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments2.kt +++ b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments2.kt @@ -1,4 +1,3 @@ -// IGNORE_FIR fun f(p: Int, t1: T1, t2: T2){} fun test() { diff --git a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments3.kt b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments3.kt index 26607d0af9c4..b5cccb797462 100644 --- a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments3.kt +++ b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments3.kt @@ -1,4 +1,3 @@ -// IGNORE_FIR fun f(p: Int, t1: T1, t2: T2){} fun test() { diff --git a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments4.kt b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments4.kt index 843e5718cddf..7b00b593651b 100644 --- a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments4.kt +++ b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArguments4.kt @@ -1,4 +1,6 @@ // IGNORE_FIR +// FIR renders "pair: Pair>" +// ConeTypeIdeRenderer does not properly render ConeSimpleDiagnostic(kind = CannotInferParameterType); new ConeDiagnostic needed fun f(p: Int, t: T1, pair: Pair){} fun test() { diff --git a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArgumentsOnTyping.kt b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArgumentsOnTyping.kt index ab86fff6c94d..c1f7c7cba3dd 100644 --- a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArgumentsOnTyping.kt +++ b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/SubstituteFromArgumentsOnTyping.kt @@ -1,4 +1,3 @@ -// IGNORE_FIR fun f(t1: T, t2: T){} fun test() { diff --git a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/TypeInference.kt b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/TypeInference.kt index 5524d25fdf7a..39963d06f61c 100644 --- a/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/TypeInference.kt +++ b/plugins/kotlin/idea/tests/testData/parameterInfo/functionCall/TypeInference.kt @@ -1,4 +1,3 @@ -// IGNORE_FIR fun foo(a: A, b: B): B = b fun test(x: Any?) = foo(x, x!!).hashCode()