Commit Graph

15 Commits

Author SHA1 Message Date
Tony Allevato
a3993f972a Merge pull request #80498 from allevato/json-usr-fixes
[AST] More JSON AST dump improvements.
2025-04-23 15:35:17 -04:00
Tony Allevato
fa1f82967f Also show the new conformance details in the default dump. 2025-04-03 12:37:15 -04:00
Slava Pestov
e3fdeaf501 ASTDumper: Dump conforming type of abstract conformance 2025-03-31 17:35:22 -04:00
Kavon Farvardin
8f97b7f1bf Test: update for NoncopyableGenerics 2024-03-14 23:10:44 -07:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Slava Pestov
23b1690f6b ASTPrinter: Refactor printing of RequirementSignatures 2024-01-31 21:55:52 -05:00
Slava Pestov
fa3eeddf6e ASTDumper: Make the SubstitutionMap dump easier to read
Don't quote generic parameter names because then the tau gets
escaped in canonical types, and expand out the replacement
type with printRec() instead of stringifying it.
2023-11-14 15:46:58 -05:00
Slava Pestov
c90b8e6e95 ASTDumper: Improve conformance dumping and use forEachAssociatedConformance() 2023-10-11 15:04:09 -04:00
Becca Royal-Gordon
8770c7f826 Rework ASTDumper (#68438)
This PR refactors the ASTDumper to make it more structured, less mistake-prone, and more amenable to future changes. For example:

```cpp
  // Before:
  void visitUnresolvedDotExpr(UnresolvedDotExpr *E) {
    printCommon(E, "unresolved_dot_expr")
      << " field '" << E->getName() << "'";
    PrintWithColorRAII(OS, ExprModifierColor)
      << " function_ref=" << getFunctionRefKindStr(E->getFunctionRefKind());
    if (E->getBase()) {
      OS << '\n';
      printRec(E->getBase());
    }
    PrintWithColorRAII(OS, ParenthesisColor) << ')';
  }

  // After:
  void visitUnresolvedDotExpr(UnresolvedDotExpr *E, StringRef label) {
    printCommon(E, "unresolved_dot_expr", label);

    printFieldQuoted(E->getName(), "field");
    printField(E->getFunctionRefKind(), "function_ref", ExprModifierColor);

    if (E->getBase()) {
      printRec(E->getBase());
    }

    printFoot();
  }
```

* Values are printed through calls to base class methods, rather than direct access to the underlying `raw_ostream`.
    * These methods tend to reduce the chances of bugs like missing/extra spaces or newlines, too much/too little indentation, etc.
    * More values are quoted, and unprintable/non-ASCII characters in quoted values are escaped before printing.
* Infrastructure to label child nodes now exists.
    * Some weird breaks from the normal "style", like `PatternBindingDecl`'s original and processed initializers, have been brought into line.
* Some types that previously used ad-hoc dumping functions, like conformances and substitution maps, are now structured similarly to the dumper classes.
* I've fixed the odd dumping bug along the way. For example, distributed actors were only marked `actor`, not `distributed actor`.

This PR doesn't change the overall style of AST dumps; they're still pseudo-S-expressions. But the logic that implements this style is now isolated into a relatively small base class, making it feasible to introduce e.g. JSON dumping in the future.
2023-09-11 23:56:38 -07:00
Slava Pestov
e4973158d8 AST: -debug-generic-signatures protocol-qualifies DependentMemberTypes 2022-01-19 22:36:15 -05:00
Robert Widmann
c75af38a7a Drop ConformanceContexts out of the TypeChecker 2019-11-06 11:41:03 -08:00
Varun Gandhi
c85eae1efb Get rid of the second call to setType() in validateExtension().
This means that we no longer have the invariant that the extendedType always
contains the generic parameters. So we need to fix the assertions/test cases
for it.
2019-08-19 11:37:18 -07:00
Slava Pestov
5d59a3f2f3 AST: Lazily compute conditional requirements in conditional conformance
In one test where we used to dump conditional requirements we now print
a message that they have not been computed yet. I couldn't come up with
a way to force them to be computed here, but for the most part this test
is just ensuring that we don't recurse forever when printing recursive
conformances.
2018-09-27 20:49:23 -07:00
Doug Gregor
3018becde7 [Type checker] Eliminate type checking from early extension binding.
Use ExtensionDecl::getExtendedNominal() to wire up extensions to their
nominal types early in type checking (the bindExtensions()) operation,
rather than going through type validation to do so.
2018-08-03 11:26:49 -07:00
Jordan Rose
d176bfa9ce [test] Move tests that only test the Frontend out of Driver/
Reorganization only.
2018-07-19 15:56:55 -07:00