Commit Graph

7767 Commits

Author SHA1 Message Date
Jordan Rose
25985cb764 [Mangling] Uniformly use "So" for imported decls.
...and repurpose "SC" for (C)lang-importer-synthesized decls, instead
of just decls that are C-like instead of ObjC-like. (See next commits.)
2017-04-24 09:57:30 -07:00
swift-ci
cd262be2c6 Merge pull request #8955 from DougGregor/associated-type-override-hints 2017-04-24 09:11:38 -07:00
Doug Gregor
225a26d25d [Stdlib] Don't redeclare the Magnitude associated type unnecessarily.
Just use a where clause on the protocol to add requirements.
2017-04-24 08:11:22 -07:00
Maxim Moiseev
1c1b2b966d [stdlib] String : RangeReplaceableCollection & BidirectionalCollection (#8921)
* [stdlib] String : RangeReplaceableCollection & BidirectionalCollection

* Add source compatibility hack for Swift.max

* Add source compatibility hack for Swift.min

* Remove redundant conformance in benchmarks

* Fix stupid typo I thought I'd already pushed

* XFAIL testing now-redundant conformance

* XFAIL an IDE test for now
2017-04-23 20:04:54 -07:00
Slava Pestov
8a0b4b0c5c Keypaths: Remove workaround for rdar://problem/31725007 2017-04-23 01:49:02 -07:00
swift-ci
da909998a2 Merge pull request #8673 from apple/empty-collection-debugPrecondition 2017-04-22 21:55:33 -07:00
swift-ci
1817776574 Merge pull request #8837 from natecook1000/nc-fixes-74-1 2017-04-22 20:38:54 -07:00
Andrew Bennett
ca31338e49 Simplifying implementation of ExpressibleByStringLiteral (#7125)
* Simplify conforming to ExpressibleByStringLiteral with default implementations

* attributes on default implementations

* ExpressibleByUnicodeScalarLiteral validation test

* more generic default implementations

* clean up test

* remove unneeded implementations

* remove test verification

* indent

* revert @effects and affected methods

* fix test generics with _ protocols

* Add semantic tests

* clean up tests

* Fix redundant conformance requirements
2017-04-21 20:45:28 -07:00
Joe Groff
3d178be169 Merge pull request #8875 from jckarter/keypaths
Keypaths
2017-04-21 17:51:17 -07:00
Ben Cohen
9733d50db4 Add Swift 3 compatibility versions of String.init for Signed/UnsignedInteger (#8926) 2017-04-21 17:30:31 -07:00
Joe Groff
d5cdf658da KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths. 2017-04-21 16:56:17 -07:00
Ben Cohen
5494424b9a Correct UnsafeBufferPointer's Collection.makeIterator, add _copyContents (#8902) 2017-04-21 15:53:51 -07:00
Michael Ilseman
659260d5a0 Merge pull request #8870 from milseman/string_character_iteration
[stdlib] Speed up char iteration on ASCII strings.
2017-04-21 11:48:55 -07:00
swift-ci
a477006cb9 Merge pull request #8884 from apple/clean-up-warnings 2017-04-20 19:49:26 -07:00
Joe Groff
fd8d488662 Work around an optimizer bug with inlining generic functions invoked with opened archetypes (rdar://problem/31749245) 2017-04-20 19:21:16 -07:00
swift-ci
42c150cfb7 Merge pull request #8900 from DougGregor/lazy-filter-index 2017-04-20 17:31:19 -07:00
Michael Ilseman
87e0076272 [stdlib] un-_fastPath ASCII path, it implies coldness of other branch
By removing the _fastPath inside of grapheme breaking, we avoid
cooling off all the other blocks in the function, restoring
performance parity with before the ASCII special case logic. This does
not meaningfully impact the performance of the special case, so we are
still about 2-3x faster iterating forwards and backwards over ASCII
characters than before.
2017-04-20 16:53:53 -07:00
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
practicalswift
c79af78a7f Merge pull request #8878 from practicalswift/gardening-20170420
[gardening] Remove unused diagnostics. Fix end of namespace comments. Match parameter name. Use override as appropriate.
2017-04-20 21:52:15 +02: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
Joe Groff
39f1a59049 Fix Linux build. 2017-04-20 08:53:20 -07:00
practicalswift
431e5a1440 [gardening] Use consistent end of namespace comments 2017-04-20 13:47:10 +02:00
swift-ci
0f4ebfd66e Merge pull request #8593 from DougGregor/stdlib-se-0142 2017-04-20 00:49:04 -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
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
swift-ci
20dcfcb425 Merge pull request #8860 from moiseev/unsigned-minus-one 2017-04-19 11:50:53 -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
Philippe Hausler
c2d5ffda94 Merge pull request #8814 from phausler/faster_NSFastEnumerationIterator
[Foundation] Rework NSFastEnumerationIterator to be more performant
2017-04-18 12:25:28 -07:00
Max Moiseev
e15b7ccf5d [stdlib] Swift 3 compatibility methods on Decimal 2017-04-18 11:45:35 -07:00
John McCall
7a4c761426 Merge pull request #8821 from rjmccall/dynamic-enforcement-vol-1
Basic dynamic enforcement of exclusivity
2017-04-18 13:57:54 -04:00
John McCall
6c16cfaa14 Implement a basic dynamic-enforcement runtime and teach IRGen to use it. 2017-04-18 11:23:43 -04: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