Commit Graph

371 Commits

Author SHA1 Message Date
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
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
Dave Abrahams
22f5dfa50a Merge pull request #5264 from shajrawi/idasany_perf
improve set's conditional downcast performance by over 2X
2016-10-19 12:13:02 -07:00
Dave Abrahams
76b5afcc4a Speed up Set/Dictionary init from Sequence
Alternative to #5264
2016-10-19 10:23:22 -07:00
Joe Shajrawi
eeae7e1f8c improve set's conditional downcast performance by over 2X 2016-10-12 16:27:54 -07:00
Slava Pestov
fab574c3a7 stdlib: Add some @_versioned declarations to fix resilient build
A recent change made accessibility checking stricter. This had some
fallout on the half-baked @_versioned attribute, where we could no
longer define @_versioned members on a non-@_versioned type.

This was wrong anyway (and will be diagnosed when we add proper
diagnostics for @_versioned), because type metadata for the
internal type did not get the right linkage, but it used to work
as long as you didn't try to get the type metadata at runtime.

This patch adds @_versioned attributes to the right types now that
this broken behavior is gone.

As a result, _Variant{Set,Dictionary}Storage became resilient
(non-@_versioned internal types are not resilient), which broke
too many tests that assumed you can exhaustively switch over all
the cases. Since eager-bridging is going to eliminate this enum
anyway (or so I've heard), make it @_fixed_layout for now.
2016-09-30 18:28:11 -07:00
Erik Eckstein
5922aa8b14 stdlib: always inline the Set/Dictionary's _bucket function
If the Key is a class, then FunctionSignatureOpts cannot convert it to a @guaranteed parameter.
Using the new EpilogueARCAnalysis in FunctionSignatureOpts should fix that.
2016-09-20 16:34:51 -07:00
Erik Eckstein
8b1184708e stdlib: replace _squeezeHashValue with a specialized version for power-of-2 ranges.
This function is only used for Set and Dictionary and there the range (which is the capacity) is always a power of 2.
2016-09-20 16:34:51 -07:00
Erik Eckstein
36ef0e6cd7 stdlib: specify to the optimizer that the capacity value of Dictionary/Set is never negative.
This removes some runtime checks.
2016-09-20 16:34:51 -07:00