Ben Cohen
ea2f64cad2
[stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement ( #8990 )
...
* Give Sequence a top-level Element, constrain Iterator to match
* Remove many instances of Iterator.
* Fixed various hard-coded tests
* XFAIL a few tests that need further investigation
* Change assoc type for arrayLiteralConvertible
* Mop up remaining "better expressed as a where clause" warnings
* Fix UnicodeDecoders prototype test
* Fix UIntBuffer
* Fix hard-coded Element identifier in CSDiag
* Fix up more tests
* Account for flatMap changes
2017-05-14 06:33:25 -07:00
Nate Cook
dafe368220
Address @dabrahams’s feedback
2017-05-13 12:25:42 -05:00
Nate Cook
f650e0a7da
[stdlib] String and range expressions
...
* finish string documentation revisions
* revise examples throughout to use range expressions instead of e.g.
prefix(upTo: _)
2017-05-13 10:06:12 -05:00
Nate Cook
1b8d982f98
[stdlib] Miscellaneous documentation revisions
...
* documented swap(_:_:) and MutableCollection.swapAt(_:_:)
* clarifications and fixes elsewhere
2017-05-13 10:06:09 -05:00
Ben Cohen
1163ea7c7a
[stdlib] swapAt method ( #9119 )
...
* Add swapAt method
* Migrate sorting to swapAt
* Migrate further stdlib usage
2017-04-29 11:55:00 -07:00
Erik Eckstein
9ac13ae606
stdlib, optimizer: add Array. reserveCapacityForAppend as a new array semantics operation.
...
This function reserves capacity in an Array for new elements which are about to be appended.
2017-04-27 09:06:55 -07:00
Erik Eckstein
9ce3df106e
Add two new array semantics functions.
...
array.append_element(newElement: Element)
array.append_contentsOf(contentsOf newElements: S)
And allow early inlining of them.
Those functions will be needed to optimize Array.append(contentsOf)
2017-03-31 15:31:57 -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
swift-ci
f89e3869f5
Merge pull request #8079 from samirGuerdah/fixTypo
2017-03-14 08:52:30 -07:00
samirMSTF
9d9cd82c59
Fix typo
2017-03-14 14:16:59 +01:00
Michael Gottesman
6d7b11c8eb
[stdlib] Cleanup usage of Builtin.castToNativeObject(...).
...
Previously often times when casting a value, we would just pass along the
cleanup of the uncasted value. With semantic SIL this is no longer correct since
the cleanup now needs to be on the cast result.
This caused problems for certain usages of Builtin.castToNativeObject(...) by
the stdlib. Specifically, the stdlib was using this on AnyObject values that
were not necessarily native. Since we were recreating the cleanup on the native
value, a swift native release was being used =><=.
In this commit I solve this problem by:
1. Adding an assert in Builtin.castToNativeObject(...) that ensures that any value
passed to Builtin.castToNativeObject() is known conservatively to use swift
native reference counting.
2. I changed all uses where we do not have a precondition of a native ref
counting type to use Builtin.castToUnknownObject(...).
3. I added a new Builtin called Builtin.unsafeCastToNativeObject(...) that does
not have the compile time check. I used this to rewrite callsites in the stdlib
where we know via preconditions that an AnyObject will dynamically always be
native.
rdar://29791263
2017-03-14 00:10:16 -07:00
Erik Eckstein
ef3a611ddb
stdlib: make sure that Array._copyBuffer is not inlined.
...
Although it’s called via _slowPath the compiler sometimes inlines it, because it considers it to be a trivial function.
This change gives small code size improvements for benchmarks which deal with arrays.
rdar://problem/30210047
2017-01-26 15:59:55 -08:00
Ben Cohen
0bafc86e5e
remove redundant _arrayReserve method
2017-01-18 09:17:26 -08:00
Ben Cohen
5a83bef7b3
tweak outer loop comment
2017-01-17 11:36:41 -08:00
ben-cohen
3dfd0f74f0
refactor sequence append growth logic
2017-01-16 20:42:00 -08:00
Ben Cohen
578a52627a
Merge branch 'master' into se-147
2017-01-07 13:19:15 -08:00
practicalswift
6d1ae2a39c
[gardening] 2016 → 2017
2017-01-06 16:41:22 +01:00
Ben Cohen
465f243943
Move += operator for append(contentsOf:) up to RangeReplaceableCollection
2017-01-05 11:59:49 -08:00
Ben Cohen
fefc2e40df
Migrate _copyContents to be called from UnsafeMutableBufferPointer with checks for overrun.
2017-01-05 11:59:49 -08:00
Yurii Samsoniuk
2b62ed250a
Updated index(_:offsetBy:limitedBy:) code example
2016-12-31 15:48:52 +01:00
Nate Cook
4169635a20
[stdlib] Consistency fixes in Array documentation
...
- Removed "see other" note from type discussion
- Modified index(_:offsetBy...) to match other collections
- Word choice in reserveCapacity(_:)
2016-12-19 14:16:36 -06:00
Nate Cook
82811c57f0
[stdlib] Improvements to Collection doc comments
2016-12-19 13:05:19 -06:00
Nate Cook
f2bc719eff
[stdlib] Address feedback from @stephentyrone
2016-12-15 13:55:38 -06:00
Nate Cook
3bc4909de8
[stdlib] Various revisions and fixes for documentation
...
- Fix wording for RandomAccessCollection
- Add note about array growth to reserveCapacity(_:)
- Reformat lazy flatMap discussions
- Improve Collection symbol consistency
2016-12-15 11:47:19 -06:00
Mishal Shah
5eece8860f
Revert "SILOptimizer: Replace Array.append(contentsOf: with Array.append(elem…"
2016-12-06 11:26:15 -08:00
Slava Pestov
a32e11a0de
Merge pull request #6064 from slavapestov/killing-substituted-type-access-check
...
Refactor accessibility checking to use TypeReprs (most of the time) rather than Types
2016-12-05 13:19:58 -08:00
Ben Ng
1b10c18b3e
SILOptimizer: Replace [].append(contentsOf:) with [].append(element:)
2016-12-05 12:27:42 -05:00
Slava Pestov
d1b753c46a
Sema: Remove a workaround for an accessibility problem in the standard library
2016-12-04 23:57:11 -08: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
practicalswift
81e93c7ca6
Remove unused internal struct _InitializePointer<T>
2016-11-20 13:58:38 +01:00
Nate Cook
534bea8f9f
[stdlib] Update revisions with feedback
2016-11-15 15:00:10 -06:00
Nate Cook
9b2128eb35
[stdlib] Add missing trivial type info to withUnsafeBytes
2016-11-11 14:03:37 -06: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
practicalswift
cc852042c9
[gardening] Fix accidental trailing whitespace.
2016-10-29 10:22:58 +02:00
Ben Cohen
fbed646d82
Merge pull request #5483 from airspeedswift/buffer-protocol
...
[stdlib] Make various free functions mutating an _ArrayBufferProtocol into extensions. Resolves ABI FIXME #14
2016-10-27 11:38:54 -07:00
Ben Cohen
81473386df
added arg labels to _expectEnd
2016-10-26 12:58:44 -07:00
Ben Cohen
77e13e042e
Remove the FIXME that led to this PR
2016-10-26 12:10:42 -07:00
Ben Cohen
f428a16635
tweaked local var names to avoid confusion with self's properties
2016-10-26 12:09:33 -07:00
Ben Cohen
91fa717715
move _arrayAppendSequence to an extension on _ArrayBufferProtocol
2016-10-26 10:21:10 -07:00
Ben Cohen
acb317c308
remove Index == Int constraints by adding missing endIndex: { get }
2016-10-26 10:15:01 -07:00
Ben Cohen
b35f1d10f3
remove some unnecessary self's
2016-10-26 09:21:37 -07:00
Ben Cohen
35d2392d7d
Change _ArrayBuffer.replace(subRange:) to replaceSubrange to match RangeReplaceableCollection
2016-10-26 09:19:50 -07:00
Ben Cohen
f0d8ca83ad
FIXME(ABI)#14 : add argument labels to _arrayOutOfPlaceReplace
2016-10-26 08:52:58 -07:00
Ben Cohen
3cc9b7f337
move _arrayOutOfPlaceReplace into _ArrayBufferProtocol extension
2016-10-25 16:36:28 -07:00
Ben Cohen
3752e6dae4
move _outlinedMakeUniqueBuffer and _arrayReserve into _ArrayBufferProtocol extension
2016-10-25 16:29:48 -07:00
Ben Cohen
6e841e0215
move _forceCreateUniqueMutableBuffer{Impl} into _ArrayBufferProtocol extension
2016-10-25 16:22:10 -07:00
Ben Cohen
b57b5bb222
move _forceCreateUniqueMutableBuffer{Impl} into _ArrayBufferProtocol extension
2016-10-25 16:18:07 -07:00
Ben Cohen
e0a31a9a6e
move _arrayOutOfPlaceUpdate into _ArrayBufferProtocol extension
2016-10-25 15:14:19 -07:00
Andrew Trick
0a448ea74b
SE-0138: Minor update. Array.withUnsafeBytes is nonmutating.
...
The "mutating" keyword should not have been on this API. The example
code in SE-0138 uses it as a nonmutating API.
(The mutating keyword was a temporary workaround that should never
have been carried over to the swift-3.0-branch).
<rdar://28614519> [swift-3.0-branch] Remove "mutating" keyword from Array.withUnsafeBytes
2016-10-11 15:54:16 -07:00
Andrew Trick
9c729e4c0c
SE-0138: UnsafeRawBufferPointer revision.
...
The withUnsafeMutableBytes closure argument should not be `inout`.
Improve testing, fix comments.
Addresses DaveA's review.
2016-09-25 19:56:21 -07:00