diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiMatcher.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiMatcher.java index 5a7b8e04af8..4c10080a68b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiMatcher.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiMatcher.java @@ -16,6 +16,10 @@ package org.jetbrains.jet.lang.psi; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; import java.util.List; public class JetPsiMatcher { @@ -26,221 +30,219 @@ public class JetPsiMatcher { return (t1 == t2) || (t1 != null && t2 != null && t1.getText().equals(t2.getText())); } - private static boolean checkStringTemplateEntryMatch(JetStringTemplateEntry e1, JetStringTemplateEntry e2) { - if (e1 == e2) return true; - if (e1 == null || e2 == null) return false; - - return e1.getClass() == e2.getClass() && checkExpressionMatch(e1.getExpression(), e2.getExpression()); + private interface Predicate2 { + boolean apply(A a, B b); } - private static boolean checkWhenConditionMatch(JetWhenCondition cond1, JetWhenCondition cond2) { - if (cond1 == cond2) return true; - if (cond1 == null || cond2 == null) return false; - - if (cond1.getClass() != cond2.getClass()) return false; - - if (cond1 instanceof JetWhenConditionInRange) { - JetWhenConditionInRange inRange1 = (JetWhenConditionInRange) cond1; - JetWhenConditionInRange inRange2 = (JetWhenConditionInRange) cond2; - - return inRange1.isNegated() == inRange2.isNegated() && - checkExpressionMatch(inRange1.getRangeExpression(), inRange2.getRangeExpression()) && - checkExpressionMatch(inRange1.getOperationReference(), inRange2.getOperationReference()); + private static final Predicate2 DEFAULT_CHECKER = new Predicate2() { + @Override + public boolean apply(JetElement element1, JetElement element2) { + return checkElementMatch(element1, element2); } + }; - if (cond1 instanceof JetWhenConditionIsPattern) { - JetWhenConditionIsPattern pattern1 = (JetWhenConditionIsPattern) cond1; - JetWhenConditionIsPattern pattern2 = (JetWhenConditionIsPattern) cond2; + private static final Predicate2 VALUE_ARGUMENT_CHECKER = new Predicate2() { + @Override + public boolean apply(ValueArgument a1, ValueArgument a2) { + if (a1 == a2) return true; + if (a1 == null || a2 == null) return false; - return pattern1.isNegated() == pattern2.isNegated() && - checkTypeReferenceMatch(pattern1.getTypeRef(), pattern2.getTypeRef()); + if (a1.getClass() != a2.getClass()) return false; + + if (a1.isNamed() != a2.isNamed()) return false; + + if (!checkElementMatch(a1.getArgumentExpression(), a2.getArgumentExpression())) return false; + + if (a1.isNamed()) { + return checkElementMatch(a1.getArgumentName(), a2.getArgumentName()); + } + + return true; } + }; - if (cond1 instanceof JetWhenConditionWithExpression) { - return checkExpressionMatch(((JetWhenConditionWithExpression) cond1).getExpression(), ((JetWhenConditionWithExpression) cond2).getExpression()); - } - - return false; - } - - private static boolean checkWhenEntryMatch(JetWhenEntry e1, JetWhenEntry e2) { - if (e1 == e2) return true; - if (e1 == null || e2 == null) return false; - - if (!(e1.isElse() == e2.isElse() && checkExpressionMatch(e1.getExpression(), e2.getExpression()))) return false; - - JetWhenCondition[] conditions1 = e1.getConditions(); - JetWhenCondition[] conditions2 = e2.getConditions(); - - int n = conditions1.length; - if (conditions2.length != n) return false; + private static boolean checkListMatch(List list1, List list2, Predicate2 checker) { + int n = list1.size(); + if (list2.size() != n) return false; for (int i = 0; i < n; i++) { - if (!checkWhenConditionMatch(conditions1[i], conditions2[i])) return false; + if (!checker.apply(list1.get(i), list2.get(i))) return false; } return true; } - public static boolean checkExpressionMatch(JetExpression e1, JetExpression e2) { - if (e1 == e2) return true; - if (e1 == null || e2 == null) return false; + private static boolean checkListMatch(List list1, List list2) { + return checkListMatch(list1, list2, DEFAULT_CHECKER); + } - e1 = JetPsiUtil.deparenthesizeWithNoTypeResolution(e1); - e2 = JetPsiUtil.deparenthesizeWithNoTypeResolution(e2); - - assert e1 != null && e2 != null; - - if (e1.getClass() != e2.getClass()) return false; - - if (e1 instanceof JetArrayAccessExpression) { - JetArrayAccessExpression aae1 = (JetArrayAccessExpression) e1; - JetArrayAccessExpression aae2 = (JetArrayAccessExpression) e2; - - if (!checkExpressionMatch(aae1.getArrayExpression(), aae2.getArrayExpression())) return false; - - List indexes1 = aae1.getIndexExpressions(); - List indexes2 = aae2.getIndexExpressions(); - - int n = indexes1.size(); - if (indexes2.size() != n) return false; - - for (int i = 0; i < n; i++) { - if (!checkExpressionMatch(indexes1.get(i), indexes2.get(i))) return false; - } - - return true; + private static final JetVisitor VISITOR = new JetVisitor() { + @Override + public Boolean visitJetElement(JetElement element, JetElement data) { + return false; } - if (e1 instanceof JetBinaryExpression) { - JetBinaryExpression be1 = (JetBinaryExpression) e1; - JetBinaryExpression be2 = (JetBinaryExpression) e2; + @Override + public Boolean visitArrayAccessExpression(JetArrayAccessExpression aae1, JetElement data) { + JetArrayAccessExpression aae2 = (JetArrayAccessExpression) data; + + return checkElementMatch(aae1.getArrayExpression(), aae2.getArrayExpression()) && + checkListMatch(aae1.getIndexExpressions(), aae2.getIndexExpressions()); + } + + @Override + public Boolean visitBinaryExpression(JetBinaryExpression be1, JetElement data) { + JetBinaryExpression be2 = (JetBinaryExpression) data; return be1.getOperationToken() == be2.getOperationToken() && - checkExpressionMatch(be1.getLeft(), be2.getLeft()) && - checkExpressionMatch(be1.getRight(), be2.getRight()); + checkElementMatch(be1.getLeft(), be2.getLeft()) && + checkElementMatch(be1.getRight(), be2.getRight()); } - if (e1 instanceof JetBinaryExpressionWithTypeRHS) { - JetBinaryExpressionWithTypeRHS bet1 = (JetBinaryExpressionWithTypeRHS) e1; - JetBinaryExpressionWithTypeRHS bet2 = (JetBinaryExpressionWithTypeRHS) e2; + @Override + public Boolean visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS bet1, JetElement data) { + JetBinaryExpressionWithTypeRHS bet2 = (JetBinaryExpressionWithTypeRHS) data; - return checkExpressionMatch(bet1.getLeft(), bet2.getLeft()) && + return checkElementMatch(bet1.getLeft(), bet2.getLeft()) && checkTypeReferenceMatch(bet1.getRight(), bet2.getRight()); } - if (e1 instanceof JetCallExpression) { - JetCallExpression call1 = (JetCallExpression) e1; - JetCallExpression call2 = (JetCallExpression) e2; + @Override + public Boolean visitCallExpression(JetCallExpression call1, JetElement data) { + JetCallExpression call2 = (JetCallExpression) data; - if (!checkExpressionMatch(call1.getCalleeExpression(), call2.getCalleeExpression())) return false; + if (!checkElementMatch(call1.getCalleeExpression(), call2.getCalleeExpression())) return false; - List args1 = call1.getValueArguments(); - List args2 = call2.getValueArguments(); - - int argCount = args1.size(); - if (args2.size() != argCount) return false; - - for (int i = 0; i < argCount; i++) { - if (!checkExpressionMatch(args1.get(i).getArgumentExpression(), args2.get(i).getArgumentExpression())) return false; - } - - List funLiterals1 = call1.getFunctionLiteralArguments(); - List funLiterals2 = call2.getFunctionLiteralArguments(); - - int funLiteralCount = funLiterals1.size(); - if (funLiterals2.size() != funLiteralCount) return false; - - for (int i = 0; i < argCount; i++) { - if (!checkExpressionMatch(funLiterals1.get(i), funLiterals2.get(i))) return false; - } - - return true; + return checkListMatch(call1.getValueArguments(), call2.getValueArguments(), VALUE_ARGUMENT_CHECKER) && + checkListMatch(call1.getFunctionLiteralArguments(), call2.getFunctionLiteralArguments()); } - if (e1 instanceof JetConstantExpression || e1 instanceof JetSimpleNameExpression) { - return e1.getText().equals(e2.getText()); + @Override + public Boolean visitSimpleNameExpression(JetSimpleNameExpression expression, JetElement data) { + return expression.getText().equals(data.getText()); } - if (e1 instanceof JetConstructorCalleeExpression) { - return checkTypeReferenceMatch(((JetConstructorCalleeExpression) e1).getTypeReference(), ((JetConstructorCalleeExpression) e2).getTypeReference()); + @Override + public Boolean visitConstantExpression(JetConstantExpression expression, JetElement data) { + return expression.getText().equals(data.getText()); } - if (e1 instanceof JetQualifiedExpression) { - return ((JetQualifiedExpression) e1).getOperationSign() == ((JetQualifiedExpression) e2).getOperationSign() && - checkExpressionMatch(((JetQualifiedExpression) e1).getReceiverExpression(), ((JetQualifiedExpression) e2).getReceiverExpression()) && - checkExpressionMatch(((JetQualifiedExpression) e1).getSelectorExpression(), ((JetQualifiedExpression) e2).getSelectorExpression()); + @Override + public Boolean visitIsExpression(JetIsExpression is1, JetElement data) { + JetIsExpression is2 = (JetIsExpression) data; + + return checkElementMatch(is1.getLeftHandSide(), is2.getLeftHandSide()) && + checkTypeReferenceMatch(is1.getTypeRef(), is2.getTypeRef()) && + is1.isNegated() == is2.isNegated(); } - if (e1 instanceof JetIfExpression) { - return checkExpressionMatch(((JetIfExpression) e1).getCondition(), ((JetIfExpression) e2).getCondition()) && - checkExpressionMatch(((JetIfExpression) e1).getThen(), ((JetIfExpression) e2).getThen()) && - checkExpressionMatch(((JetIfExpression) e1).getElse(), ((JetIfExpression) e2).getElse()); + @Override + public Boolean visitQualifiedExpression(JetQualifiedExpression qe1, JetElement data) { + JetQualifiedExpression qe2 = (JetQualifiedExpression) data; + + return qe1.getOperationSign() == qe2.getOperationSign() && + checkElementMatch(qe1.getReceiverExpression(), qe2.getReceiverExpression()) && + checkElementMatch(qe1.getSelectorExpression(), qe2.getSelectorExpression()); } - if (e1 instanceof JetIsExpression) { - return checkExpressionMatch(((JetIsExpression) e1).getLeftHandSide(), ((JetIsExpression) e2).getLeftHandSide()) && - checkTypeReferenceMatch(((JetIsExpression) e1).getTypeRef(), ((JetIsExpression) e2).getTypeRef()) && - ((JetIsExpression) e1).isNegated() == ((JetIsExpression) e2).isNegated(); + @Override + public Boolean visitStringTemplateExpression(JetStringTemplateExpression expression, JetElement data) { + return checkListMatch( + Arrays.asList(expression.getEntries()), + Arrays.asList(((JetStringTemplateExpression) data).getEntries()) + ); } - if (e1 instanceof JetStringTemplateExpression) { - JetStringTemplateExpression str1 = (JetStringTemplateExpression) e1; - JetStringTemplateExpression str2 = (JetStringTemplateExpression) e2; - - JetStringTemplateEntry[] entries1 = str1.getEntries(); - JetStringTemplateEntry[] entries2 = str2.getEntries(); - - int n = entries1.length; - if (entries2.length != n) return false; - - for (int i = 0; i < n; i++) { - if (!checkStringTemplateEntryMatch(entries1[i], entries2[i])) return false; - } - - return true; + @Override + public Boolean visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry, JetElement data) { + return checkElementMatch(entry.getExpression(), ((JetStringTemplateEntryWithExpression) data).getExpression()); } - if (e1 instanceof JetThrowExpression) { - return checkExpressionMatch(((JetThrowExpression) e1).getThrownExpression(), ((JetThrowExpression) e2).getThrownExpression()); + @Override + public Boolean visitLiteralStringTemplateEntry(JetLiteralStringTemplateEntry entry, JetElement data) { + return entry.getText().equals(data.getText()); } - if (e1 instanceof JetUnaryExpression) { - JetUnaryExpression ue1 = (JetUnaryExpression) e1; - JetUnaryExpression ue2 = (JetUnaryExpression) e2; - - return checkExpressionMatch(ue1.getBaseExpression(), ue2.getBaseExpression()) && - checkExpressionMatch(ue1.getOperationReference(), ue2.getOperationReference()); + @Override + public Boolean visitEscapeStringTemplateEntry(JetEscapeStringTemplateEntry entry, JetElement data) { + return entry.getText().equals(data.getText()); } - if (e1 instanceof JetWhenExpression) { - JetWhenExpression when1 = (JetWhenExpression) e1; - JetWhenExpression when2 = (JetWhenExpression) e2; - - if (checkExpressionMatch(when1.getSubjectExpression(), when2.getSubjectExpression())) return false; - - List entries1 = when1.getEntries(); - List entries2 = when2.getEntries(); - - int n = entries1.size(); - if (entries2.size() != n) return false; - - for (int i = 0; i < n; i++) { - if (!checkWhenEntryMatch(entries1.get(i), entries2.get(i))) return false; - } - } - - if (e1 instanceof JetThisExpression) return true; - - if (e1 instanceof JetSuperExpression) { - JetSuperExpression super1 = (JetSuperExpression) e1; - JetSuperExpression super2 = (JetSuperExpression) e2; + @Override + public Boolean visitSuperExpression(JetSuperExpression super1, JetElement data) { + JetSuperExpression super2 = (JetSuperExpression) data; return checkTypeReferenceMatch(super1.getSuperTypeQualifier(), super2.getSuperTypeQualifier()) && - checkExpressionMatch(super1.getInstanceReference(), super2.getInstanceReference()) && - checkExpressionMatch(super1.getTargetLabel(), super2.getTargetLabel()); + checkElementMatch(super1.getInstanceReference(), super2.getInstanceReference()) && + checkElementMatch(super1.getTargetLabel(), super2.getTargetLabel()); } - return false; + @Override + public Boolean visitThrowExpression(JetThrowExpression expression, JetElement data) { + return checkElementMatch(expression.getThrownExpression(), ((JetThrowExpression) data).getThrownExpression()); + } + + @Override + public Boolean visitThisExpression(JetThisExpression this1, JetElement data) { + return checkElementMatch(this1.getTargetLabel(), ((JetThisExpression) data).getTargetLabel()); + } + + @Override + public Boolean visitUnaryExpression(JetUnaryExpression ue1, JetElement data) { + JetUnaryExpression ue2 = (JetUnaryExpression) data; + + return checkElementMatch(ue1.getBaseExpression(), ue2.getBaseExpression()) && + checkElementMatch(ue1.getOperationReference(), ue2.getOperationReference()); + } + + @Override + public Boolean visitTypeReference(JetTypeReference typeReference, JetElement data) { + return checkElementMatch(typeReference.getTypeElement(), ((JetTypeReference) data).getTypeElement()); + } + + @Override + public Boolean visitFunctionType(JetFunctionType type1, JetElement data) { + JetFunctionType type2 = (JetFunctionType) data; + + return checkListMatch(type1.getTypeArgumentsAsTypes(), type2.getTypeArgumentsAsTypes()); + } + + @Override + public Boolean visitUserType(JetUserType type1, JetElement data) { + JetUserType type2 = (JetUserType) data; + + return checkElementMatch(type1.getReferenceExpression(), type2.getReferenceExpression()) && + checkElementMatch(type1.getQualifier(), type2.getQualifier()) && + checkListMatch(type1.getTypeArgumentsAsTypes(), type2.getTypeArgumentsAsTypes()); + } + + @Override + public Boolean visitSelfType(JetSelfType type, JetElement data) { + return true; + } + + @Override + public Boolean visitNullableType(JetNullableType nullableType, JetElement data) { + return checkElementMatch(nullableType.getInnerType(), ((JetNullableType) data).getInnerType()); + } + }; + + private static JetElement unwrap(JetElement e) { + if (e instanceof JetExpression) { + return JetPsiUtil.deparenthesizeWithNoTypeResolution((JetExpression) e); + } + return e; + } + + public static boolean checkElementMatch(@Nullable JetElement e1, @Nullable JetElement e2) { + e1 = unwrap(e1); + e2 = unwrap(e2); + + if (e1 == e2) return true; + if (e1 == null || e2 == null) return false; + + if (e1.getClass() != e2.getClass()) return false; + + return e1.accept(VISITOR, e2); } } diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt new file mode 100644 index 00000000000..aead762075d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a[0] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt.2 new file mode 100644 index 00000000000..7e47cf58a31 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt.2 @@ -0,0 +1 @@ +b[0] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt new file mode 100644 index 00000000000..aead762075d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a[0] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt.2 new file mode 100644 index 00000000000..e4ce9c1e8bb --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt.2 @@ -0,0 +1 @@ +a[2] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt new file mode 100644 index 00000000000..aead762075d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a[0] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt.2 new file mode 100644 index 00000000000..f8d9bf02262 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt.2 @@ -0,0 +1 @@ +a[n] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt new file mode 100644 index 00000000000..1727bf901f2 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt @@ -0,0 +1 @@ +a[0] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt.2 new file mode 100644 index 00000000000..1727bf901f2 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt.2 @@ -0,0 +1 @@ +a[0] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt new file mode 100644 index 00000000000..f8d9bf02262 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt @@ -0,0 +1 @@ +a[n] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt.2 new file mode 100644 index 00000000000..f8d9bf02262 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt.2 @@ -0,0 +1 @@ +a[n] \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt new file mode 100644 index 00000000000..cb38a52f476 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +1 + 2 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt.2 new file mode 100644 index 00000000000..1ad61fe45a2 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt.2 @@ -0,0 +1 @@ +2 + 1 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt new file mode 100644 index 00000000000..cb38a52f476 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +1 + 2 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt.2 new file mode 100644 index 00000000000..7ec0a893aef --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt.2 @@ -0,0 +1 @@ +1 - 2 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt new file mode 100644 index 00000000000..2e1a1bf0cbd --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a + 2 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt.2 new file mode 100644 index 00000000000..fe98fcd3d5a --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt.2 @@ -0,0 +1 @@ +b + 2 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt new file mode 100644 index 00000000000..be8c0c96fd4 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a + b \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt.2 new file mode 100644 index 00000000000..68bdebaba7f --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt.2 @@ -0,0 +1 @@ +c/d \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt new file mode 100644 index 00000000000..fcce78399aa --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a is String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt.2 new file mode 100644 index 00000000000..01823a34497 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt.2 @@ -0,0 +1 @@ +a as String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt new file mode 100644 index 00000000000..1383f3c6743 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a !is String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt.2 new file mode 100644 index 00000000000..7ccaa0c9744 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt.2 @@ -0,0 +1 @@ +a is String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt new file mode 100644 index 00000000000..193df0b550b --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt @@ -0,0 +1 @@ +1 + 2 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt.2 new file mode 100644 index 00000000000..193df0b550b --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt.2 @@ -0,0 +1 @@ +1 + 2 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt new file mode 100644 index 00000000000..2fdfd51e8d7 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt @@ -0,0 +1 @@ +a + b \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt.2 new file mode 100644 index 00000000000..2fdfd51e8d7 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt.2 @@ -0,0 +1 @@ +a + b \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt new file mode 100644 index 00000000000..64dd70ad082 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt @@ -0,0 +1 @@ +a*10 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt.2 new file mode 100644 index 00000000000..64dd70ad082 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt.2 @@ -0,0 +1 @@ +a*10 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt new file mode 100644 index 00000000000..7ccaa0c9744 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt @@ -0,0 +1 @@ +a is String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt.2 new file mode 100644 index 00000000000..7ccaa0c9744 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt.2 @@ -0,0 +1 @@ +a is String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt new file mode 100644 index 00000000000..36601b5c09b --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt @@ -0,0 +1 @@ +a !is String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt.2 new file mode 100644 index 00000000000..36601b5c09b --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt.2 @@ -0,0 +1 @@ +a !is String \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call1.kt new file mode 100644 index 00000000000..a0a6cc8e2f9 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call1.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +f() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call1.kt.2 new file mode 100644 index 00000000000..7476967925d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call1.kt.2 @@ -0,0 +1 @@ +f(0) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call2.kt new file mode 100644 index 00000000000..a0a6cc8e2f9 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call2.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +f() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call2.kt.2 new file mode 100644 index 00000000000..3a2765afd1e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call2.kt.2 @@ -0,0 +1 @@ +g() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call3.kt new file mode 100644 index 00000000000..02e0aa5de2d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call3.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +f(a, b) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call3.kt.2 new file mode 100644 index 00000000000..1bf42070b82 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call3.kt.2 @@ -0,0 +1 @@ +a.f(b) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call4.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call4.kt new file mode 100644 index 00000000000..41e44980678 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call4.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +x.f(a, b) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/_call4.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call4.kt.2 new file mode 100644 index 00000000000..259b9c7f0be --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/_call4.kt.2 @@ -0,0 +1 @@ +y.f(c, z) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/call1.kt new file mode 100644 index 00000000000..300ddfaeb1d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call1.kt @@ -0,0 +1 @@ +f() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/call1.kt.2 new file mode 100644 index 00000000000..300ddfaeb1d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call1.kt.2 @@ -0,0 +1 @@ +f() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/call2.kt new file mode 100644 index 00000000000..7326bb66e0a --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call2.kt @@ -0,0 +1 @@ +f(a) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/call2.kt.2 new file mode 100644 index 00000000000..7326bb66e0a --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call2.kt.2 @@ -0,0 +1 @@ +f(a) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/call3.kt new file mode 100644 index 00000000000..655ee57c2c8 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call3.kt @@ -0,0 +1 @@ +f(a, 1) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/call3.kt.2 new file mode 100644 index 00000000000..655ee57c2c8 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call3.kt.2 @@ -0,0 +1 @@ +f(a, 1) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call4.kt b/compiler/testData/psi/jetPsiMatcher/expressions/call/call4.kt new file mode 100644 index 00000000000..2c8c8598b91 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call4.kt @@ -0,0 +1 @@ +x.f(a, 1) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/call/call4.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/call/call4.kt.2 new file mode 100644 index 00000000000..2c8c8598b91 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/call/call4.kt.2 @@ -0,0 +1 @@ +x.f(a, 1) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/const/_const.kt b/compiler/testData/psi/jetPsiMatcher/expressions/const/_const.kt new file mode 100644 index 00000000000..ebd1a599403 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/const/_const.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +123 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/const/_const.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/const/_const.kt.2 new file mode 100644 index 00000000000..5ca234cb538 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/const/_const.kt.2 @@ -0,0 +1 @@ +345 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/const/const.kt b/compiler/testData/psi/jetPsiMatcher/expressions/const/const.kt new file mode 100644 index 00000000000..d800886d9c8 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/const/const.kt @@ -0,0 +1 @@ +123 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/const/const.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/const/const.kt.2 new file mode 100644 index 00000000000..d800886d9c8 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/const/const.kt.2 @@ -0,0 +1 @@ +123 \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc1.kt new file mode 100644 index 00000000000..2901e88f945 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc1.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +(a + b*x.f(n - 1)) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc1.kt.2 new file mode 100644 index 00000000000..dc0753c5111 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc1.kt.2 @@ -0,0 +1 @@ +(a + b)*x.f(n - 1) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc2.kt new file mode 100644 index 00000000000..ca5f2ff5574 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc2.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +(a.foo((n + 2)*(m - 1))[k[i]] is MyClass?) || (b.foo(n - 2)[i + 1] !is YourClass) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc2.kt.2 new file mode 100644 index 00000000000..f4b610a2ea8 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc2.kt.2 @@ -0,0 +1 @@ +a.foo((n + 2*m - 1))[k[i]] is MyClass? || b.foo[n - 2](i + 1) !is YourClass \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc3.kt new file mode 100644 index 00000000000..21f39b31af4 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc3.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +a > b[n] && (a < foo(x.bar(n + 2)) || a == n) && b[n - 1] != foo(a + 2) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc3.kt.2 new file mode 100644 index 00000000000..26464ee1ae7 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc3.kt.2 @@ -0,0 +1 @@ +a > b[n] && a < foo(x.bar(n + 2)) || (a == n) && (b[n - 1] != foo(a + 2)) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc1.kt new file mode 100644 index 00000000000..a3cccb1e9b4 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc1.kt @@ -0,0 +1 @@ +(a + b*x.f(n - 1)) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc1.kt.2 new file mode 100644 index 00000000000..b1a5c6058d7 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc1.kt.2 @@ -0,0 +1 @@ +(a) + b*x.f(n - 1) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc2.kt new file mode 100644 index 00000000000..0970212b5a9 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc2.kt @@ -0,0 +1 @@ +(a.foo((n + 2)*(m - 1))[k[i]] is MyClass?) || (b.foo(n - 2)[i + 1] !is YourClass) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc2.kt.2 new file mode 100644 index 00000000000..4a37455cfcc --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc2.kt.2 @@ -0,0 +1 @@ +a.foo((n + 2)*(m - 1))[k[i]] is MyClass? || b.foo(n - 2)[i + 1] !is YourClass \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc3.kt new file mode 100644 index 00000000000..8f350410c20 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc3.kt @@ -0,0 +1 @@ +a > b[n] && (a < foo(x.bar(n + 2)) || a == n) && b[n - 1] != foo(a + 2) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc3.kt.2 new file mode 100644 index 00000000000..b1fc711a891 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/misc/misc3.kt.2 @@ -0,0 +1 @@ +a > b[n] && (a < foo(x.bar(n + 2)) || (a == n)) && (b[n - 1] != foo(a + 2)) \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/_simpleName.kt b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/_simpleName.kt new file mode 100644 index 00000000000..2244cd77052 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/_simpleName.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +test \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/_simpleName.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/_simpleName.kt.2 new file mode 100644 index 00000000000..17f7fcd1dc9 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/_simpleName.kt.2 @@ -0,0 +1,2 @@ +// NOT_EQUAL +abcd \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/simpleName.kt b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/simpleName.kt new file mode 100644 index 00000000000..30d74d25844 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/simpleName.kt @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/simpleName.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/simpleName.kt.2 new file mode 100644 index 00000000000..30d74d25844 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/simpleName/simpleName.kt.2 @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super1.kt new file mode 100644 index 00000000000..1f5a6ca4d7f --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super1.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super1.kt.2 new file mode 100644 index 00000000000..426ee4d61c0 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super1.kt.2 @@ -0,0 +1 @@ +super.bar() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super2.kt new file mode 100644 index 00000000000..b48a3487a9b --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super2.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super2.kt.2 new file mode 100644 index 00000000000..c051b54557e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super2.kt.2 @@ -0,0 +1 @@ +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super3.kt new file mode 100644 index 00000000000..d169cbad4ef --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super3.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +super<>.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super3.kt.2 new file mode 100644 index 00000000000..dfe6ebb4165 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super3.kt.2 @@ -0,0 +1 @@ +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super4.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super4.kt new file mode 100644 index 00000000000..307bad345cc --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super4.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +super@B.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/_super4.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super4.kt.2 new file mode 100644 index 00000000000..d1e2e856f56 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/_super4.kt.2 @@ -0,0 +1 @@ +super@A.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/super1.kt new file mode 100644 index 00000000000..dfe6ebb4165 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super1.kt @@ -0,0 +1 @@ +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/super1.kt.2 new file mode 100644 index 00000000000..dfe6ebb4165 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super1.kt.2 @@ -0,0 +1 @@ +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/super2.kt new file mode 100644 index 00000000000..c051b54557e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super2.kt @@ -0,0 +1 @@ +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/super2.kt.2 new file mode 100644 index 00000000000..c051b54557e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super2.kt.2 @@ -0,0 +1 @@ +super.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/super3.kt new file mode 100644 index 00000000000..64f2753245e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super3.kt @@ -0,0 +1 @@ +super<>.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/super3.kt.2 new file mode 100644 index 00000000000..64f2753245e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super3.kt.2 @@ -0,0 +1 @@ +super<>.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super4.kt b/compiler/testData/psi/jetPsiMatcher/expressions/super/super4.kt new file mode 100644 index 00000000000..7520ea9ff7d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super4.kt @@ -0,0 +1 @@ +super@label.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/super/super4.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/super/super4.kt.2 new file mode 100644 index 00000000000..7520ea9ff7d --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/super/super4.kt.2 @@ -0,0 +1 @@ +super@label.foo() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/throw/_throw.kt b/compiler/testData/psi/jetPsiMatcher/expressions/throw/_throw.kt new file mode 100644 index 00000000000..cbd29c6905b --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/throw/_throw.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +throw X() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/throw/_throw.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/throw/_throw.kt.2 new file mode 100644 index 00000000000..d6766b53139 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/throw/_throw.kt.2 @@ -0,0 +1,2 @@ +// NOT_EQUAL +throw Z() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/throw/throw.kt b/compiler/testData/psi/jetPsiMatcher/expressions/throw/throw.kt new file mode 100644 index 00000000000..36381ca5aef --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/throw/throw.kt @@ -0,0 +1 @@ +throw X() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/throw/throw.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/throw/throw.kt.2 new file mode 100644 index 00000000000..36381ca5aef --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/throw/throw.kt.2 @@ -0,0 +1 @@ +throw X() \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt new file mode 100644 index 00000000000..5bfaf586de2 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +!false \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt.2 new file mode 100644 index 00000000000..3dc7170e670 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt.2 @@ -0,0 +1 @@ +!true \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt new file mode 100644 index 00000000000..bf2fa63cc04 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +!a \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt.2 new file mode 100644 index 00000000000..ce85aad2824 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt.2 @@ -0,0 +1,2 @@ +// NOT_EQUAL +++a \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt new file mode 100644 index 00000000000..bf2fa63cc04 --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt @@ -0,0 +1,2 @@ +// NOT_EQUAL +!a \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt.2 new file mode 100644 index 00000000000..c42c7cce71f --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt.2 @@ -0,0 +1,2 @@ +// NOT_EQUAL +!x \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt new file mode 100644 index 00000000000..dfec184200f --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt @@ -0,0 +1 @@ +!false \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt.2 new file mode 100644 index 00000000000..dfec184200f --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt.2 @@ -0,0 +1 @@ +!false \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt new file mode 100644 index 00000000000..fa7cdb18c3e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt @@ -0,0 +1 @@ +!a \ No newline at end of file diff --git a/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt.2 b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt.2 new file mode 100644 index 00000000000..fa7cdb18c3e --- /dev/null +++ b/compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt.2 @@ -0,0 +1 @@ +!a \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/lang/psi/AbstractJetPsiMatcherTest.java b/compiler/tests/org/jetbrains/jet/lang/psi/AbstractJetPsiMatcherTest.java new file mode 100644 index 00000000000..68f543b7342 --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/lang/psi/AbstractJetPsiMatcherTest.java @@ -0,0 +1,48 @@ +/* + * 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.util.io.FileUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.InTextDirectivesUtils; +import org.jetbrains.jet.JetLiteFixture; +import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment; +import org.jetbrains.jet.config.CompilerConfiguration; + +import java.io.File; + +public abstract class AbstractJetPsiMatcherTest extends JetLiteFixture { + public void doTestExpressions(@NotNull String path) throws Exception { + String fileText = FileUtil.loadFile(new File(path)); + String fileText2 = FileUtil.loadFile(new File(path + ".2")); + + boolean equalityExpected = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// NOT_EQUAL") == null; + + JetExpression expr = JetPsiFactory.createExpression(getProject(), fileText); + JetExpression expr2 = JetPsiFactory.createExpression(getProject(), fileText2); + + assertTrue( + "JetPsiMatcher.checkElementMatch() should return " + equalityExpected, + equalityExpected == JetPsiMatcher.checkElementMatch(expr, expr2) + ); + } + + @Override + protected JetCoreEnvironment createEnvironment() { + return new JetCoreEnvironment(getTestRootDisposable(), new CompilerConfiguration()); + } +} diff --git a/compiler/tests/org/jetbrains/jet/lang/psi/JetPsiMatcherTest.java b/compiler/tests/org/jetbrains/jet/lang/psi/JetPsiMatcherTest.java new file mode 100644 index 00000000000..726cc5153ed --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/lang/psi/JetPsiMatcherTest.java @@ -0,0 +1,386 @@ +/* + * 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 junit.framework.Assert; +import junit.framework.Test; +import junit.framework.TestSuite; + +import java.io.File; +import java.util.regex.Pattern; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.InnerTestClasses; +import org.jetbrains.jet.test.TestMetadata; + +import org.jetbrains.jet.lang.psi.AbstractJetPsiMatcherTest; + +/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/psi/jetPsiMatcher") +@InnerTestClasses({JetPsiMatcherTest.Expressions.class}) +public class JetPsiMatcherTest extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInJetPsiMatcher() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions") + @InnerTestClasses({Expressions.ArrayAccess.class, Expressions.BinaryExpr.class, Expressions.Call.class, Expressions.Const.class, Expressions.Misc.class, Expressions.SimpleName.class, Expressions.Super.class, Expressions.Throw.class, Expressions.UnaryExpr.class}) + public static class Expressions extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInExpressions() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess") + public static class ArrayAccess extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInArrayAccess() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("arrayAccess1.kt") + public void testArrayAccess1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess1.kt"); + } + + @TestMetadata("arrayAccess2.kt") + public void testArrayAccess2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/arrayAccess2.kt"); + } + + @TestMetadata("_arrayAccess1.kt") + public void test_arrayAccess1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess1.kt"); + } + + @TestMetadata("_arrayAccess2.kt") + public void test_arrayAccess2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess2.kt"); + } + + @TestMetadata("_arrayAccess3.kt") + public void test_arrayAccess3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/arrayAccess/_arrayAccess3.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr") + public static class BinaryExpr extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInBinaryExpr() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("binaryExpr1.kt") + public void testBinaryExpr1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr1.kt"); + } + + @TestMetadata("binaryExpr2.kt") + public void testBinaryExpr2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr2.kt"); + } + + @TestMetadata("binaryExpr3.kt") + public void testBinaryExpr3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr3.kt"); + } + + @TestMetadata("binaryExpr4.kt") + public void testBinaryExpr4() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr4.kt"); + } + + @TestMetadata("binaryExpr5.kt") + public void testBinaryExpr5() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/binaryExpr5.kt"); + } + + @TestMetadata("_binaryExpr1.kt") + public void test_binaryExpr1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr1.kt"); + } + + @TestMetadata("_binaryExpr2.kt") + public void test_binaryExpr2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr2.kt"); + } + + @TestMetadata("_binaryExpr3.kt") + public void test_binaryExpr3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr3.kt"); + } + + @TestMetadata("_binaryExpr4.kt") + public void test_binaryExpr4() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr4.kt"); + } + + @TestMetadata("_binaryExpr5.kt") + public void test_binaryExpr5() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr5.kt"); + } + + @TestMetadata("_binaryExpr6.kt") + public void test_binaryExpr6() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/binaryExpr/_binaryExpr6.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/call") + public static class Call extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInCall() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/call"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("call1.kt") + public void testCall1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/call1.kt"); + } + + @TestMetadata("call2.kt") + public void testCall2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/call2.kt"); + } + + @TestMetadata("call3.kt") + public void testCall3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/call3.kt"); + } + + @TestMetadata("call4.kt") + public void testCall4() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/call4.kt"); + } + + @TestMetadata("_call1.kt") + public void test_call1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/_call1.kt"); + } + + @TestMetadata("_call2.kt") + public void test_call2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/_call2.kt"); + } + + @TestMetadata("_call3.kt") + public void test_call3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/_call3.kt"); + } + + @TestMetadata("_call4.kt") + public void test_call4() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/call/_call4.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/const") + public static class Const extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInConst() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/const"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("const.kt") + public void testConst() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/const/const.kt"); + } + + @TestMetadata("_const.kt") + public void test_const() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/const/_const.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/misc") + public static class Misc extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInMisc() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/misc"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("misc1.kt") + public void testMisc1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/misc/misc1.kt"); + } + + @TestMetadata("misc2.kt") + public void testMisc2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/misc/misc2.kt"); + } + + @TestMetadata("misc3.kt") + public void testMisc3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/misc/misc3.kt"); + } + + @TestMetadata("_misc1.kt") + public void test_misc1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc1.kt"); + } + + @TestMetadata("_misc2.kt") + public void test_misc2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc2.kt"); + } + + @TestMetadata("_misc3.kt") + public void test_misc3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/misc/_misc3.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/simpleName") + public static class SimpleName extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInSimpleName() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/simpleName"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("simpleName.kt") + public void testSimpleName() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/simpleName/simpleName.kt"); + } + + @TestMetadata("_simpleName.kt") + public void test_simpleName() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/simpleName/_simpleName.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/super") + public static class Super extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInSuper() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/super"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("super1.kt") + public void testSuper1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/super1.kt"); + } + + @TestMetadata("super2.kt") + public void testSuper2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/super2.kt"); + } + + @TestMetadata("super3.kt") + public void testSuper3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/super3.kt"); + } + + @TestMetadata("super4.kt") + public void testSuper4() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/super4.kt"); + } + + @TestMetadata("_super1.kt") + public void test_super1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/_super1.kt"); + } + + @TestMetadata("_super2.kt") + public void test_super2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/_super2.kt"); + } + + @TestMetadata("_super3.kt") + public void test_super3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/_super3.kt"); + } + + @TestMetadata("_super4.kt") + public void test_super4() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/super/_super4.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/throw") + public static class Throw extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInThrow() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/throw"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("throw.kt") + public void testThrow() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/throw/throw.kt"); + } + + @TestMetadata("_throw.kt") + public void test_throw() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/throw/_throw.kt"); + } + + } + + @TestMetadata("compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr") + public static class UnaryExpr extends AbstractJetPsiMatcherTest { + public void testAllFilesPresentInUnaryExpr() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("unaryExpr1.kt") + public void testUnaryExpr1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr1.kt"); + } + + @TestMetadata("unaryExpr2.kt") + public void testUnaryExpr2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/unaryExpr2.kt"); + } + + @TestMetadata("_unaryExpr1.kt") + public void test_unaryExpr1() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr1.kt"); + } + + @TestMetadata("_unaryExpr2.kt") + public void test_unaryExpr2() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr2.kt"); + } + + @TestMetadata("_unaryExpr3.kt") + public void test_unaryExpr3() throws Exception { + doTestExpressions("compiler/testData/psi/jetPsiMatcher/expressions/unaryExpr/_unaryExpr3.kt"); + } + + } + + public static Test innerSuite() { + TestSuite suite = new TestSuite("Expressions"); + suite.addTestSuite(Expressions.class); + suite.addTestSuite(ArrayAccess.class); + suite.addTestSuite(BinaryExpr.class); + suite.addTestSuite(Call.class); + suite.addTestSuite(Const.class); + suite.addTestSuite(Misc.class); + suite.addTestSuite(SimpleName.class); + suite.addTestSuite(Super.class); + suite.addTestSuite(Throw.class); + suite.addTestSuite(UnaryExpr.class); + return suite; + } + } + + public static Test suite() { + TestSuite suite = new TestSuite("JetPsiMatcherTest"); + suite.addTestSuite(JetPsiMatcherTest.class); + suite.addTest(Expressions.innerSuite()); + return suite; + } +} diff --git a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java index ed3cde6478f..cdcda21f2e6 100644 --- a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java +++ b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java @@ -32,6 +32,7 @@ import org.jetbrains.jet.completion.AbstractJavaWithLibCompletionTest; import org.jetbrains.jet.completion.AbstractJetJSCompletionTest; import org.jetbrains.jet.completion.AbstractKeywordCompletionTest; import org.jetbrains.jet.jvm.compiler.*; +import org.jetbrains.jet.lang.psi.AbstractJetPsiMatcherTest; import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveDescriptorRendererTest; import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveNamespaceComparingTest; import org.jetbrains.jet.lang.resolve.lazy.AbstractLazyResolveTest; @@ -211,6 +212,13 @@ public class GenerateTests { testModel("compiler/testData/modules.xml", true, "xml", "doTest") ); + generateTest( + "compiler/tests/", + "JetPsiMatcherTest", + AbstractJetPsiMatcherTest.class, + testModel("compiler/testData/psi/jetPsiMatcher", "doTestExpressions") + ); + generateTest( "idea/tests/", "JetPsiCheckerTestGenerated", diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/WhenUtils.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/WhenUtils.java index fde43685005..1b0bb1e06db 100644 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/WhenUtils.java +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/codeTransformations/branchedTransformations/WhenUtils.java @@ -55,7 +55,7 @@ public class WhenUtils { if (lastCandidate == null) { lastCandidate = currCandidate; } - else if (!JetPsiMatcher.checkExpressionMatch(lastCandidate, currCandidate)) return null; + else if (!JetPsiMatcher.checkElementMatch(lastCandidate, currCandidate)) return null; } } @@ -75,7 +75,7 @@ public class WhenUtils { JetWhenExpression nestedWhenExpression = (JetWhenExpression) elseBranch; return JetPsiUtil.checkWhenExpressionHasSingleElse(nestedWhenExpression) && - JetPsiMatcher.checkExpressionMatch(subject, nestedWhenExpression.getSubjectExpression()); + JetPsiMatcher.checkElementMatch(subject, nestedWhenExpression.getSubjectExpression()); } public static boolean checkIntroduceWhenSubject(@NotNull JetWhenExpression whenExpression) {