Commit Graph

3744 Commits

Author SHA1 Message Date
Nate Cook
04518afde3 [stdlib] Add conditional Hashable conformance for indices 2017-11-28 13:29:55 -06:00
Nate Cook
6c66cf3e61 [stdlib] Make stdlib index types Hashable
This adds Hashable conformance for the String, Dictionary,
and Set's index types.
2017-11-28 13:29:55 -06:00
Saleem Abdulrasool
0c42b57962 ELF: restructure image metadata registration
Restructure the ELF handling to be completely agnostic to the OS.
Rather than usng the loader to query the section information, use the
linker to construct linker tables and synthetic markers for the
beginning and of the table.  Save off the values of these pointers and
pass them along through the constructor to the runtime for registration.

This removes the need for the begin/end objects.  Remove the special
construction of the begin/end objects through the special assembly
constructs, preferring to do this in C with a bit of inline assembly to
ensure that the section is always allocated.

Remove the special handling for the various targets, the empty object
file can be linked on all the targets.

The new object file has no requirements on the ordering.  It needs to
simply be injected into the link.

Name the replacement file `swiftrt.o` mirroring `crt.o` from libc.  Merge
the constructor and the definition into a single object file.

This approach is generally more portable, overall simpler to implement,
and more robust.

Thanks to Orlando Bassotto for help analyzing some of the odd behaviours
when switching over.
2017-11-28 10:04:04 -08:00
Huon Wilson
39e0a951b8 [stdlib] Make Optional, Array and Dictionary conditionally Equatable. 2017-11-27 21:09:49 -08:00
Max Moiseev
3730115af2 Merge pull request #13062 from natecook1000/nc-dw-string
[stdlib] Improve large integer support
2017-11-27 16:09:24 -08:00
Guillaume Lessard
4427a66da8 [gardening] fix an inconsistency
This doc-comment's two paragraphs said in the first that the memory must be uninitialized before assignment, while in the second that it cannot be uninitialized.
2017-11-27 10:09:08 -07:00
Xiaodi Wu
2a5b0d4a61 Disable conditional conformance of Stride{To|Through} 2017-11-25 12:49:59 -06:00
Xiaodi Wu
06ef6736d5 Add conditional conformance for Stride{To|Through} 2017-11-25 12:31:54 -06:00
Xiaodi Wu
94e3677033 Remove uninhabitable _DisabledRangeIndex_ type 2017-11-25 11:52:08 -06:00
Xiaodi Wu
c53dc66de8 Simplify Strideable._step 2017-11-25 11:50:00 -06:00
Xiaodi Wu
d3fe5ac264 Support fused multiply-add and remove buggy Collection conformance in floating-point strides 2017-11-25 11:44:18 -06:00
Nate Cook
abb75bca1a Allow large integer literals for DoubleWidth 2017-11-24 22:48:35 -06:00
Nate Cook
390d4464ad Support larger integers in String(_:radix:) 2017-11-24 22:16:30 -06:00
Pavel Yaskevich
090acade11 [stdlib] Remove iterator type workaround from ClosedRange
After changes to stdlib and type-checker related to removing
of the `_Strideable` it's now possible to properly support
iterator types for *ClosedRange without any workarounds.

Resolves: rdar://problem/25584401
2017-11-23 18:51:35 -08:00
Jonathan Hagberg
81bf571989 Removes superfluous 'the' in documentation 2017-11-21 18:22:11 -08:00
Hamish
12416f94bb [stdlib] Don't use autoclosure on pointerToValue(forKey:insertingDefault:) methods
Previously we used @autoclosure on the _VariantDictionaryBuffer methods and forwarded closures directly.
However, this relied on an unintentional type-checker inconsistency, tracked by SR-5719.
2017-11-21 17:51:00 +00:00
Philip Ridgeway
6926fd3412 Removes a superfluous "the" in a documentation comment. 2017-11-20 11:04:04 -08:00
Hamish
76ea3a2ca4 [stdlib] Fix uniqueness check in nativePointerToValue(forKey:insertingDefault:)
The reasoning for this change is detailed in PR-13000.
2017-11-19 22:37:05 +00:00
Hamish
79d8209ffa [stdlib] Use addressor for Dictionary's subscript(_:default:) 2017-11-19 15:45:27 +00:00
swift-ci
53ddcb5079 Merge pull request #13000 from gottesmm/pr-6a0399e1ebd7ccad1979a2af165d0b09595fb2cb 2017-11-18 20:55:27 -08:00
Michael Gottesman
89cefe0a70 [stdlib] Use a different access pattern to check uniqueness to work around more conservative SILGen codegen.
Using && here causes us to go down a SILGen path that guarantees that self will
be evaluated over the entire && expression instead of just the LHS. This cause
the uniqueness check to always return false at -Onone. At -O, the optimizer is
smart enough to remove this issue.

rdar://33358110
2017-11-18 20:16:28 -07:00
taylor swift
c85880899d implement SE 184: add allocation methods to Unsafe buffer pointers, drop all parameters from deallocation, adjust namings, and add repeated-value assignment methods 2017-11-17 21:28:03 -08:00
Doug Gregor
9f1cd0bf6b [Stdlib] Move _OptionalNilComparisonType operators into an extension on Optional.
Because global operators are “meh”.
2017-11-17 20:41:43 -08:00
Huon Wilson
48baa3f472 [stdlib] Move Array and Optional == and != into static methods. 2017-11-17 16:09:20 -08:00
Joe Groff
925d6f61d3 Merge pull request #12796 from linux-on-ibm-z/master_s390x_KeyPath
fixed test case KeyPath.swift for s390x
2017-11-17 09:35:01 -08:00
Pavel Yaskevich
57ccdf7423 Merge pull request #12520 from xedin/remove-strideable
[stdlib] changes to remove `_Strideable` protocol.
2017-11-16 19:06:40 -08:00
Pavel Yaskevich
98c6a7e127 [stdlib] Add + overload to LazyMapCollectionProtocol in Swift 3 mode
This overload is needed to re-enable Swift 3 source compatibility
related to a bugfix in ranking behavior of the constraint solver.
2017-11-16 13:38:24 -08:00
Pavel Yaskevich
b5584e0b1f [stdlib] Add contains(_ element:) Countable{Closed}Range
Solution ranking always prefers methods declared on concerete type
vs. in protocol extension, which means in order to to disambiguite
expressions like `(0 ..< 42).contains(7)` we need to have `contains(_:)`
method on both `Range` and `CountableRange` declared explicitly, that
ensures that `CountableRange` is prefered since `Strideable` inherits
from `Comparable` which makes it "more specialized".
2017-11-16 13:38:24 -08:00
Ben Cohen
35452c2e62 [stdlib] Remove _Strideable protocol 2017-11-16 13:38:24 -08:00
Greg Parker
1e894cd80b [runtime] Clean up symbols in error machinery. (#12853)
* [runtime] Clean up symbols in error machinery.

* [runtime] Clean up symbols in Foundation overlay.

* [runtime] Clean up symbols in collections and hashing.

* [runtime] Remove symbol controls from the Linux definition of swift_allocError.

* [tests] Add more stub functions for tests that link directly to the runtime.
2017-11-15 22:20:11 -08:00
Greg Parker
e8475cc130 Revert "Use conditional conformances to implement Equatable for Optional, Array and Dictionary" 2017-11-15 14:17:22 -08:00
Stephen Canon
c7f1df4da6 Fix the value of Float80.pi (#12881)
Currently this is implemented as Float80(literal), which gets interpreted as Float80(Double(literal)), unfortunately. Switch to the correct spelling: literal as Float80.

Resolves rdar://problem/35459284
2017-11-15 09:32:20 -08:00
Doug Gregor
e9b7336d44 [Stdlib] Move _OptionalNilComparisonType operators into an extension on Optional.
Because global operators are “meh”.
2017-11-14 16:23:20 -08:00
Huon Wilson
8524379352 [stdlib] Make Optional, Array and Dictionary conditionally Equatable. 2017-11-14 16:23:20 -08:00
Max Moiseev
759aad57c1 Merge pull request #12640 from moiseev/strides
[stdlib] Implement StrideTo and StrideThrough collections [WIP]
2017-11-13 14:15:09 -08:00
Max Moiseev
9b98303a95 Temporarily add an O(N) underestimatedCount to StrideTo and StrideThrough 2017-11-09 14:42:04 -08:00
Max Moiseev
67763cd92d Mark Stride collections as internal while waiting for conditional conformances 2017-11-09 11:16:06 -08:00
Sam Ding
1c2b2eb1ad fixed test case KeyPath.swift for s390x 2017-11-09 16:44:22 +00:00
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