Skip to content

Fix decoding Array of LSPAnyCodable #1011

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

Merged
merged 3 commits into from
Jan 10, 2024
Merged

Fix decoding Array of LSPAnyCodable #1011

merged 3 commits into from
Jan 10, 2024

Conversation

krzyzanowskim
Copy link
Contributor

Fixes decoding array of LSPAnyCodable that wasn't handled properly and decoded only dictionary values

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case for this please?

@krzyzanowskim
Copy link
Contributor Author

is LSPAnyCodable tested at all? can't find

@krzyzanowskim
Copy link
Contributor Author

Can we get this fixed?

Comment on lines 180 to 182
if let value = value as? Element {
result.append(value)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return nil if one of the elements can’t get decoded to indicate failure instead of silently dropping it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, probably we should. Changed

Comment on lines 184 to 185
// skip array of null
break
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t we append nil to result if Element is Optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Element: LSPAnyCodable here is not optional

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, stupid me. 🤦🏽

@krzyzanowskim krzyzanowskim requested a review from ahoppen January 8, 2024 22:59
@ahoppen
Copy link
Member

ahoppen commented Jan 8, 2024

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge January 8, 2024 23:08
@ahoppen
Copy link
Member

ahoppen commented Jan 9, 2024

@swift-ci Please test Windows

1 similar comment
@ahoppen
Copy link
Member

ahoppen commented Jan 9, 2024

@swift-ci Please test Windows

@ahoppen ahoppen merged commit e8e4fb2 into swiftlang:main Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants