Commit Graph

65 Commits

Author SHA1 Message Date
Doug Gregor
71ca9c86e6 [Macros] Diagnose when we forget to provide macro arguments.
Unlike functions, you can't curry macros; diagnose when one omits the
arguments in a macro expansion of a macro that has a parameter list.
2023-01-02 21:22:04 -08:00
Doug Gregor
6bad02c50a [Macros] Implement overloading rules 2023-01-02 21:22:04 -08:00
Doug Gregor
806b5a8777 [Macros] Diagnose errors where a macro is used without the '#'. 2023-01-02 21:22:04 -08:00
Doug Gregor
af49a90dde Customize diagnostic text for extra/missing/mislabeled arguments for callee kind
Most of the diagnostics for extra/missing/mislabeled arguments refer
to argument to a "call". Some (but not call) would substitute in
"subscript". None would refer to an argument to a macro expansion
properly.

Rework all of these to refer to the argument in a call, subscript, or
macro expansion as appropriate. Fix up lots of tests that now say
"subscript" instead, and add tests for macro expansions.
2023-01-02 21:22:04 -08:00
Doug Gregor
bdc01ea985 [Macros] Handle macro argument lists in diagnostics
This improves diagnostics for missing/extra/incorrectly-labeled arguments.
2023-01-02 21:22:04 -08:00
Doug Gregor
f78f5729c3 Start requiring expression macros to be marked with @expression 2022-12-22 09:18:05 -08:00
Alastair Houghton
da51c04116 Two of the macros tests are failing to import SwiftDiagnostics.
Disabling these for now, pending a fix.
2022-12-22 09:45:59 +00:00
Doug Gregor
3be6344619 Eliminate dependencies on _SwiftSyntaxMacros having actual macros in it 2022-12-14 16:13:48 -08:00
Doug Gregor
54625a3a70 Only diagnose a missing external macro definition when we try to expand 2022-12-12 13:18:13 -08:00
Doug Gregor
a9ee5dd142 [Macros] Don't allow local names to shadow macro names. 2022-11-28 18:33:10 -08:00
Doug Gregor
1a10009cae [Macro] Diagnose macros declared in nested scopes 2022-11-28 18:33:10 -08:00
Doug Gregor
ab9608cd78 [Macros] Add tests for redeclarations of macros 2022-11-28 18:33:10 -08:00
Doug Gregor
e2c66cb67d [Macros] Check access control and availability 2022-11-28 18:33:10 -08:00
Doug Gregor
4f823c60be [Macros] Ensure that macros cannot return opaque result types 2022-11-28 18:33:10 -08:00
Doug Gregor
3c80b714bf [Macros] Fix end location of macro declarations with where clauses 2022-11-28 18:33:10 -08:00