swiftlang/swift

Error says `@preconcurrency` only applies in inheritance clauses

オープン

#88,338 opened on 2026/04/07

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Swift (10,719 件のフォーク)batch import
@preconcurrencyTypeResolverattributescompilerdiagnostics qualitygood first issueswift 6.3type checker

Repository metrics

Stars
 (69,989 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド