Skip to content

Only 21 of 75 Tests succeed when running them on main. #28

Closed

Description

@Midbin

When trying to work on some of the issues I filed earlier today, I discovered that when running the tests on main (simply opening the Package.swift in XCode an pressing Command + U) about 75% of the Tests fail.

The failures seem to indicate that @Codable is not expanded:

An example failure:

CodableTests.swift:75: failed - Actual output (+) differed from expected output (-):
 struct SomeCodable: Encodable {
     let value: String
 
     func encode(to encoder: Encoder) throws {
     }
 }
–
–extension SomeCodable: Decodable {
–    init(from decoder: Decoder) throws {
–        let container = try decoder.container(keyedBy: CodingKeys.self)
–        self.value = try container.decode(String.self, forKey: CodingKeys.value)
–    }
–}
–
–extension SomeCodable {
–    enum CodingKeys: String, CodingKey {
–        case value = "value"
–    }
–}

Actual expanded source:

struct SomeCodable: Encodable {
    let value: String

    func encode(to encoder: Encoder) throws {
    }
}

Is this an error on my end?

Activity

  1. soumyamahunt commented on Oct 10, 2023

    @soumyamahunt
    Contributor
  2. pinned this issue on Oct 11, 2023
  3. soumyamahunt commented on Nov 3, 2023

    @soumyamahunt
    Contributor

    @Midbin I have added fix in my forked version of swift-syntax which is now used by this library, hopefully the fix is accepted by upstream.

    The fix works well with VSCode without any additional steps.
    For XCode, you might need to comment out line 49 and 63 in Package.swift:

    if Context.environment["SWIFT_SYNTAX_EXTENSION_MACRO_FIXED"] != nil {

  4. unpinned this issue on Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions