Skip to content

Targeted fix for pulling in Hashable conformance for Set and Dictionary (3.0) #4299

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

Conversation

slavapestov
Copy link
Contributor

  • Explanation: Recent changes introducing NS_STRING_ENUM meant that we are now able to bridge dictionaries whose keys are imported types, namely stringly-typed enums. When bridging a nil value, nothing was forcing the conformance of the key type to the Hashable protocol to be emitted. So it was possible to hit a linker error due to an undefined symbol in this case.
  • Scope: Affects anyone using frameworks with NS_STRING_ENUMs
  • Risk: Low
  • Testing: New test added, fails without the change and passes with
  • Radar: rdar://problem/27470505

@slavapestov slavapestov added this to the Swift 3.0 milestone Aug 15, 2016
@slavapestov slavapestov changed the title Targeted fix for pulling in Hashable conformance for Set and Dictionary Targeted fix for pulling in Hashable conformance for Set and Dictionary (3.0) Aug 15, 2016
@slavapestov
Copy link
Contributor Author

@swift-ci Please test os x

…ry when a nil literal is bridged

When bridging values via the ObjectiveCBridgeable protocol,
SILGen has to look up conformances directly, behind the
type checker's back.

To make sure the ObjectiveCBridgeable conformance is forced,
Sema calls useObjectiveCBridgeableConformances() in the right
places.

However, another conformance we may also need when bridging
is the Hashable conformance for a Set or Dictionary's key type.

Make sure we force these too, because otherwise when bridging
a nil literal nothing needs them in Sema.

Fixes <rdar://problem/27470505>.
@slavapestov slavapestov force-pushed the fix-for-missing-conformance-3.0 branch from 686ac1b to 118d865 Compare August 15, 2016 08:48
@slavapestov
Copy link
Contributor Author

@swift-ci Please test os x

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test os x

@slavapestov
Copy link
Contributor Author

@jrose-apple or @DougGregor, mind reviewing this?

@jrose-apple
Copy link
Contributor

I don't understand this code as well as I probably should, but I like that it's not doing much more work than it already was. Seems reasonable to me.

@slavapestov slavapestov merged commit 0993200 into swiftlang:swift-3.0-branch Aug 15, 2016
@DougGregor
Copy link
Member

Yeah, this LGTM. Thanks, @slavapestov

@slavapestov slavapestov deleted the fix-for-missing-conformance-3.0 branch August 19, 2016 05:21
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