Commit Graph

3606 Commits

Author SHA1 Message Date
swift-ci
87021527b3 Merge pull request #12783 from natecook1000/nc-fixes-710-1 2017-11-07 14:23:59 -08:00
Max Moiseev
0bc9c05b2f Use the ClosedRangeIndex for StrideThrough collections 2017-11-07 11:45:48 -08:00
Nate Cook
0b62b0608d [stdlib] Doc revisions
- Add missing docs & parameter lists
- Remove deprecated `characters` usage in examples
- Revise documentation for Mirror and CVarArg
- Revise documentation for swap(_:_:)
- Various typo and grammar fixes
2017-11-07 11:11:23 -06:00
Max Moiseev
1f7d155702 Use RandomAccessSlice for StrideToCollection.SubSequence 2017-11-06 15:59:04 -08:00
Max Moiseev
f00fb5d478 Relax the ClosedRangeIndex constraints 2017-11-06 15:59:04 -08:00
Max Moiseev
10f880c3dc [stdlib] Implement StrideTo and StrideThrough collections
In the absence of conditional conformances, they are now extra types
with different constraints, plus extra overloads to the
stride(from:to:by:) and stride(from:through:by:).
2017-11-06 15:59:04 -08:00
Nate Cook
dcf6e2b409 [stdlib] Fix FloatingPoint.init(exactly:) (#12739)
* [stdlib] Fix FloatingPoint.init(exactly:)

This initializer wasn't actually checking the exact conversion.

SR-4634, rdar://problem/31836766
2017-11-06 15:24:44 -08:00
Joe Groff
a59af9855e Merge pull request #12725 from jckarter/key-path-optional-chain-out-of-bounds
KeyPath: Fix out-of-bounds access when instantiating keypaths with optional chaining components.
2017-11-02 22:34:33 +01:00
Joe Groff
993d795152 KeyPath: Fix out-of-bounds access when instantiating keypaths with optional chaining components.
When we pre-scan the components of a key path pattern to determine its runtime type and instance size, we would short-circuit upon seeing an optional-chaining component, since that makes a key path definitely read-only, but the loop also accumulates the size of the instance we're supposed to allocate, so…bad stuff happened. Leave out the short-circuit, fixing SR-6096 | rdar://problem/34889333 .
2017-11-02 13:32:35 -07:00
Mark Lacey
26f6a751c4 Remove extensions on ImplicitlyUnwrappedOptional from the stdlib.
Extensions on ImplicitlyUnwrappedOptional are not actually accessible
because we force the optional (and thus can only access things on the
type it is wrapping).

Remove these from the stdlib in order to pave the way toward fully
implementing SE-0054.
2017-11-01 16:33:53 -07:00
Slava Pestov
278425a62a stdlib: Remove unnecessary @_inlineable and @_versioned declarations 2017-10-31 13:37:38 -07:00
Slava Pestov
a4147fce78 Merge pull request #12664 from slavapestov/ns-fast-enumerator-madness
stdlib: Fix for NSFastEnumerator breakage in resilient builds
2017-10-28 00:19:26 -07:00
Doug Gregor
5947ae9c00 Merge pull request #12645 from DougGregor/conformance-near-miss
Warn on “near-misses” when defaults are used for protocol witnesses.
2017-10-27 23:01:59 -07:00
Slava Pestov
7f73623532 stdlib: Fix for NSFastEnumerator breakage in resilient builds 2017-10-27 18:55:05 -07:00
Slava Pestov
a07e991093 SILOptimizer: Fix string switch optimization with resilient stdlib
Progress on <rdar://problem/34794790>, but since the build started failing
some other things broke.
2017-10-26 23:58:50 -07:00
Doug Gregor
e423640527 Merge pull request #12638 from glessard/umrbp-tweak
[stdlib] use Collection.isEmpty rather than Collection.count
2017-10-26 21:13:40 -07:00
Doug Gregor
10ae35d070 Minor tweak to the standard library to reduce near-miss false positives. 2017-10-26 17:05:04 -07:00
Guillaume Lessard
99e5570376 use Collection.isEmpty rather than Collection.count 2017-10-26 16:11:35 -06:00
Roman Levenstein
68d7778add Address post-commit review comments on PR #11910
- Use SWIFT_RUNTIME_EXPORT instead of SWIFT_RT_ENTRY_VISIBILITY for exposed functions
- Use `_swift_`  prefixes on the names of exposed functions
- Make the global counters and per-object counters cache thread-safe by using locks
2017-10-24 15:49:37 -07:00
Valentin Pertuisot
4b9d5d54db Improve lowercased comments documentation (#12579)
Differentiate better between a full string character lowercased and a first character only lowercased
2017-10-24 13:11:00 -05:00
Guillaume Lessard
515b455aa1 fix a typo 2017-10-19 04:22:36 -06:00
Greg Parker
72c65ffcaf Revert "[stdlib] Fix FloatingPoint.init(exactly:) (#11311)"
This reverts commit c9f4df84f6.
It is causing test failures on 32-bit iOS simulator and on Linux.
2017-10-18 01:17:08 -07:00
Nate Cook
c9f4df84f6 [stdlib] Fix FloatingPoint.init(exactly:) (#11311)
* [stdlib] Fix FloatingPoint.init(exactly:)

This initializer wasn't actually checking the exact conversion. Corrects
the tests as well.
2017-10-17 13:52:11 -05:00
Ben Cohen
a70e857d59 [stdlib] Fix issue with UTF16 index(_:offsetBy:limitedBy) (#12378)
* Fix issue with empty string ranges

* Add tests for basic offsetBy operation on UTF16View.Index
2017-10-16 13:44:51 -07:00
Max Moiseev
ba019f3dea Use _base._customContainsEquatableElement in LazyFilterX structs 2017-10-12 17:04:52 -07:00
Max Moiseev
dd5ba51a19 [stdlib] Implement _customContainsEquatableElement for LazySequence and LazyXCollection 2017-10-12 16:46:17 -07:00
Max Moiseev
2874662ffb [stdlib] Implement _preprocessingPass and _customContainsEquatableElement for StrideTo and StrideThrough 2017-10-12 16:46:17 -07:00
Max Moiseev
93afb243ca Merge pull request #11917 from natecook1000/nc-uint-advance
[stdlib] Fix strideable methods for large unsigned values
2017-10-11 10:08:29 -07:00
Slava Pestov
124251cf2c Merge pull request #9619 from allevato/synthesize-equatable-hashable
Synthesize Equatable/Hashable for complex enums, structs
2017-10-10 18:22:40 -07:00
Saleem Abdulrasool
03ecfe2867 Merge pull request #12350 from compnerd/calling-conv
stdlib: fix build for non-ObjC targets
2017-10-10 17:25:29 -07:00
Saleem Abdulrasool
5022dbc201 stdlib: fix build for LLP64 targets
When building the stdlib for Windows x86_64, we would see the following error:

  swift/stdlib/public/core/RuntimeFunctionCounters.swift:95:19: error: '(UnsafeRawPointer, Int64) -> Void' is not representable in Objective-C, so it cannot be used with '@convention(c)'
     @convention(c) (_ object: UnsafeRawPointer, _ functionId: Int64) -> Void
                    ^

This is caused by `Int64` not being mapped as on Windows x86_64, `CLong`
is mapped to `Int32` and `CLongLong` is mapped to `Int`.  This causes
the `Int64` to fail to be reverse-mapped to a C type causing the FFI
construction failure.
2017-10-10 12:21:08 -07:00
Nate Cook
37b4083ac7 [stdlib] Try inlining integer stride methods 2017-10-10 13:00:36 -05:00
Tony Allevato
715ba632dd Merge branch 'master' into synthesize-equatable-hashable 2017-10-09 15:57:36 -07:00
Nate Cook
0648aad14f [stdlib] Constrain SubSequence.IndexDistance == IndexDistance 2017-10-09 01:59:44 -05:00
Roman Levenstein
111499d2bf Merge pull request #12256 from swiftix/sil-serialize-all-improvments
Remove the -sil-serialize-all option
2017-10-05 22:03:41 -07:00
Michael Ilseman
94970496ba Merge pull request #12306 from milseman/spooky_bit_masques
[shims] Move bit masks to SwiftShims and include/swift/ABI.
2017-10-05 20:12:19 -07:00
Michael Ilseman
3d04fb5eac [shims] Move bit masks to SwiftShims and include/swift/ABI.
Move bits mask from Metadata.h to SwiftShims's HeapObject.h. This
exposes the bit masks to the stdlib, so that the stdlib doesn't have
to have its own magic numbers per-platform. This also enhances
readability for BridgeObject, whose magic numbers are mostly derived
from Swift's ABI.
2017-10-05 16:31:43 -07:00
Ben Cohen
e3a4ca22d5 [stdlib] Implement slice Indices using their base Indices (#12277)
* Implement slice Indices using their base Indices

* Fix expected type test for Slice
2017-10-05 10:46:04 -07:00
Karoy Lorentey
7dabd3ee1a Merge pull request #12249 from lorentey/rdar/34672149
[stdlib] Dictionary.Keys, .Values: Implement Custom[Debug]StringConvertible
2017-10-05 11:31:14 +01:00
Slava Pestov
c272d41e2f Re-apply "SIL: Remove special meaning for @_semantics("stdlib_binary_only")"
With -sil-serialize-all gone, this no longer means anything; just
don't declare the function as @_inlineable instead.

Fixes <rdar://problem/34564380>.
2017-10-04 14:07:52 -07:00
Jordan Rose
aab5f7aa4f Revert "SIL: Remove special meaning for @_semantics("stdlib_binary_only")" (#12270)
It still affects StdlibUnittest, which is still using -sil-serialize-all.
2017-10-04 12:49:21 -07:00
Karoy Lorentey
4ff5a41061 [stdlib] Dictionary.Keys, .Values: Implement Custom[Debug]StringConvertible.
This prevents a crash while printing these collections.

Resolves:
https://bugs.swift.org/browse/SR-6003
rdar://problem/34672149
2017-10-04 12:40:00 +01:00
Karoy Lorentey
e4ef5203d2 [stdlib] Extract Array._makeDescription into standalone function
This enables its use for collection types unrelated to Arrays.
Use the new function to replace Set’s implementation of
Custom[Debug]StringConvertible.
2017-10-04 12:40:00 +01:00
Slava Pestov
aed8c33a93 Merge pull request #12237 from slavapestov/kill-stdlib-binary-only
SIL: Remove special meaning for @_semantics("stdlib_binary_only")
2017-10-03 15:25:50 -07:00
Ben Cohen
31c1d8d52e Remove no-longer-used _Incrementable protocol (#12251) 2017-10-03 15:08:18 -07:00
Ben Cohen
aacb1edc7d Constrain AnySubSequence variants of Sequence methods (#12029) 2017-10-03 14:17:25 -07:00
Slava Pestov
0fad13eeba SIL: Remove special meaning for @_semantics("stdlib_binary_only")
With -sil-serialize-all gone, this no longer means anything; just
don't declare the function as @_inlineable instead.

Fixes <rdar://problem/34564380>.
2017-10-03 13:48:22 -07:00
swift-ci
2844583d7f Merge pull request #12229 from moiseev/resilience-fix 2017-10-02 16:01:27 -07:00
Max Moiseev
a24998a5b1 [stdlib] Add missing @_fixed_layout attributes to fix resilience build 2017-10-02 15:19:06 -07:00
Arnold Schwaighofer
cc176ef8d9 stdlib: Fix an assert that triggers after uniqueness hoisting
makeUnique hoisting can create a situation where we hit an assert in
_reserveCapacityAssumingUniqueBuffer that the buffer is not unique if we use
_makeMutableAndUniqueOrPinned to replace
_makeUniqueAndReserveCapacityIfNotUnique.

It is actually fine do to the replacement because we will make the buffer unique
_reserveCapacityAssumingUniqueBuffer if the capacity is zero so adjust the
assert accordingly.

do {
  if (someCond) {
    // array.append(...)
    _makeUniqueAndReserveCapacityIfNotUnique(&array)
    _reserveCapacityAssumingUniqueBuffer(&array)
    _appendElementAssumeUniqueAndCapacity(&array, …)
  } else {
   // array[i] = …
   _makeMutableAndUniqueOrPinned(&array)
   addr = _getElementAddress(&array)
   store 1, addr
  }
} while();

to:

_makeMutableAndUniqueOrPinned(&array) // does not replace empty arrays.
do {
  if (someCond) {
    // array.append(...)
    _reserveCapacityAssumingUniqueBuffer(&array) // hit the assert.
    _appendElementAssumeUniqueAndCapacity(&array, …)
  } else {
   // array[i] = …
   addr = _getElementAddress(&array)
   store 1, addr
  }
} while();

Tested by the performance test if we build the stdlib with assertions.

rdar://34149935
2017-10-02 14:23:17 -07:00