Commit Graph

12 Commits

Author SHA1 Message Date
Doug Gregor
997dfc6507 Top-level macros and type aliases can get @available attributes and @unsafe 2024-12-14 21:49:56 -08:00
Doug Gregor
de4d4a4244 Teach the TypeRefinementContext not to skip declarations within macro expansions
The construction of type refinement contexts performs lazy expansion
for the contents of macro expansions, so that TRC creation doesn't
force all macros to be expanded. However, the logic that skips macro
expansions would *also* skip some declarations produced within a macro
expansion, even when building the TRC specifically for that macro
expansion buffer. This manifest as missing some availability
information within the TRC, rejecting some well-formed code.

Tune the logic for "don't visit macro expansions when building a TRC"
to recognize when we're building a TRC for that macro expansion.

Fixes rdar://128400301.
2024-11-10 07:32:00 -08:00
Doug Gregor
879a10b860 [Macros] Ensure that the type refinement context accounts for macros
Make sure that we include all of the AST nodes from a macro expansion
buffer when building the type refinement context, not just the
declarations.
2023-04-26 18:27:10 -07:00
Ben Barham
e5a28caa9a [Test] Fix swift_swift_parser feature and use in tests
The macro tests were all using "REQUIRES: OS=macosx" as a proxy for
"have the Swift Swift parser". There was an existing feature for this,
but it was just checking whether the path was passed through. Fix that
to use the same variable as in CMake.

Also remove all extraneous `-I` and `-L` to the host libs in the target
invocations.
2023-04-03 09:25:03 -07:00
Doug Gregor
f88d2c638f Clean up feature flags for macros.
Enable expression macros by default, and add separate feature flags for
attached and freestanding macros.
2023-03-02 14:34:59 -08:00
Doug Gregor
04eca73d60 [Macros] Stop parsing the ": <type>" syntax. We always require parameters 2023-02-09 22:11:23 -08:00
Alex Hoppen
ba5a727983 [Macros] Compile Macros tests with swift-version 5 instead of swift-version 4 2023-02-04 11:10:08 +01:00
Doug Gregor
5a9a654adb Adopt @freestanding(expression) for all @expression macros 2023-01-25 17:07:38 -08:00
Doug Gregor
535aecbd4f [Macros] Check primary-file macro definitions more thoroughly.
Error if a macro is undefined, and warn if it refers to an external
macro definition that cannot be found.
2023-01-08 22:22:27 -08:00
Doug Gregor
32a918a320 [Macros] Ensure that we check the macro definition in the primary file.
Otherwise, we won't diagnose issues with a macro until the point of use.
2023-01-08 21:58:25 -08:00
Doug Gregor
f78f5729c3 Start requiring expression macros to be marked with @expression 2022-12-22 09:18:05 -08:00
Doug Gregor
e2c66cb67d [Macros] Check access control and availability 2022-11-28 18:33:10 -08:00