Commit Graph

4 Commits

Author SHA1 Message Date
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