KT-32178 Keyword completion: don't add 'fun' after 'suspend' in type position

#KT-32178 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-07-04 18:08:34 +09:00
committed by Roman Golyshev
parent 1f878049eb
commit ba640be81d
7 changed files with 14 additions and 5 deletions
@@ -104,7 +104,7 @@ object KeywordCompletion {
var keyword = keywordToken.value
val nextKeyword = when {
keywordToken == SUSPEND_KEYWORD && ((position.containingFile as? KtFile)?.isScript() == true) -> null
keywordToken == SUSPEND_KEYWORD && position.getStrictParentOfType<KtTypeReference>() != null -> null
else -> COMPOUND_KEYWORDS[keywordToken]
}
var applicableAsCompound = false
@@ -2,5 +2,5 @@ fun foo() {
val test : <caret>
}
// EXIST: suspend fun
// EXIST: suspend
// NOTHING_ELSE
+1 -1
View File
@@ -1,5 +1,5 @@
val a : <caret>
// EXIST: suspend fun
// EXIST: suspend
// NOTHING_ELSE
@@ -0,0 +1,4 @@
fun foo(a: <caret>) {}
// EXIST: suspend
// NOTHING_ELSE
@@ -5,7 +5,7 @@ class Su() {
}
// EXIST: suspend fun
// EXIST: suspend
/* TODO: items below are not valid here */
// EXIST: class
@@ -5,7 +5,7 @@ class Su() {
}
// EXIST: suspend fun
// EXIST: suspend
/* TODO: items below are not valid here */
// EXIST: class
@@ -503,6 +503,11 @@ public class KeywordCompletionTestGenerated extends AbstractKeywordCompletionTes
runTest("idea/idea-completion/testData/keywords/ReturnSet.kt");
}
@TestMetadata("SuspendInParameterTypePosition.kt")
public void testSuspendInParameterTypePosition() throws Exception {
runTest("idea/idea-completion/testData/keywords/SuspendInParameterTypePosition.kt");
}
@TestMetadata("SuspendInsideTypeArguments.kt")
public void testSuspendInsideTypeArguments() throws Exception {
runTest("idea/idea-completion/testData/keywords/SuspendInsideTypeArguments.kt");