diff --git a/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java b/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java index 85f52f2938b..450fc302ee1 100644 --- a/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java +++ b/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java @@ -123,6 +123,11 @@ public class JetPsiChecker implements Annotator { catch (ProcessCanceledException e) { throw e; } + catch (AssertionError e) { + // For failing tests and to notify about idea internal error in -ea mode + holder.createErrorAnnotation(element, e.getClass().getCanonicalName() + ": " + e.getMessage()); + throw e; + } catch (Throwable e) { // TODO holder.createErrorAnnotation(element, e.getClass().getCanonicalName() + ": " + e.getMessage()); diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassFix.java index a1796a5a6d9..1d702684e31 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassFix.java @@ -177,8 +177,7 @@ public class ImportClassFix extends JetHintAction imple @Nullable @Override public JetIntentionAction createAction(@NotNull DiagnosticWithPsiElement diagnostic) { - assert diagnostic.getPsiElement() instanceof JetSimpleNameExpression; - + // There could be different psi elements (i.e. JetArrayAccessExpression), but we can fix only JetSimpleNameExpression case if (diagnostic.getPsiElement() instanceof JetSimpleNameExpression) { JetSimpleNameExpression psiElement = (JetSimpleNameExpression) diagnostic.getPsiElement(); return new ImportClassFix(psiElement); diff --git a/idea/testData/quickfix/autoImports/afterNoImportForIndex.kt b/idea/testData/quickfix/autoImports/afterNoImportForIndex.kt new file mode 100644 index 00000000000..1b254db93ee --- /dev/null +++ b/idea/testData/quickfix/autoImports/afterNoImportForIndex.kt @@ -0,0 +1,15 @@ +// "Import Class" "false" + +package Teting + +class Some() { +// fun get(i : Int) : Int { +// return i +// } +} + +fun main(args : Array) { + val some = Some() + // Nothing should be changed + some[12] +} \ No newline at end of file diff --git a/idea/testData/quickfix/autoImports/beforeNoImportForIndex.kt b/idea/testData/quickfix/autoImports/beforeNoImportForIndex.kt new file mode 100644 index 00000000000..1b254db93ee --- /dev/null +++ b/idea/testData/quickfix/autoImports/beforeNoImportForIndex.kt @@ -0,0 +1,15 @@ +// "Import Class" "false" + +package Teting + +class Some() { +// fun get(i : Int) : Int { +// return i +// } +} + +fun main(args : Array) { + val some = Some() + // Nothing should be changed + some[12] +} \ No newline at end of file