Пример #1
0
  private static void checkAllResolvedCallsAreCompleted(
      @NotNull List<JetFile> jetFiles, @NotNull BindingContext bindingContext) {
    for (JetFile file : jetFiles) {
      if (!AnalyzingUtils.getSyntaxErrorRanges(file).isEmpty()) {
        return;
      }
    }

    ImmutableMap<JetElement, ResolvedCall<?>> resolvedCallsEntries =
        bindingContext.getSliceContents(BindingContext.RESOLVED_CALL);
    for (Map.Entry<JetElement, ResolvedCall<?>> entry : resolvedCallsEntries.entrySet()) {
      JetElement element = entry.getKey();
      ResolvedCall<?> resolvedCall = entry.getValue();

      DiagnosticUtils.LineAndColumn lineAndColumn =
          DiagnosticUtils.getLineAndColumnInPsiFile(
              element.getContainingFile(), element.getTextRange());

      assertTrue(
          "Resolved call for '" + element.getText() + "'" + lineAndColumn + " is not completed",
          ((MutableResolvedCall<?>) resolvedCall).isCompleted());
    }

    checkResolvedCallsInDiagnostics(bindingContext);
  }
Пример #2
0
  private static void assertResolvedCallsAreCompleted(
      @NotNull Diagnostic diagnostic,
      @NotNull Collection<? extends ResolvedCall<?>> resolvedCalls) {
    boolean allCallsAreCompleted = true;
    for (ResolvedCall<?> resolvedCall : resolvedCalls) {
      if (!((MutableResolvedCall<?>) resolvedCall).isCompleted()) {
        allCallsAreCompleted = false;
      }
    }

    PsiElement element = diagnostic.getPsiElement();
    DiagnosticUtils.LineAndColumn lineAndColumn =
        DiagnosticUtils.getLineAndColumnInPsiFile(
            element.getContainingFile(), element.getTextRange());

    assertTrue(
        "Resolved calls stored in "
            + diagnostic.getFactory().getName()
            + "\n"
            + "for '"
            + element.getText()
            + "'"
            + lineAndColumn
            + " are not completed",
        allCallsAreCompleted);
  }