swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
66.79k stars 10.29k forks source link

Enum Comparable and macro. #74295

Open VAndrJ opened 3 weeks ago

VAndrJ commented 3 weeks ago

Description

I installed Xcode 16, where a problem appeared with enum and Comparable when there is a macro. Below is a screenshot of the error and what the macro turns into:

929e596dc50df66889a7d246c089b38d69230a7b_2_1380x778

If I remove the macro and write it manually, the error disappears:

5cd0bf7e1b8cb25e99f3e3275a5815c5837b725c_2_1380x800

Reproduction

MRE:

ComparableEnumTest.zip

Expected behavior

Сompiles without errors, like in previous Swift versions.

Environment

swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10) Target: arm64-apple-macosx15.0

Additional information

UPD. With an extension, everything is ok too, example:

Screenshot 2024-06-11 at 18 35 07
vanvoorden commented 3 weeks ago

Might be related to https://github.com/apple/swift/issues/70087.

vanvoorden commented 3 weeks ago

@VAndrJ have you tried this with an enum conforming to Equatable? Same problem?

VAndrJ commented 2 weeks ago

@vanvoorden with Equatable no errors.

VAndrJ commented 4 days ago

UPD: with a class conforming to Equatable the same problem:

Screenshot 2024-07-03 at 17 31 43 Screenshot 2024-07-03 at 17 32 21

Environment

swift-driver version: 1.110 Apple Swift version 6.0 (swiftlang-6.0.0.4.52 clang-1600.0.21.1.3) Target: arm64-apple-macosx15.0