Commit Graph

2952 Commits

Author SHA1 Message Date
Louis D'hauwe
520d0d2e12 Updated popLast() and removeLast() documentation. 2016-10-18 15:59:19 +02:00
Christian Hoffmann
ae7728cc7d Make Bool example compileable 2016-10-18 10:19:05 +02:00
Louis D'hauwe
ad827ccd51 Use code style in documentation for referred functions. 2016-10-18 00:30:42 +02:00
Louis D'hauwe
f1a2f22b17 Improved documentation for removeLast() 2016-10-18 00:21:18 +02:00
Louis D'hauwe
cdbfc4fb45 Improved documentation for popLast() with note about performance versus removeLast() 2016-10-17 23:47:08 +02:00
Max Moiseev
8d1155c2b9 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-10-17 11:29:07 -07:00
Max Moiseev
fe3c737835 Removing FIXMEs 2016-10-17 11:27:32 -07:00
Nicholas Maccharoli
3d7f8cc1a0 [stdlib] Reorder increment and element creation to not need (#5062) 2016-10-14 14:05:49 -07:00
Nate Cook
c2bc72d9d6 [stdlib] Fix string index sharing (#4896)
* [stdlib] Fix String.UTF16View index sharing

* [stdlib] Fix String.UnicodeScalarView index sharing

* [stdlib] Fix String.CharacterView index sharing

* [stdlib] Test advancing string indices past their ends

* [stdlib] Simplify CharacterView ranged subscript
2016-10-13 10:19:38 -07:00
Doug Gregor
25e00d78d1 [AnyHashable] Eliminate the _AnyHashableProtocol hack.
Now that we have the ability to write extensions where one of the type
parameters is equivalent to a concrete type, eliminate
_AnyHashableProtocol and provide AnyHashable-specific behavior for
Dictionary (where Key == AnyHashable) and Set (where Element ==
AnyHashable) rather than employing the "Key: _AnyHashableProtocol"
hack.

Fixes standard library ABI FIXME's #35, #37, #39.
2016-10-12 18:56:37 -07:00
Joe Shajrawi
eeae7e1f8c improve set's conditional downcast performance by over 2X 2016-10-12 16:27:54 -07:00
Max Moiseev
079ead9daf Cleaning up the gyb 2016-10-12 16:09:10 -07:00
Max Moiseev
2190819e99 Breaking up complex expression to improve compilation time 2016-10-12 15:04:54 -07:00
swift-ci
37ee4eed55 Merge pull request #5245 from airspeedswift/remove-dummy-void-args 2016-10-11 18:41:04 -07:00
ben-cohen
d34f3ee96d Remove dummy Void args working around fixed typechecker bug – ABI FIXME #26 2016-10-11 17:56:42 -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
Max Moiseev
4902db27bb Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-10-11 11:22:15 -07:00
Max Moiseev
9cba734323 Moving unavailable operators out of concrete types 2016-10-11 10:15:25 -07:00
Dave Abrahams
be1f95a65b [stdlib] Simplify expressions
Overload resolution is still slow, so these simple changes make a >10%
difference in compilation time.
2016-10-11 10:07:21 -07:00
Max Moiseev
9428c826bd Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-10-10 14:07:28 -07:00
Max Moiseev
5cc2c8cb5a Operators as static funcs for Arithmetic (see SE-0091) 2016-10-10 14:04:11 -07:00
Erik Eckstein
0aa023aeda stdlib: Use new built-ins for tail-allocated arrays in ManagedBuffer
... instead of ManagedBufferPointer.
This is what we already did for Array, Set and Dictionary.
The intention is to simplify the generated SIL which is generated for ManagedBuffer operations.
2016-10-07 14:26:13 -07:00
Ben Cohen
a2a3e1d706 numbered FIXME #165: _RangeReplaceableIndexable should be RangeReplaceableCollection 2016-10-05 17:56:15 -07:00
Max Moiseev
99837a47a5 Merge branch 'master' into new-integer-protocols 2016-10-05 15:26:37 -07:00
Max Moiseev
08cf1de65a [WIP] fixing some of the integer related test failures 2016-10-05 15:25:23 -07:00
Max Moiseev
530e97ef2a Merge branch 'new-integer-protocols' of github.com:apple/swift into new-integer-protocols 2016-10-05 15:24:08 -07:00
Nate Cook
68a307ed96 [stdlib] Revise documentation for integer types & protocols (#5083)
* [stdlib] Revise documentation for integer types & protocols

* Update with feedback

* [stdlib] Additional integer documentation revisions
2016-10-05 15:22:57 -07:00
Andrew Trick
d5642f731b Add descriptive doc comments to withMemoryRebound(to:capacity:_:) and… (#5072)
* Add descriptive doc comments to withMemoryRebound(to:capacity:_:) and bindMemory(to:capacity:).

SR-2480: Improve documentation for withMemoryRebound(to:capacity:_:)
rdar://problem/28440528

* Nate's feedback
2016-10-05 12:44:47 -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
Max Moiseev
17b3e38497 Merge branch 'master' into new-integer-protocols 2016-09-30 15:14:55 -07:00
Max Moiseev
e0b8532204 introducing concrete initializers from all floating point types 2016-09-29 16:35:42 -07:00
Max Moiseev
3a43d8c433 Adding a (bad) implementation of init(_ source: FloatingPoint) to fix some tests 2016-09-28 12:31:02 -07:00
Steve (Numerics) Canon
40628dd043 Fix for documentation of the [form]TruncatingRemainder methods.
The result of these methods was incorrectly documented as having
the same sign as `other` (the divisor) rather than `self` (the
dividend). This patch corrects the documentation, and also fixes
the capitalization of `formTruncatingRemainder` in one location.
2016-09-28 12:20:23 -04:00
Max Moiseev
09c3e800fb turning the memcpy and memmove alignment arguments into compile time constants 2016-09-26 16:26:52 -07:00
Max Moiseev
6803cda05c Merge branch 'master' into new-integer-protocols 2016-09-26 11:39:46 -07:00
swift-ci
27eab8ae77 Merge pull request #4982 from moiseev/floating-availability 2016-09-26 11:23:47 -07:00
swift-ci
0ab20e8bb2 Merge pull request #4929 from eliperkins/SR-2627-utf16-access-modifier 2016-09-25 22:11:29 -07:00
swift-ci
bfd8d2040d Merge pull request #5013 from atrick/unsafebytes 2016-09-25 20:54:15 -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
swift-ci
69925cd54c Merge pull request #5010 from practicalswift/redundant-nil-init 2016-09-25 10:42:55 -07:00
practicalswift
a75ce9b45f [gardening] Remove redundant nil-initialization of optional variables 2016-09-25 18:53:13 +02:00
practicalswift
1110189a29 [gardening] Fix typos. 2016-09-25 18:00:49 +02:00
practicalswift
69b0f622f3 [gardening] Fix inconsistent headers 2016-09-25 18:00:39 +02:00
Max Moiseev
a779f3059d [stdlib] availability attributes for floating point types 2016-09-23 16:42:17 -07:00
Nicholas Maccharoli
cbc3334600 [stdlib] Refactor using switch. (#4948) 2016-09-23 15:35:33 -07:00
Nicholas Maccharoli
731df181eb [stdlib] Refactor logic for .pastEnd index check. (#4957) 2016-09-23 15:33:53 -07:00
Andrew Trick
f70a2e083e SE-0138: Add UnsafeRawBufferPointer and UnsafeMutableRawBufferPointer. (#4954)
https://github.com/apple/swift-evolution/blob/master/proposals/0138-unsaferawbufferpointer.md

Unsafe[Mutable]RawBufferPointer is a non-owning view over a region of memory as
a Collection of bytes independent of the type of values held in that
memory. Each 8-bit byte in memory is viewed as a `UInt8` value.

Reads and writes on memory via `Unsafe[Mutable]RawBufferPointer` are untyped
operations. Accessing this Collection's bytes does not bind the
underlying memory to `UInt8`. The underlying memory must be bound
to some trivial type whenever it is accessed via a typed operation.

In addition to the `Collection` interface, the following methods from
`Unsafe[Mutable]RawPointer`'s interface to raw memory are
provided with debug mode bounds checks: `load(fromByteOffset:as:)`,
`storeBytes(of:toByteOffset:as:)`, and `copyBytes(from:count:)`.

This is only a view into memory and does not own the memory. Copying a value of
type `UnsafeMutableRawBufferPointer` does not copy the underlying
memory. Assigning an `Unsafe[Mutable]RawBufferPointer` into a value-based
collection, such as `[UInt8]` copies bytes out of memory. Assigning into a
subscript range of UnsafeMutableRawBufferPointer copies into memory.
2016-09-23 11:26:00 -07:00
Eli Perkins
4a6d368f44 Keep value as only available internally 2016-09-22 18:47:56 -04:00
Doug Gregor
312c80af41 Merge pull request #4926 from DougGregor/sr-2648-anyhashable-wrappers
[AnyHashable] Handle comparisons/casting for wrappers around bridged types
2016-09-22 15:44:51 -07:00
Eli Perkins
9009eaf968 Mark UnicodeScalar.utf16 and UnicodeScalar.UTF16View as public
Implements SR-2627
2016-09-22 17:21:51 -04:00