You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a new initializer to DiagnosticSpec which takes an optional array
of highlights instead of a single optional highlight string. Updates
existing initializer to map the string into an array of one.
Updates assertMacroExpansion to check each highlight in the diagnostic
spec against the actual produced diagnostic individually. Additionally
changes the behavior to drop leading and trailing trivial when
performing the highlight comparison to better match the Swift compiler's
behavior.
-`DiagnosticSpec.highlight` replaced by `highlights`
51
+
- Description: The use of a single string `highlight` prevented users from asserting that a macro highlighted exactly the expected set of syntax nodes. Use of `DiagnosticSpec.init(...highlight:...)` is deprecated and forwards to `DiagnosticSpec.init(...highlights:...)`. Migrating from `highlight` to `highlights` is straightforward; any uses of `DiagnosticSpec.init` which do not specify a `highlight` do not need to change, otherwise:
52
+
- If the diagnostic highlights a single node, the `highlight` string should be replaced with a single element array containing the same string without any trailing trivia, e.g., `highlight: "let "` -> `highlights: ["let"]`.
53
+
- If the diagnostic highlights multiple nodes, the `highlight` string should be replaced with an array containing an element for each highlighted node, e.g., `highlight: "struct {}"` -> `highlights: ["struct", "{}"]`.
0 commit comments