Commit Graph

9 Commits

Author SHA1 Message Date
Kuba Mracek
b47227b57b Remaining test a code fixes for @_section->@section rename 2025-10-23 08:43:42 -07:00
Kuba Mracek
adeb40f261 SE-0492: Stabilize @_section/@_used into @section/@used
Removes the underscored prefixes from the @_section and @_used attributes, making them public as @section and @used respectively. The SymbolLinkageMarkers experimental feature has been removed as these attributes are now part of the standard language. Implemented expression syntactic checking rules per SE-0492.

Major parts:
- Renamed @_section to @section and @_used to @used
- Removed the SymbolLinkageMarkers experimental feature
- Added parsing support for the old underscored names with deprecation warnings
- Updated all tests and examples to use the new attribute names
- Added syntactic validation for @section to align with SE-0492 (reusing the legality checker by @artemcm)
- Changed @DebugDescription macro to explicitly use a tuple type instead of type inferring it, to comply with the expression syntax rules
- Added a testcase for the various allowed and disallowed syntactic forms, `test/ConstValues/SectionSyntactic.swift`.
2025-10-22 16:05:39 -07:00
Anthony Latsis
2cd90bdd69 AST: Quote attributes more consistently in DiagnosticsSema.def 2025-04-22 18:23:36 +01:00
Anthony Latsis
fffa8c2f51 Diag: Abstract away some calls to DeclAttribute::getAttrName 2025-03-28 02:01:27 +00:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Dave Lee
ad8b0f3397 [Sema] Allow @_section/@_used in concrete generic context (#75222)
Allow `@_section` and `@_used` to be used in fully constrained extensions.

This aligns with the existing behavior of static properties of generic types. The following is valid:

```swift
extension Array where Element == Int {
  static let specificConstant = 41
}
```

However, adding `@_section` or `@_used` to the above property, will result in an error diagnostic.

This change updates the logic of `@_section`/`@_used` to allow their use when the generic context is fully concrete.
2024-07-16 10:05:15 -07:00
Kuba Mracek
9e585148ab [embedded] Change empty ';' into a return, reformat and expand tests 2023-10-21 13:17:49 -07:00
Kuba Mracek
25cad6fe8a Diagnose more invalid uses of @_section/@_used 2023-10-18 17:48:20 -07:00
Kuba Mracek
f2cd8e0d2b Allow attributes @_used and @_section on static variables and member functions
- Drop the current requirement that these attributes can only apply to top-level declarations
- Diagnose if they are used in local contexts
- Diagnose if they are used in generic contexts
- Add tests
2023-10-18 17:09:53 -07:00