Skip to content
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

Work around type-checking error present in XCode 16.0 #97

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

michaelkirk
Copy link
Collaborator

I started seeing this immediately upon upgrading to the stable release of XCode 16.0

The error is:

Cannot convert return expression of type 'Dictionary<Int, Double>' to return type 'Dictionary<String, Optional>.RawValue' (aka 'Dictionary<String, Optional>')

This assignment should be a no-op, but it avoids hitting the error. This seems like a swift/xcode bug, but the work around is harmless enough.

Context

JSONValue (mentioned in the error message) is defined in turf.

Maybe the complexity of the various expressible-by-literal's in JSONValue/JSONObject are leading to a compiler edge case? Just a wild guess.

This seems like a swift/xcode bug, but the work around is harmless
enough

This assignment should be a no-op, but it avoids hitting a type checking error I'm seeing in XCode Version 16.0 (16A242d) (stable release)
I did not experience this error on XCode 15.4

The error is:
> Cannot convert return expression of type 'Dictionary<Int, Double>' to return type 'Dictionary<String, Optional<JSONValue>>.RawValue' (aka 'Dictionary<String, Optional<Any>>')

JSONValue is defined in turf.
Maybe the complexity of the various expressible-by-literal's in JSONValue/JSONObject are leading to a compiler edgecase? Just a guess.
Copy link
Contributor

@ianthetechie ianthetechie left a comment

Choose a reason for hiding this comment

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

Yeah, sounds like a compiler bug to me. Workaround looks fine.

Copy link
Contributor

@StephanPartzsch StephanPartzsch left a comment

Choose a reason for hiding this comment

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

Thanks for the workaround. Looks good!
Would love to see it merged asap ;)

Copy link
Collaborator

@hactar hactar left a comment

Choose a reason for hiding this comment

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

Looks harmless.

@hactar hactar merged commit f91faff into maplibre:main Sep 20, 2024
2 checks passed
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.

4 participants