Uast: converting Unit to void on type mapping (KT-25249)

This commit is contained in:
Nicolay Mitropolsky
2018-07-03 20:59:58 +03:00
parent 39fc7cffe1
commit 5d9807ac36
9 changed files with 17 additions and 14 deletions
@@ -82,6 +82,7 @@ private fun psiType(kotlinType: KotlinType, context: PsiElement): PsiType? {
"kotlin.Char" -> PsiType.CHAR
"kotlin.Double" -> PsiType.DOUBLE
"kotlin.Float" -> PsiType.FLOAT
"kotlin.Unit" -> PsiType.VOID
"kotlin.String" -> PsiType.getJavaLangString(context.manager, context.resolveScope)
else -> PsiType.getTypeByName(typeFqName, context.project, context.resolveScope)
}
@@ -82,6 +82,7 @@ private fun psiType(kotlinType: KotlinType, context: PsiElement): PsiType? {
"kotlin.Char" -> PsiType.CHAR
"kotlin.Double" -> PsiType.DOUBLE
"kotlin.Float" -> PsiType.FLOAT
"kotlin.Unit" -> PsiType.VOID
"kotlin.String" -> PsiType.getJavaLangString(context.manager, context.resolveScope)
else -> PsiType.getTypeByName(typeFqName, context.project, context.resolveScope)
}
@@ -182,6 +182,7 @@ internal fun KotlinType.toPsiType(lightDeclaration: PsiModifierListOwner?, conte
"kotlin.Char" -> PsiType.CHAR.orBoxed()
"kotlin.Double" -> PsiType.DOUBLE.orBoxed()
"kotlin.Float" -> PsiType.FLOAT.orBoxed()
"kotlin.Unit" -> PsiType.VOID.orBoxed()
"kotlin.String" -> PsiType.getJavaLangString(context.manager, context.resolveScope)
else -> {
val typeConstructor = this.constructor
@@ -51,10 +51,10 @@ UFile (package = ) [public final class StringTemplateComplexKt {...]
UReturnExpression [return i]
USimpleNameReferenceExpression (identifier = i) [i] : PsiType:int
UAnnotationMethod (name = foo) [public static final fun foo() : void {...}]
UBlockExpression [{...}] : PsiType:Unit
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [println(baz)] : PsiType:Unit
UBlockExpression [{...}] : PsiType:void
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [println(baz)] : PsiType:void
UIdentifier (Identifier (println)) [UIdentifier (Identifier (println))]
USimpleNameReferenceExpression (identifier = println) [println] : PsiType:Unit
USimpleNameReferenceExpression (identifier = println) [println] : PsiType:void
USimpleNameReferenceExpression (identifier = baz) [baz]
UDeclarationsExpression [var template1: java.lang.String = simpleForTemplate()]
ULocalVariable (name = template1) [var template1: java.lang.String = simpleForTemplate()]
@@ -51,10 +51,10 @@ UFile (package = ) [public final class StringTemplateComplexKt {...]
UReturnExpression [return i]
USimpleNameReferenceExpression (identifier = i) [i] : PsiType:int
UAnnotationMethod (name = foo) [public static final fun foo() : void {...}]
UBlockExpression [{...}] : PsiType:Unit
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [println(baz)] : PsiType:Unit
UBlockExpression [{...}] : PsiType:void
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [println(baz)] : PsiType:void
UIdentifier (Identifier (println)) [UIdentifier (Identifier (println))]
USimpleNameReferenceExpression (identifier = println) [println] : PsiType:Unit
USimpleNameReferenceExpression (identifier = println) [println] : PsiType:void
USimpleNameReferenceExpression (identifier = baz) [baz]
UDeclarationsExpression [var template1: java.lang.String = simpleForTemplate()]
ULocalVariable (name = template1) [var template1: java.lang.String = simpleForTemplate()]
@@ -16,10 +16,10 @@ UFile (package = ) [public abstract interface Callback {...]
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:UnsupportedOperationException
UAnnotationMethod (name = Model) [public fun Model() {...}]
UBlockExpression [{...}]
UBlockExpression [{...}] : PsiType:Unit
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [crashMe(Callback.java, { ...})] : PsiType:Unit
UBlockExpression [{...}] : PsiType:void
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [crashMe(Callback.java, { ...})] : PsiType:void
UIdentifier (Identifier (crashMe)) [UIdentifier (Identifier (crashMe))]
USimpleNameReferenceExpression (identifier = crashMe) [crashMe] : PsiType:Unit
USimpleNameReferenceExpression (identifier = crashMe) [crashMe] : PsiType:void
UQualifiedReferenceExpression [Callback.java] : PsiType:Class<Callback>
UClassLiteralExpression [Callback] : PsiType:KClass<Callback>
USimpleNameReferenceExpression (identifier = java) [java] : PsiType:Class<Callback>
@@ -16,10 +16,10 @@ UFile (package = ) [public abstract interface Callback {...]
USimpleNameReferenceExpression (identifier = <init>) [<init>] : PsiType:UnsupportedOperationException
UAnnotationMethod (name = Model) [public fun Model() {...}]
UBlockExpression [{...}]
UBlockExpression [{...}] : PsiType:Unit
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [crashMe(Callback.java, { ...})] : PsiType:Unit
UBlockExpression [{...}] : PsiType:void
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 2)) [crashMe(Callback.java, { ...})] : PsiType:void
UIdentifier (Identifier (crashMe)) [UIdentifier (Identifier (crashMe))]
USimpleNameReferenceExpression (identifier = crashMe) [crashMe] : PsiType:Unit
USimpleNameReferenceExpression (identifier = crashMe) [crashMe] : PsiType:void
UQualifiedReferenceExpression [Callback.java] : PsiType:Class<Callback>
UClassLiteralExpression [Callback] : PsiType:KClass<Callback>
USimpleNameReferenceExpression (identifier = java) [java] : PsiType:Class<Callback>
+1 -1
View File
@@ -1,7 +1,7 @@
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
UBlockExpression [{...}] : PsiType:void
UDeclarationsExpression [var a: <ErrorType> = Obj(555)]
ULocalVariable (name = a) [var a: <ErrorType> = Obj(555)]
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [Obj(555)]
+1 -1
View File
@@ -1,7 +1,7 @@
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
UBlockExpression [{...}] : PsiType:void
UDeclarationsExpression [var a: <ErrorType> = Obj(555)]
ULocalVariable (name = a) [var a: <ErrorType> = Obj(555)]
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) [Obj(555)]