-
-
Notifications
You must be signed in to change notification settings - Fork 41
Update swift-syntax version and improve type constraints to resolve errors & warnings
#150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- [x] Bumped `swift-syntax` dependency to allow up to `603.0.0`. - [x] Added `SendableMetatype` constraint to `NumberCodingStrategy` extension. - [x] Refactored `caseEncodeExpr` in `EnumVariable` for consistent `FunctionCallExprSyntax` usage.
- [x] Corrected indentation for the `caseEncodeExpr` closure to maintain consistent formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the swift-syntax dependency to support versions up to 603.0.0 and addresses breaking API changes introduced in newer versions of the library.
- Updated
swift-syntaxversion range from"509.1.0"..<"602.0.0"to"509.1.0"..<"603.0.0" - Refactored
FunctionCallExprSyntaxinitialization to usecalledExpression:parameter instead of deprecatedcallee: - Added
SendableMetatypeconstraint toValueCodingStrategyextension for number types
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Package.swift | Bumped swift-syntax dependency upper bound to 603.0.0 |
| Sources/PluginCore/Variables/Type/EnumVariable.swift | Updated FunctionCallExprSyntax API usage from callee: to calledExpression: for consistency |
| Sources/HelperCoders/ValueCoders/Number.swift | Added SendableMetatype constraint to ValueCodingStrategy extension |
Replaces the `SendableMetatype` constraint with `Sendable` in the `ValueCodingStrategy` extension to align with updated protocol requirements or type definitions.
- [x] Refactors `caseEncodeExpr` to return only the case name for enum cases without associated values, avoiding unnecessary parentheses. This improves code generation for enums with simple cases.
- [x] Update `ConformEncodableTests.misuseWithCodable` to expect four diagnostics. - [x] Ensure diagnostic IDs, messages, fix-its, and line/column positions match emitted results: - [x] Two diagnostics for `@ConformEncodable` at line 1, column 1. - [x] Two diagnostics for `@Codable` at line 2, column 1. - [x] Mirrors the pattern already used in `misuseWithDecodable`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| .init( | ||
| id: Codable.misuseID, | ||
| message: | ||
| "@Codable can't be used in combination with @ConformEncodable", | ||
| line: 2, column: 1, | ||
| fixIts: [ | ||
| .init(message: "Remove @Codable attribute") | ||
| ] | ||
| ), |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diagnostic entry appears to be a duplicate of the diagnostic at lines 59-67. Both have the same id (Codable.misuseID), message, line, column, and fixIt. Consider removing this duplicate entry to avoid test redundancy.
This pull request updates dependencies, improves enum case encoding logic, enhances protocol constraints for numeric value coders, and adds a new test for attribute misuse. The changes focus on compatibility, correctness, and improved diagnostics.
Dependency update:
swift-syntaxpackage dependency to allow versions up to603.0.0, ensuring compatibility with newer releases.Enum encoding logic improvements:
EnumVariableso that cases without associated values are encoded as just the case name, without parentheses, improving the correctness of generated code.Protocol constraint enhancement:
Sendableconstraint to the generic requirements for numeric value coding strategies, improving safety for concurrent use.Testing and diagnostics:
ConformEncodableTeststo check for misuse when@Codableis used in combination with@ConformEncodable, providing better diagnostics for attribute conflicts.