Commit Graph

378 Commits

Author SHA1 Message Date
Nate Cook
e2328885c1 [stdlib] Dictionary/Set enhancements
A variety of enhancements from SE-154 and SE-165:

- Custom Keys and Values collections for Dictionary
- Two sequence-based Dictionary initializers
- Merging methods for Dictionary
- Capacity checking and reserving for Dictionary and Set
- Type-specific filter(_:) methods for Dictionary and Set
- A mapValues(_:) method for Dictionary
- A grouping Dictionary initializer
2017-04-26 11:21:16 -05:00
practicalswift
ca72b12287 [gardening] Remove accidental \t:s 2017-04-02 16:03:54 +02:00
Doug Gregor
cc225eb9fa [Stdlib] Silence all warnings about deprecated @objc inference.
This eliminates 26 Objective-C entry points that we never intended to expose, but that came “for free” with the @objc inference rules.
2017-03-31 21:53:55 -07:00
Philippe Hausler
bb674fe75a Merge pull request #6421 from phausler/dictionary_bridge_perf
Add a fast-path case for enumeration of keys and objects for bridged Dictionaries
2017-03-28 08:36:55 -07:00
Doug Gregor
388f0c505e [Stdlib] Eliminate explicit constraints made redundant by inferred ones. 2017-03-22 17:35:12 -07:00
Roman Levenstein
29ad714bb7 Annotate stdlib functions to get a good performance even in resilient mode, when -sil-serialize-all is disabled
This commit mostly improves the performance of arrays and ranges.
It does not cover Strings, Dictionaries and Sets yet.
2017-03-16 19:46:11 -07:00
Nate Cook
c25bf40c26 [stdlib] Various documentation improvements
* Revise type(of:)
* Revise withoutActuallyEscaping(_:do:)
* Add slicing / index sharing to Collection
* Other cleanups
2017-02-07 23:02:41 -06: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
Slava Pestov
d65d1d25f9 Sema: Diagnostics for @_inlineable, @_versioned and Swift 4 default arguments model
Piggybacks some resilience diagnostics onto the availability
checking code.

Public and versioned functions with inlineable bodies can only
reference other public and internal entities, since the SIL code
for the function body is serialized and stored as part of the
module.

This includes @_transparent functions, @_inlineable functions,
accessors for @_inlineable storage, @inline(__always) functions,
and in Swift 4 mode, default argument expressions.

The new checks are a source-breaking change, however we don't
guarantee source compatibility for underscored attributes.

The new ABI and tests for the default argument model will come in
subsequent commits.
2017-01-09 16:59:13 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Ben Cohen
28114baeb9 Flag various FIXMEs as ABI-impacting 2017-01-03 18:36:20 -08:00
practicalswift
ce7a10474f [gardening] Fix accidental double and triple spaces. 2016-12-21 22:13:56 +01:00
Philippe Hausler
7d01c5d851 Add a fast-path case for enumeration of keys and objects for bridged Dictionaries 2016-12-20 15:16:48 -08:00
Diego Torres
7168a9ea6a Resolve unnecessary buffer copy in HashedCollections 2016-12-11 21:54:09 +01: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
Alexis Beingessner
28656578be Merge pull request #5850 from Gankro/empty
[runtime] statically initialize the empty Dictionary and Set singletons
2016-11-19 16:51:48 -05:00
Alexis Beingessner
ae648c1564 Merge pull request #5840 from Gankro/docit
minor cleanup in HashedCollections
2016-11-18 17:53:54 -05:00
Alexis Beingessner
21405f1ac1 [runtime] statically construct the Dictionary and Set singletons 2016-11-18 13:56:57 -05:00
Slava Pestov
9a4c0488ba stdlib: SetIndex and DictionaryIndex can now be nested types of Set and Dictionary
Resolves ABI FIXME #34 and <rdar://problem/17002096>.
2016-11-18 00:39:15 -08:00
Alexis Beingessner
8caa9f4cd1 minor cleanup in HashedCollections 2016-11-17 13:33:15 -05:00
Alexis Beingessner
7536b9420e Merge pull request #5722 from Gankro/unmanaged
Resolve ABI FIXME#158
2016-11-16 16:42:25 -05:00
swift-ci
67f4ae078b Merge pull request #5723 from natecook1000/nc-fixes-05 2016-11-15 16:47:20 -08:00
Alexis Beingessner
ad0a9daf8f Resolve ABI FIXME#158 2016-11-15 17:36:21 -05:00
Slava Pestov
ba72188927 stdlib: Fix resilient build 2016-11-14 18:03:11 -08:00
Nate Cook
bd6025f463 [stdlib] Various documentation fixes
- Fix incorrect type in Float(_:String) examples
- Expand discussions for ExpressibleBy_Literal protocols
- Add notes about non-escaping unsafe pointers from closures
- Add note about isEmpty to Collection.count discussions
- Describe imported `Bool` types
- Clean up some floating point discussions
- Provide some additional operator documentation
- Revise documentation for CVarArg functions
- Fix incorrect Set method parameter descriptions
- Clarify array bridging behavior
- Add collection subscript complexity notes
2016-11-11 11:23:49 -06:00
Alexis Beingessner
9ad14ea890 WIP fix resilience build 2016-11-08 19:12:26 -05:00
Alexis Beingessner
5fdd0c7b5b revert _CocoaDictionaryBuffer indexing design
The use of a lazy var crashes the swift module (de)serializer.
2016-11-07 21:28:24 -05:00
practicalswift
4552fc8f88 [gardening] Use American English: "behaviour" → "behavior" 2016-11-05 20:33:57 +01:00
practicalswift
debeebaa3a [gardening] Fix recently introduced typo: "nsenumator" → "nsenumerator" 2016-11-05 20:32:25 +01:00
Alexis Beingessner
e4c5e159c9 remove useless constant redefinition 2016-11-04 03:17:13 -04:00
Alexis Beingessner
3cdc8ec444 remove buffer header to eliminate optional traps 2016-11-04 02:44:29 -04:00
Alexis Beingessner
931f7ba658 actually used the cached keys/values pointer 2016-11-04 01:19:50 -04:00
Alexis Beingessner
5e776e5e39 cleanup initializers in HashedCollections 2016-11-04 01:19:50 -04:00
Alexis Beingessner
428cdac57c leave FIXME for future dictionary bucaneers 2016-11-04 01:01:35 -04:00
Alexis Beingessner
a62f6c6a89 Fix incorrect bitcasts, refactor code to guard against this error. 2016-11-04 01:01:35 -04:00
Alexis Beingessner
b4d97776d8 more comment cleanups 2016-11-04 01:01:35 -04:00
Alexis Beingessner
731aa1494b Properly if-def out bridging code. 2016-11-03 19:55:36 -04:00
Alexis Beingessner
bb0b4be7ac Update comment to clarify why it's interesting, link a relevant impl. 2016-11-03 19:55:36 -04:00
Alexis Beingessner
8eea522e9c rename storage type to be more useful 2016-11-03 19:52:30 -04:00
Alexis Beingessner
b1425ce78b remove _'s from some variables that don't need it 2016-11-03 19:52:30 -04:00
Alexis Beingessner
41fb15f042 rename Buffer <---> Storage in HashedCollections to match conventions 2016-11-03 19:52:30 -04:00
Alexis Beingessner
3144870e86 add new toll-free bridge fast-paths to HashedCollections 2016-11-03 19:52:30 -04:00
Alexis Beingessner
a43c1dfba0 Some minor cleanups in HashedCollections:
* rename bridgingStorage to bridged
* add a missing fixLifetime
* remove useless temporary
2016-11-03 19:52:30 -04:00
Alexis Beingessner
f12d7914e8 update comments in HashedCollections to reflect new design 2016-11-03 19:52:30 -04:00
Alexis Beingessner
052e94a34a refactor HashedCollections to support verbatim bridging 2016-11-03 19:52:30 -04:00
Alexis Beingessner
d179655952 refactor Dictionary to support an empty singleton 2016-11-03 19:52:30 -04:00
Alexis Beingessner
953e51a97e [stdlib] Handle some outstanding Dictionary indexing-model FIXMEs/TODOs 2016-10-29 10:04:35 -04:00
Alexis Beingessner
b08732cbd4 [stdlib] Update Dictionary comments to reflect new design 2016-10-29 10:04:35 -04:00
Alexis Beingessner
76c6281fea [stdlib] Rewriting native hashed collection indices
Changes:
- Native dictionary and set indices no longer hold references to storage
- Cocoa-based dictionary and set indices no longer hold references to storage
- Removed double indirection trick from hashed collections
- Rewrote storage types to reflect simpler model
- Updated unit tests
2016-10-29 10:04:35 -04:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00