Commit Graph

183 Commits

Author SHA1 Message Date
Karoy Lorentey
0344f0830e Merge branch 'master' into foundation-no-inlinable-shim-calls 2020-03-31 18:24:59 -07:00
Mishal Shah
e7cd5ab17f Update master to build with Xcode 11.4 2020-03-24 11:30:45 -07:00
Xiaodi Wu
1d7ec4c129 [NFC][Foundation] Remove or replace unnecessary uses of 'fileprivate' 2020-02-23 13:45:13 -05:00
Alexis Laferrière
4055c94d6d [stdlib] Update one String initializer and client to use @_spi 2020-02-19 16:38:51 -08:00
Karoy Lorentey
846e957278 [Foundation] Switch to private imports of CoreFoundation shims 2020-01-22 13:26:27 -08:00
Karoy Lorentey
cdd99564e3 [Foundation] Fix potential backdeployment regression in append
Data.append now calls Data.count’s setter, which used to have a bug in previously shipped versions of the Foundation overlay (#28918).

To prevent working code from breaking when recompiled with the current version, avoid calling Data.count’s setter directly. Instead, extract its implementation (conveniently already packaged into a nested function) into a named method, marking it @_alwaysEmitIntoClient.
2020-01-08 18:39:40 -08:00
Karoy Lorentey
a6d7ee5eba Merge branch 'fix-Data.count-setter' into foundation-no-inlinable-shim-calls 2019-12-20 23:48:34 -08:00
Karoy Lorentey
1a9f7afdec [Foundation] Fix Data.count’s setter
Data provides a settable `count` property. Its expected behavior is undocumented, but based on the implementation, it is intended to zero-extend (or truncate) the collection to the specified length.

This does not work correctly if we start with an empty Data and we try to increase the count by a small integer:

```
import Foundation

var d = Data()
d.count = 2
print(d.count) // ⟹ 0 ⁉️

d.count = 100
print(d.count) // ⟹ 100 ✓
```

It looks like this bug was introduced with the Data overhaul that shipped in Swift 5.

(This issue was uncovered by https://github.com/apple/swift/pull/28918.)

rdar://58134026
2019-12-20 23:35:05 -08:00
Karoy Lorentey
c9058f0946 [Foundation] Switch to private imports of Foundation shims 2019-12-20 20:50:18 -08:00
Karoy Lorentey
15e865f0b5 [Foundation] Remove inlinable shim calls
We want to enable overlays to import their shims as @_implementationOnly, so that the shims disappear from the public interface.

However, this isn’t possible when a shim is called from an @inlinable func, because then the existence (and definition) of the shim needs to be available to all callers of it.

Unfortunately Foundation’s Data has three instances where it calls  _SwiftFoundationOverlayShims._withStackOrHeapBuffer within @inlinable code:

- Data.init<S: Sequence>(_: S)
- Data.append<S: Sequence>(contentsOf: S)
- Data.replaceSubrange<C: Collection>(_: Range<Int>, with: C)

Rewrite the first two to write sequence contents directly into the target Data instance (saving a memcpy and possibly a memory allocation).

In replaceSubrange, add fast paths for contiguous collection cases, falling back to a Swift version of _withStackOrHeapBuffer with a 32-byte inline buffer.

The expectation is that this will be an overall speedup in most cases, with the possible exception of replaceSubrange invocations with a large non-contiguous collection.

rdar://58132561
2019-12-20 20:45:02 -08:00
Karoy Lorentey
4c3c3355f0 Merge pull request #28685 from lorentey/i-heard-you-like-runtime-so-i-put-a-runtime-in-your-foundation-overlay-so-you-can-run-while-you-found
[Foundation][runtime] Remove swift_errorBridgingInfo
2019-12-11 10:54:40 -08:00
Luciano Almeida
392baefc47 [stdlib][Qol] SR-11295 Removing stdlib unnecessary coercions (#27165)
* Removing unnecessary casts from stdlib

* Minor adjustments

* [stdlib][qol] Clean up error variable assign NSError

* Removing unnecessary coercions after removing DeclRefExpr restriction.
2019-12-11 07:30:25 -08:00
Karoy Lorentey
c34389ce72 [Foundation][runtime] Remove swift_errorBridgingInfo
To implement swift_errorBridgingInfo, the Foundation overlay needs to import private runtime headers. Now that we cannot statically link the Foundation overlay, there is no point to keeping this workaround in the overlay any more.

This effectively reverts https://github.com/apple/swift/pull/16677.

rdar://problem/57809306
2019-12-10 15:33:24 -08:00
swift-ci
9905c44509 Merge pull request #28327 from CodaFi/do-it-for-the-datagrams 2019-11-18 13:38:21 -08:00
Philippe Hausler
498a240a98 [Foundation] Reorder _DataStorage to save 14 bytes of overhead 2019-11-18 10:52:35 -08:00
Robert Pieta
cda5676525 IndexSet.union performance improvement 2019-11-18 09:50:05 -08:00
Sergo Beruashvili
62a75d762d Use precondition instead of fatalError in DateInterval initializer 2019-11-17 15:15:55 -08:00
Luca Torella
e6992d35cd Fix reference to range(of:) in the contains doc
Signed-off-by: Luca Torella <luca@scandit.com>
2019-11-14 10:44:05 -08:00
Karoy Lorentey
6bc4c85005 [doc] Avoid use of “iff” in public API documentation 2019-09-10 18:52:01 -07:00
David Smith
f559a94f1b Redo CFStringCreateWithBytes shim 2019-08-12 15:15:10 -07:00
Alex Langford
184d942ba0 [CMake] add_swift_target_library shouldn't implicitly set INSTALL_IN_TARGET
This makes it more explicit what the install component of a target
library is if you don't see one (and its marked as IS_SDK_OVERLAY).
Explicit in this case makes more sense, as you don't have to rely on
knowledge of how `add_swift_target_library` is implemented to understand
what component is used to install the target.
2019-08-02 13:51:52 -07:00
swift-ci
f34ef5db85 Merge pull request #24356 from zetasq/zetasq-fix-KVO 2019-07-25 15:14:18 -07:00
David Smith
5e83f80d6f Let NSMutableDictionary check for -copy on keys, rather than doing it ourselves with a full (slow) conformance check 2019-07-17 15:50:03 -07:00
Stephen Canon
dc5915cdb5 Replace stdlib and test/stdlib 9999 availability. (#26108)
* Replace stdlib and test/stdlib 9999 availability.

macOS 9999 -> macOS 10.15
iOS 9999 -> iOS 13
tvOS 9999 -> tvOS 13
watchOS 9999 -> watchOS 6

* Restore the pre-10.15 version of public init?(_: NSRange, in: __shared String)

We need this to allow master to work on 10.14 systems (in particular, to allow PR testing to work correctly without disabling back-deployment tests).
2019-07-12 16:30:36 -04:00
Karoy Lorentey
315e865d9f [Darwin] Fix ABI breaks introduced since 5.1
rdar://problem/52847498
(cherry picked from commit 9e94afdf83)
2019-07-09 12:48:34 -07:00
Xiaodi Wu
dfb90b7e1c Merge pull request #25745 from xwu/sync-decimal
[Foundation] Synchronize Decimal overlay with swift-corelibs-foundation
2019-07-05 14:42:16 -04:00
swift-ci
9ee3c0eab1 Merge pull request #25503 from stevebrun/stevebrun/NSLocalizedString-docs 2019-07-05 09:40:46 -07:00
Nate Cook
d0db904811 Revert "Capitalize the w in with"
This was my error — with should be lowercase in titles.
2019-07-03 11:52:22 -05:00
Saleem Abdulrasool
88f8a3c597 Merge pull request #25846 from plotfi/master2
Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
2019-07-01 16:34:40 -07:00
Scott Perry
f994fc3f80 Merge pull request #25808 from numist/numist/diffing-performance-master
Performance improvements and availability updates for Collection.difference(from:using:)
2019-07-01 14:20:07 -07:00
Puyan Lotfi
6691fda8ec Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
There are situations where you want to build against a libc that is out
of tree or that is not the system libc (Or for cross build scenarios).
This is a change for passing the -sdk and include paths for things like
this.
2019-07-01 09:43:47 -07:00
Steven Brunwasser
e7746b0eba Capitalize the w in with 2019-06-28 21:36:17 -07:00
Steven Brunwasser
2e22f57d79 Fix wording for manual string management header 2019-06-28 21:32:40 -07:00
Steven Brunwasser
c93b18d8b3 "Must" must not be used outside a precondition 2019-06-28 21:13:09 -07:00
Steven Brunwasser
23d40e7e6d Correct spelling mistakes and typos 2019-06-28 20:58:28 -07:00
Steven Brunwasser
707697c53f Fix verb tense disagreement 2019-06-28 20:54:20 -07:00
Karoy Lorentey
09c8997f94 [SDK] Regenerate overlay dependencies 2019-06-27 12:19:31 -07:00
Karoy Lorentey
22e0b4a2b8 [Foundation] Manually add CoreGraphics dependency
This isn’t hardcoded into the dependency detection script anymore.
2019-06-27 12:14:49 -07:00
Scott Perry
0fc5d6ad31 Performance improvements and availability updates for Collection.difference(from:using:) 2019-06-26 16:55:29 -07:00
Xiaodi Wu
4555b287e8 [gardening] Update copyright year 2019-06-25 09:49:58 -04:00
Xiaodi Wu
6b5ee6d18c [NFC] Consolidate Decimal FloatingPoint implementations into one extension 2019-06-25 09:48:48 -04:00
Xiaodi Wu
ba34ee0a09 [NFC] Reorder Decimal protocol conformances to match documentation order; fix indentation 2019-06-25 09:17:48 -04:00
Xiaodi Wu
3104ccb12e Apply fix for SR-3126 and other changes to sync Decimal.init(_: Double) with sclf 2019-06-25 09:11:59 -04:00
Xiaodi Wu
fa0671c1af [NFC] Use sclf implementation of + - * / operators, move them and negate to SignedNumeric extension 2019-06-25 09:05:59 -04:00
Xiaodi Wu
742741f59b Note major divergences with sclf in implementation 2019-06-25 09:03:04 -04:00
Xiaodi Wu
e843bd303e [gardening] Sync formatting for constants with sclf version 2019-06-25 08:56:43 -04:00
Xiaodi Wu
b2ce4a2ba1 [Foundation] Fix two Decimal members with respect to NaN (#25698)
* Update Decimal.swift

Fix `Decimal.magnitude` so that `Decimal.nan.magnitude` is no longer incorrectly `0`.
Port changes from apple/swift-corelibs-foundation#1759, crucially correcting an error where `(0 as Decimal).doubleValue` returned `.nan`.

* [gardening] Zap indentation error

* Add test for `Decimal.nan.magnitude`

* Apply reviewer suggestion

Clean up `doubleValue`
2019-06-25 08:45:56 -04:00
Steven Brunwasser
3d6b52507f Focus on what to do and why to do it 2019-06-21 20:14:29 -07:00
Steven Brunwasser
fd8bd3645d Reword returns section without bullets 2019-06-21 19:49:13 -07:00
Steven Brunwasser
4d481a3dc2 Describe the behavior of value without mentioning its default value 2019-06-21 19:45:08 -07:00