Type generated by peer macro can't conform to Equatable #68683
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
I want to use a peer macro to create a new type that conforms to the same protocols as the type it's attached to. This seems to work for
Hashable
,Encodable
,Decodable
, but when I try to implementEquatable
, I get compiler errors. Here's a reduction of the problem:And this is what the
Duplicate
macro expands to:I get:
error: type 'S_Duplicate' does not conform to protocol 'Equatable'
For completeness, here's my stupid macro:
and its declaration:
Steps to reproduce
Use Xcode's "new package" to create a macro package. Delete the unit tests.
Replace the macro declaration, macro implementation, and client code with the above snippets.
Compile (or rather, fail to). Full error output:
Expected behavior
I expect my macro-generated struct to be able to conform to
Equatable
Environment
$ swiftc --version
$ xcodebuild -version
The text was updated successfully, but these errors were encountered: