Commit Graph

3606 Commits

Author SHA1 Message Date
Max Moiseev
409c2437a4 Remove the GYB artifact from [NFC] 2017-11-30 18:51:34 -08:00
Ben Cohen
dcab9493ae Removed some warnings (#12753) 2017-11-30 15:12:56 -08:00
samding01
e1db602212 Fix VarArgs.swift test case for s390x (#12792) 2017-11-30 14:08:52 -08:00
Doug Gregor
33de34bc38 Merge pull request #13178 from DougGregor/coding-conditional-conformances
[Coding] Make Codable conformances for Optional and collections conditional.
2017-11-30 13:43:30 -08:00
Saleem Abdulrasool
9ea988f22d Merge pull request #12758 from compnerd/ELF-registration
ELF registration Restructuring
2017-11-30 11:20:53 -08:00
Doug Gregor
89343e2c98 [Coding] Make Codable conformances for Optional and collections conditional.
Array, Set, Dictionary, and Optional all provide unconditional conformances
to Encodable & Decodable that dynamically check whether their type arguments
are Encodable/Decodable. Now that we have conditional conformances, make
these unconditional conformances properly conditional, removing all of
the Swift 4-era type-erasure hacks.

Fixes rdar://problem/34989162.
2017-11-30 11:06:29 -08:00
Ben Cohen
c4f0b5fe94 [stdlib] Adopt conditional conformance for Indices, Slice, ReversedCollection (#12913)
* Refactor Indices and Slice to use conditional conformance

* Replace ReversedRandomAccessCollection with a conditional extension

* Refactor some types into struct+extensions

* Revise Slice documentation

* Fix test cases for adoption of conditional conformances.

* [RangeReplaceableCollection] Eliminate unnecessary slicing subscript operator.

* Add -enable-experimental-conditional-conformances to test.

* Gruesome workaround for crasher in MutableSlice tests
2017-11-30 09:10:22 -08:00
Christian Bieniak
ec0d53f96f [stdlib] [SR-4005] Allow heterogenous comparisons in elementsEqual (#8045)
* [SR-4005] Allow heterogenous comparisons in elementsEqual

When a user is supplying a predicate to compare the type equivalence
isn’t required

* elementsEqualWithPredicate tests

Compares a string of a number with an integer value by using the
elementsEqualPredicate closure

* Update test expectations to use new sequence element types

* Update hardcoded test to reference sequence
2017-11-29 17:06:38 -08:00
Max Moiseev
66f8a9bbe0 Merge pull request #13007 from xwu/fused-multiply-add-stride
[stdlib] Eliminate intermediate rounding error in floating-point strides (and related gardening)
2017-11-29 11:35:14 -08:00
swift-ci
cdab55a202 Merge pull request #13124 from DougGregor/se-0143-experimental-flag 2017-11-28 16:59:27 -08:00
Doug Gregor
b59c30c1af [SE-0143] Put conditional conformances behind an "experimental" flag.
Conditional conformances aren't quite ready yet for Swift 4.1, so
introduce the flag `-enable-experimental-conditional-conformances` to
enable conditional conformaces, and an error when one declares a
conditional conformance without specifying the flag.

Add this flag when building the standard library (which will vend
conditional conformances) and to all of the tests that need it.

Fixes rdar://problem/35728337.
2017-11-28 16:01:51 -08:00
Hamish
4b3f0374c8 [stdlib] Don't check for native when known native in ensureNativeBuffer() 2017-11-28 19:34:01 +00:00
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