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>.
This API is documented in its headers to only allow being called once
for a particular domain, so we have to make sure our check for an
existing provider is synchronized with the setting.
rdar://problem/27541751
Previously AnyHashable would consider SwiftValue to be a subclass of
NSObject (which it is in practice) and return false when trying to
compare an AnyHashable of a SwiftValue box to an AnyHashable of the
unboxed value.
If the Swift error wrapped in a _SwiftNativeNSError box conforms to
Hashable, the box now uses the Swift's conformance to Hashable.
Part of rdar://problem/27574348.
It's important to let people know that, in contrast with existing
practice in other frameworks, we really are going to remove the
deprecated API, and soon.
SE-0072 took implicit bridging conversions away, which regressed the ability to express NSDictionaries as dictionary literals and index them using literal keys. Address this by changing the signature of init(dictionaryLiteral:) to use Hashable and Any, and by replacing the subscript from Objective-C with one using _Hashable that does the bridging on the user's behalf. This largely restores the QoI of working with NS collections.
Huge thanks to John for noting that 'consume' didn't provide the
guarantees we wanted, and to Michael G. for getting a TSan build up
and running to identify/verify this race.
It's possible that this is overlay strict, and that we only need to
look at the domain to ensure that the code and userInfo are
visible. However, TSan seems to prefix the form in this patch, so
we'll be more conservative for now.
Fixes rdar://problem/27541751.
Implements part of SE-0110. Single argument in closures will not be accepted if
there exists explicit type with a number of arguments that's not 1.
```swift
let f: (Int, Int) -> Void = { x in } // this is now an error
```
Note there's a second part of SE-0110 which could be considered additive,
which says one must add an extra pair of parens to specify a single arugment
type that is a tuple:
```swift
let g ((Int, Int)) -> Void = { y in } // y should have type (Int, Int)
```
This patch does not implement that part.
ArraySlice.removeLast() only worked when startIndex was equal to zero.
This change fixes the bug, and uses the proper customization point for
the algorithm.
Fixes SR-1791, rdar://problem/26897658.