Description
An existing diagnostic prevents you from defining a public memberwise initializer for a type in an extension:
invalid redeclaration of synthesized memberwise 'init'
…but this is the only reasonable way to do so for a type generated by a macro.
Six years ago a suggestion was made on the forums that same-file extensions should be able to define memberwise initializers: https://forums.swift.org/t/why-doesn-t-an-init-in-an-extension-suppress-the-synthesized-init/35182/ It didn't get traction but it also didn't have pushback.
This limitation seems more relevant than ever with macros now in the language.
Reproduction
public struct A {
}
extension A {
public init() {} // 🛑
}
Expected behavior
I expect a same-file extension to be able to define the memberwise initializer publicly.
Environment
swift-driver version: 1.168.4 Apple Swift version 6.4 (swiftlang-6.4.0.25.4 clang-2100.3.25.1)
Target: arm64-apple-macosx26.0
Additional information
No response
Description
An existing diagnostic prevents you from defining a public memberwise initializer for a type in an extension:
…but this is the only reasonable way to do so for a type generated by a macro.
Six years ago a suggestion was made on the forums that same-file extensions should be able to define memberwise initializers: https://forums.swift.org/t/why-doesn-t-an-init-in-an-extension-suppress-the-synthesized-init/35182/ It didn't get traction but it also didn't have pushback.
This limitation seems more relevant than ever with macros now in the language.
Reproduction
Expected behavior
I expect a same-file extension to be able to define the memberwise initializer publicly.
Environment
swift-driver version: 1.168.4 Apple Swift version 6.4 (swiftlang-6.4.0.25.4 clang-2100.3.25.1)
Target: arm64-apple-macosx26.0
Additional information
No response