diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiPrecedences.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiPrecedences.java new file mode 100644 index 00000000000..c1943333695 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiPrecedences.java @@ -0,0 +1,73 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.psi; + +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.parsing.JetExpressionParsing; + +import java.util.HashMap; +import java.util.Map; + +import static org.jetbrains.jet.lang.parsing.JetExpressionParsing.Precedence.*; + +public class JetPsiPrecedences { + private static final Logger LOG = Logger.getInstance(JetPsiPrecedences.class); + + private static final Map precedence; + static { + Map builder = new HashMap(); + + JetExpressionParsing.Precedence[] records = values(); + for (int i = 0; i < records.length; i++) { + for (IElementType elementType : records[i].getOperations().getTypes()) { + builder.put(elementType, i); + } + } + + precedence = builder; + } + + public static final int PRECEDENCE_OF_ATOMIC_EXPRESSION = -1; + + public static final int PRECEDENCE_OF_PREFIX_EXPRESSION = PREFIX.ordinal(); + + public static final int PRECEDENCE_OF_POSTFIX_EXPRESSION = POSTFIX.ordinal(); + + public static int getPrecedence(@NotNull JetExpression expression) { + if (expression instanceof JetAnnotatedExpression || expression instanceof JetPrefixExpression) { + return PRECEDENCE_OF_PREFIX_EXPRESSION; + } + if (expression instanceof JetPostfixExpression) { + return PRECEDENCE_OF_POSTFIX_EXPRESSION; + } + if (expression instanceof JetOperationExpression) { + JetOperationExpression operationExpression = (JetOperationExpression) expression; + + IElementType operation = operationExpression.getOperationReference().getReferencedNameElementType(); + + Integer precedenceNumber = precedence.get(operation); + if (precedenceNumber == null) { + LOG.error("No precedence for operation: " + operation); + return precedence.size(); // lowest + } + return precedenceNumber; + } + return PRECEDENCE_OF_ATOMIC_EXPRESSION; // Atomic expression + } +} diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/KotlinSuppressableWarningProblemGroup.kt b/idea/src/org/jetbrains/jet/plugin/highlighter/KotlinSuppressableWarningProblemGroup.kt index ae708da52cb..093b41b08ce 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/KotlinSuppressableWarningProblemGroup.kt +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/KotlinSuppressableWarningProblemGroup.kt @@ -23,7 +23,7 @@ import org.jetbrains.jet.lang.diagnostics.Severity import java.util.Collections import org.jetbrains.jet.plugin.quickfix.KotlinSuppressIntentionAction import org.jetbrains.jet.lang.psi.* -import org.jetbrains.jet.plugin.quickfix.DeclarationKind +import org.jetbrains.jet.plugin.quickfix.AnnotationHostKind import org.jetbrains.jet.lang.diagnostics.DiagnosticFactory import com.intellij.psi.util.PsiTreeUtil @@ -53,6 +53,7 @@ fun createSuppressWarningActions(element: PsiElement, diagnosticFactory: Diagnos val actions = arrayListOf() var current: PsiElement? = element + var suppressAtStatementAllowed = true while (current != null) { if (current is JetDeclaration) { val declaration = current as JetDeclaration @@ -60,6 +61,16 @@ fun createSuppressWarningActions(element: PsiElement, diagnosticFactory: Diagnos if (kind != null) { actions.add(KotlinSuppressIntentionAction(declaration, diagnosticFactory, kind)) } + suppressAtStatementAllowed = false + } + else if (current is JetExpression && suppressAtStatementAllowed) { + // Add suppress action at first statement + if ((current as PsiElement).getParent() is JetBlockExpression) { + val expression = current as JetExpression + actions.add(KotlinSuppressIntentionAction(expression, diagnosticFactory, + AnnotationHostKind("statement", "", true))) + suppressAtStatementAllowed = false + } } current = current?.getParent() @@ -67,7 +78,7 @@ fun createSuppressWarningActions(element: PsiElement, diagnosticFactory: Diagnos return actions } -private object DeclarationKindDetector : JetVisitor() { +private object DeclarationKindDetector : JetVisitor() { fun detect(declaration: JetDeclaration) = declaration.accept(this, null) @@ -91,11 +102,12 @@ private object DeclarationKindDetector : JetVisitor() { override fun visitParameter(d: JetParameter, _: Unit?) = detect(d, "parameter", newLineNeeded = false) - override fun visitObjectDeclaration(d: JetObjectDeclaration, _: Unit?): DeclarationKind? { + override fun visitObjectDeclaration(d: JetObjectDeclaration, _: Unit?): AnnotationHostKind? { if (d.getParent() is JetClassObject) return null + if (d.getParent() is JetObjectLiteralExpression) return null return detect(d, "object") } - private fun detect(declaration: JetDeclaration, kind: String, name: String = declaration.getName() ?: "", newLineNeeded: Boolean = true) - = DeclarationKind(kind, name, newLineNeeded) + private fun detect(declaration: JetDeclaration, kind: String, name: String = declaration.getName() ?: "", newLineNeeded: Boolean = true) + = AnnotationHostKind(kind, name, newLineNeeded) } \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/KotlinSuppressIntentionAction.kt b/idea/src/org/jetbrains/jet/plugin/quickfix/KotlinSuppressIntentionAction.kt index ecce290046a..59b01dbece6 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/KotlinSuppressIntentionAction.kt +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/KotlinSuppressIntentionAction.kt @@ -16,25 +16,22 @@ package org.jetbrains.jet.plugin.quickfix -import com.intellij.codeInsight.intention.IntentionAction import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import org.jetbrains.jet.lang.diagnostics.DiagnosticFactory -import org.jetbrains.jet.lang.diagnostics.Diagnostic -import org.jetbrains.jet.lang.diagnostics.Severity import org.jetbrains.jet.lang.psi.* import org.jetbrains.jet.plugin.JetBundle -import java.util.Collections import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache import org.jetbrains.jet.lang.resolve.BindingContext import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns import com.intellij.codeInspection.SuppressIntentionAction +import org.jetbrains.jet.lang.psi.JetPsiPrecedences.* public class KotlinSuppressIntentionAction( - private val suppressAt: JetDeclaration, + private val suppressAt: JetExpression, private val diagnosticFactory: DiagnosticFactory, - private val kind: DeclarationKind + private val kind: AnnotationHostKind ) : SuppressIntentionAction() { override fun getFamilyName() = JetBundle.message("suppress.warnings.family") @@ -44,49 +41,103 @@ public class KotlinSuppressIntentionAction( override fun invoke(project: Project, editor: Editor?, element: PsiElement) { val id = "\"${diagnosticFactory.getName()}\"" + if (suppressAt is JetModifierListOwner) { + suppressAtModifierListOwner(suppressAt, id) + } + else if (suppressAt is JetAnnotatedExpression) { + suppressAtAnnotatedExpression(CaretBox(suppressAt, editor), id) + } + else if (suppressAt is JetExpression) { + suppressAtExpression(CaretBox(suppressAt, editor), id) + } + } + + private fun suppressAtModifierListOwner(suppressAt: JetModifierListOwner, id: String) { + val project = suppressAt.getProject() val modifierList = suppressAt.getModifierList() if (modifierList == null) { // create a modifier list from scratch - val newModifierList = JetPsiFactory.createModifierList(project, "[suppress($id)]") + val newModifierList = JetPsiFactory.createModifierList(project, suppressAnnotationText(id)) val replaced = JetPsiUtil.replaceModifierList(suppressAt, newModifierList) val whiteSpace = project.createWhiteSpace(kind) suppressAt.addAfter(whiteSpace, replaced) } else { - val entry = findSuppressAnnotation(modifierList) + val entry = findSuppressAnnotation(suppressAt) if (entry == null) { - val newAnnotation = JetPsiFactory.createAnnotation(project, "[suppress($id)]") + // no [suppress] annotation + val newAnnotation = JetPsiFactory.createAnnotation(project, suppressAnnotationText(id)) val addedAnnotation = modifierList.addBefore(newAnnotation, modifierList.getFirstChild()) val whiteSpace = project.createWhiteSpace(kind) modifierList.addAfter(whiteSpace, addedAnnotation) } else { - // add new arguments to an existing entry - val args = entry.getValueArgumentList() - val newArgList = JetPsiFactory.createCallArguments(project, "($id)") - if (args == null) { - // new argument list - entry.addAfter(newArgList, entry.getLastChild()) - } - else if (args.getArguments().isEmpty()) { - // replace '()' with a new argument list - args.replace(newArgList) - } - else { - val rightParen = args.getRightParenthesis() - args.addBefore(JetPsiFactory.createComma(project), rightParen) - args.addBefore(JetPsiFactory.createWhiteSpace(project), rightParen) - args.addBefore(newArgList.getArguments()[0], rightParen) - } + // already annotated with [suppress] + addArgumentToSuppressAnnotation(entry, id) } } - } - private fun findSuppressAnnotation(modifierList: JetModifierList): JetAnnotationEntry? { + private fun suppressAtAnnotatedExpression(suppressAt: CaretBox, id: String) { + val entry = findSuppressAnnotation(suppressAt.expression) + if (entry != null) { + // already annotated with [suppress] + addArgumentToSuppressAnnotation(entry, id) + } + else { + suppressAtExpression(suppressAt, id) + } + } + + private fun suppressAtExpression(caretBox: CaretBox, id: String) { + val suppressAt = caretBox.expression + assert(suppressAt !is JetDeclaration, "Declarations should have been checked for above") + + val project = suppressAt.getProject() + + val parentheses = getPrecedence(suppressAt) > PRECEDENCE_OF_PREFIX_EXPRESSION + val placeholderText = "PLACEHOLDER_ID" + val inner = if (parentheses) "($placeholderText)" else placeholderText + val annotatedExpression = JetPsiFactory.createExpression(project, suppressAnnotationText(id) + "\n" + inner) + + val copy = suppressAt.copy()!! + + val afterReplace = suppressAt.replace(annotatedExpression) as JetAnnotatedExpression + val toReplace = afterReplace.findElementAt(afterReplace.getTextLength() - 2)!! + assert (toReplace.getText() == placeholderText) + val result = toReplace.replace(copy)!! + + caretBox.positionCaretInCopy(result) + } + + private fun addArgumentToSuppressAnnotation(entry: JetAnnotationEntry, id: String) { + val project = entry.getProject() + + // add new arguments to an existing entry + val args = entry.getValueArgumentList() + val newArgList = JetPsiFactory.createCallArguments(project, "($id)") + if (args == null) { + // new argument list + entry.addAfter(newArgList, entry.getLastChild()) + } + else if (args.getArguments().isEmpty()) { + // replace '()' with a new argument list + args.replace(newArgList) + } + else { + val rightParen = args.getRightParenthesis() + args.addBefore(JetPsiFactory.createComma(project), rightParen) + args.addBefore(JetPsiFactory.createWhiteSpace(project), rightParen) + args.addBefore(newArgList.getArguments()[0], rightParen) + } + } + + private fun suppressAnnotationText(id: String) = "[suppress($id)]" + + private fun findSuppressAnnotation(annotated: JetAnnotated): JetAnnotationEntry? { val suppressAnnotationClass = KotlinBuiltIns.getInstance().getSuppressAnnotationClass() - val context = AnalyzerFacadeWithCache.getContextForElement(modifierList) - for (entry in modifierList.getAnnotationEntries()) { + val context = AnalyzerFacadeWithCache.getContextForElement(annotated) + for (entry in annotated.getAnnotationEntries()) { val annotationDescriptor = context.get(BindingContext.ANNOTATION, entry) if (annotationDescriptor != null && suppressAnnotationClass.getTypeConstructor() == annotationDescriptor.getType().getConstructor()) { return entry @@ -96,9 +147,21 @@ public class KotlinSuppressIntentionAction( } } -public class DeclarationKind(val kind: String, val name: String, val newLineNeeded: Boolean) -private fun Project.createWhiteSpace(kind: DeclarationKind): PsiElement = +public class AnnotationHostKind(val kind: String, val name: String, val newLineNeeded: Boolean) +private fun Project.createWhiteSpace(kind: AnnotationHostKind): PsiElement = if (kind.newLineNeeded) JetPsiFactory.createNewLine(this) else - JetPsiFactory.createWhiteSpace(this) \ No newline at end of file + JetPsiFactory.createWhiteSpace(this) + +private class CaretBox( + val expression: E, + private val editor: Editor? +) { + private val offsetInExpression: Int = (editor?.getCaretModel()?.getOffset() ?: 0) - expression.getTextRange()!!.getStartOffset() + + fun positionCaretInCopy(copy: PsiElement) { + if (editor == null) return + editor.getCaretModel().moveToOffset(copy.getTextOffset() + offsetInExpression) + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterAndAnd.kt b/idea/testData/quickfix/suppress/forStatement/afterAndAnd.kt new file mode 100644 index 00000000000..a37df2319c1 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterAndAnd.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (false!! && true) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterAnnotatedExpr.kt b/idea/testData/quickfix/suppress/forStatement/afterAnnotatedExpr.kt new file mode 100644 index 00000000000..a85aa8b91c4 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterAnnotatedExpr.kt @@ -0,0 +1,8 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + [ann] ""!! +} + +annotation class ann \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterAnnotatedExprWithSuppress.kt b/idea/testData/quickfix/suppress/forStatement/afterAnnotatedExprWithSuppress.kt new file mode 100644 index 00000000000..68889c20fa5 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterAnnotatedExprWithSuppress.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("Foo", "UNNECESSARY_NOT_NULL_ASSERTION")] ""!! +} + +annotation class ann \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterArrayRead.kt b/idea/testData/quickfix/suppress/forStatement/afterArrayRead.kt new file mode 100644 index 00000000000..d2fa957531e --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterArrayRead.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: Array) { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + a[1!!] +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterAs.kt b/idea/testData/quickfix/suppress/forStatement/afterAs.kt new file mode 100644 index 00000000000..0dd72c7dfa4 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterAs.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (""!! as String) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterAsSafe.kt b/idea/testData/quickfix/suppress/forStatement/afterAsSafe.kt new file mode 100644 index 00000000000..22c6943ce20 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterAsSafe.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (""!! as? String) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterAssign.kt b/idea/testData/quickfix/suppress/forStatement/afterAssign.kt new file mode 100644 index 00000000000..f9c172ef71f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterAssign.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + var x = 0 + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (x = 1!!) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterCall.kt b/idea/testData/quickfix/suppress/forStatement/afterCall.kt new file mode 100644 index 00000000000..2c166794e08 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterCall.kt @@ -0,0 +1,8 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + [suppress("REDUNDANT_NULLABLE")] + call("": String??) +} + +fun call(s: String?) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterColon.kt b/idea/testData/quickfix/suppress/forStatement/afterColon.kt new file mode 100644 index 00000000000..2067973f446 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterColon.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (""!! : String) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterDoWhile.kt b/idea/testData/quickfix/suppress/forStatement/afterDoWhile.kt new file mode 100644 index 00000000000..e3a30136151 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterDoWhile.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + do {} + while (true!!) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterDotQualified.kt b/idea/testData/quickfix/suppress/forStatement/afterDotQualified.kt new file mode 100644 index 00000000000..c6b01035778 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterDotQualified.kt @@ -0,0 +1,10 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: C) { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + a.foo(""!!) +} + +class C { + fun foo(a: Any) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterElvis.kt b/idea/testData/quickfix/suppress/forStatement/afterElvis.kt new file mode 100644 index 00000000000..d85981f7708 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterElvis.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! ?: 0) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterEqEq.kt b/idea/testData/quickfix/suppress/forStatement/afterEqEq.kt new file mode 100644 index 00000000000..40d8d1dba8b --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterEqEq.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! == 2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterFor.kt b/idea/testData/quickfix/suppress/forStatement/afterFor.kt new file mode 100644 index 00000000000..fb8cefe80dc --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterFor.kt @@ -0,0 +1,8 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + for (i in list()!!) {} +} + +fun list(): List = throw Exception() \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterIf.kt b/idea/testData/quickfix/suppress/forStatement/afterIf.kt new file mode 100644 index 00000000000..b29393acb47 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterIf.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + if (true!!) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterIn.kt b/idea/testData/quickfix/suppress/forStatement/afterIn.kt new file mode 100644 index 00000000000..534481a2dca --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterIn.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! in (1..2)) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterInfix.kt b/idea/testData/quickfix/suppress/forStatement/afterInfix.kt new file mode 100644 index 00000000000..9270d38caf5 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterInfix.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! plus 2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterIs.kt b/idea/testData/quickfix/suppress/forStatement/afterIs.kt new file mode 100644 index 00000000000..68ac65bbd4c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterIs.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (""!! is String) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterLabeled.kt b/idea/testData/quickfix/suppress/forStatement/afterLabeled.kt new file mode 100644 index 00000000000..d5243aebdbc --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterLabeled.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + @label""!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterLess.kt b/idea/testData/quickfix/suppress/forStatement/afterLess.kt new file mode 100644 index 00000000000..b2750578d7b --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterLess.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! < 2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterMul.kt b/idea/testData/quickfix/suppress/forStatement/afterMul.kt new file mode 100644 index 00000000000..6a0cc3595d1 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterMul.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! * 2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterOrOr.kt b/idea/testData/quickfix/suppress/forStatement/afterOrOr.kt new file mode 100644 index 00000000000..6e1d2f3ee6c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterOrOr.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (false!! || true) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterParenthesized.kt b/idea/testData/quickfix/suppress/forStatement/afterParenthesized.kt new file mode 100644 index 00000000000..8e869e61845 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterParenthesized.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (""!!) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterPlus.kt b/idea/testData/quickfix/suppress/forStatement/afterPlus.kt new file mode 100644 index 00000000000..c9829778901 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterPlus.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! + 2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterPostfix.kt b/idea/testData/quickfix/suppress/forStatement/afterPostfix.kt new file mode 100644 index 00000000000..38ede106bbf --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterPostfix.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + ""!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterPostfixPlusPlus.kt b/idea/testData/quickfix/suppress/forStatement/afterPostfixPlusPlus.kt new file mode 100644 index 00000000000..1128dc5dcc3 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterPostfixPlusPlus.kt @@ -0,0 +1,11 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + var v = Box() + [suppress("REDUNDANT_NULLABLE")] + (v: Box?>)++ +} + +class Box { + fun inc() = this +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterPrefixPlusPlus.kt b/idea/testData/quickfix/suppress/forStatement/afterPrefixPlusPlus.kt new file mode 100644 index 00000000000..aa978c79247 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterPrefixPlusPlus.kt @@ -0,0 +1,11 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + var v = Box() + [suppress("REDUNDANT_NULLABLE")] + ++(v: Box?>) +} + +class Box { + fun inc() = this +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterRange.kt b/idea/testData/quickfix/suppress/forStatement/afterRange.kt new file mode 100644 index 00000000000..f628da1d86f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterRange.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + (1!! .. 2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterReturn.kt b/idea/testData/quickfix/suppress/forStatement/afterReturn.kt new file mode 100644 index 00000000000..597c148d78c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterReturn.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(): Any { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + return ""!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterSafeQualified.kt b/idea/testData/quickfix/suppress/forStatement/afterSafeQualified.kt new file mode 100644 index 00000000000..057dd485a2f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterSafeQualified.kt @@ -0,0 +1,10 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: C) { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + a?.foo(""!!) +} + +class C { + fun foo(a: Any) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterSimpleName.kt b/idea/testData/quickfix/suppress/forStatement/afterSimpleName.kt new file mode 100644 index 00000000000..8ecf6f18705 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterSimpleName.kt @@ -0,0 +1,8 @@ +// "Suppress 'UNUSED_EXPRESSION' for statement " "true" + +fun foo() { + [suppress("UNUSED_EXPRESSION")] + a +} + +val a = 1 \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterStringTemplate.kt b/idea/testData/quickfix/suppress/forStatement/afterStringTemplate.kt new file mode 100644 index 00000000000..29548a60e5a --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterStringTemplate.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + "${""!!}" +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterThrow.kt b/idea/testData/quickfix/suppress/forStatement/afterThrow.kt new file mode 100644 index 00000000000..630786d2352 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterThrow.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(): Any { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + throw Exception(""!!) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterTry.kt b/idea/testData/quickfix/suppress/forStatement/afterTry.kt new file mode 100644 index 00000000000..c32b69a5fe2 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterTry.kt @@ -0,0 +1,11 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + try { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + ""!! + } + finally { + + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterWhenExpressionEntry.kt b/idea/testData/quickfix/suppress/forStatement/afterWhenExpressionEntry.kt new file mode 100644 index 00000000000..b4e029e95c6 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterWhenExpressionEntry.kt @@ -0,0 +1,8 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: Any) { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + when (a) { + ""!! -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterWhenInEntry.kt b/idea/testData/quickfix/suppress/forStatement/afterWhenInEntry.kt new file mode 100644 index 00000000000..b6a897bc20c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterWhenInEntry.kt @@ -0,0 +1,8 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + when (1) { + in 1!!..2 -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterWhenIsEntry.kt b/idea/testData/quickfix/suppress/forStatement/afterWhenIsEntry.kt new file mode 100644 index 00000000000..1a86673fb1e --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterWhenIsEntry.kt @@ -0,0 +1,8 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + [suppress("REDUNDANT_NULLABLE")] + when ("") { + is Any?? -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterWhenSubject.kt b/idea/testData/quickfix/suppress/forStatement/afterWhenSubject.kt new file mode 100644 index 00000000000..fdacaac9d0b --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterWhenSubject.kt @@ -0,0 +1,8 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + when (""!!) { + is Any -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/afterWhile.kt b/idea/testData/quickfix/suppress/forStatement/afterWhile.kt new file mode 100644 index 00000000000..7fba63ef987 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/afterWhile.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("UNNECESSARY_NOT_NULL_ASSERTION")] + while (true!!) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeAndAnd.kt b/idea/testData/quickfix/suppress/forStatement/beforeAndAnd.kt new file mode 100644 index 00000000000..a41333fc9d2 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeAndAnd.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + false!! && true +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExpr.kt b/idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExpr.kt new file mode 100644 index 00000000000..2110e6c420c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExpr.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [ann] ""!! +} + +annotation class ann \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExprWithSuppress.kt b/idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExprWithSuppress.kt new file mode 100644 index 00000000000..8b42c0736b8 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExprWithSuppress.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + [suppress("Foo")] ""!! +} + +annotation class ann \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeArrayRead.kt b/idea/testData/quickfix/suppress/forStatement/beforeArrayRead.kt new file mode 100644 index 00000000000..64c7e2383ed --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeArrayRead.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: Array) { + a[1!!] +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeAs.kt b/idea/testData/quickfix/suppress/forStatement/beforeAs.kt new file mode 100644 index 00000000000..4660ac5ceb5 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeAs.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + ""!! as String +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeAsSafe.kt b/idea/testData/quickfix/suppress/forStatement/beforeAsSafe.kt new file mode 100644 index 00000000000..eaded77a20f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeAsSafe.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + ""!! as? String +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeAssign.kt b/idea/testData/quickfix/suppress/forStatement/beforeAssign.kt new file mode 100644 index 00000000000..439d4526c5e --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeAssign.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + var x = 0 + x = 1!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeCall.kt b/idea/testData/quickfix/suppress/forStatement/beforeCall.kt new file mode 100644 index 00000000000..aedc3b6276c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeCall.kt @@ -0,0 +1,7 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + call("": String??) +} + +fun call(s: String?) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeColon.kt b/idea/testData/quickfix/suppress/forStatement/beforeColon.kt new file mode 100644 index 00000000000..576dbc900f3 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeColon.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + ""!! : String +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeDoWhile.kt b/idea/testData/quickfix/suppress/forStatement/beforeDoWhile.kt new file mode 100644 index 00000000000..d717605cc2d --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeDoWhile.kt @@ -0,0 +1,6 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + do {} + while (true!!) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeDotQualified.kt b/idea/testData/quickfix/suppress/forStatement/beforeDotQualified.kt new file mode 100644 index 00000000000..21ff4668966 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeDotQualified.kt @@ -0,0 +1,9 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: C) { + a.foo(""!!) +} + +class C { + fun foo(a: Any) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeElvis.kt b/idea/testData/quickfix/suppress/forStatement/beforeElvis.kt new file mode 100644 index 00000000000..d4a8ff072fd --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeElvis.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! ?: 0 +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeEqEq.kt b/idea/testData/quickfix/suppress/forStatement/beforeEqEq.kt new file mode 100644 index 00000000000..8ad1adfc60a --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeEqEq.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! == 2 +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeFor.kt b/idea/testData/quickfix/suppress/forStatement/beforeFor.kt new file mode 100644 index 00000000000..e5abd4f5910 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeFor.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + for (i in list()!!) {} +} + +fun list(): List = throw Exception() \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeIf.kt b/idea/testData/quickfix/suppress/forStatement/beforeIf.kt new file mode 100644 index 00000000000..20703945734 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeIf.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + if (true!!) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeIn.kt b/idea/testData/quickfix/suppress/forStatement/beforeIn.kt new file mode 100644 index 00000000000..4376cdf5e6a --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeIn.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! in (1..2) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeInfix.kt b/idea/testData/quickfix/suppress/forStatement/beforeInfix.kt new file mode 100644 index 00000000000..4175a8a4d54 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeInfix.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! plus 2 +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeIs.kt b/idea/testData/quickfix/suppress/forStatement/beforeIs.kt new file mode 100644 index 00000000000..47d5f59595c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeIs.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + ""!! is String +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeLabeled.kt b/idea/testData/quickfix/suppress/forStatement/beforeLabeled.kt new file mode 100644 index 00000000000..83bbcc23fe6 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeLabeled.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + @label""!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeLess.kt b/idea/testData/quickfix/suppress/forStatement/beforeLess.kt new file mode 100644 index 00000000000..98c49487d31 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeLess.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! < 2 +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeMul.kt b/idea/testData/quickfix/suppress/forStatement/beforeMul.kt new file mode 100644 index 00000000000..f4b5550594d --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeMul.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! * 2 +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeOrOr.kt b/idea/testData/quickfix/suppress/forStatement/beforeOrOr.kt new file mode 100644 index 00000000000..79e7c3731fb --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeOrOr.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + false!! || true +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeParenthesized.kt b/idea/testData/quickfix/suppress/forStatement/beforeParenthesized.kt new file mode 100644 index 00000000000..345e47d2c02 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeParenthesized.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + (""!!) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforePlus.kt b/idea/testData/quickfix/suppress/forStatement/beforePlus.kt new file mode 100644 index 00000000000..095a8d2e713 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforePlus.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! + 2 +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforePostfix.kt b/idea/testData/quickfix/suppress/forStatement/beforePostfix.kt new file mode 100644 index 00000000000..07f7142398f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforePostfix.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + ""!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforePostfixPlusPlus.kt b/idea/testData/quickfix/suppress/forStatement/beforePostfixPlusPlus.kt new file mode 100644 index 00000000000..fbf5734f311 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforePostfixPlusPlus.kt @@ -0,0 +1,10 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + var v = Box() + (v: Box?>)++ +} + +class Box { + fun inc() = this +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforePrefixPlusPlus.kt b/idea/testData/quickfix/suppress/forStatement/beforePrefixPlusPlus.kt new file mode 100644 index 00000000000..dbae6d379cb --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforePrefixPlusPlus.kt @@ -0,0 +1,10 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + var v = Box() + ++(v: Box?>) +} + +class Box { + fun inc() = this +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeRange.kt b/idea/testData/quickfix/suppress/forStatement/beforeRange.kt new file mode 100644 index 00000000000..1b9a34540e2 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeRange.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + 1!! .. 2 +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeReturn.kt b/idea/testData/quickfix/suppress/forStatement/beforeReturn.kt new file mode 100644 index 00000000000..6fcd06ffc93 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeReturn.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(): Any { + return ""!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeSafeQualified.kt b/idea/testData/quickfix/suppress/forStatement/beforeSafeQualified.kt new file mode 100644 index 00000000000..a275a8b1032 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeSafeQualified.kt @@ -0,0 +1,9 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: C) { + a?.foo(""!!) +} + +class C { + fun foo(a: Any) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt b/idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt new file mode 100644 index 00000000000..adb23c57996 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNUSED_EXPRESSION' for statement " "true" + +fun foo() { + a +} + +val a = 1 \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeStringTemplate.kt b/idea/testData/quickfix/suppress/forStatement/beforeStringTemplate.kt new file mode 100644 index 00000000000..6ee9c1a7404 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeStringTemplate.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + "${""!!}" +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeThrow.kt b/idea/testData/quickfix/suppress/forStatement/beforeThrow.kt new file mode 100644 index 00000000000..a40e50fc961 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeThrow.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(): Any { + throw Exception(""!!) +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeTry.kt b/idea/testData/quickfix/suppress/forStatement/beforeTry.kt new file mode 100644 index 00000000000..4400cc1df74 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeTry.kt @@ -0,0 +1,10 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + try { + ""!! + } + finally { + + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeWhenExpressionEntry.kt b/idea/testData/quickfix/suppress/forStatement/beforeWhenExpressionEntry.kt new file mode 100644 index 00000000000..69529bf0f36 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeWhenExpressionEntry.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo(a: Any) { + when (a) { + ""!! -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeWhenInEntry.kt b/idea/testData/quickfix/suppress/forStatement/beforeWhenInEntry.kt new file mode 100644 index 00000000000..dd3909ae36f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeWhenInEntry.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + when (1) { + in 1!!..2 -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeWhenIsEntry.kt b/idea/testData/quickfix/suppress/forStatement/beforeWhenIsEntry.kt new file mode 100644 index 00000000000..c895754e538 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeWhenIsEntry.kt @@ -0,0 +1,7 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "true" + +fun foo() { + when ("") { + is Any?? -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeWhenSubject.kt b/idea/testData/quickfix/suppress/forStatement/beforeWhenSubject.kt new file mode 100644 index 00000000000..652af108278 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeWhenSubject.kt @@ -0,0 +1,7 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + when (""!!) { + is Any -> {} + } +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/beforeWhile.kt b/idea/testData/quickfix/suppress/forStatement/beforeWhile.kt new file mode 100644 index 00000000000..b6f4041709c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/beforeWhile.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "true" + +fun foo() { + while (true!!) {} +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt new file mode 100644 index 00000000000..d10b1deb3e2 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false" +// ACTION: Remove unnecessary non-null assertion (!!) + +[suppress("FOO"!!)] +fun foo() {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt new file mode 100644 index 00000000000..dd69a597825 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt @@ -0,0 +1,5 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false" +// ACTION: Remove unnecessary non-null assertion (!!) + +open class Base(s: String) +class Child: Base(""!!) \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt new file mode 100644 index 00000000000..814997eda2e --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt @@ -0,0 +1,4 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false" +// ACTION: Remove unnecessary non-null assertion (!!) + +fun foo(s: String = ""!!) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt new file mode 100644 index 00000000000..06c4a12096d --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt @@ -0,0 +1,4 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false" +// ACTION: Remove unnecessary non-null assertion (!!) + +fun foo() = ""!! \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt new file mode 100644 index 00000000000..dfcd4099e83 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt @@ -0,0 +1,9 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false" +// ACTION: Disable 'Split Property Declaration' +// ACTION: Edit intention settings +// ACTION: Remove unnecessary non-null assertion (!!) +// ACTION: Split property declaration + +fun foo() { + val bar = ""!! +} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt new file mode 100644 index 00000000000..ad91af11a4f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt @@ -0,0 +1,4 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "false" +// ACTION: Remove redundant '?' + +fun foo(s: String??) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt new file mode 100644 index 00000000000..95eba9d061f --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt @@ -0,0 +1,10 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "false" +// ACTION: Remove redundant '?' + +fun foo() { + any { + (x: String??) -> + } +} + +fun any(a: Any?) {} \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt new file mode 100644 index 00000000000..7019a9cbc44 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt @@ -0,0 +1,4 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false" +// ACTION: Remove unnecessary non-null assertion (!!) + +val foo = ""!! \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt new file mode 100644 index 00000000000..69e841ef557 --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt @@ -0,0 +1,10 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for object " "false" +// ACTION: Remove unnecessary non-null assertion (!!) + +fun foo() { + object : Base(""!!) { + + } +} + +open class Base(s: Any) \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt new file mode 100644 index 00000000000..bfa8397bf5d --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt @@ -0,0 +1,13 @@ +// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for object " "false" +// ACTION: Disable 'Split Property Declaration' +// ACTION: Edit intention settings +// ACTION: Remove unnecessary non-null assertion (!!) +// ACTION: Split property declaration + +fun foo() { + val a = object : Base(""!!) { + + } +} + +open class Base(s: Any) \ No newline at end of file diff --git a/idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt new file mode 100644 index 00000000000..50cc067ba5c --- /dev/null +++ b/idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt @@ -0,0 +1,5 @@ +// "Suppress 'REDUNDANT_NULLABLE' for statement " "false" +// ACTION: Remove redundant '?' + +open class Base +class Child: Base?>() \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java index 112f9381222..4eedf6d81f7 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixMultiFileTestGenerated.java @@ -250,15 +250,30 @@ public class QuickFixMultiFileTestGenerated extends AbstractQuickFixMultiFileTes } @TestMetadata("idea/testData/quickfix/suppress") - @InnerTestClasses({}) + @InnerTestClasses({Suppress.ForStatement.class}) public static class Suppress extends AbstractQuickFixMultiFileTest { public void testAllFilesPresentInSuppress() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/suppress"), Pattern.compile("^(\\w+)\\.before\\.Main\\.kt$"), true); } + @TestMetadata("idea/testData/quickfix/suppress/forStatement") + @InnerTestClasses({}) + public static class ForStatement extends AbstractQuickFixMultiFileTest { + public void testAllFilesPresentInForStatement() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/suppress/forStatement"), Pattern.compile("^(\\w+)\\.before\\.Main\\.kt$"), true); + } + + public static Test innerSuite() { + TestSuite suite = new TestSuite("ForStatement"); + suite.addTestSuite(ForStatement.class); + return suite; + } + } + public static Test innerSuite() { TestSuite suite = new TestSuite("Suppress"); suite.addTestSuite(Suppress.class); + suite.addTest(ForStatement.innerSuite()); return suite; } } diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java index 4f1b66ee85e..57cfaea5348 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/QuickFixTestGenerated.java @@ -1372,7 +1372,7 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } @TestMetadata("idea/testData/quickfix/suppress") - @InnerTestClasses({Suppress.AnnotationPosition.class, Suppress.Availability.class, Suppress.DeclarationKinds.class, Suppress.ErrorRecovery.class}) + @InnerTestClasses({Suppress.AnnotationPosition.class, Suppress.Availability.class, Suppress.DeclarationKinds.class, Suppress.ErrorRecovery.class, Suppress.ForStatement.class}) public static class Suppress extends AbstractQuickFixTest { public void testAllFilesPresentInSuppress() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/suppress"), Pattern.compile("^before(\\w+)\\.kt$"), true); @@ -1585,6 +1585,279 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } + @TestMetadata("idea/testData/quickfix/suppress/forStatement") + @InnerTestClasses({ForStatement.Unavailable.class}) + public static class ForStatement extends AbstractQuickFixTest { + public void testAllFilesPresentInForStatement() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/suppress/forStatement"), Pattern.compile("^before(\\w+)\\.kt$"), true); + } + + @TestMetadata("beforeAndAnd.kt") + public void testAndAnd() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeAndAnd.kt"); + } + + @TestMetadata("beforeAnnotatedExpr.kt") + public void testAnnotatedExpr() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExpr.kt"); + } + + @TestMetadata("beforeAnnotatedExprWithSuppress.kt") + public void testAnnotatedExprWithSuppress() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeAnnotatedExprWithSuppress.kt"); + } + + @TestMetadata("beforeArrayRead.kt") + public void testArrayRead() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeArrayRead.kt"); + } + + @TestMetadata("beforeAs.kt") + public void testAs() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeAs.kt"); + } + + @TestMetadata("beforeAsSafe.kt") + public void testAsSafe() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeAsSafe.kt"); + } + + @TestMetadata("beforeAssign.kt") + public void testAssign() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeAssign.kt"); + } + + @TestMetadata("beforeCall.kt") + public void testCall() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeCall.kt"); + } + + @TestMetadata("beforeColon.kt") + public void testColon() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeColon.kt"); + } + + @TestMetadata("beforeDoWhile.kt") + public void testDoWhile() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeDoWhile.kt"); + } + + @TestMetadata("beforeDotQualified.kt") + public void testDotQualified() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeDotQualified.kt"); + } + + @TestMetadata("beforeElvis.kt") + public void testElvis() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeElvis.kt"); + } + + @TestMetadata("beforeEqEq.kt") + public void testEqEq() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeEqEq.kt"); + } + + @TestMetadata("beforeFor.kt") + public void testFor() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeFor.kt"); + } + + @TestMetadata("beforeIf.kt") + public void testIf() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeIf.kt"); + } + + @TestMetadata("beforeIn.kt") + public void testIn() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeIn.kt"); + } + + @TestMetadata("beforeInfix.kt") + public void testInfix() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeInfix.kt"); + } + + @TestMetadata("beforeIs.kt") + public void testIs() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeIs.kt"); + } + + @TestMetadata("beforeLabeled.kt") + public void testLabeled() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeLabeled.kt"); + } + + @TestMetadata("beforeLess.kt") + public void testLess() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeLess.kt"); + } + + @TestMetadata("beforeMul.kt") + public void testMul() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeMul.kt"); + } + + @TestMetadata("beforeOrOr.kt") + public void testOrOr() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeOrOr.kt"); + } + + @TestMetadata("beforeParenthesized.kt") + public void testParenthesized() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeParenthesized.kt"); + } + + @TestMetadata("beforePlus.kt") + public void testPlus() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforePlus.kt"); + } + + @TestMetadata("beforePostfix.kt") + public void testPostfix() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforePostfix.kt"); + } + + @TestMetadata("beforePostfixPlusPlus.kt") + public void testPostfixPlusPlus() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforePostfixPlusPlus.kt"); + } + + @TestMetadata("beforePrefixPlusPlus.kt") + public void testPrefixPlusPlus() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforePrefixPlusPlus.kt"); + } + + @TestMetadata("beforeRange.kt") + public void testRange() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeRange.kt"); + } + + @TestMetadata("beforeReturn.kt") + public void testReturn() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeReturn.kt"); + } + + @TestMetadata("beforeSafeQualified.kt") + public void testSafeQualified() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeSafeQualified.kt"); + } + + @TestMetadata("beforeSimpleName.kt") + public void testSimpleName() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeSimpleName.kt"); + } + + @TestMetadata("beforeStringTemplate.kt") + public void testStringTemplate() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeStringTemplate.kt"); + } + + @TestMetadata("beforeThrow.kt") + public void testThrow() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeThrow.kt"); + } + + @TestMetadata("beforeTry.kt") + public void testTry() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeTry.kt"); + } + + @TestMetadata("beforeWhenExpressionEntry.kt") + public void testWhenExpressionEntry() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeWhenExpressionEntry.kt"); + } + + @TestMetadata("beforeWhenInEntry.kt") + public void testWhenInEntry() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeWhenInEntry.kt"); + } + + @TestMetadata("beforeWhenIsEntry.kt") + public void testWhenIsEntry() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeWhenIsEntry.kt"); + } + + @TestMetadata("beforeWhenSubject.kt") + public void testWhenSubject() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeWhenSubject.kt"); + } + + @TestMetadata("beforeWhile.kt") + public void testWhile() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/beforeWhile.kt"); + } + + @TestMetadata("idea/testData/quickfix/suppress/forStatement/unavailable") + public static class Unavailable extends AbstractQuickFixTest { + public void testAllFilesPresentInUnavailable() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/quickfix/suppress/forStatement/unavailable"), Pattern.compile("^before(\\w+)\\.kt$"), true); + } + + @TestMetadata("beforeInAnnotationArgument.kt") + public void testInAnnotationArgument() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInAnnotationArgument.kt"); + } + + @TestMetadata("beforeInClassHeader.kt") + public void testInClassHeader() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInClassHeader.kt"); + } + + @TestMetadata("beforeInDefaultArgument.kt") + public void testInDefaultArgument() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInDefaultArgument.kt"); + } + + @TestMetadata("beforeInExpressionBody.kt") + public void testInExpressionBody() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInExpressionBody.kt"); + } + + @TestMetadata("beforeInLocalValInitializer.kt") + public void testInLocalValInitializer() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInLocalValInitializer.kt"); + } + + @TestMetadata("beforeInParameterType.kt") + public void testInParameterType() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterType.kt"); + } + + @TestMetadata("beforeInParameterTypeInFunctionLiteral.kt") + public void testInParameterTypeInFunctionLiteral() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInParameterTypeInFunctionLiteral.kt"); + } + + @TestMetadata("beforeInPropertyInitializer.kt") + public void testInPropertyInitializer() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeInPropertyInitializer.kt"); + } + + @TestMetadata("beforeObjectLiteral.kt") + public void testObjectLiteral() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteral.kt"); + } + + @TestMetadata("beforeObjectLiteralInsideExpression.kt") + public void testObjectLiteralInsideExpression() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeObjectLiteralInsideExpression.kt"); + } + + @TestMetadata("beforeSupretype.kt") + public void testSupretype() throws Exception { + doTest("idea/testData/quickfix/suppress/forStatement/unavailable/beforeSupretype.kt"); + } + + } + + public static Test innerSuite() { + TestSuite suite = new TestSuite("ForStatement"); + suite.addTestSuite(ForStatement.class); + suite.addTestSuite(Unavailable.class); + return suite; + } + } + public static Test innerSuite() { TestSuite suite = new TestSuite("Suppress"); suite.addTestSuite(Suppress.class); @@ -1592,6 +1865,7 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { suite.addTestSuite(Availability.class); suite.addTestSuite(DeclarationKinds.class); suite.addTestSuite(ErrorRecovery.class); + suite.addTest(ForStatement.innerSuite()); return suite; } }