EA-101715: Handle also case with IntegerValueTypeConstructor
This commit is contained in:
+9
-1
@@ -42,6 +42,7 @@ import org.jetbrains.kotlin.resolve.BindingContext
|
|||||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
|
import org.jetbrains.kotlin.resolve.constants.IntegerValueTypeConstructor
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.isError
|
import org.jetbrains.kotlin.types.isError
|
||||||
@@ -86,7 +87,14 @@ internal fun KotlinType.toPsiType(source: UElement, element: KtElement, boxed: B
|
|||||||
"kotlin.Double" -> PsiType.DOUBLE.orBoxed()
|
"kotlin.Double" -> PsiType.DOUBLE.orBoxed()
|
||||||
"kotlin.Float" -> PsiType.FLOAT.orBoxed()
|
"kotlin.Float" -> PsiType.FLOAT.orBoxed()
|
||||||
"kotlin.String" -> PsiType.getJavaLangString(element.manager, GlobalSearchScope.projectScope(element.project))
|
"kotlin.String" -> PsiType.getJavaLangString(element.manager, GlobalSearchScope.projectScope(element.project))
|
||||||
else -> null
|
else -> {
|
||||||
|
val typeConstructor = this.constructor
|
||||||
|
if (typeConstructor is IntegerValueTypeConstructor) {
|
||||||
|
typeConstructor.supertypes.first().toPsiType(source, element, boxed)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (psiType != null) return psiType
|
if (psiType != null) return psiType
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
fun a() {
|
||||||
|
val a = Obj(555)
|
||||||
|
}
|
||||||
|
|
||||||
|
object Obj
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
UFile (package = ) [public final class Ea101715Kt {...]
|
||||||
|
UClass (name = Ea101715Kt) [public final class Ea101715Kt {...}]
|
||||||
|
UAnnotationMethod (name = a) [public static final fun a() : void {...}]
|
||||||
|
UBlockExpression [{...}] : PsiType:Unit
|
||||||
|
UDeclarationsExpression [var a: <ErrorType> = Obj(555)]
|
||||||
|
ULocalVariable (name = a) [var a: <ErrorType> = Obj(555)]
|
||||||
|
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [Obj(555)]
|
||||||
|
UIdentifier (Identifier (Obj)) [UIdentifier (Identifier (Obj))]
|
||||||
|
USimpleNameReferenceExpression (identifier = Obj) [Obj]
|
||||||
|
ULiteralExpression (value = 555) [555] : PsiType:int
|
||||||
|
UClass (name = Obj) [public final class Obj {...}]
|
||||||
|
UField (name = INSTANCE) [public static final var INSTANCE: Obj]
|
||||||
|
UAnnotation (fqName = null) [@null]
|
||||||
|
UAnnotationMethod (name = Obj) [private fun Obj() = UastEmptyExpression]
|
||||||
@@ -8,4 +8,6 @@ class KotlinUastTypesTest : AbstractKotlinTypesTest() {
|
|||||||
@Test fun testUnexpectedContainerException() = doTest("UnexpectedContainerException")
|
@Test fun testUnexpectedContainerException() = doTest("UnexpectedContainerException")
|
||||||
|
|
||||||
@Test fun testCycleInTypeParameters() = doTest("CycleInTypeParameters")
|
@Test fun testCycleInTypeParameters() = doTest("CycleInTypeParameters")
|
||||||
|
|
||||||
|
@Test fun testEa101715() = doTest("ea101715")
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user