Skip to content

[Sema] Allow @_section/@_used in concrete generic context #75222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Jul 12, 2024

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:

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.

@kastiglione kastiglione changed the title [NFC] .github: Delete release branch PR template in favor of org-wide variant [Sema] Allow @_section/@_used in concrete generic context Jul 12, 2024
@kastiglione kastiglione requested a review from kubamracek July 12, 2024 23:55
@kastiglione
Copy link
Contributor Author

@swift-ci smoke test

@kastiglione
Copy link
Contributor Author

@swift-ci test macOS

@kastiglione
Copy link
Contributor Author

@swift-ci smoke test macOS

@kastiglione kastiglione merged commit ad8b0f3 into main Jul 16, 2024
4 checks passed
@kastiglione kastiglione deleted the dl/Sema-Allow-_section-_used-in-concrete-generic-context branch July 16, 2024 17:05
kastiglione added a commit that referenced this pull request Jul 16, 2024
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.

(cherry picked from commit ad8b0f3)
kastiglione added a commit that referenced this pull request Jul 17, 2024
…75277)

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.

(cherry picked from commit ad8b0f3)
susmonteiro pushed a commit that referenced this pull request Jul 19, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants