Commit Graph

111 Commits

Author SHA1 Message Date
Itai Ferber
6171d68bfa Merge pull request #25065 from ikesyo/fix-dataprotocol-lastrange
Fix `DataProtocol.lastRange(of:)` (and cherry-pick Data.swift changes from swift-5.0-branch)
2019-05-28 09:54:16 -07:00
Sho Ikeda
44f0e93747 Merge pull request #25067 from ikesyo/avoid-fallthrough-where-appropriate
[gardening] Avoid fallthrough where appropriate (for readability/understandability)
2019-05-29 00:27:05 +09:00
Sho Ikeda
c1bb945124 [gardening] Avoid fallthrough where appropriate (for readability/understandability) 2019-05-26 09:50:02 +09:00
Sho Ikeda
a35c9f0c60 [gardening] Use Collection.isEmpty over Collection.count 2019-05-26 09:35:20 +09:00
swift-ci
b088acb66e Merge pull request #24767 from ikesyo/remove-unnecessary-breaks 2019-05-25 16:15:06 -07:00
Sho Ikeda
55b300f852 Fix DataProtocol.lastRange(of:) (and cherry-pick Data.swift changes from swift-5.0-branch)
`DataProtocol.lastRange(of:)` is correct in swift-5.0-branch, but not in master and swift-5.1-branch.
2019-05-26 07:26:33 +09:00
Slava Pestov
e0bba70923 Foundation: Provide a Hashable.hashValue witness for _BridgedStoredNSError conformers
Previously we would synthesize this in Sema, but this no longer
works when conformance checking is triggered by SILGen.
2019-05-18 11:35:05 -04:00
swift-ci
d1cc7136dd Merge pull request #23793 from phausler/data_mapped_perf_bug 2019-05-15 07:58:32 -07:00
Brent Royal-Gordon
dce879f508 Revert "[Foundation] Fix availability of NSValue.value(of:)" 2019-05-15 05:17:42 -07:00
Philippe Hausler
8a751bd4de Add tests and validate Data and DispatchData as sequences 2019-05-14 17:12:44 -07:00
Bob Wilson
6160545800 Merge pull request #24498 from lorentey/nsvalue-availability
[Foundation] Fix availability of NSValue.value(of:)
2019-05-14 15:22:22 -07:00
Sho Ikeda
6eead16283 [gardening] Remove unnecessary breaks 2019-05-15 00:54:33 +09:00
Karoy Lorentey
fbe5563d60 [Foundation] Fix availability of NSValue.value(of:) 2019-05-03 19:55:03 -07:00
Keita Nonaka
0613cd3e6b Merge remote-tracking branch 'origin' into fix-build-warnings 2019-05-01 19:10:31 -04:00
Jordan Rose
d20a7ca64e [CMake] Switch to building the overlays in Swift 5 mode (#24350)
Now that that's stabilized, we don't have to keep them in Swift 4 mode
any longer. (Arguably we don't need the CMake variable at all, but it
may be useful again in the future.)

rdar://problem/49040980
2019-04-29 17:55:20 -07:00
Karoy Lorentey
d9c166fdb9 Merge pull request #23832 from lorentey/foundation-hashing
[Foundation] Modernize hashing in Foundation's Swift-only types
2019-04-26 14:59:13 -07:00
Ian Partridge
3425f4fb4a [String] [Foundation] perf: UTF8 String -> Data
Currently, `str.data(using:allowLossyConversion)` always bridges via
`NSString`.

As `String` is now natively UTF8 we can fastpath this conversion in the
case where the user requests UTF8 encoding.

A benchmark for this was previously added in #22648.
2019-04-23 10:43:14 +01:00
Keita Nonaka
9411a0823a change var to let 2019-04-18 15:39:40 -04:00
Keita Nonaka
2771eb520c fix warnings 2019-04-18 13:11:57 -04:00
Yigitcan Yurtsever
68c00792df Fix doc typo on yearForWeekOfYear case in DateComponents 2019-04-12 18:58:52 -07:00
Karoy Lorentey
13bc567085 [Foundation] Notification: Add note on == not being reflexive and stabilize hashing
The `ObjectIdentifier(object as AnyObject)` is not necessarily stable; this breaks reflexivity for ==, and it makes the hash encoding nondeterministic.
2019-04-12 15:26:40 -07:00
Karoy Lorentey
582b65b993 Revert "[Foundation] Data: Hash the entire contents, not just an arbitrary subset"
This reverts commit b711ed9f90.
2019-04-08 18:48:52 -07:00
Karoy Lorentey
7f1dd3ef23 [Foundation] Fix bizarre indentation issues 2019-04-08 18:46:44 -07:00
Karoy Lorentey
2ab2431dbd [Foundation] URL is actually already Hashable
I’m not sure why I was so convinced it wasn’t, but this certainly simplifies things.
2019-04-08 18:30:16 -07:00
Karoy Lorentey
f859dd1316 [Foundation] URL: Fix availability of the new hash(into:) implementation 2019-04-05 19:25:27 -07:00
Karoy Lorentey
b711ed9f90 [Foundation] Data: Hash the entire contents, not just an arbitrary subset 2019-04-05 18:07:30 -07:00
Karoy Lorentey
6f40a4abf9 [Foundation] Measurement: Fix hashing 2019-04-05 18:07:30 -07:00
Karoy Lorentey
28e4688c05 [Foundation] PersonNameComponents: Modernize hashing 2019-04-05 18:07:30 -07:00
Karoy Lorentey
a23c3f36bd [Foundation] UUID: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
23cc71935b [Foundation] URLRequest: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
590f40770e [Foundation] URLComponents: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
10cb05ae6c [Foundation] URL: Add hash(into:) implementation
Note: URL does not implement Hashable.
2019-04-05 18:07:29 -07:00
Karoy Lorentey
b41eb97896 [Foundation] TimeZone: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
afa253961b [Foundation] NSRange: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
4bdc458c52 [Foundation] Notification: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
5e451e6d8f [Foundation] IndexPath: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
2d5520e80d [Foundation] IndexSet: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
9c46858d05 [Foundation] Locale: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
a0004226b1 [Foundation] Decimal: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
c1049e7b79 [Foundation] DateInterval: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
73be6b8335 [Foundation] DateComponents: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
741122ae65 [Foundation] Date: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
8b7adb35d3 [Foundation] AffineTransform: modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
0867f7e17f [Foundation] String.Encoding: Modernize hashing 2019-04-05 18:07:29 -07:00
Karoy Lorentey
81567ed85e [Foundation] CharacterSet: Modernize hashing 2019-04-05 18:07:26 -07:00
Karoy Lorentey
73ad830e40 [Foundation] Calendar: Modernize hashing 2019-04-05 18:07:21 -07:00
Karoy Lorentey
569e380337 [Foundation] NSRange: Add an explicit definition for hash(into:)
This replaces the compiler-generated variant (based on hashValue) with a better implementation.
2019-04-05 15:21:24 -07:00
Karoy Lorentey
46225d728a [Foundation] IndexPath: Add explicit hash(into:) definition, hashing *all* components
The new definition diverges from the existing hashValue: it feeds all path components to the hasher, rather than just a limited subset.

Hashing all the bits that are compared in == is necessary to ensure proper operation of the hash table.
2019-04-05 15:21:24 -07:00
Philippe Hausler
02c55f372c Avoid O(n) copies when bridgable NSData objects are available 2019-04-04 09:33:17 -07:00
Karoy Lorentey
3c74c0f1cb [stdlib] Change the signature of Dictionary’s bulk initializer (#23758)
The initializer was originally introduced without proper availability; in https://github.com/apple/swift/pull/23643, we fixed this by applying the `@_alwaysEmitIntoClient` attribute. However, this had the unfortunate side-effect that the symbol disappeared from `libswiftCore.dylib`, which somehow confuses some simulator builds.

Try to figure out what’s happening by replacing the third closure argument with an integer return value. This changes the mangled name of the bulk initializer, which should make it more obvious how/why these builds fail.

rdar://problem/49479386
2019-04-03 10:51:36 -07:00