Commit Graph

222 Commits

Author SHA1 Message Date
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
Max Moiseev
27889c6376 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-06 15:54:44 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Ben Cohen
465f243943 Move += operator for append(contentsOf:) up to RangeReplaceableCollection 2017-01-05 11:59:49 -08:00
Ben Cohen
fefc2e40df Migrate _copyContents to be called from UnsafeMutableBufferPointer with checks for overrun. 2017-01-05 11:59:49 -08:00
Ben Cohen
4dc5eacef5 Merge branch 'master' into im-not-warning-you-again 2017-01-05 10:11:48 -08:00
JP Simard
65688bdc39 [gardening] replace unused closure parameters with '_' in stdlib source (#6522)
* replace unused closure parameters with '_' in stdlib source

* fold some _ closure arguments into line above

* fold more _ closure arguments into line above
2017-01-03 20:10:41 -07:00
ben-cohen
adf56d1435 supress function-arg-before-defaulted-arg warning 2016-12-29 10:49:14 -08:00
ben-cohen
ce0d713cd6 fixed where clauses, Optional-as-Any and unused vars 2016-12-29 07:58:12 -08:00
Max Moiseev
7afd9bbdef Making StdlibUnittest compile in absense of + on Strideable 2016-12-02 15:21:51 -08:00
Max Moiseev
70b2343626 Merge branch 'master' into new-integer-protocols 2016-11-28 15:25:01 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Max Moiseev
76e0a99a37 Merge branch 'master' into new-integer-protocols 2016-10-31 09:29:19 -07:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Max Moiseev
ea8e0f0e15 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-09-21 14:48:35 -07:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00
Dmitri Gribenko
243a35cd65 Migrate callsites from 'expectEmpty()' to 'expectNil()' 2016-09-10 20:05:42 -07:00
Dmitri Gribenko
92c180031f stdlib: make 'Sequence.first(where:)' a pure protocol extension (no dynamic dispatch)
SE-0032 did not propose a protocol entry point, only a protocol
extension.

Using a pure protocol extension is the right choice here because a
concrete sequence can't provide a more efficient implementation of this
method than the default one.
2016-09-09 11:30:55 -07:00
Dmitri Gribenko
6b4427b573 StdlibUnittest: expose cartesianProduct() helper 2016-09-06 20:41:03 -07:00