From 9f15c0f4d792234de1fab15a71c5e2559280a896 Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Thu, 16 Jan 2020 17:38:01 +0300 Subject: [PATCH] Add commentary about inserting type for lateinit var in completion - Also, use dedicated method to check modifier --- .../kotlin/idea/completion/BasicCompletionSession.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt index e80869a993f..367e90f8afc 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt @@ -189,7 +189,9 @@ class BasicCompletionSession( completeDeclarationNameFromUnresolvedOrOverride(declaration) if (declaration is KtProperty) { - completeParameterOrVarNameAndType(declaration.modifierList?.hasModifier(KtTokens.LATEINIT_KEYWORD) == true) + // we want to insert type only if the property is lateinit, + // because lateinit var cannot have its type deduced from initializer + completeParameterOrVarNameAndType(withType = declaration.hasModifier(KtTokens.LATEINIT_KEYWORD)) } // no auto-popup on typing after "val", "var" and "fun" because it's likely the name of the declaration which is being typed by user