Fully qualify stdlib types (Error, Encoder, Decoder) in generated code#869
Conversation
czechboy0
left a comment
There was a problem hiding this comment.
Thank you, @william-laverty 🙏
|
We should probably think about generating code with full module qualifiers once 6.3 is released to avoid any ambiguity. |
|
@william-laverty please rerun the formatter, the CI is failing on that |
Head branch was pushed to by a user without write access
|
I think you need to revert all those formatting changes, and then run the Swift 6.2-aligned swift-format using the act command in the CONTRIBUTING guide. That will skip the doc files and other files we don't want to reformat. In other words, no files where you didn't change code should be modified in this PR. |
f4bb630 to
e1e6b12
Compare
|
Reverted all formatting-only changes — the diff now only touches files where code actually changed (the |
Summary
Fixes generated code to emit
Swift.Error,Swift.Encoder, andSwift.Decoderinstead of unqualifiedError,Encoder, andDecoder. This prevents compilation errors when user modules define their own types with those names.Changes
Source changes
translateCodable.swift: Changed.member("Error")→.member(["Swift", "Error"]),.member("Encoder")→.member(["Swift", "Encoder"]),.member("Decoder")→.member(["Swift", "Decoder"])translateBoxedTypes.swift: Same changes for boxed type Codable conformancesTest updates
Petstore/Types.swiftreference source to expect fully qualified typesSnippetBasedReferenceTests.swiftto matchBefore / After
Closes #719