diff --git a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java index cc998dd0ac8..105351a6f4f 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java @@ -69,6 +69,7 @@ public class KotlinCompiler { environment.addToClasspath(rtJar); environment.registerFileType(JetFileType.INSTANCE, "kt"); + environment.registerFileType(JetFileType.INSTANCE, "jet"); environment.registerParserDefinition(new JetParserDefinition()); VirtualFile vFile = environment.getLocalFileSystem().findFileByPath(arguments.src); diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java index fc591498479..67bb062e71e 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java @@ -168,7 +168,7 @@ public class JavaDescriptorResolver { private DeclarationDescriptor resolveParentDescriptor(PsiClass psiClass) { PsiClass containingClass = psiClass.getContainingClass(); if (containingClass != null) { - return resolveClass(psiClass); + return resolveClass(containingClass); } PsiJavaFile containingFile = (PsiJavaFile) psiClass.getContainingFile(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index 51fcb9f6aac..15d55b7f5de 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -556,6 +556,7 @@ public class JetControlFlowProcessor { List statements = bodyExpression.getStatements(); generateSubroutineControlFlow(functionLiteral, statements); } + builder.read(expression); } @Override diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/LocalDeclarationInstruction.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/LocalDeclarationInstruction.java index e44c428dff9..c7753272360 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/LocalDeclarationInstruction.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/pseudocode/LocalDeclarationInstruction.java @@ -39,6 +39,6 @@ public class LocalDeclarationInstruction extends ReadValueInstruction { else if (element instanceof JetObjectDeclaration) { kind = "o"; } - return "r" + kind + "(" + element.getText() + ")"; + return "d" + kind + "(" + element.getText() + ")"; } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetElement.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetElement.java index 32b7364b2ce..5c9816c0148 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetElement.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetElement.java @@ -3,6 +3,7 @@ package org.jetbrains.jet.lang.psi; import com.intellij.extapi.psi.ASTWrapperPsiElement; import com.intellij.lang.ASTNode; import com.intellij.lang.Language; +import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.plugin.JetLanguage; @@ -48,6 +49,16 @@ public class JetElement extends ASTWrapperPsiElement { } } + public void acceptChildren(@NotNull JetTreeVisitor visitor, D data) { + PsiElement child = getFirstChild(); + while (child != null) { + if (child instanceof JetElement) { + ((JetElement) child).accept(visitor, data); + } + child = child.getNextSibling(); + } + } + public void accept(@NotNull JetVisitorVoid visitor) { visitor.visitJetElement(this); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTreeVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTreeVisitor.java index d48dc9a4d31..76f3c5e1119 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTreeVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetTreeVisitor.java @@ -1,804 +1,12 @@ package org.jetbrains.jet.lang.psi; -import java.util.List; - /** * @author svtk */ public class JetTreeVisitor extends JetVisitor { @Override - public Void visitNamespace(JetNamespace namespace, D data) { - List importDirectives = namespace.getImportDirectives(); - for (JetImportDirective directive : importDirectives) { - directive.accept(this, data); - } - List declarations = namespace.getDeclarations(); - for (JetDeclaration declaration : declarations) { - declaration.accept(this, data); - } - return null; - } - - @Override - public Void visitClass(JetClass klass, D data) { - List declarations = klass.getDeclarations(); - for (JetDeclaration declaration : declarations) { - declaration.accept(this, data); - } - return null; - } - - @Override - public Void visitClassObject(JetClassObject classObject, D data) { - JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration(); - if (objectDeclaration != null) { - objectDeclaration.accept(this, data); - } - return null; - } - - @Override - public Void visitConstructor(JetConstructor constructor, D data) { - visitDeclarationWithBody(constructor, data); - return null; - } - - @Override - public Void visitNamedFunction(JetNamedFunction function, D data) { - visitDeclarationWithBody(function, data); - return null; - } - - @Override - public Void visitProperty(JetProperty property, D data) { - List accessors = property.getAccessors(); - for (JetPropertyAccessor accessor : accessors) { - accessor.accept(this, data); - } - JetExpression initializer = property.getInitializer(); - if (initializer != null) { - initializer.accept(this, data); - } - return null; - } - - @Override - public Void visitTypedef(JetTypedef typedef, D data) { - return super.visitTypedef(typedef, data); - } - - @Override - public Void visitJetFile(JetFile file, D data) { - JetNamespace rootNamespace = file.getRootNamespace(); - return rootNamespace.accept(this, data); - } - - @Override - public Void visitImportDirective(JetImportDirective importDirective, D data) { - return super.visitImportDirective(importDirective, data); - } - - @Override - public Void visitClassBody(JetClassBody classBody, D data) { - List declarations = classBody.getDeclarations(); - for (JetDeclaration declaration : declarations) { - declaration.accept(this, data); - } - List secondaryConstructors = classBody.getSecondaryConstructors(); - for (JetConstructor constructor : secondaryConstructors) { - constructor.accept(this, data); - } - return null; - } - - @Override - public Void visitNamespaceBody(JetNamespaceBody body, D data) { - List declarations = body.getDeclarations(); - for (JetDeclaration declaration : declarations) { - declaration.accept(this, data); - } - return null; - } - - @Override - public Void visitModifierList(JetModifierList list, D data) { - return super.visitModifierList(list, data); - } - - @Override - public Void visitAnnotation(JetAnnotation annotation, D data) { - return super.visitAnnotation(annotation, data); - } - - @Override - public Void visitAnnotationEntry(JetAnnotationEntry annotationEntry, D data) { - return super.visitAnnotationEntry(annotationEntry, data); - } - - @Override - public Void visitTypeParameterList(JetTypeParameterList list, D data) { - List parameters = list.getParameters(); - for (JetTypeParameter parameter : parameters) { - parameter.accept(this, data); - } - return null; - } - - @Override - public Void visitTypeParameter(JetTypeParameter parameter, D data) { - return super.visitTypeParameter(parameter, data); - } - - @Override - public Void visitEnumEntry(JetEnumEntry enumEntry, D data) { - List delegationSpecifiers = enumEntry.getDelegationSpecifiers(); - for (JetDelegationSpecifier delegationSpecifier : delegationSpecifiers) { - delegationSpecifier.accept(this, data); - } - JetModifierList modifierList = enumEntry.getModifierList(); - if (modifierList != null) { - modifierList.accept(this, data); - } - return null; - } - - @Override - public Void visitParameterList(JetParameterList list, D data) { - List parameters = list.getParameters(); - for (JetParameter parameter : parameters) { - parameter.accept(this, data); - } - return null; - } - - @Override - public Void visitParameter(JetParameter parameter, D data) { - return super.visitParameter(parameter, data); - } - - @Override - public Void visitDelegationSpecifierList(JetDelegationSpecifierList list, D data) { - List delegationSpecifiers = list.getDelegationSpecifiers(); - for (JetDelegationSpecifier delegationSpecifier : delegationSpecifiers) { - delegationSpecifier.accept(this, data); - } - return null; - } - - @Override - public Void visitDelegationSpecifier(JetDelegationSpecifier specifier, D data) { - return super.visitDelegationSpecifier(specifier, data); - } - - @Override - public Void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier, D data) { - return super.visitDelegationByExpressionSpecifier(specifier, data); - } - - @Override - public Void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call, D data) { - return super.visitDelegationToSuperCallSpecifier(call, data); - } - - @Override - public Void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier, D data) { - return super.visitDelegationToSuperClassSpecifier(specifier, data); - } - - @Override - public Void visitDelegationToThisCall(JetDelegatorToThisCall thisCall, D data) { - return super.visitDelegationToThisCall(thisCall, data); - } - - @Override - public Void visitTypeReference(JetTypeReference typeReference, D data) { - return super.visitTypeReference(typeReference, data); - } - - @Override - public Void visitValueArgumentList(JetValueArgumentList list, D data) { - List arguments = list.getArguments(); - for (JetValueArgument argument : arguments) { - argument.accept(this, data); - } - return null; - } - - @Override - public Void visitArgument(JetValueArgument argument, D data) { - return super.visitArgument(argument, data); - } - - @Override - public Void visitLoopExpression(JetLoopExpression loopExpression, D data) { - JetExpression body = loopExpression.getBody(); - if (body != null) { - body.accept(this, data); - } - return null; - } - - @Override - public Void visitConstantExpression(JetConstantExpression expression, D data) { - return super.visitConstantExpression(expression, data); - } - - @Override - public Void visitSimpleNameExpression(JetSimpleNameExpression expression, D data) { - return super.visitSimpleNameExpression(expression, data); - } - - @Override - public Void visitReferenceExpression(JetReferenceExpression expression, D data) { - return super.visitReferenceExpression(expression, data); - } - - @Override - public Void visitTupleExpression(JetTupleExpression expression, D data) { - return super.visitTupleExpression(expression, data); - } - - @Override - public Void visitPrefixExpression(JetPrefixExpression expression, D data) { - JetExpression baseExpression = expression.getBaseExpression(); - if (baseExpression != null) { - baseExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitPostfixExpression(JetPostfixExpression expression, D data) { - JetExpression baseExpression = expression.getBaseExpression(); - baseExpression.accept(this, data); - return null; - } - - @Override - public Void visitUnaryExpression(JetUnaryExpression expression, D data) { - JetExpression baseExpression = expression.getBaseExpression(); - assert baseExpression != null; - baseExpression.accept(this, data); - return null; - } - - @Override - public Void visitBinaryExpression(JetBinaryExpression expression, D data) { - JetExpression left = expression.getLeft(); - left.accept(this, data); - JetExpression right = expression.getRight(); - if (right != null) { - right.accept(this, data); - } - return super.visitBinaryExpression(expression, data); - } - - @Override - public Void visitReturnExpression(JetReturnExpression expression, D data) { - JetExpression returnedExpression = expression.getReturnedExpression(); - if (returnedExpression != null) { - returnedExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression, D data) { - JetExpression labeledExpression = expression.getLabeledExpression(); - if (labeledExpression != null) { - labeledExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitThrowExpression(JetThrowExpression expression, D data) { - JetExpression thrownExpression = expression.getThrownExpression(); - if (thrownExpression != null) { - thrownExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitBreakExpression(JetBreakExpression expression, D data) { - return super.visitBreakExpression(expression, data); - } - - @Override - public Void visitContinueExpression(JetContinueExpression expression, D data) { - return super.visitContinueExpression(expression, data); - } - - @Override - public Void visitIfExpression(JetIfExpression expression, D data) { - JetExpression condition = expression.getCondition(); - if (condition != null) { - condition.accept(this, data); - } - JetExpression then = expression.getThen(); - if (then != null) { - then.accept(this, data); - } - JetExpression anElse = expression.getElse(); - if (anElse != null) { - anElse.accept(this, data); - } - return null; - } - - @Override - public Void visitWhenExpression(JetWhenExpression expression, D data) { - List entries = expression.getEntries(); - for (JetWhenEntry entry : entries) { - entry.accept(this, data); - } - JetExpression subjectExpression = expression.getSubjectExpression(); - if (subjectExpression != null) { - subjectExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitTryExpression(JetTryExpression expression, D data) { - JetBlockExpression tryBlock = expression.getTryBlock(); - tryBlock.accept(this, data); - List catchClauses = expression.getCatchClauses(); - for (JetCatchClause catchClause : catchClauses) { - catchClause.accept(this, data); - } - JetFinallySection finallyBlock = expression.getFinallyBlock(); - if (finallyBlock != null) { - finallyBlock.accept(this, data); - } - return null; - } - - @Override - public Void visitForExpression(JetForExpression expression, D data) { - JetParameter loopParameter = expression.getLoopParameter(); - if (loopParameter != null) { - loopParameter.accept(this, data); - } - JetExpression loopRange = expression.getLoopRange(); - if (loopRange != null) { - loopRange.accept(this, data); - } - visitLoopExpression(expression, data); - return null; - } - - @Override - public Void visitWhileExpression(JetWhileExpression expression, D data) { - JetExpression condition = expression.getCondition(); - if (condition != null) { - condition.accept(this, data); - } - visitLoopExpression(expression, data); - return null; - } - - @Override - public Void visitDoWhileExpression(JetDoWhileExpression expression, D data) { - JetExpression condition = expression.getCondition(); - if (condition != null) { - condition.accept(this, data); - } - visitLoopExpression(expression, data); - return null; - } - - @Override - public Void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression, D data) { - JetFunctionLiteral functionLiteral = expression.getFunctionLiteral(); - functionLiteral.accept(this, data); - visitDeclarationWithBody(expression, data); - return null; - } - - @Override - public Void visitAnnotatedExpression(JetAnnotatedExpression expression, D data) { - JetExpression baseExpression = expression.getBaseExpression(); - baseExpression.accept(this, data); - return null; - } - - @Override - public Void visitCallExpression(JetCallExpression expression, D data) { - JetExpression calleeExpression = expression.getCalleeExpression(); - if (calleeExpression != null) { - calleeExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitArrayAccessExpression(JetArrayAccessExpression expression, D data) { - JetExpression arrayExpression = expression.getArrayExpression(); - arrayExpression.accept(this, data); - List indexExpressions = expression.getIndexExpressions(); - for (JetExpression indexExpression : indexExpressions) { - indexExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitQualifiedExpression(JetQualifiedExpression expression, D data) { - JetExpression receiver = expression.getReceiverExpression(); - receiver.accept(this, data); - JetExpression selector = expression.getSelectorExpression(); - if (selector != null) { - selector.accept(this, data); - } - return null; - } - - @Override - public Void visitHashQualifiedExpression(JetHashQualifiedExpression expression, D data) { - visitQualifiedExpression(expression, data); - return null; - } - - @Override - public Void visitDotQualifiedExpression(JetDotQualifiedExpression expression, D data) { - visitQualifiedExpression(expression, data); - return null; - } - - @Override - public Void visitPredicateExpression(JetPredicateExpression expression, D data) { - visitQualifiedExpression(expression, data); - return null; - } - - @Override - public Void visitSafeQualifiedExpression(JetSafeQualifiedExpression expression, D data) { - visitQualifiedExpression(expression, data); - return null; - } - - @Override - public Void visitObjectLiteralExpression(JetObjectLiteralExpression expression, D data) { - JetObjectDeclaration objectDeclaration = expression.getObjectDeclaration(); - objectDeclaration.accept(this, data); - return null; - } - - @Override - public Void visitRootNamespaceExpression(JetRootNamespaceExpression expression, D data) { - return super.visitRootNamespaceExpression(expression, data); - } - - @Override - public Void visitBlockExpression(JetBlockExpression expression, D data) { - List statements = expression.getStatements(); - for (JetElement statement : statements) { - statement.accept(this, data); - } - return null; - } - - @Override - public Void visitCatchSection(JetCatchClause catchClause, D data) { - JetParameter catchParameter = catchClause.getCatchParameter(); - if (catchParameter != null) { - catchParameter.accept(this, data); - } - JetExpression catchBody = catchClause.getCatchBody(); - if (catchBody != null) { - catchBody.accept(this, data); - } - return null; - } - - @Override - public Void visitFinallySection(JetFinallySection finallySection, D data) { - JetBlockExpression finalExpression = finallySection.getFinalExpression(); - finalExpression.accept(this, data); - return null; - } - - @Override - public Void visitTypeArgumentList(JetTypeArgumentList typeArgumentList, D data) { - List arguments = typeArgumentList.getArguments(); - for (JetTypeProjection argument : arguments) { - argument.accept(this, data); - } - return null; - } - - @Override - public Void visitThisExpression(JetThisExpression expression, D data) { - JetReferenceExpression thisReference = expression.getInstanceReference(); - thisReference.accept(this, data); - visitLabelQualifiedExpression(expression, data); - return null; - } - - @Override - public Void visitSuperExpression(JetSuperExpression expression, D data) { - JetReferenceExpression thisReference = expression.getInstanceReference(); - thisReference.accept(this, data); - JetTypeReference superTypeQualifier = expression.getSuperTypeQualifier(); - if (superTypeQualifier != null) { - superTypeQualifier.accept(this, data); - } - visitLabelQualifiedExpression(expression, data); - return null; - } - - @Override - public Void visitParenthesizedExpression(JetParenthesizedExpression expression, D data) { - JetExpression innerExpression = expression.getExpression(); - if (innerExpression != null) { - innerExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitInitializerList(JetInitializerList list, D data) { - List initializers = list.getInitializers(); - for (JetDelegationSpecifier initializer : initializers) { - initializer.accept(this, data); - } - return null; - } - - @Override - public Void visitAnonymousInitializer(JetClassInitializer initializer, D data) { - JetExpression body = initializer.getBody(); - body.accept(this, data); - return null; - } - - @Override - public Void visitPropertyAccessor(JetPropertyAccessor accessor, D data) { - visitDeclarationWithBody(accessor, data); - return null; - } - - @Override - public Void visitTypeConstraintList(JetTypeConstraintList list, D data) { - List constraints = list.getConstraints(); - for (JetTypeConstraint constraint : constraints) { - constraint.accept(this, data); - } - return null; - } - - @Override - public Void visitTypeConstraint(JetTypeConstraint constraint, D data) { - JetSimpleNameExpression subjectTypeParameterName = constraint.getSubjectTypeParameterName(); - if (subjectTypeParameterName != null) { - subjectTypeParameterName.accept(this, data); - } - return null; - } - - @Override - public Void visitUserType(JetUserType type, D data) { - return super.visitUserType(type, data); - } - - @Override - public Void visitTupleType(JetTupleType type, D data) { - return super.visitTupleType(type, data); - } - - @Override - public Void visitFunctionType(JetFunctionType type, D data) { - return super.visitFunctionType(type, data); - } - - @Override - public Void visitSelfType(JetSelfType type, D data) { - return super.visitSelfType(type, data); - } - - @Override - public Void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression, D data) { - JetExpression left = expression.getLeft(); - left.accept(this, data); - JetTypeReference right = expression.getRight(); - if (right != null) { - right.accept(this, data); - } - return null; - } - - @Override - public Void visitStringTemplateExpression(JetStringTemplateExpression expression, D data) { - JetStringTemplateEntry[] entries = expression.getEntries(); - for (JetStringTemplateEntry entry : entries) { - entry.accept(this, data); - } - return null; - } - - @Override - public Void visitNamedDeclaration(JetNamedDeclaration declaration, D data) { - return super.visitNamedDeclaration(declaration, data); - } - - @Override - public Void visitNullableType(JetNullableType nullableType, D data) { - return super.visitNullableType(nullableType, data); - } - - @Override - public Void visitTypeProjection(JetTypeProjection typeProjection, D data) { - return super.visitTypeProjection(typeProjection, data); - } - - @Override - public Void visitWhenEntry(JetWhenEntry jetWhenEntry, D data) { - JetExpression expression = jetWhenEntry.getExpression(); - if (expression != null) { - expression.accept(this, data); - } - JetWhenCondition[] conditions = jetWhenEntry.getConditions(); - for (JetWhenCondition condition : conditions) { - condition.accept(this, data); - } - return null; - } - - @Override - public Void visitIsExpression(JetIsExpression expression, D data) { - JetExpression leftHandSide = expression.getLeftHandSide(); - leftHandSide.accept(this, data); - JetSimpleNameExpression operationReference = expression.getOperationReference(); - operationReference.accept(this, data); - JetPattern pattern = expression.getPattern(); - if (pattern != null) { - pattern.accept(this, data); - } - return null; - } - - @Override - public Void visitWhenConditionCall(JetWhenConditionCall condition, D data) { - JetExpression callSuffixExpression = condition.getCallSuffixExpression(); - if (callSuffixExpression != null) { - callSuffixExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition, D data) { - JetPattern pattern = condition.getPattern(); - if (pattern != null) { - pattern.accept(this, data); - } - return null; - } - - @Override - public Void visitWhenConditionInRange(JetWhenConditionInRange condition, D data) { - JetSimpleNameExpression operationReference = condition.getOperationReference(); - operationReference.accept(this, data); - JetExpression rangeExpression = condition.getRangeExpression(); - if (rangeExpression != null) { - rangeExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitTypePattern(JetTypePattern pattern, D data) { - return super.visitTypePattern(pattern, data); - } - - @Override - public Void visitWildcardPattern(JetWildcardPattern pattern, D data) { - return super.visitWildcardPattern(pattern, data); - } - - @Override - public Void visitExpressionPattern(JetExpressionPattern pattern, D data) { - JetExpression expression = pattern.getExpression(); - if (expression != null) { - expression.accept(this, data); - } - return null; - } - - @Override - public Void visitTuplePattern(JetTuplePattern pattern, D data) { - List entries = pattern.getEntries(); - for (JetTuplePatternEntry entry : entries) { - entry.accept(this, data); - } - return null; - } - - @Override - public Void visitDecomposerPattern(JetDecomposerPattern pattern, D data) { - JetTuplePattern argumentList = pattern.getArgumentList(); - argumentList.accept(this, data); - JetExpression decomposerExpression = pattern.getDecomposerExpression(); - if (decomposerExpression != null) { - decomposerExpression.accept(this, data); - } - return null; - } - - @Override - public Void visitObjectDeclaration(JetObjectDeclaration objectDeclaration, D data) { - List declarations = objectDeclaration.getDeclarations(); - for (JetDeclaration declaration : declarations) { - declaration.accept(this, data); - } - JetDelegationSpecifierList delegationSpecifierList = objectDeclaration.getDelegationSpecifierList(); - if (delegationSpecifierList != null) { - delegationSpecifierList.accept(this, data); - } - return null; - } - - @Override - public Void visitBindingPattern(JetBindingPattern pattern, D data) { - JetWhenCondition condition = pattern.getCondition(); - if (condition != null) { - condition.accept(this, data); - } - JetProperty variableDeclaration = pattern.getVariableDeclaration(); - variableDeclaration.accept(this, data); - return null; - } - - @Override - public Void visitStringTemplateEntry(JetStringTemplateEntry entry, D data) { - JetExpression expression = entry.getExpression(); - if (expression != null) { - expression.accept(this, data); - } - return null; - } - - @Override - public Void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry, D data) { - visitStringTemplateEntry(entry, data); - return null; - } - - @Override - public Void visitBlockStringTemplateEntry(JetBlockStringTemplateEntry entry, D data) { - visitStringTemplateEntry(entry, data); - return null; - } - - @Override - public Void visitSimpleNameStringTemplateEntry(JetSimpleNameStringTemplateEntry entry, D data) { - visitStringTemplateEntry(entry, data); - return null; - } - - @Override - public Void visitLiteralStringTemplateEntry(JetLiteralStringTemplateEntry entry, D data) { - visitStringTemplateEntry(entry, data); - return null; - } - - @Override - public Void visitEscapeStringTemplateEntry(JetEscapeStringTemplateEntry entry, D data) { - visitStringTemplateEntry(entry, data); - return null; - } - - private Void visitDeclarationWithBody(JetDeclarationWithBody declaration, D data) { - JetExpression bodyExpression = declaration.getBodyExpression(); - if (bodyExpression != null) { - bodyExpression.accept(this, data); - } - List valueParameters = declaration.getValueParameters(); - for (JetParameter valueParameter : valueParameters) { - valueParameter.accept(this, data); - } + public Void visitJetElement(JetElement element, D data) { + element.acceptChildren(this, data); return null; } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java index 5847cf61cfd..2acc11bc2c9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java @@ -25,11 +25,12 @@ import java.util.Set; protected final Map namespaceScopes = Maps.newHashMap(); protected final Map namespaceDescriptors = Maps.newHashMap(); + private final Map declaringScopes = Maps.newHashMap(); + private final Map functions = Maps.newLinkedHashMap(); private final Map constructors = Maps.newLinkedHashMap(); private final Map properties = Maps.newLinkedHashMap(); private final Set primaryConstructorParameterProperties = Sets.newHashSet(); - private final Map declaringScopes = Maps.newHashMap(); public TopDownAnalysisContext(JetSemanticServices semanticServices, BindingTrace trace) { this.trace = new ObservableBindingTrace(trace); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java index 32755ce154c..3b43c0bbe42 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalyzer.java @@ -18,44 +18,14 @@ public class TopDownAnalyzer { private TopDownAnalyzer() {} - public static void processObject( + public static void process( @NotNull JetSemanticServices semanticServices, @NotNull BindingTrace trace, @NotNull JetScope outerScope, - @NotNull DeclarationDescriptor containingDeclaration, - @NotNull JetObjectDeclaration object) { - process(semanticServices, trace, outerScope, new NamespaceLike.Adapter(containingDeclaration) { - - @Override - public NamespaceDescriptorImpl getNamespace(String name) { - throw new UnsupportedOperationException(); - } - - @Override - public void addNamespace(@NotNull NamespaceDescriptor namespaceDescriptor) { - throw new UnsupportedOperationException(); - } - - @Override - public void addClassifierDescriptor(@NotNull MutableClassDescriptor classDescriptor) { - - } - - @Override - public void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor) { - throw new UnsupportedOperationException(); - } - - @Override - public void addPropertyDescriptor(@NotNull PropertyDescriptor propertyDescriptor) { - - } - - @Override - public ClassObjectStatus setClassObjectDescriptor(@NotNull MutableClassDescriptor classObjectDescriptor) { - return ClassObjectStatus.NOT_ALLOWED; - } - }, Collections.singletonList(object), JetControlFlowDataTraceFactory.EMPTY, true); + NamespaceLike owner, + @NotNull List declarations, + @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) { + process(semanticServices, trace, outerScope, owner, declarations, flowDataTraceFactory, false); } private static void process( @@ -75,16 +45,6 @@ public class TopDownAnalyzer { new DeclarationsChecker(context).process(); new ControlFlowAnalyzer(context, flowDataTraceFactory, declaredLocally).process(); } - - public static void process( - @NotNull JetSemanticServices semanticServices, - @NotNull BindingTrace trace, - @NotNull JetScope outerScope, - NamespaceLike owner, - @NotNull List declarations, - @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) { - process(semanticServices, trace, outerScope, owner, declarations, flowDataTraceFactory, false); - } public static void processStandardLibraryNamespace( @NotNull JetSemanticServices semanticServices, @@ -93,6 +53,8 @@ public class TopDownAnalyzer { TopDownAnalysisContext context = new TopDownAnalysisContext(semanticServices, trace); context.getNamespaceScopes().put(namespace, standardLibraryNamespace.getMemberScope()); context.getNamespaceDescriptors().put(namespace, standardLibraryNamespace); + context.getDeclaringScopes().put(namespace, outerScope); + new TypeHierarchyResolver(context).process(outerScope, standardLibraryNamespace, namespace.getDeclarations()); new DeclarationResolver(context).process(); new DelegationResolver(context).process(); @@ -105,6 +67,46 @@ public class TopDownAnalyzer { new BodyResolver(context).resolveBehaviorDeclarationBodies(); } + public static void processObject( + @NotNull JetSemanticServices semanticServices, + @NotNull BindingTrace trace, + @NotNull JetScope outerScope, + @NotNull DeclarationDescriptor containingDeclaration, + @NotNull JetObjectDeclaration object) { + process(semanticServices, trace, outerScope, new NamespaceLike.Adapter(containingDeclaration) { + + @Override + public NamespaceDescriptorImpl getNamespace(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public void addNamespace(@NotNull NamespaceDescriptor namespaceDescriptor) { + throw new UnsupportedOperationException(); + } + + @Override + public void addClassifierDescriptor(@NotNull MutableClassDescriptor classDescriptor) { + + } + + @Override + public void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor) { + throw new UnsupportedOperationException(); + } + + @Override + public void addPropertyDescriptor(@NotNull PropertyDescriptor propertyDescriptor) { + + } + + @Override + public ClassObjectStatus setClassObjectDescriptor(@NotNull MutableClassDescriptor classObjectDescriptor) { + return ClassObjectStatus.NOT_ALLOWED; + } + }, Collections.singletonList(object), JetControlFlowDataTraceFactory.EMPTY, true); + } + } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java index 7c49becc754..49ed44b4a4f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java @@ -12,6 +12,7 @@ import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.scopes.JetScope; +import org.jetbrains.jet.lang.resolve.scopes.WritableScope; import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl; import org.jetbrains.jet.lang.resolve.scopes.WriteThroughScope; import org.jetbrains.jet.lang.types.*; @@ -38,6 +39,8 @@ public class TypeHierarchyResolver { public void process(@NotNull JetScope outerScope, NamespaceLike owner, @NotNull List declarations) { collectNamespacesAndClassifiers(outerScope, owner, declarations); // namespaceScopes, classes + processTypeImports(); + createTypeConstructors(); // create type constructors for classes and generic parameters, supertypes are not filled in resolveTypesInClassHeaders(); // Generic bounds and types in supertype lists (no expressions or constructor resolution) @@ -82,8 +85,9 @@ public class TypeHierarchyResolver { WriteThroughScope namespaceScope = new WriteThroughScope(outerScope, namespaceDescriptor.getMemberScope(), new TraceBasedRedeclarationHandler(context.getTrace())); context.getNamespaceScopes().put(namespace, namespaceScope); + context.getDeclaringScopes().put(namespace, outerScope); - processImports(namespace, namespaceScope, outerScope); +// processImports(namespace, namespaceScope, outerScope); collectNamespacesAndClassifiers(namespaceScope, namespaceDescriptor, namespace.getDeclarations()); } @@ -205,12 +209,17 @@ public class TypeHierarchyResolver { return ClassKind.CLASS; } - private void processImports(@NotNull JetNamespace namespace, @NotNull WriteThroughScope namespaceScope, @NotNull JetScope outerScope) { + private void processTypeImports() { + for (JetNamespace jetNamespace : context.getNamespaceDescriptors().keySet()) { + processImports(jetNamespace, context.getNamespaceScopes().get(jetNamespace), context.getDeclaringScopes().get(jetNamespace)); + } + } + + private void processImports(@NotNull JetNamespace namespace, @NotNull WritableScope namespaceScope, @NotNull JetScope outerScope) { List importDirectives = namespace.getImportDirectives(); for (JetImportDirective importDirective : importDirectives) { if (importDirective.isAbsoluteInRootNamespace()) { -// context.getTrace().getErrorHandler().genericError(namespace.getNode(), "Unsupported by TDA"); // TODO - context.getTrace().report(UNSUPPORTED.on(namespace, "TypeHierarchyResolver")); // TODO + context.getTrace().report(UNSUPPORTED.on(importDirective, "TypeHierarchyResolver")); // TODO continue; } if (importDirective.isAllUnder()) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScope.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScope.java index 04ea11c3be4..f56816079fb 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScope.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScope.java @@ -33,4 +33,8 @@ public interface WritableScope extends JetScope { void importScope(@NotNull JetScope imported); void setImplicitReceiver(@NotNull ReceiverDescriptor implicitReceiver); + + void importClassifierAlias(@NotNull String importedClassifierName, @NotNull ClassifierDescriptor classifierDescriptor); + + void importNamespaceAlias(String aliasName, NamespaceDescriptor namespaceDescriptor); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScopeWithImports.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScopeWithImports.java index e3205c0d9ee..ba957519c14 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScopeWithImports.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WritableScopeWithImports.java @@ -106,11 +106,13 @@ public abstract class WritableScopeWithImports extends JetScopeAdapter implement return currentIndividualImportScope; } + @Override public void importClassifierAlias(@NotNull String importedClassifierName, @NotNull ClassifierDescriptor classifierDescriptor) { getCurrentIndividualImportScope().addClassifierAlias(importedClassifierName, classifierDescriptor); } + @Override public void importNamespaceAlias(String aliasName, NamespaceDescriptor namespaceDescriptor) { getCurrentIndividualImportScope().addNamespaceAlias(aliasName, namespaceDescriptor); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WriteThroughScope.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WriteThroughScope.java index 941562949e4..9c3a2abc7e6 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WriteThroughScope.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/scopes/WriteThroughScope.java @@ -167,4 +167,9 @@ public class WriteThroughScope extends WritableScopeWithImports { } return allDescriptors; } + + @NotNull + public JetScope getOuterScope() { + return getWorkerScope(); + } } diff --git a/compiler/testData/cfg/Basic.instructions b/compiler/testData/cfg/Basic.instructions index f8f34d1dc84..e03b4382450 100644 --- a/compiler/testData/cfg/Basic.instructions +++ b/compiler/testData/cfg/Basic.instructions @@ -40,9 +40,10 @@ l0: r(foo) NEXT:[r(foo(a, 3))] PREV:[r(3)] r(foo(a, 3)) NEXT:[r(genfun)] PREV:[r(foo)] r(genfun) NEXT:[r(genfun())] PREV:[r(foo(a, 3))] - r(genfun()) NEXT:[rf({1})] PREV:[r(genfun)] - rf({1}) NEXT:[r(flfun)] PREV:[r(genfun())] - r(flfun) NEXT:[r(flfun {1})] PREV:[rf({1})] + r(genfun()) NEXT:[df({1})] PREV:[r(genfun)] + df({1}) NEXT:[r({1})] PREV:[r(genfun())] + r({1}) NEXT:[r(flfun)] PREV:[df({1})] + r(flfun) NEXT:[r(flfun {1})] PREV:[r({1})] r(flfun {1}) NEXT:[r(3)] PREV:[r(flfun)] r(3) NEXT:[r(4)] PREV:[r(flfun {1})] r(4) NEXT:[r(equals)] PREV:[r(3)] diff --git a/compiler/testData/cfg/Finally.instructions b/compiler/testData/cfg/Finally.instructions index 8500acbd625..32e5c6c9b3a 100644 --- a/compiler/testData/cfg/Finally.instructions +++ b/compiler/testData/cfg/Finally.instructions @@ -93,14 +93,19 @@ fun t3() { l0: NEXT:[jmp?(l2)] PREV:[] jmp?(l2) NEXT:[r(2), r(1)] PREV:[] - r(1) NEXT:[rf({ () => if (2 > 3) { retu..)] PREV:[jmp?(l2)] - rf({ () => + r(1) NEXT:[df({ () => if (2 > 3) { retu..)] PREV:[jmp?(l2)] + df({ () => if (2 > 3) { return@ } - }) NEXT:[r(2)] PREV:[r(1)] + }) NEXT:[r({ () => if (2 > 3) { retur..)] PREV:[r(1)] + r({ () => + if (2 > 3) { + return@ + } + }) NEXT:[r(2)] PREV:[df({ () => if (2 > 3) { retu..)] l2: - r(2) NEXT:[] PREV:[jmp?(l2), rf({ () => if (2 > 3) { retu..)] + r(2) NEXT:[] PREV:[jmp?(l2), r({ () => if (2 > 3) { retur..)] l1: NEXT:[] PREV:[r(2)] error: @@ -171,8 +176,8 @@ fun t3() { } --------------------- l0: - NEXT:[rf({ () => try { 1 if (2 > 3..)] PREV:[] - rf({ () => + NEXT:[df({ () => try { 1 if (2 > 3..)] PREV:[] + df({ () => try { 1 if (2 > 3) { @@ -181,9 +186,19 @@ l0: } finally { 2 } - }) NEXT:[] PREV:[] + }) NEXT:[r({ () => try { 1 if (2 > 3)..)] PREV:[] + r({ () => + try { + 1 + if (2 > 3) { + return@ + } + } finally { + 2 + } + }) NEXT:[] PREV:[df({ () => try { 1 if (2 > 3..)] l1: - NEXT:[] PREV:[rf({ () => try { 1 if (2 > 3..)] + NEXT:[] PREV:[r({ () => try { 1 if (2 > 3)..)] error: NEXT:[] PREV:[] l2: diff --git a/compiler/testData/checkerWithErrorTypes/full/regression/kt402.jet b/compiler/testData/checkerWithErrorTypes/full/regression/kt402.jet new file mode 100644 index 00000000000..7df59b2aa2f --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/full/regression/kt402.jet @@ -0,0 +1,8 @@ +namespace kt402 + +fun getTypeChecker() : fun(Any):Boolean { + { (a : Any) => a is T } // reports unsupported +} +fun f() : fun(Any) : Boolean { + return { (a : Any) => a is String } +} \ No newline at end of file diff --git a/compiler/testData/checkerWithErrorTypes/quick/ImportResolutionOrder.jet b/compiler/testData/checkerWithErrorTypes/quick/ImportResolutionOrder.jet new file mode 100644 index 00000000000..1b12d676fe7 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/ImportResolutionOrder.jet @@ -0,0 +1,12 @@ +// KT-355 Resolve imports after all symbols are built + +namespace a { + import b.* + val x : X = X() +} + +namespace b { + class X() { + + } +} diff --git a/compiler/tests/org/jetbrains/jet/JetTestCaseBase.java b/compiler/tests/org/jetbrains/jet/JetTestCaseBase.java index 88dd75b955a..e53d7077cdd 100644 --- a/compiler/tests/org/jetbrains/jet/JetTestCaseBase.java +++ b/compiler/tests/org/jetbrains/jet/JetTestCaseBase.java @@ -20,6 +20,7 @@ import java.util.List; */ public abstract class JetTestCaseBase extends LightDaemonAnalyzerTestCase { + private static FilenameFilter emptyFilter; private boolean checkInfos = false; private String dataPath; protected final String name; @@ -75,20 +76,49 @@ public abstract class JetTestCaseBase extends LightDaemonAnalyzerTestCase { return dataPath; } + protected void setUp() throws Exception { + super.setUp(); + emptyFilter = new FilenameFilter() { + @Override + public boolean accept(File file, String name) { + return true; + } + }; + } + public interface NamedTestFactory { @NotNull Test createTest(@NotNull String dataPath, @NotNull String name); } @NotNull public static TestSuite suiteForDirectory(String baseDataDir, @NotNull final String dataPath, boolean recursive, @NotNull NamedTestFactory factory) { + return suiteForDirectory(baseDataDir, dataPath, recursive, emptyFilter, factory); + } + + @NotNull + public static TestSuite suiteForDirectory(String baseDataDir, @NotNull final String dataPath, boolean recursive, final FilenameFilter filter, @NotNull NamedTestFactory factory) { TestSuite suite = new TestSuite(dataPath); - final String extension = ".jet"; - FilenameFilter extensionFilter = new FilenameFilter() { + final String extensionJet = ".jet"; + final String extensionKt = ".kt"; + final FilenameFilter extensionFilter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { - return name.endsWith(extension); + return name.endsWith(extensionJet) || name.endsWith(extensionKt); } }; + FilenameFilter resultFilter; + if (filter != emptyFilter) { + resultFilter = new FilenameFilter() { + @Override + public boolean accept(File file, String s) { + if (extensionFilter.accept(file, s) && filter.accept(file, s)) return true; + return false; + } + }; + } + else { + resultFilter = extensionFilter; + } File dir = new File(baseDataDir + dataPath); FileFilter dirFilter = new FileFilter() { @Override @@ -105,11 +135,12 @@ public abstract class JetTestCaseBase extends LightDaemonAnalyzerTestCase { suite.addTest(suiteForDirectory(baseDataDir, dataPath + "/" + subdir.getName(), recursive, factory)); } } - List files = Arrays.asList(dir.listFiles(extensionFilter)); + List files = Arrays.asList(dir.listFiles(resultFilter)); Collections.sort(files); for (File file : files) { String fileName = file.getName(); assert fileName != null; + String extension = fileName.endsWith(extensionJet) ? extensionJet : extensionKt; suite.addTest(factory.createTest(dataPath, fileName.substring(0, fileName.length() - extension.length()))); } return suite; diff --git a/idea/src/org/jetbrains/jet/plugin/JetBundle.java b/idea/src/org/jetbrains/jet/plugin/JetBundle.java new file mode 100644 index 00000000000..8e8e81edc57 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/JetBundle.java @@ -0,0 +1,36 @@ +package org.jetbrains.jet.plugin; + +import com.intellij.CommonBundle; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.PropertyKey; + +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.util.ResourceBundle; + +/** + * @author svtk + */ +public class JetBundle { + private static Reference ourBundle; + + @NonNls + private static final String BUNDLE = "org.jetbrains.jet.plugin.JetBundle"; + + private JetBundle() { + } + + public static String message(@NonNls @PropertyKey(resourceBundle = BUNDLE)String key, Object... params) { + return CommonBundle.message(getBundle(), key, params); + } + + private static ResourceBundle getBundle() { + ResourceBundle bundle = null; + if (ourBundle != null) bundle = ourBundle.get(); + if (bundle == null) { + bundle = ResourceBundle.getBundle(BUNDLE); + ourBundle = new SoftReference(bundle); + } + return bundle; + } +} diff --git a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties new file mode 100644 index 00000000000..7e6753c0757 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties @@ -0,0 +1,26 @@ +#quick fix messages +add.function.body=Add function body +add.primary.constructor=Add primary constructor to {0} +add.primary.constructor.family=Add primary constructor +add.return.type=Add return type declaration +change.accessor.type=Change accessor type +change.getter.type=Change getter type to {0} +change.setter.type=Change setter parameter type to {0} +make.variable.immutable=Make variable immutable +make.variable.mutable=Make variable mutable +change.variable.mutability.family=Change variable mutability +remove.function.body=Remove function body +make.element.modifier=Make {0} {1} +add.modifier=Add ''{0}'' modifier +make.element.not.modifier=Make {0} not {1} +remove.modifier=Remove ''{0}'' modifier +remove.modifier.family=Remove modifier +remove.redundant.modifier=Remove redundant ''{0}'' modifier +remove.parts.from.property=Remove {0} from property +remove.parts.from.property.family=Remove parts from property +remove.right.part.of.binary.expression=Remove right part of a binary expression +remove.cast=Remove cast +remove.elvis.operator=Remove elvis operator +replace.operation.in.binary.expression=Replace operation in a binary expression +replace.cast.with.static.assert=Replace a cast with a static assert +replace.with.dot.call=Replace with dot call \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/AddFunctionBodyFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/AddFunctionBodyFix.java index 4c919f86e94..c347e044432 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/AddFunctionBodyFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/AddFunctionBodyFix.java @@ -8,6 +8,7 @@ import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.diagnostics.DiagnosticWithPsiElement; import org.jetbrains.jet.lang.psi.*; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -20,13 +21,13 @@ public class AddFunctionBodyFix extends JetIntentionAction { @NotNull @Override public String getText() { - return "Add function body"; + return JetBundle.message("add.function.body"); } @NotNull @Override public String getFamilyName() { - return "Add function body"; + return JetBundle.message("add.function.body"); } @Override diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/AddModifierFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/AddModifierFix.java index 42e28ef25eb..1872257488d 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/AddModifierFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/AddModifierFix.java @@ -15,6 +15,7 @@ import org.jetbrains.jet.lang.psi.JetPsiFactory; import org.jetbrains.jet.lexer.JetKeywordToken; import org.jetbrains.jet.lexer.JetToken; import org.jetbrains.jet.lexer.JetTokens; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -51,9 +52,9 @@ public class AddModifierFix extends JetIntentionAction { @Override public String getText() { if (modifier == JetTokens.ABSTRACT_KEYWORD || modifier == JetTokens.OPEN_KEYWORD) { - return "Make " + getElementName(element) + " " + modifier.getValue(); + return JetBundle.message("make.element.modifier", getElementName(element), modifier.getValue()); } - return "Add '" + modifier.getValue() + "' modifier"; + return JetBundle.message("add.modifier", modifier.getValue()); } @NotNull diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/AddPrimaryConstructorFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/AddPrimaryConstructorFix.java index ec8e3ee1a50..050bb5eac7f 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/AddPrimaryConstructorFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/AddPrimaryConstructorFix.java @@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.diagnostics.DiagnosticWithPsiElement; import org.jetbrains.jet.lang.psi.JetClass; import org.jetbrains.jet.lang.psi.JetPsiFactory; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -22,13 +23,13 @@ public class AddPrimaryConstructorFix extends JetIntentionAction { @NotNull @Override public String getText() { - return "Add primary constructor to " + element.getName(); + return JetBundle.message("add.primary.constructor", element.getName()); } @NotNull @Override public String getFamilyName() { - return "Add primary constructor"; + return JetBundle.message("add.primary.constructor.family"); } @Override diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java index 7314585e233..a6bab35510e 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java @@ -12,6 +12,7 @@ import org.jetbrains.jet.lang.diagnostics.DiagnosticWithParameters; import org.jetbrains.jet.lang.diagnostics.DiagnosticWithPsiElement; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.types.JetType; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -27,13 +28,13 @@ public class AddReturnTypeFix extends JetIntentionAction { @NotNull @Override public String getText() { - return "Add return type declaration"; + return JetBundle.message("add.return.type"); } @NotNull @Override public String getFamilyName() { - return "Add return type declaration"; + return JetBundle.message("add.return.type"); } @Override diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeAccessorTypeFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeAccessorTypeFix.java index 17590360691..82a12be3ca2 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeAccessorTypeFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/ChangeAccessorTypeFix.java @@ -15,6 +15,7 @@ import org.jetbrains.jet.lang.psi.JetPropertyAccessor; import org.jetbrains.jet.lang.psi.JetPsiFactory; import org.jetbrains.jet.lang.psi.JetTypeReference; import org.jetbrains.jet.lang.types.JetType; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -30,13 +31,13 @@ public class ChangeAccessorTypeFix extends JetIntentionAction @NotNull @Override public String getText() { - return "Make variable " + (element.isVar() ? "immutable" : "mutable"); + return element.isVar() ? JetBundle.message("make.variable.immutable") : JetBundle.message("make.variable.mutable"); } @NotNull @Override public String getFamilyName() { - return "Change variable mutability"; + return JetBundle.message("change.variable.mutability.family"); } @Override diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java index 76f37013470..5c1e2c4a34f 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java @@ -81,7 +81,7 @@ public class QuickFixes { add(Errors.USELESS_ELVIS, RemoveRightPartOfBinaryExpressionFix.createRemoveElvisOperatorFactory()); - add(Errors.UNNECESSARY_SAFE_CALL, ReplaceSafeCallToDotCall.createFactory()); + add(Errors.UNNECESSARY_SAFE_CALL, ReplaceSafeCallWithDotCall.createFactory()); JetIntentionActionFactory removeRedundantModifierFactory = RemoveModifierFix.createRemoveModifierFromListFactory(true); add(Errors.REDUNDANT_MODIFIER, removeRedundantModifierFactory); diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveFunctionBodyFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveFunctionBodyFix.java index 35e58499ddc..3cdc3717fae 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveFunctionBodyFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveFunctionBodyFix.java @@ -13,6 +13,7 @@ import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetExpression; import org.jetbrains.jet.lang.psi.JetFunction; import org.jetbrains.jet.lexer.JetTokens; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -26,13 +27,13 @@ public class RemoveFunctionBodyFix extends JetIntentionAction { @NotNull @Override public String getText() { - return "Remove function body"; + return JetBundle.message("remove.function.body"); } @NotNull @Override public String getFamilyName() { - return "Remove function body"; + return JetBundle.message("remove.function.body"); } @Override diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveModifierFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveModifierFix.java index 79cb415fee0..efe1337520b 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveModifierFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveModifierFix.java @@ -17,6 +17,7 @@ import org.jetbrains.jet.lang.psi.JetModifierListOwner; import org.jetbrains.jet.lexer.JetKeywordToken; import org.jetbrains.jet.lexer.JetToken; import org.jetbrains.jet.lexer.JetTokens; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -32,16 +33,16 @@ public class RemoveModifierFix { private static String makeText(@Nullable JetModifierListOwner element, JetKeywordToken modifier, boolean isRedundant) { if (isRedundant) { - return "Remove redundant '" + modifier.getValue() + "' modifier"; + return JetBundle.message("remove.redundant.modifier", modifier.getValue()); } if (element != null && modifier == JetTokens.ABSTRACT_KEYWORD || modifier == JetTokens.OPEN_KEYWORD) { - return "Make " + AddModifierFix.getElementName(element) + " not " + modifier.getValue(); + return JetBundle.message("make.element.not.modifier", AddModifierFix.getElementName(element), modifier.getValue()); } - return "Remove '" + modifier.getValue() + "' modifier"; + return JetBundle.message("remove.modifier", modifier.getValue()); } private static String getFamilyName() { - return "Remove modifier fix"; + return JetBundle.message("remove.modifier.family"); } @NotNull diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java index f9e3afc1295..e4bcefade98 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java @@ -12,6 +12,7 @@ import org.jetbrains.jet.lang.diagnostics.DiagnosticWithParameters; import org.jetbrains.jet.lang.diagnostics.DiagnosticWithPsiElement; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.types.JetType; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -66,13 +67,13 @@ public class RemovePartsFromPropertyFix extends JetIntentionAction @NotNull @Override public String getText() { - return "Remove " + partsToRemove(removeGetter, removeSetter, removeInitializer) + " from property"; + return JetBundle.message("remove.parts.from.property", partsToRemove(removeGetter, removeSetter, removeInitializer)); } @NotNull @Override public String getFamilyName() { - return "Remove parts from property to make it abstract"; + return JetBundle.message("remove.parts.from.property.family"); } @Override diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveRightPartOfBinaryExpressionFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveRightPartOfBinaryExpressionFix.java index 61b72d624c9..9799b3420fa 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveRightPartOfBinaryExpressionFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/RemoveRightPartOfBinaryExpressionFix.java @@ -9,6 +9,7 @@ import org.jetbrains.jet.lang.diagnostics.DiagnosticWithPsiElement; import org.jetbrains.jet.lang.psi.JetBinaryExpression; import org.jetbrains.jet.lang.psi.JetBinaryExpressionWithTypeRHS; import org.jetbrains.jet.lang.psi.JetExpression; +import org.jetbrains.jet.plugin.JetBundle; /** * @author svtk @@ -21,7 +22,7 @@ public abstract class RemoveRightPartOfBinaryExpressionFix { +public class ReplaceSafeCallWithDotCall extends JetIntentionAction { - public ReplaceSafeCallToDotCall(@NotNull JetElement element) { + public ReplaceSafeCallWithDotCall(@NotNull JetElement element) { super(element); } @NotNull @Override public String getText() { - return "Replace to dot call"; + return JetBundle.message("replace.with.dot.call"); } @NotNull @Override public String getFamilyName() { - return "Replace safe call to dot call"; + return JetBundle.message("replace.with.dot.call"); } @Override @@ -55,7 +56,7 @@ public class ReplaceSafeCallToDotCall extends JetIntentionAction { @Override public JetIntentionAction createAction(DiagnosticWithPsiElement diagnostic) { assert diagnostic.getPsiElement() instanceof JetElement; - return new ReplaceSafeCallToDotCall((JetElement) diagnostic.getPsiElement()); + return new ReplaceSafeCallWithDotCall((JetElement) diagnostic.getPsiElement()); } }; } diff --git a/idea/testData/quickfix/expressions/afterUnnecessarySafeCall1.kt b/idea/testData/quickfix/expressions/afterUnnecessarySafeCall1.kt index 7422cfd3f6b..55d3d6c64f3 100644 --- a/idea/testData/quickfix/expressions/afterUnnecessarySafeCall1.kt +++ b/idea/testData/quickfix/expressions/afterUnnecessarySafeCall1.kt @@ -1,4 +1,4 @@ -// "Replace to dot call" "true" +// "Replace with dot call" "true" fun foo(a: Any) { a.equals(0) } diff --git a/idea/testData/quickfix/expressions/afterUnnecessarySafeCall2.kt b/idea/testData/quickfix/expressions/afterUnnecessarySafeCall2.kt index f5efe05b2ea..1524b0526a4 100644 --- a/idea/testData/quickfix/expressions/afterUnnecessarySafeCall2.kt +++ b/idea/testData/quickfix/expressions/afterUnnecessarySafeCall2.kt @@ -1,4 +1,4 @@ -// "Replace to dot call" "true" +// "Replace with dot call" "true" fun foo(a: Any) { when (a) { .equals(0) => true diff --git a/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall1.kt b/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall1.kt index 61063ff4cc4..e9e0c31da15 100644 --- a/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall1.kt +++ b/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall1.kt @@ -1,4 +1,4 @@ -// "Replace to dot call" "true" +// "Replace with dot call" "true" fun foo(a: Any) { a?.equals(0) } diff --git a/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall2.kt b/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall2.kt index 40f33005054..cee0f9535b3 100644 --- a/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall2.kt +++ b/idea/testData/quickfix/expressions/beforeUnnecessarySafeCall2.kt @@ -1,4 +1,4 @@ -// "Replace to dot call" "true" +// "Replace with dot call" "true" fun foo(a: Any) { when (a) { ?.equals(0) => true diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/AbstractModifierFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/AbstractModifierFixTest.java deleted file mode 100644 index 91542507b41..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/AbstractModifierFixTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; - -/** - * @author svtk - */ -public class AbstractModifierFixTest extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/abstract"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } -} diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/AddPrimaryConstructorFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/AddPrimaryConstructorFixTest.java deleted file mode 100644 index 633f5f8b09d..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/AddPrimaryConstructorFixTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; -import org.jetbrains.jet.JetTestCaseBase; - -/** - * @author svtk - */ -public class AddPrimaryConstructorFixTest extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/addPrimaryConstructor"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } -} diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/ChangeVariableMutabilityFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/ChangeVariableMutabilityFixTest.java deleted file mode 100644 index 78f7e287f9f..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/ChangeVariableMutabilityFixTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; - -/** - * @author svtk - */ -public class ChangeVariableMutabilityFixTest extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/changeVariableMutability"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } -} diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/ClassImportFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/ClassImportFixTest.java deleted file mode 100644 index d765f6aad5c..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/ClassImportFixTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; -import com.intellij.openapi.projectRoots.Sdk; -import org.jetbrains.jet.JetTestCaseBase; - -/** - * @author svtk - */ -public class ClassImportFixTest extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/classImport"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } - - @Override - protected Sdk getProjectJDK() { - return JetTestCaseBase.jdkFromIdeaHome(); - } - -} - diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/ExpressionsFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/ExpressionsFixTest.java deleted file mode 100644 index ad60d7b72e5..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/ExpressionsFixTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; -import org.jetbrains.jet.JetTestCaseBase; - -/** - * @author svtk - */ -public class ExpressionsFixTest extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/expressions"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } -} diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/JetQuickFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/JetQuickFixTest.java new file mode 100644 index 00000000000..85b900949db --- /dev/null +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/JetQuickFixTest.java @@ -0,0 +1,96 @@ +package org.jetbrains.jet.plugin.quickfix; + +import com.google.common.collect.Lists; +import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; +import com.intellij.openapi.projectRoots.Sdk; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.JetTestCaseBase; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * @author svtk + */ +public class JetQuickFixTest extends LightQuickFixTestCase { + private final String dataPath; + private final String name; + private static FilenameFilter quickFixTestsFilter; + + public JetQuickFixTest(String dataPath, String name) { + this.dataPath = dataPath; + this.name = name; + } + + private static void setFilter() { + final ArrayList appropriateDirs = Lists.newArrayList("classImport", "expressions"); + quickFixTestsFilter = new FilenameFilter() { + @Override + public boolean accept(File file, String s) { + if (appropriateDirs.contains(s)) return true; + return false; + } + }; + } + + public static Test suite() { + //setFilter(); //to launch only part of tests + TestSuite suite = new TestSuite(); + FilenameFilter fileNameFilter = new FilenameFilter() { + @Override + public boolean accept(File file, String s) { + if (s.startsWith("before")) return true; + return false; + } + }; + JetTestCaseBase.NamedTestFactory namedTestFactory = new JetTestCaseBase.NamedTestFactory() { + @NotNull + @Override + public Test createTest(@NotNull String dataPath, @NotNull String name) { + return new JetQuickFixTest(dataPath, name); + } + }; + File dir = new File(getTestDataPathBase()); + List subDirs = Arrays.asList(quickFixTestsFilter != null ? dir.list(quickFixTestsFilter) : dir.list()); + Collections.sort(subDirs); + for (String subDirName : subDirs) { + suite.addTest(JetTestCaseBase.suiteForDirectory(getTestDataPathBase(), subDirName, false, fileNameFilter, namedTestFactory)); + + } + return suite; + } + + public static String getTestDataPathBase() { + return JetTestCaseBase.getHomeDirectory() + "/idea/testData/quickfix/"; + } + + public String getName() { + return "test" + name.replaceFirst(name.substring(0, 1), name.substring(0, 1).toUpperCase()); + } + + @Override + protected void runTest() throws Throwable { + doSingleTest(name.substring("before".length()) + ".kt"); + } + + @Override + protected String getBasePath() { + return "/quickfix/" + dataPath; + } + + @Override + protected String getTestDataPath() { + return PluginTestCaseBase.getTestDataPathBase(); + } + + @Override + protected Sdk getProjectJDK() { + return JetTestCaseBase.jdkFromIdeaHome(); + } +} diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/ModifiersFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/ModifiersFixTest.java deleted file mode 100644 index 32ce67866dd..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/ModifiersFixTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; -import org.jetbrains.jet.JetTestCaseBase; - -/** - * @author svtk - */ -public class ModifiersFixTest extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/modifiers"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } -} - - diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/OverrideModifierFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/OverrideModifierFixTest.java deleted file mode 100644 index 6969bcce9b8..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/OverrideModifierFixTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; -import org.jetbrains.jet.JetTestCaseBase; - -/** - * @author svtk - */ -public class OverrideModifierFixTest extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/override"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } -} - diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/TypeAdditionFixTests.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/TypeAdditionFixTests.java deleted file mode 100644 index c870f1e6088..00000000000 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/TypeAdditionFixTests.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jetbrains.jet.plugin.quickfix; - -import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; -import com.intellij.openapi.projectRoots.Sdk; -import org.jetbrains.jet.JetTestCaseBase; - -/** - * @author svtk - */ -public class TypeAdditionFixTests extends LightQuickFixTestCase { - - public void test() throws Exception { - doAllTests(); - } - - @Override - protected String getBasePath() { - return "/quickfix/typeAddition"; - } - - @Override - protected String getTestDataPath() { - return PluginTestCaseBase.getTestDataPathBase(); - } - - @Override - protected Sdk getProjectJDK() { - return JetTestCaseBase.jdkFromIdeaHome(); - } -} -