Revert "Reserve "async* {}", extend the quick-fix"

This reverts commit a7e7d53e2b.
This commit is contained in:
Denis Zharkov
2016-05-19 14:02:11 +03:00
parent bf3e6247aa
commit 7d3333e86e
13 changed files with 8 additions and 101 deletions
@@ -23,7 +23,6 @@ import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.idea.codeInsight.surroundWith.expression.KotlinParenthesesSurrounder
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.KtBinaryExpression
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtFile
@@ -34,15 +33,8 @@ class UnsupportedAsyncFix(val psiElement: PsiElement): KotlinQuickFixAction<PsiE
override fun getText(): String = familyName
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
if (element is KtBinaryExpression) {
if (element.operationToken != KtTokens.IDENTIFIER) {
// async+ {}
element.addBefore(KtPsiFactory(element).createWhiteSpace(), element.operationReference)
}
else if (element.right != null) {
// foo async {}
KotlinParenthesesSurrounder.surroundWithParentheses(element.right!!)
}
if (element is KtBinaryExpression && element.right != null) {
KotlinParenthesesSurrounder.surroundWithParentheses(element.right!!)
}
if (element is KtCallExpression) {
-5
View File
@@ -77,9 +77,6 @@ fun infixTest() {
fun async(f: () -> Unit) {}
infix fun Any.async(f: () -> Unit) {}
object async {
operator fun times(f: () -> Unit) = f()
}
fun test(foo: Any) {
async { }
@@ -95,7 +92,5 @@ fun test(foo: Any) {
foo async (fun () {})
async (fun () {})
async* {}
}
-5
View File
@@ -76,9 +76,6 @@ fun infixTest() {
fun async(f: () -> Unit) {}
infix fun Any.async(f: () -> Unit) {}
object async {
operator fun times(f: () -> Unit) = f()
}
fun test(foo: Any) {
async() { }
@@ -94,7 +91,5 @@ fun test(foo: Any) {
foo async (fun () {})
async (fun () {})
async * {}
}
@@ -1,8 +0,0 @@
// "Migrate unsupported async syntax" "true"
object async {
operator fun times(f: () -> Unit) = f()
}
fun test() {
asy<caret>nc* { }
}
@@ -1,8 +0,0 @@
// "Migrate unsupported async syntax" "true"
object async {
operator fun times(f: () -> Unit) = f()
}
fun test() {
asy<caret>nc * { }
}
@@ -615,12 +615,6 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/asyncUnsupported/asyncWithLambdaAndComment.kt");
doTest(fileName);
}
@TestMetadata("asyncWithTimes.kt")
public void testAsyncWithTimes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/asyncUnsupported/asyncWithTimes.kt");
doTest(fileName);
}
}
@TestMetadata("idea/testData/quickfix/autoImports")