swiftlang/swift
Error says `@preconcurrency` only applies in inheritance clauses
Ouverte
#88 338 ouverte le 7 avr. 2026
@preconcurrencyTypeResolverattributescompilerdiagnostics qualitygood first issueswift 6.3type checker
Métriques du dépôt
- Stars
- (69 989 étoiles)
- Métriques de merge PR
- (Merge moyen 8j 17h) (510 PRs mergées en 30 j)
Description
Description
This is not true. The attribute can also be used on declarations such as types, functions, and imports.
Reproduction
let _: @preconcurrency @MainActor() -> Void = {}
error: '@preconcurrency' only applies in inheritance clauses
83 |
84 | let _: @preconcurrency @MainActor() -> Void = {}
| `- error: '@preconcurrency' only applies in inheritance clauses
85 |
Expected behavior
An accurate error message. It might be better to say that @preconcurrency cannot be used on a type attribute instead of enumerating all the valid positions.
Environment
Swift version 6.3-dev (fefcb257b5b5d32)
Additional information
No response