Remove assert about error type for removing type annotation

This commit is contained in:
Nikolay Krasko
2013-08-03 11:43:25 +04:00
parent 26f14a67ee
commit 3fd265e34a
4 changed files with 15 additions and 1 deletions
@@ -69,7 +69,6 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
}
PsiElement parent = element.getParent();
JetType type = getTypeForDeclaration((JetNamedDeclaration) parent);
assert !ErrorUtils.isErrorType(type) : "Unexpected error type: " + element.getText();
if (parent instanceof JetProperty) {
JetProperty property = (JetProperty) parent;
if (property.getTypeRef() == null) {
@@ -109,6 +108,7 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
return false;
}
JetNamedDeclaration declaration = (JetNamedDeclaration) parent;
if (declaration instanceof JetProperty && !PsiTreeUtil.isAncestor(((JetProperty) declaration).getInitializer(), element, false)) {
if (((JetProperty) declaration).getTypeRef() != null) {
setText(JetBundle.message("specify.type.explicitly.remove.action.name"));
@@ -217,6 +217,8 @@ public class SpecifyTypeExplicitlyAction extends PsiElementBaseIntentionAction {
@NotNull PsiElement anchor,
@NotNull JetType exprType
) {
assert !ErrorUtils.isErrorType(exprType) : "Unexpected error type: " + namedDeclaration.getText();
TypeConstructor constructor = exprType.getConstructor();
boolean isAnonymous = DescriptorUtils.isAnonymous(constructor.getDeclarationDescriptor());
@@ -0,0 +1,4 @@
// "Remove explicitly specified type" "true"
package testing
val a = 12
@@ -0,0 +1,4 @@
// "Remove explicitly specified type" "true"
package testing
val a: <caret>Bad = 12
@@ -61,6 +61,10 @@ public class SpecifyTypeExplicitlyTest extends LightIntentionActionTestCase {
doTest();
}
public void testRemoveUnresolvedType() {
doTest();
}
@Override
protected String getTestDataPath() {
return PluginTestCaseBase.getTestDataPathBase() + "/intentions/";