Commit Graph

291 Commits

Author SHA1 Message Date
Max Moiseev
3bace08f9a Revert "[stdlib] Improve default implementation of Collection.distance(from:to:)"
This reverts commit 72948cae9a.
2017-12-07 14:28:19 -08:00
Max Moiseev
72948cae9a [stdlib] Improve default implementation of Collection.distance(from:to:) 2017-12-06 18:19:34 -08:00
Ben Cohen
85d190cd7d [stdlib] Replace various uses of BlahSlice with Slice to reduce warnings (#13263)
* Kill the slice variants from the gybbed collection test types

* Handful more SDK instances

* Fix SequencesCollections.swift.gyb
2017-12-05 19:09:56 -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
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
Roman Levenstein
5047e1b475 Enable the serialization of sil_vtables by default and completely remove the -sil-serialize-vtables option
Only sil_vtables of public classes with fixed layout are serialized.
2017-10-21 11:36:12 -07:00
Roman Levenstein
48d9b99675 Remove -sil-serialize-witness-tables flag completely
The functionality is always enabled now and there is no need to have a dedicated flag for it.
2017-10-20 19:45:29 -07:00
Roman Levenstein
5e67f755e0 Remove the -sil-serialize-all option 2017-10-04 14:20:53 -07:00
Doug Gregor
42968b2069 Eliminate a number of uses of the *Indexable protocols. 2017-10-01 15:08:23 -07:00
Doug Gregor
52eb618abc [Collections] Constrain Indices type to Collection.
Make the Indices types conform to the appropriate Collection protocol:
* Collection.Indices: Collection
* BidirectionalCollection.Indices: BidirectionalCollection
* RandomAccessCollection.Indices: RandomAccessCollection
2017-10-01 15:08:22 -07:00
Doug Gregor
44572644d3 [Unit test library] Remove redundant constraints. 2017-10-01 15:08:22 -07:00
Doug Gregor
6b51806b54 [SE-0157] Make *Collection.SubSequence conform to corresponding *Collection.
Introduce (recursive) constraints that make the *Collection constraint
of SubSequence match that of its enclosing *Collection, e.g.,
MutableCollection.SubSequence conforms to MutableCollection.

Fixes rdar://problem/20715031 and more of SR-3453.
2017-10-01 15:08:22 -07:00
Doug Gregor
e5f893bc59 [Sequence] Make Sequence.SubSequence conform to Sequence.
Addressed ABI FIXME’s #4, #5, #104 and #105, making Sequence’s
SubSequence conform to Sequence, with the same element type, and for
which the SubSequence of a SubSequence is the same SubSequence.

Fixes SR-318 / rdar://problem/31418206.
2017-10-01 15:08:22 -07:00
Doug Gregor
0793f6c8c5 Revert "[Sequence] Make Sequence.SubSequence conform to Sequence."
This reverts commit 7dc8737c9c.
2017-09-14 09:12:56 -07:00
Doug Gregor
7dc8737c9c [Sequence] Make Sequence.SubSequence conform to Sequence.
Addressed ABI FIXME’s #4, #5, #104 and #105, making Sequence’s
SubSequence conform to Sequence, with the same element type, and for
which the SubSequence of a SubSequence is the same SubSequence.

Fixes SR-318 / rdar://problem/31418206.
2017-09-12 06:52:01 -07:00
Mark Lacey
b64551b853 [stdlib] Restore signatures to use UnsafeMutableBufferPointer.
Resolves rdar://problem/21933004.
2017-08-31 22:33:36 -07:00
Dave Abrahams
c497969987 [stdlib] Swift4 Modernizations Compatible with Swift 3.2 2017-07-14 17:54:33 -07:00
Dave Abrahams
5f0b33f04d [stdlibunittest] _Element => Element 2017-05-31 15:56:57 -07:00
Dave Abrahams
4dee6ead5c [stdlib] Provisional c[...] syntax while we await language features 2017-05-12 22:14:17 -07:00
Ben Cohen
c03b14e93f Revert "Merge pull request #9379 from airspeedswift/redundant-where"
95e9681d10
2017-05-11 11:43:54 -07:00
ben-cohen
e4af80d39c Remove redudant constraints to supress warnings 2017-05-07 11:30:01 -07:00
practicalswift
861f70e13d [gardening] Use consistent spacing 2017-04-25 21:03:43 +02:00
Doug Gregor
13f6c79b2a [Stdlib] For Collections, the SubSequence of a Subsequence is SubSequence.
Part of ABI FIXME #99, this gives us some nice consistency that
ensures that slicing a SubSequence gives us another SubSequence. There
are two source-compatibility implications to this change:

* Collections now need to satisfy this property, which could not be
  expressed in Swift 3. There might be some Collections that don't
  satisfy this property, and will break with the Swift 4 compiler
  *even in Swift 3 compatibility mode*. Case in point...
* The Lazy collection types were formulated as a lazy collection of
  the base slice (e.g., LazyCollection<ArraySlice<T>>) rather than as
  a slice of the lazy collection (e.g.,
  Slice<LazyCollection<Array<T>>). The former doesn't meet the new
  requirements, so change to the latter.
2017-04-20 13:18:32 -07:00
Doug Gregor
5eebd08791 [StdlibUnittest] Remove a number of extraneous same-type constraints. NFC 2017-04-20 00:17:15 -07:00
Doug Gregor
29a15ce402 [Stdlib] Apply SE-0142 to fix ABI FIXME #92, part of ABI FIXME #99. 2017-04-19 23:15:33 -07:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
Max Moiseev
9b53efd72c Merge branch 'master' into new-integer-protocols 2017-04-17 09:53:44 -07:00
practicalswift
bb822285b4 [gardening] Remove comparison to true 2017-04-14 17:33:24 +02:00
Dave Abrahams
1f7ec57b04 Merge pull request #1527 from codestergit/master
[Stdlib] Improves Collection.sort  to accept throwing closure
2017-04-11 18:03:17 -07:00
Andrew Trick
30f2cce1b6 Do not run recursive O(n^2) collection slice testing on large collections.
Now, even with collection unit testing wired up, the validation tests
take the same amount of time to execute.
2017-04-06 17:12:18 -07:00
Andrew Trick
42e43f7ea0 Add sliceability tests for Unsafe(Raw)BufferPointer.
Improve the generic sliceability tests to verify that SubSequence indices are
compatible with their parents indices.
2017-04-06 17:12:18 -07:00
Andrew Trick
da0c4db530 Fix and enable testing stdlib Collection instances.
Top-level entry points fully testing a collection instance:
check${Traversal}Collection

One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).

Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.

Fixes a bug in subscriptRangeTests.

The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.
2017-04-06 17:12:18 -07:00
Andrew Trick
849421799a Revert "SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)"
This reverts commit 1d32586d28.
2017-04-06 10:38:52 -07:00
Max Moiseev
8fe28b4e32 Merge branch 'master' into new-integer-protocols 2017-04-06 10:22:37 -07:00
Andrew Trick
1d32586d28 SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)
* Add sliceability tests for Unsafe(Raw)BufferPointer.

Improve the generic sliceability tests to verify that SubSequence indices are
compatible with their parents indices.

* Fix and enable testing stdlib Collection instances.

Top-level entry points fully testing a collection instance:
check${Traversal}Collection

One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).

Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.

Fixes a bug in subscriptRangeTests.

The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.

* Give UnsafeRawBufferPointer a distinct slice type.

SubSequence = RandomAccessSlice<Self>

* Fix raw buffer pointer tests after changing the API

* Add UnsafeRawBuffer(rebasing:) initializers.

Allows converting a raw slice into a zero-based raw buffer,
which is a common operation on flat memory.

Add and update UnsafeRawBufferPointer unit tests.

* Do not run recursive O(n^2) collection slice testing on large collections.

Now, even with collection unit testing wired up, the validation tests
take the same amount of time to execute.

* Add init(rebasing:) to UnsafeBufferPointer.

This is required for consistency with UnsafeRawBufferPointer.

* Update CHANGELOG.md for SE-0138 amendment: UnsafeRawBufferPointer slice type.
2017-04-06 10:08:09 -07:00
codestergit
aa9e9edc8a [Stdlib] Improves sort and sorted to accept throwing clousre
This commit resolves https://bugs.swift.org/browse/SR-715
2017-04-03 16:59:02 +05:30
Max Moiseev
2c9be47551 Merge branch 'master' into new-integer-protocols 2017-03-23 16:46:01 -07:00
Doug Gregor
ab5d88ec29 [Stdlib unit test] Eliminate redundant explicit constraints. 2017-03-22 17:35:14 -07:00
Doug Gregor
c4cf38f2e7 [Stdlib unit test] Fix random access overload of makeBufferAccessLoggingMutableCollection(wrapping:) 2017-03-22 17:35:12 -07:00
Max Moiseev
b9fb3badc8 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-03-22 12:30:24 -07:00
Doug Gregor
cad49e66c4 [Unit test library] Eliminate redundant conformance requirements. 2017-03-17 21:53:17 -10:00
Michael Gottesman
8437819b5a [CMake] Revert recent changes.
These changes caused a number of issues:

1. No debug info is emitted when a release-debug info compiler is built.
2. OS X deployment target specification is broken.
3. Swift options were broken without any attempt any recreating that
functionality. The specific option in question is --force-optimized-typechecker.

Such refactorings should be done in a fashion that does not break existing
users and use cases.

This reverts commit e6ce2ff388.
This reverts commit e8645f3750.
This reverts commit 89b038ea7e.
This reverts commit 497cac64d9.
This reverts commit 953ad094da.
This reverts commit e096d1c033.

rdar://30549345
2017-02-15 22:26:06 -08:00
Chris Bieneman
e096d1c033 [CMake] Simplify add_swift_library
This patch splits add_swift_library into two functions one which handles
the simple case of adding a library that is part of the compiler being
built and the second handling the more complicated case of "target"
libraries, which may need to build for one or more targets.

The new add_swift_library is built using llvm_add_library, which re-uses
LLVM's CMake modules. In adapting to use LLVM's modules some of
add_swift_library's named parameters have been removed and
LINK_LIBRARIES has changed to LINK_LIBS, and LLVM_LINK_COMPONENTS
changed to LINK_COMPONENTS.

This patch also cleans up libswiftBasic's handling of UUID library and
headers, and how it interfaces with gyb sources.

add_swift_library also no longer has the FILE_DEPENDS parameter, which
doesn't matter because llvm_add_library's DEPENDS parameter has the same
behavior.
2017-02-14 14:28:10 -08:00
Max Moiseev
ab1422b8ef [tests] Fixing mixed-type arithmetics warnings in the test suite 2017-02-03 15:50:31 -08:00
Max Moiseev
d128ed42b0 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-19 14:16:32 -08:00
Matthew Carroll
0e09bbbb83 [DiagnosticsQoI] SR-3359: Add a fix-it to remove @discardableResult on functions that return Void or Never (#6681)
This commit adds a fix-it to remove @discardableResult on functions that return Void or Never. The fix-it is at the warning level. A test was added to verify that the fix-it removes the @discardableResult. This issue was reported in SR-3359:
https://bugs.swift.org/browse/SR-3359

Changes:
TypeCheckAttr.cpp: implemented AttributeChecker::visitDiscardableResultAttr to add a fix-it to remove @discardableResult on functions returning Void or Never.

DiagnosticsSema.def: Added a warning with a diagnostic message.

LoggingWrappers.swift.gyb, HashedCollections.swift.gyb: Removed @discardableResult on functions returning Void.

fixits-apply-all.swift, fixits-apply-all.swift.result: Added tests to verify that @discardableResult is removed from functions returning Void or Never.
2017-01-11 15:12:36 -08:00
Max Moiseev
aecccc7e48 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-09 17:38:04 -08:00
Ben Cohen
578a52627a Merge branch 'master' into se-147 2017-01-07 13:19:15 -08:00
Ben Cohen
3bdada1773 Merge pull request #6506 from airspeedswift/im-not-warning-you-again
[stdlib] Squash various warnings
2017-01-06 16:51:06 -08:00