Commit Graph

6 Commits

Author SHA1 Message Date
Artem Chikin e3f07a58f5 [Diagnostics] Display full diagnostic group parent chains
When a diagnostic belongs to a group that has a parent group (`GROUP_LINK` in `DiagnosticGroups.def`), display the full inheritance chain in the diagnostic output, including documentation hyperlinks and footnotes for each.

For example, a diagnostic in `ExistentialType` (child of `PerformanceHints`) now renders as:
```
warning: ... [#PerformanceHints::ExistentialType]
```
Groups without parents continue to display as before (`[#DeprecatedDeclaration]`).

Resolves rdar://170805800
2026-03-16 10:04:10 +00:00
Doug Gregor 8c9e04ed3f Split out the Fix-It for the untyped throws performance hint 2026-03-13 13:33:57 -07:00
Doug Gregor c72eab6be5 Introduce performance hints for untyped throws
Untyped throws requires a heap allocation and reference counting for
thrown errors, which can be unacceptable in very
performancce-constrained environments. Introduce a new subgroup of
performance hints, UntypedThrows, to report uses of untyped throws.

This resurrects the code we were using for diagnosing untyped throws
in Embedded Swift, repurposing it as a performance hint, which is more
appropriate.
2026-03-12 13:07:00 -07:00
Aviral Goel 3caa3e319d [Performance Hints] Issue diagnostic for code wrapped in implicit nodes
In order to avoid issuing diagnostics for compiler-generate code, we ignore the
syntax subtree rooted at an implicit node. This causes our algorithm to miss
user code wrapped in implicit nodes during desugaring. For example, expressions
in implicit returns from single-expression closures and trailing closures are
completely ignored right now.

This change fixes heproblem by introducing a simple change to the AST walker.
Instead of ignoring the entire implicit-node subtree, we only ignore the
implicit node but continue to descend into its children. This enables our
algorithm to access non-implicit (user code) nodes nested inside
implicit (compiler-generated) nodes.
2025-10-07 21:46:16 -07:00
Aviral Goel 1cf692f116 [Performance Hints] Implement check for existential any
This commit introduces a performance hint check that warns on the use of
existential any in variable declarations, function and closure parameters and
returns, and typealiases.
2025-10-07 11:18:31 -07:00
Artem Chikin 7c74890bd8 [Performance Hints] Add simple check for returning of values of array and dictionary type
This check will run on each type-checked primary input of the current compilation and emit a warning diagnostic for all discovered occurences of this code pattern when the performance hint diagnostic is enabled
2025-10-02 10:31:13 -07:00