Commit Graph

1760 Commits

Author SHA1 Message Date
Slava Pestov
ce0b51cc9b Update resilience annotations in stdlib for recent changes
The new indexing model and floating point stuff was missing a few
annotations, causing a build failure with -enable-resilience.
2016-05-11 22:51:33 -07:00
Stephen Canon
772d7ec3c5 Merge branch 'SE-0067' of https://github.com/stephentyrone/swift into stephentyrone-SE-0067
Implements almost all of SE-0067. There are a few outstanding features; this implementation does not have:

- formRemainder(dividingBy:)
- formSquareRoot()
- addProduct(_:,_:)

which require additions to the Builtin module. I can probably figure out how to do these, but I haven't had a chance to do so yet. Also missing are the generic initializers and comparisons whose implementation depends on having new Integer protocols.

The last remaining feature of SE-0067 is that while the basic operators +,-,*,/, etc are moved onto the FloatingPoint protocol, they are still required on the concrete types in order to disambiguate overloads. Fixing this seems to require either modifying the overload resolution rules or removing these operators from some other protocols. Or it might just require that someone smarter than me looks at the problem.

Passes the existing tests locally (with the included changes). I'm working on additional tests for the new features.
2016-05-11 22:11:21 -04:00
swift-ci
df4d93901f Merge pull request #2490 from kballard/flatten-seealso-joinWithSeparator 2016-05-11 18:10:56 -07:00
Max Moiseev
4027afa536 [stdlib] fixing the signature of RandomAccessCollection.index(_:offsetBy:limitedBy:) and uncommenting the test 2016-05-11 17:27:49 -07:00
swift-ci
b56c15a08e Merge pull request #2461 from russbishop/fork/master 2016-05-11 16:20:42 -07:00
Kevin Ballard
83c113c11e [Stdlib] Update the SeeAlso docs for flatten()
flatten() was still referencing `joinWithSeparator(_:)` even though
that's now been renamed to `joined(separator:)`.
2016-05-11 16:01:41 -07:00
Stephen Canon
71e7767346 Make sure @_transparent and @warn_unused_result are on operators where appropriate. 2016-05-11 18:08:23 -04:00
Russ Bishop
7dc71d0d96 Rename generic arguments 2016-05-11 13:44:37 -07:00
Stephen Canon
a5e87c8792 Fix crasher due to out-of-range initializer on 32b. 2016-05-11 09:21:40 -04:00
Russ Bishop
b7329df146 Cleanup comments for flatMap overloads 2016-05-11 00:27:59 -07:00
Russ Bishop
408e8c738b Remove RandomAccess overloads and types 2016-05-11 00:27:59 -07:00
Dmitri Gribenko
405fb1339d Merge pull request #2329 from Nirma/sequence_fix
[stdlib] Simplification of split function
2016-05-10 21:40:17 -07:00
Chris Lattner
4cf5613406 Merge pull request #2460 from dakeshi/stdlib-core-array-structure
[stdlib] Fix print method syntax and add the optional binding
2016-05-10 20:12:24 -07:00
Sangjoon-Moon
b49b5c4fb3 Fix print method syntax and revert whitespace
* Remove terminator argument in print method because the default terminator is "\n".
* Revert removed trailing whitespace by the previous commit
2016-05-11 10:08:49 +09:00
Dmitri Gribenko
de8fb07052 stdlib: add unavailable methods on string indices to make migration to Swift 3 easier 2016-05-10 11:34:51 -07:00
Sangjoon-Moon
d2c273b7f4 Fix code syntax error. 2016-05-10 20:43:14 +09:00
Russ Bishop
1afa93b646 [stdlib] SR-361: Implement SE008: Add Lazy flatMap for Seq of Optionals
https://bugs.swift.org/browse/SR-361

Adds required LazyFilterRandomAccessCollection and the flatMap extensions.
2016-05-10 02:42:57 -07:00
Sangjoon-Moon
1dce37e0e1 * Fix print(_:separator =) with print(_:separator:terminator)
* Add optional binding for using optional first, last property
2016-05-10 17:38:32 +09:00
Stephen Canon
63759a4a9e Remove comparison operators from concrete types, since they're now provided by FloatingPoint. 2016-05-09 21:16:55 -04:00
amartini51
55be501ad6 Merge pull request #2429 from natecook1000/nc-revise-core
[stdlib] Revise documentation for core types and protocols
2016-05-09 17:13:46 -07:00
Max Moiseev
5345128c74 [stdlib] workaround for CustomPlaygroundQuickLookable in UIView subclasses 2016-05-09 17:07:15 -07:00
Stephen Canon
6802c5e263 Restore public on top-level operators, mark -- and ++ unavailable for CGFloat. 2016-05-09 18:35:52 -04:00
Nate Cook
9f326385d6 [stdlib] Revise documentation for core types and protocols
This adds to and expands upon documentation for some core parts of the
standard library, including Optional, ErrorProtocol, AnyObject, and Bool.
2016-05-09 16:41:20 -05:00
Stephen Canon
dd1f116cc3 Reinstate Strideable, switch static lets to @inline(__always). 2016-05-09 16:19:40 -04:00
Stephen Canon
3609b690c0 Restore _to/_fromBitPattern for compatability, but mark deprecated. 2016-05-09 12:44:35 -04:00
Stephen Canon
6429eabf74 Implement the new FloatingPoint protocols from SE-0067.
There are a couple of features that are not yet implemented, because they require additions to the Builtin module.  Specifically, this implementation does not have:

- formRemainder(dividingBy:)
- formSquareRoot()
- addProduct(_:,_:)

Also missing are the generic initializers and comparisons whose implementation depends on having new Integer protocols.

The last remaining feature of SE-0067 is that while the basic operators +,-,*,/, etc are moved onto the FloatingPoint protocol, they are still required on the concrete types in order to disambiguate overloads.  Fixing this seems to require either modifying the overload resolution rules or removing these operators from some other protocols.  Or it might just require that someone smarter than me looks at the problem.

Passes all the existing tests (with the included changes).  I'm working on additional tests for the new features.
2016-05-09 10:34:13 -04:00
Doug Gregor
b4a58650dd [SE-0033] Add _SwiftNewtypeWrapper protocol for swift_newtype'd types.
This protocol lets us identify swift_newtype'd types. More
importantly, use protocol extensions to make it easy to transfer
specific conformances from the underlying type to the wrapper
type. So, for example, if the underlying type is Hashable, make the
wrapper type Hashable as well. Do the same for Equatable, Comparable,
and _ObjectiveCBridgeable. Fixes rdar://problem/26010804.
2016-05-08 22:34:39 -07:00
Nicholas Maccharoli
efb340c228 [stdlib] Simplification of split function 2016-05-08 22:23:37 +09:00
practicalswift
68b148cfb1 [gardening] Fix recently introduced typos. 2016-05-06 20:31:38 +02:00
practicalswift
1a4cf40a30 [gardening] Fix recently introduced top of file headers. 2016-05-06 19:56:26 +02:00
Roman Levenstein
b55564228f Fix some Set-related performance regressions introduced by the new indexing model.
Implement the FIXME and perform only one lookup instead of two.

rdar://26129485
2016-05-06 07:25:08 -07:00
Dmitri Gribenko
fbba722195 stdlib: replace _ascii8() with UInt8(ascii:) 2016-05-04 16:34:38 -06:00
John McCall
50d58b2732 Add a lot of calling-convention annotations to the standard library / runtime.
The general rule here is that something needs to be SWIFT_CC(swift)
if it's just declared in Swift code using _silgen_name, as opposed to
importing something via a header.

Of course, SWIFT_CC(swift) expands to nothing by default for now, and
I haven't made an effort yet to add the indirect-result / context
parameter ABI attributes.  This is just a best-effort first pass.

I also took the opportunity to shift a few files to just implement
their shims header and to demote a few things to be private stdlib
interfaces.
2016-05-04 10:31:23 -07:00
Nate Cook
62955b0d3b [stdlib] Fix copypasto 2016-05-04 10:19:12 -05:00
swift-ci
909c63d433 Merge pull request #2388 from apple/stdlib-collectionofone-fixes-tests 2016-05-04 02:13:11 -07:00
Arnold Schwaighofer
093070986a Don't create a longer lifetime for the value then necessary.
NFC
2016-05-03 20:14:50 -07:00
Dmitri Gribenko
f82ca83a68 stdlib: CollectionOfOne: fixes for index movement and tests 2016-05-03 18:44:34 -07:00
Roman Levenstein
4544cd196e Fix an off-by-one error in the condition of the index method. 2016-05-03 17:07:06 -07:00
Roman Levenstein
47eecbdcf0 Fix some Array-related performance regressions introduced by the new indexing model.
This is a manual specialization of index movement functions for a Strideable index that is required for Array performance.
The optimizer is not capable of creating partial specializations yet.

rdar://25946325
2016-05-03 17:07:06 -07:00
Chris Willmore
af0c7bd620 Initial implementation of SE-0054 "Abolish IUO Type" (#2322)
This is a squash of the following commits:

* [SE-0054] Import function pointer arg, return types, typedefs as optional

IUOs are only allowed on function decl arguments and return types, so
don't import typedefs or function pointer args or return types as IUO.

* [SE-0054] Only allow IUOs in function arg and result type.

When validating a TypeRepr, raise a diagnostic if an IUO is found
anywhere other thn the top level or as a function parameter or return
tpye.

* [SE-0054] Disable inference of IUOs by default

When considering a constraint of the form '$T1 is convertible to T!',
generate potential bindings 'T' and 'T?' for $T1, but not 'T!'. This
prevents variables without explicit type information from ending up with
IUO type. It also prevents implicit instantiation of functions and types
with IUO type arguments.

* [SE-0054] Remove the -disable-infer-iuos flag.

* Add nonnull annotations to ObjectiveCTests.h in benchmark suite.
2016-05-03 14:06:19 -07:00
Mark Lacey
e03d334b68 Use Builtin.unreachable() in unavailable functions.
Saves a bit of code size in the standard library by eliminating some
static strings and function calls.

rdar://problem/25767016
2016-05-02 21:30:25 -07:00
Dave Abrahams
0e38795c29 [stdlib] Fix SIL verification error 2016-05-02 16:14:31 -07:00
practicalswift
06fe6b0424 Merge pull request #2358 from practicalswift/a-vs-an-fixes
[gardening] Fix "a" vs. "an" issues.
2016-05-02 23:21:15 +02:00
Dave Abrahams
3105ef9bf1 [stdlib] Fixing a duplicate declaration bug 2016-05-02 12:02:27 -07:00
Dave Abrahams
0d68b3a4af [stdlib] Generate RandomAccessCollection defaults
The defaults we were generating for Collection and
BidirectionalCollection didn't make any sense, because if you could do
that strideable arithmetic then you essentially had random access.
Instead we constrain the defaults to apply to RandomAccessCollection
where the Indices are a CountableRange.
2016-05-02 11:35:32 -07:00
Dmitri Gribenko
c594b1d331 EmptyCollection: fixes for index movement and more tests 2016-05-02 11:08:57 -07:00
Max Moiseev
1e501ddd9f [stdlib] copying fixed doc comments from Indexable to Collection 2016-05-02 09:45:56 -07:00
Dave Abrahams
c99f59e3e6 [stdlib] Suppress some warnings
internal structs shouldn't have public members: nag, nag.
2016-05-02 09:20:55 -07:00
Dave Abrahams
8d809993be [stdlib] Use CountableRange for Indices more
This will be much more efficient than the default, when it applies,
because it doesn't need to carry a reference to underlying collection
storage.
2016-05-01 19:42:40 -07:00
Dave Abrahams
2ea3db0443 [stdlib] More RandomAccessCollection conformances
I missed a few the first time around.
2016-05-01 18:37:45 -07:00