If an extension macro produces an extension that declares conformance to a protocol with @preconcurrency attribute. The compiler gives error:
'preconcurrency' attribute only applies in inheritance clauses
But inlining the macro expansion, code is compiled without any error.
For example let's suppose @Codable is an extension macro that produces Decodable conformance to actor, i.e.
@Codable
actor SomeActorCodable {
@CodedIn("deeply", "nested1")
let value1: String
@CodedIn("deeply", "nested2")
var value2: String?
@CodedIn("deeply", "nested3")
var value3: String!
}
Compiler shows following error for produced expansion:
Showing All Messages
/var/folders/r6/gctp971x7bgg0sgxjqy8z7s00000gq/T/swift-generated-sources/@__swiftmacro16MetaCodableTests09SomeActorB00B0fMe.swift:1:29: 'preconcurrency' attribute only applies in inheritance clauses
Add an actor declaration with @Codable macro attached, i.e.
@Codable
actor SomeActorCodable {
@CodedIn("deeply", "nested1")
let value1: String
@CodedIn("deeply", "nested2")
var value2: String?
@CodedIn("deeply", "nested3")
var value3: String!
}
See the error when macro expanded during compile/build.
Expected behavior
Macro expansion should be accepted.
Environment
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: x86_64-apple-macosx14.0
Description
If an extension macro produces an extension that declares conformance to a protocol with
@preconcurrency
attribute. The compiler gives error:But inlining the macro expansion, code is compiled without any error.
For example let's suppose
@Codable
is an extension macro that producesDecodable
conformance to actor, i.e.produces an extension declaration
Compiler shows following error for produced expansion:
Reproduction
MetaCodable
swift package: https://github.com/SwiftyLab/MetaCodable targeting branchswift-testing
.Add an actor declaration with
@Codable
macro attached, i.e.Expected behavior
Macro expansion should be accepted.
Environment
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2) Target: x86_64-apple-macosx14.0
Additional information
No response