Commit Graph

7762 Commits

Author SHA1 Message Date
Dave Abrahams
b650ca7b6d [stdlib] Fix a bug in advance(start, n, end)
Long-standing bug: it didn't work for random access indices
when start == end!

Swift SVN r29982
2015-07-08 18:37:11 +00:00
Erik Eckstein
facf122848 stdlib: replace some overflow with non-overflow additions/subtractions in hashed collections.
This removes some unneeded overflow checks in the loop which iterates over the buckets.



Swift SVN r29975
2015-07-08 15:29:20 +00:00
Doug Gregor
c410bce986 We cannot validate a declaration while its context is being type-checked.
Fixes rdar://problem/21538521 and a few crashers.

Swift SVN r29957
2015-07-08 04:21:51 +00:00
Jordan Rose
1edf9b3ae8 Check access for associated type requirements, too.
This is a straight-up "oops". You could always get to these typealiases via
the protocol, but like the member requirements you should have to say so.

Swift SVN r29952
2015-07-08 00:43:37 +00:00
Arnold Schwaighofer
8517b7ba08 Revert "Un-XFAIL test on Linux."
Revert "simd overlay: Use LLVM vector types."

This reverts commit r29922 and r29924.

More arm64 instruction selection errors.

rdar://21703486

Swift SVN r29941
2015-07-07 16:45:08 +00:00
David Farler
4d17bf0691 Remove SinkType and SinkOf
Remove these standard library types in favor of (T) -> () closures.

It was originally believed that generic optimizations would make these
types profitable, however:

// FIXME: Insert benchmarks here.

rdar://problem/21663799

Swift SVN r29927
2015-07-07 00:36:12 +00:00
Joe Groff
9a23fa9040 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Reapplying now that Nadav's fixed the ARM64 SelectionDAG issue this exposed before.

Swift SVN r29922
2015-07-06 22:56:42 +00:00
David Farler
402bbd3813 RangeReplaceableCollectionType review changes
- Clean up tests
  - Create API-specific test structures with clearer labels
  - Use `OpaqueValue`s in test collections
  - Make tests non-generic to allow array literal declarations
  - Remove some unused functions
  - Test return values for mutating functions that return a value
  - Add expect* test source locations
- Add _customRemoveLast ad-hoc default implementation for `removeLast`
- Add default implementation for reserveCapacity that does nothing.

Swift SVN r29905
2015-07-03 02:14:22 +00:00
Dave Abrahams
fb241acf6f [stdlib] kill __ArrayType
Swift SVN r29895
2015-07-02 18:47:05 +00:00
Joe Groff
e692c87bbf Revert "simd overlay: Use LLVM vector types."
This reverts commit r29891. It causes an LLVM assertion failure in SelectionDAG on appletvos-arm64.

Swift SVN r29893
2015-07-02 17:31:34 +00:00
Joe Groff
8103dfb825 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Swift SVN r29891
2015-07-02 17:05:29 +00:00
Dmitri Hrybenko
1edcc49ff9 stdlib: remove Slice.Element typealias
It is misleading in generic code.  A testcase that was failing:

  expectEqualType(C.Generator.Element.self, Slice<C>.Element.self)

Swift SVN r29887
2015-07-02 06:44:38 +00:00
Jordan Rose
d0a6713f66 [stdlib] Make some typealiases more public, since they're used in public ways.
The next commit will start enforcing this.

Swift SVN r29862
2015-07-01 23:34:35 +00:00
Dave Abrahams
59997efa2a [stdlib] Make _CollectionWrapperType usable
It was neither testable (because it was internal) nor usable (because in
practice models would be full of ambiguities with methods provided in
extensions for CollectionType.

Swift SVN r29859
2015-07-01 22:51:37 +00:00
David Farler
438119d558 Fold ExtensibleCollectionType into RangeRaplaceableCollectionType
ExtensibleCollectionType's operations can all be represented by the
primitive range replacement operation, so fold it into
RangeReplaceableCollectionType.

In addition, provide default implementations of
RangeReplaceableCollectionType's methods.

- New tests added for combinations of (static, generic) calls and
  (default, custom) implementations.
- Mark free Swift functions as unavailable with a message to direct the
  developer to the protocol methods.
- Mark ExtensibleCollectionType as available with a message added to
  direct the developer to the right protocol.

rdar://problem/18220295

Swift SVN r29857
2015-07-01 22:33:04 +00:00
Dmitri Hrybenko
a3f74461fb stdlib: remove an explicit Slice.generate(), it is supplied by a protocol extension
Swift SVN r29848
2015-07-01 18:44:59 +00:00
Dmitri Hrybenko
fc0fa96371 stdlib: de-underscore Indexable and add tests for it
Swift SVN r29847
2015-07-01 18:31:31 +00:00
Dmitri Hrybenko
76f5706b50 stdlib: de-underscore the Slice type and add tests for it
Swift SVN r29846
2015-07-01 18:31:29 +00:00
Dmitri Hrybenko
80b1380fe8 stdlib: fold Sliceable into CollectionType and de-underscore SubSequence
Swift SVN r29845
2015-07-01 18:31:25 +00:00
Dmitri Hrybenko
4eb24da01b stdlib: underscore MirrorType
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29833
2015-07-01 04:05:48 +00:00
Dmitri Hrybenko
9da16e592e stdlib: underscore reflect() and unsafeReflect()
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29826
2015-07-01 00:31:39 +00:00
Dmitri Hrybenko
8d79d9e142 stdlib: underscore MirrorDisposition
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29825
2015-07-01 00:31:37 +00:00
Dmitri Hrybenko
6bc93d4d79 stdlib: finish renaming QuickLookObject to PlaygroundQuickLook
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29824
2015-07-01 00:31:35 +00:00
Dmitri Hrybenko
7ee84ed6b3 stdlib: rename Reflectable.{getMirror() -> _getMirror()}
Start removing the old mirrors.

rdar://21428474

Swift SVN r29823
2015-07-01 00:31:32 +00:00
Dave Abrahams
80ebf972f0 [stdlib] Add _SequenceWrapperType and _CollectionWrapperType
These form an important part of the basis of the new lazy sequence
system.  Tests for _CollectionWrapperType are currently blocked on
<rdar://problem/21599265>

Swift SVN r29814
2015-06-30 22:36:46 +00:00
Chris Lattner
bb4e2ad80b Eliminate the ability to 'if' branch directly on a Builtin.Int1 value, instead
always require BooleanType.  It isn't necessary and it is in the way of progress.


Swift SVN r29812
2015-06-30 22:10:14 +00:00
Dmitri Hrybenko
ad81277931 stdlib: remove Set<T>.GeneratorType
This API was added by mistake, and the type alias should have been
called ``Generator``.  In fact, a nested type alias is already inferred
to satisfy the associated type ``Generator`` in Set's ``SequenceType``
conformance.

rdar://20171363

Swift SVN r29796
2015-06-29 22:43:53 +00:00
Dmitri Hrybenko
82122f9362 stdlib: fixit-based migrations for generic parameter renames
rdar://21538940

Swift SVN r29756
2015-06-27 04:06:27 +00:00
Dave Abrahams
f77d6d47a0 [stdlib] Quick fix
Missed updating Slice.swift in my last commit.

Swift SVN r29727
2015-06-26 01:36:45 +00:00
Dave Abrahams
8e0b5bd553 [stdlib] Cleanups based on commit-list feedback
Thanks, Dmitri!

Swift SVN r29724
2015-06-26 01:15:50 +00:00
Dave Abrahams
fefc726ed0 [stdlib] Use a clearer protocol conformance
...now that Doug heroically fixed rdar://21546738

Swift SVN r29722
2015-06-26 01:15:49 +00:00
Dave Abrahams
f646b7016a [stdlib] Add missing parameter name
Swift SVN r29721
2015-06-26 01:15:48 +00:00
Dave Abrahams
d73cbf525b [stdlib] Add missing comments
Swift SVN r29720
2015-06-26 01:15:48 +00:00
Dave Abrahams
68dc42f350 [stdlib] Move IndexingGenerator for readability.
Swift SVN r29719
2015-06-26 01:15:47 +00:00
Dave Abrahams
65179cf143 [stdlib] Add missing comment.
Swift SVN r29718
2015-06-26 01:15:46 +00:00
Dave Abrahams
1c5f805074 [stdlib] Protocol Extension-ize CollectionType
Eliminates _CollectionDefaultsType and _CollectionGeneratorDefaultsType
and creates sanity that should allow us to Protocol Extension-ize the
lazy operations, which have been blocked on inscrutable errors due in
part to the existing complexity.

Note: names beginning with "_prext_" are intended to be public after API
review and removal of the "_prext_" prefix.

Swift SVN r29689
2015-06-25 21:34:28 +00:00
Dave Abrahams
79bd9b3e7e [stdlib] Move "first" _CollectionDefaultsType -> CollectionType
Swift SVN r29684
2015-06-25 21:34:22 +00:00
Dmitri Hrybenko
63fb583294 stdlib: fix coding style in Interval.swift.gyb
Swift SVN r29643
2015-06-24 20:42:10 +00:00
Dmitri Hrybenko
dc2f89fe44 stdlib: fix coding style in Unmanaged.swift
Swift SVN r29642
2015-06-24 20:42:10 +00:00
Dmitri Hrybenko
0d954c3b24 stdlib: rename the generic parameter from T to Instance on Unmanaged
Part of rdar://21429126

Swift SVN r29641
2015-06-24 20:42:09 +00:00
Dmitri Hrybenko
4e9b6b803d stdlib: rename generic parameters from T to Bound on intervals
Changes HalfOpenInterval and ClosedInterval.

Part of rdar://21429126

Swift SVN r29640
2015-06-24 20:42:08 +00:00
Dmitri Hrybenko
4cdf37a68b stdlib: rename the generic parameter from T to Element on unsafe pointers
Fixed AutoreleasingUnsafeMutablePointer, UnsafePointer,
UnsafeMutablePointer.

Part of rdar://21429126

Swift SVN r29637
2015-06-24 20:42:04 +00:00
Dmitri Hrybenko
ba208cd672 stdlib: rename zip generator and collection to a common naming convention
// Renamed from `ZipGenerator2`.
  struct Zip2Generator<Generator1 : GeneratorType, Generator2 : GeneratorType> { ... }

  // Renamed from `Zip2`.
  struct Zip2Sequence<Sequence1 : SequenceType, Sequence2 : SequenceType> { ... }

Part of rdar://21429126

Swift SVN r29636
2015-06-24 20:42:03 +00:00
Dmitri Hrybenko
60ba7be3d1 stdlib: rename the generic parameter from T to Element on GeneratorSequence
Part of rdar://21429126

Swift SVN r29635
2015-06-24 20:42:02 +00:00
Dmitri Hrybenko
71022a46c1 stdlib: rename mapping sequence and collection wrappers to a common naming convention
struct ReverseIndex<Base : BidirectionalIndexType> { ... }
  struct ReverseRandomAccessIndex<Base : RandomAccessIndexType> { ... }

  // Renamed from `BidirectionalReverseView`.
  struct ReverseCollection<Base : CollectionType where T.Index : BidirectionalIndexType> { ... }

  // Renamed from `RandomAccessReverseView`.
  struct ReverseRandomAccessCollection<Base : CollectionType where T.Index : RandomAccessIndexType> { ... }

Also fixed a bug (found by the new tests I added in this commit) in
LazyRandomAccessCollection.reverse(), which mistakenly returned a bidirectional
reversed collection.

Part of rdar://21429126

Swift SVN r29634
2015-06-24 20:42:01 +00:00
Dmitri Hrybenko
deac6d7020 stdlib: rename generic parameters from T to Element
... for LazySequence, LazyForwardCollection, LazyBidirectionalCollection,
LazyRandomAccessCollection.

Part of rdar://21429126

Swift SVN r29633
2015-06-24 20:42:01 +00:00
Dmitri Hrybenko
c2162f097f stdlib: rename mapping sequence and collection wrappers to a common naming convention
// Renamed from `MapSequenceGenerator`.
  struct MapGenerator<Base : GeneratorType, Element> { ... }

  // Renamed from `MapSequenceView`.
  struct MapSequence<Base : SequenceType, Element> { ... }

  // Renamed from `MapCollectionView`.
  struct MapCollection<Base : CollectionType, Element> { ... }

Part of rdar://21429126

Swift SVN r29632
2015-06-24 20:42:00 +00:00
Dmitri Hrybenko
6be11fe711 stdlib: rename filtering sequence and collection wrappers to a common naming convention
// Renamed from `FilterSequenceView`.
  struct FilterSequence<Base : SequenceType> { ... }

  // Renamed from `FilterCollectionViewIndex`.
  struct FilterCollectionIndex<Base : CollectionType> { ... }

  // Renamed from `FilterCollectionView`.
  struct FilterCollection<Base : CollectionType> { ... }

Part of rdar://21429126

Swift SVN r29630
2015-06-24 20:41:59 +00:00
Dmitri Hrybenko
fdd73a57b4 stdlib: add tests for generic parameter names on EnumerateGenerator,
EnumerateSequence

Part of rdar://21429126

Swift SVN r29629
2015-06-24 20:41:58 +00:00
Dmitri Hrybenko
9dff1aa407 stdlib: rename generic parameters from T to Element
... for AnyGenerator, AnySequence, AnyForwardCollection,
AnyBidirectionalCollection, AnyRandomAccessCollection.

Part of rdar://21429126

Swift SVN r29628
2015-06-24 20:41:57 +00:00