[Analysis API] support unsigned arrays creation functions
IDEA-335151, KT-62663 Merge-request: KT-MR-12614 Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
4922223bec
commit
45792c2e60
+1
-8
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.descriptors.components
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.analysis.api.calls.*
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
|
||||
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
|
||||
@@ -29,7 +28,6 @@ import org.jetbrains.kotlin.analysis.api.signatures.KtFunctionLikeSignature
|
||||
import org.jetbrains.kotlin.analysis.api.signatures.KtVariableLikeSignature
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtType
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.parentOfType
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.*
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
@@ -548,12 +546,7 @@ internal class KtFe10CallResolver(
|
||||
private fun createSignature(symbol: KtSymbol, resultingDescriptor: CallableDescriptor): KtCallableSignature<*>? {
|
||||
val returnType = if (resultingDescriptor is ValueParameterDescriptor && resultingDescriptor.isVararg) {
|
||||
val arrayType = resultingDescriptor.returnType ?: return null
|
||||
val primitiveArrayElementType = KotlinBuiltIns.getPrimitiveArrayElementType(arrayType)
|
||||
if (primitiveArrayElementType == null) {
|
||||
arrayType.arguments.singleOrNull()?.type
|
||||
} else {
|
||||
analysisContext.builtIns.getPrimitiveKotlinType(primitiveArrayElementType)
|
||||
}
|
||||
analysisContext.builtIns.getArrayElementType(arrayType)
|
||||
} else {
|
||||
resultingDescriptor.returnType
|
||||
}
|
||||
|
||||
+6
@@ -862,6 +862,12 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/unresolvedSuperReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsignedArrayOf.kt")
|
||||
public void testUnsignedArrayOf() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/unsignedArrayOf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("variableAsFunction.kt")
|
||||
public void testVariableAsFunction() throws Exception {
|
||||
|
||||
+6
@@ -862,6 +862,12 @@ public class FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated extends Ab
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/unresolvedSuperReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsignedArrayOf.kt")
|
||||
public void testUnsignedArrayOf() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/unsignedArrayOf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("variableAsFunction.kt")
|
||||
public void testVariableAsFunction() throws Exception {
|
||||
|
||||
+6
@@ -862,6 +862,12 @@ public class FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated ext
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/unresolvedSuperReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unsignedArrayOf.kt")
|
||||
public void testUnsignedArrayOf() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/unsignedArrayOf.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("variableAsFunction.kt")
|
||||
public void testVariableAsFunction() throws Exception {
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_STDLIB
|
||||
fun foo() {
|
||||
println(<expr>uintArrayOf(42u)</expr>)
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.UIntArray
|
||||
symbol = kotlin/uintArrayOf(vararg elements: kotlin.UInt): kotlin.UIntArray
|
||||
valueParameters = [
|
||||
KtVariableLikeSignature:
|
||||
name = elements
|
||||
receiverType = null
|
||||
returnType = kotlin.UInt
|
||||
symbol = vararg elements: kotlin.UInt
|
||||
callableIdIfNonLocal = null
|
||||
]
|
||||
callableIdIfNonLocal = kotlin/uintArrayOf
|
||||
typeArgumentsMapping = {}
|
||||
argumentMapping = {
|
||||
42u -> (KtVariableLikeSignature:
|
||||
name = elements
|
||||
receiverType = null
|
||||
returnType = kotlin.UInt
|
||||
symbol = vararg elements: kotlin.UInt
|
||||
callableIdIfNonLocal = null)
|
||||
}
|
||||
Reference in New Issue
Block a user