Commit Graph

2952 Commits

Author SHA1 Message Date
Michael Ilseman
8b5777fdd2 [stdlib] Bug fix in reverse ASCII grapheme breaking
Fix a bug using wrong index calculations in the ASCII grapheme
breaking fast path. Add new test case.
2017-04-20 16:22:18 -07:00
Michael Ilseman
8ff9bb602f [stdlib] Speed up char iteration on ASCII strings.
By doing a fast check for CR-LF, we can speed up forwards and
backwards character iteration on ASCII strings by ~2-3x. This speedup
can be seen in the stringTests suite (previous PR).

It is done as a fast path inside of
_measureExtendedGraphemeClusterForward/Backward, which is never
inlined. Doing the fast path inline would yield even more dramatic
improvements, and might be an area for future exploration, but would
slightly pessimize non-ASCII strings due to code bloat. Additionally,
the current implementation has not been micro-optimized yet. It's
possible that more optimal code would be smaller and have less of an
impact on the general case.
2017-04-20 16:22:18 -07:00
Doug Gregor
70ee642072 [Stdlib] Eliminate LazyFilterIndex.
Eliminate the vestigial type `LazyFilterIndex`, which was
necessary pre-Swift-3 to allow the index to move. Swift 3's indexing
model means that the movement of indices is on the collection itself,
so we no longer need `LazyFilterIndex`: instead, the `Index` type of
the lazy filtered collection is simply the `Index` type of the base
collection, which is a nice convenience: it means you can take indices
from a lazy wrapper around a given collection C and use them with the
collection C (and, with care, vice-versa) without jumping through
extra hoops.
2017-04-20 16:15:41 -07:00
Doug Gregor
583d567705 Merge pull request #8888 from DougGregor/the-subsequence-of-my-subsequence
[Stdlib] For Collections, the SubSequence of a Subsequence is SubSequence
2017-04-20 15:46:37 -07:00
Dave Abrahams
d3ad565b33 [stdlib] Clean up warnings 2017-04-20 14:08:57 -07: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
Maxim Moiseev
10da98abb9 Merge pull request #8851 from moiseev/integer-fixes
[stdlib] A few Swift 3 compatibility fixes
2017-04-20 10:45:02 -07:00
Maxim Moiseev
e25da82b15 Merge pull request #8863 from moiseev/resilience
[stdlib] _fixed_layout for ArithmeticOverflow
2017-04-20 10:30:25 -07:00
Nate Cook
8c15c72dfa [stdlib] Minor documentation fixes
* Revise `withExtendedLifetime(_:_:)`
* Correct method in UnsafeMutablePointer discussion
* `Sequence.filter(_:)` documentation fixes
2017-04-20 12:23:17 -05:00
Joe Groff
c742f88434 Work around a bug in the closure specializer with methods that return Self and take closure arguments (rdar://problem/31725007) 2017-04-20 08:53:55 -07:00
swift-ci
0f4ebfd66e Merge pull request #8593 from DougGregor/stdlib-se-0142 2017-04-20 00:49:04 -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
Doug Gregor
d1d4238c40 [Stdlib] Remove ABI FIXMEs #94 and #96, which are consequences of other FIXMEs.
There isn't any work related to SE-0142 associated type where clauses
for these particular ABI FIXMEs. Rather, we get all of the constraints
we need from Collection and the recursive constraint we cannot yet
express, all of which are covered by other ABI FIXMEs.
2017-04-19 23:15:32 -07:00
Doug Gregor
0dd1da35d4 [Stdlib] Use SE-0142 to address ABI FIXMEs #68, #89, #90, #91.
Address ABI FIXME #68 by using same-type constraints directly on an
associated type to describe the requirements on the Indices associated
type of the Collection protocol. ABI FIXMEs #89, #90, #91 are all in
StdlibUnittest, and provoke warnings once #68 is fixed, but it's nice
to clear them out.

Fixes SR-2121.
2017-04-19 23:15:32 -07:00
Joe Groff
595e0e4ede Merge branch 'master' into keypaths 2017-04-19 18:38:24 -07:00
Max Moiseev
e611911cc3 [stdlib] _fixed_layout for ArithmeticOverflow
Fixes: <rdar://problem/31702435>
2017-04-19 11:59:04 -07:00
Max Moiseev
a1cb7a8d73 [stdlib] Removing redundand requirement 2017-04-19 11:24:59 -07:00
Max Moiseev
3101c4f8e3 [stdlib] Arithmetic operators on floating point types to static funcs 2017-04-19 11:24:59 -07:00
Max Moiseev
fe6d9255c1 [stdlib] _sizeInBits and _sizeInBytes for Swift 3 source compatibility 2017-04-19 11:24:58 -07:00
Max Moiseev
b41dd17edd [stdlib] Swift 3 XXXWithOverflow methods for integers 2017-04-19 11:24:58 -07:00
Max Moiseev
830b2edf54 [stdlib] Check overflow in integer init from literal
Fixes: <rdar://problem/29911715>
And partially: <rdar://problem/29937936>
2017-04-19 11:06:26 -07:00
Joe Groff
a6cd471c2b IRGen/stdlib: Instantiate non-generic computed key path components. 2017-04-18 21:51:12 -07:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
Joe Groff
0bb83bb185 KeyPaths: Support out-of-place instantiation of generic key paths. 2017-04-17 22:36:26 -07:00
Max Moiseev
8ca814cc8c Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-04-17 14:40:20 -07:00
Max Moiseev
b7f715f7e5 Fixing the iOS test failures 2017-04-17 14:05:34 -07:00
Max Moiseev
71b2c1fb41 Adding Swift 3 alias for _SignedInteger 2017-04-17 11:01:59 -07:00
Max Moiseev
192c11217f Adding arithmetic methods to FloatingPoint for Swift 3 mode 2017-04-17 10:43:40 -07:00
Max Moiseev
9b53efd72c Merge branch 'master' into new-integer-protocols 2017-04-17 09:53:44 -07:00
Dave Abrahams
6177af57dd [stdlib] Eliminate redundant capacity reservation
append(contentsOf:) already reserves capacity.
2017-04-15 22:00:28 -07:00
Max Moiseev
7b98267d78 Fixing the unicode tests by removing the potential optimization 2017-04-14 17:03:26 -07:00
Max Moiseev
8de33b4824 Overloads for +/- on Strideable for Swift 3 compatibility mode 2017-04-13 17:29:42 -07:00
Max Moiseev
54e5f5d741 Handling the differences in << and >> for Swift 3 vs Swift 4
In Swift 3 shifts used to be defined on the concrete integer types, so
the right-hand-side value in the shift expression could define a type
for the result, as in `1 << i32` would have the type Int32. Swift 4
makes shift operators heterogeneous, so now `1 << i32` will result in an
Int, according to the type of the left-hand-side value, which gets a
default type for integer literals.
2017-04-13 15:34:32 -07:00
Max Moiseev
bc7918b94c Commenting out deprecated +/- on Strideable 2017-04-12 17:03:30 -07:00
swift-ci
967e2d9653 Merge pull request #8721 from natecook1000/nc-fixes-73-1 2017-04-12 10:33:53 -07:00
Arnold Schwaighofer
69e6f07167 Merge pull request #8701 from aschwaighofer/wip_ast_silgen_const_string_literal
AST/SILGen support for constant string literals
2017-04-12 09:52:18 -07:00
Nate Cook
909c4c8714 [stdlib] Fix Collection discussion typo 2017-04-12 00:14:53 -05: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
Max Moiseev
3d7ddc53c9 More typealiases for Swift 3 protocols 2017-04-11 17:05:22 -07:00
Max Moiseev
def49e8fa4 Adding SignedInteger.&+ and &- for source compatibility 2017-04-11 17:05:21 -07:00
Arnold Schwaighofer
4d60ec333b AST/SILGen support for constant string literals
rdar://30545013
2017-04-11 11:41:43 -07:00
Dave Abrahams
9b0e80079c [stdlib] EmptyCollection: release-mode checks-=10
These checks weren't protecting memory safety; let's see if benchmarks go faster without them in release mode.
2017-04-10 16:01:17 -07:00
Max Moiseev
d30a2f95e6 Adding non-masking shifts on concrete types 2017-04-10 15:18:21 -07:00
Max Moiseev
cb82daa282 Speculatively replacing a couple more transparent's with inline-always'es 2017-04-10 13:43:02 -07:00
Joe Groff
39a0849362 SILGen: Codegen for key path applications. 2017-04-09 16:38:34 -07:00
Max Moiseev
dfc8c65dca Adding overloads for << and >> with the literal on the left-hand side 2017-04-07 13:56:40 -07:00
Max Moiseev
9bf43d632f Arithmetic operators for Strideable where Stride : ExpressibleByIntegerLiteral for compatibility 2017-04-07 11:41:23 -07:00
Max Moiseev
5b613b3f44 Adding deprecated mixed-type arithmetic operators for Strideable & SignedInteger for compatibility 2017-04-07 11:41:22 -07:00
Max Moiseev
ed90d8c908 Adding a few Swift 3 compatibilty APIs 2017-04-07 11:41:22 -07:00
Joe Groff
85ad6b355e Merge branch 'master' into keypaths 2017-04-06 18:02:07 -07:00