Commit Graph

5263 Commits

Author SHA1 Message Date
Sho Ikeda
44f0e93747 Merge pull request #25067 from ikesyo/avoid-fallthrough-where-appropriate
[gardening] Avoid fallthrough where appropriate (for readability/understandability)
2019-05-29 00:27:05 +09:00
Sho Ikeda
2019a97e55 Merge pull request #25066 from ikesyo/use-isempty-over-count
[gardening] Use `Collection.isEmpty` over `Collection.count`
2019-05-29 00:24:48 +09:00
Turushan Aktay
c61691919b Fix documentation typos. 2019-05-26 14:17:45 +02:00
Sho Ikeda
c1bb945124 [gardening] Avoid fallthrough where appropriate (for readability/understandability) 2019-05-26 09:50:02 +09:00
Sho Ikeda
a35c9f0c60 [gardening] Use Collection.isEmpty over Collection.count 2019-05-26 09:35:20 +09:00
Federico Zanetello
afcf4b6991 fix documentation typo (#25061) 2019-05-25 12:43:49 -05:00
David Smith
803227a46b Avoid O(n) character accesses in String.UTF8View._foreignCount 2019-05-21 13:22:42 -07:00
Ted Kremenek
4beb673b8e Bump compiler version to Swift 5.1 (#24671)
* Bump version to Swift 5.1

* Update tests with compiler version bump

* Undo flatMap and math obsolescences
2019-05-13 07:32:39 -07:00
Xiaodi Wu
da9f67c781 [docs] Update trailingZeroBitCount documentation (#24713)
* [docs] Update `trailingZeroBitCount` documentation

Document the required behavior for `trailingZeroBitCount` when the value is zero. Namely, in that scenario, `trailingZeroBitCount` should be equal to `bitWidth`.

* [docs] Address reviewer comments on `trailingZeroBitCount` docs
2019-05-13 08:53:28 -04:00
Patrick Pijnappel
70be266440 Merge pull request #23293 from PatrickPijnappel/range-overlaps-performance-impl
[stdlib] Refactor Range Overlaps for Performance
2019-05-13 22:00:23 +10:00
Nate Cook
841eb4cf5e [stdlib] Revise collection difference documentation (#24675)
* Revise CollectionDifference documentation.
2019-05-10 20:57:46 +02:00
Mike Ash
3ad6e46930 [Stdlib] Fix warnings about designated initializers in SwiftNativeXXX classes. 2019-05-06 17:15:53 -04:00
Nicholas Maccharoli
cd5055711a Fix syntax error in comment code
Closing parentheses is missing in the example code.
2019-05-06 01:38:47 +09:00
David Smith
1192b914d2 Merge pull request #24457 from Catfish-Man/two-by-two-length-of-blue
Fix bounds check in bridged ASCII String comparison
2019-05-03 18:28:55 -07:00
Patrick Pijnappel
87f02b173b [stdlib] Refactor range overlaps for performance 2019-05-04 09:15:21 +10:00
David Smith
008699e52d Fix bounds check in bridged ASCII String comparison 2019-05-03 15:55:58 -07:00
Ravi Kandhadai
a7b7db7854 [Constant Evaluator] Move "string.append" semantics attribute from
`String.+=` function to `String.append` function, and use a new
semantics attribute for String.+=.

Teach the constant evaluator about `String.Append` instead of `String.+=`.
2019-04-30 14:26:06 -07:00
David Smith
b6d0362204 Merge pull request #24289 from Catfish-Man/bulk-discount
SR-10555 foreignCopyUTF8 should do bulk access
2019-04-29 22:17:29 -07:00
David Smith
fd0d4d858e SR-10555 foreignCopyUTF8 should do bulk access 2019-04-29 16:23:55 -07:00
Stephen Canon
d2f695935f Add availability information to the new Math function protocols (#24187)
* Add availability information to the new Math function protocols

The protocols ElementaryFunctions, RealFunctions, and Real are new in Swift 5.1 and accordingly need to have availability attached to them for platforms that are ABI-stable. The actual implementation hooks (static functions) are unconditionally defined on scalar types and marked @_alwaysEmitIntoClient, so they are available even when targeting older library versions, but the protocols themselves, and anything defined in terms of them (the global functions and the SIMD extensions) is only available when targeting library versions that have the new protocols.

* Additionally provide concrete implementations of signGamma for each stdlib-builtin floating-point type.

* Remove Real[Functions] protocols pending re-review

Temporarily pull these back so we can make minor tweaks to the design and get a re-review on SE.
2019-04-29 17:39:33 -04:00
Ben Cohen
1096179aaa Merge pull request #24186 from AnthonyLatsis/fix-reversed-index-alias
Stdlib: Fix ReversedIndex compatibility alias
2019-04-26 14:43:55 -07:00
Michael Ilseman
102a3a816a Merge pull request #24198 from troughton/floating-point-parsing-utf8
[stdlib] Use String’s underlying UTF-8 view for Float parsing
2019-04-26 13:28:49 -07:00
Saleem Abdulrasool
f88be05394 Merge pull request #24240 from compnerd/bridge-to-terabithia
WIP: bridge BOOL to Bool
2019-04-26 11:13:41 -07:00
Stephen Canon
ba0888df5b Really remove static min and max on simd. One slipped through. (#24283) 2019-04-26 07:41:49 -04:00
Saleem Abdulrasool
83b290438c Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to
`Bool` implicitly.  The implicit bridging allows for a more ergonomic
use of the native Windows APIs in Swift.

Due to the ambiguity between the Objective C `BOOL` and the Windows
`BOOL`, we must manually map the `BOOL` type to the appropriate type.
This required lifting the mapping entry for `ObjCBool` from the mapped
types XMACRO definition into the inline definition in the importer.

Take the opportunity to simplify the mapping code.

Adjust the standard library usage of the `BOOL` type which is now
eclipsed by the new `WindowsBool` type, preferring to use `Bool`
whenever possible.

Thanks to Jordan Rose for the suggestion to do this and a couple of
hints along the way.
2019-04-25 17:52:08 -07:00
Stephen Canon
9850150c91 Restore elementwise min/max on SIMD, with explicit naming. (#24136)
* Restore elementwise min/max on SIMD, but as statics instead of free functions.

Having these as free functions causes expression too complex issues due to overload vis-a-vis min<Collection>. There are (at least) three plausible solutions:

1. Fix the typechecker. This is infeasable in the short term; or more precisely, we do not know how much work is involved.

2. Give these operations different names. Candidates discussed with core team include "pointwiseMin", "elementwiseMin", "lanewiseMin"; these all suffer from the flaw that when someone writes "min" in a SIMD context, they are essentially always looking for either the horizontal minimum (reduction) on a single vector or--more often--the lanewise minimum of two vectors (this operation). It would be odd to give the operation that people actually want the unnecessarily verbose name.

3. Make these operations static; this is, in effect, a different name, but it's one which frequently allows eliding the qualifier:

  let x = v + .min(v, w)

This isn't perfect; you will still need to spell out SIMD4.min( ) fairly often, but that's more concise than any of the proposed alternatives, and at least allows elision some of the time. Also, if you squint, you can pretend that the "." prefix is like ".<" and ".&" and indicates lanewise operation.
2019-04-25 14:52:03 -04:00
fischertony
eff8a789fc Stdlib: Fix ReversedIndex compatibility alias 2019-04-25 01:39:56 +03:00
swift-ci
c34c3e373e Merge pull request #23732 from Catfish-Man/pointernt 2019-04-23 14:58:34 -07:00
David Smith
96a93261d0 Use the Swift runtime's (faster) class check in the stdlib instead of shimming object_getClass() 2019-04-23 13:05:25 -07:00
Thomas Roughton
4c2df287a7 [stdlib] Use String’s underlying UTF-8 view for Float parsing 2019-04-23 10:46:19 +12:00
Joe Groff
a8c2b50bd8 Merge pull request #22072 from jckarter/opaque-type-runtime
Opaque types with resilience
2019-04-18 14:52:31 -07:00
Stephen Canon
57a4553832 SE-0246: Protocols and static functions (#23824)
This implements the protocols and static functions proposed in SE-0246, plus some initial test coverage. It also has some rough accompanying cleanup of tgmath. It does not include the globals (on scalars or SIMD types) nor does it deprecate much in tgmath.h.
2019-04-17 23:57:33 +02:00
Joe Groff
05dfec0cda Push the conformance accessor hack down into getTypeByMangledName. 2019-04-17 14:44:40 -07:00
swift-ci
388c21ac64 Merge pull request #24000 from Catfish-Man/thread-specific-doh 2019-04-15 18:08:06 -07:00
David Smith
584fbfc245 Avoid the overhead of looking up the current CFAllocator in String bridging 2019-04-15 15:28:00 -07:00
Karoy Lorentey
e08b219448 Merge pull request #23683 from lorentey/casting-improvements
[stdlib] Fix Set/Dictionary casting issues
2019-04-15 10:56:38 -07:00
Stephen Canon
9e61aaefba Temporarily remove the global min(a,b) and max(a,b) SIMD functions. (#23960)
These are triggering a bad compile-time regression for some expressions; that's a bug that should be fixed, but we don't know how to fix it yet, so we'll need to remove these in the short-term, and possibly spell them differently in the medium term.
2019-04-12 16:30:32 +02:00
Bob Wilson
207bf788f2 Merge pull request #23896 from bob-wilson/branchHint-followup
Move the legacy _branchHint function to LegacyABI.swift
2019-04-09 16:47:56 -07:00
Michael Ilseman
b39ead1774 Merge pull request #23863 from milseman/string_cleaning
[gardening] Clean up many String computed vars
2019-04-09 14:02:39 -07:00
Bob Wilson
0cf186f25d Move the legacy _branchHint function to LegacyABI.swift 2019-04-09 11:44:35 -07:00
Stephen Canon
f4b2916de6 [SE-0251] Additions to SIMD types. (#23421)
* Additions to SIMD types.

- extension from 2 and 3-element vectors to 3- and 4-element vectors.
- the .one member
- swizzles via subscript-by-simd
- min/max/sum reductions
- min/max/clamp on vectors-of-comparable
- any and all

- Make permute subscript wrap on vector length, even for SIMD3 dictionaries. Also restore min/max to globals, rather than static functions.
2019-04-09 18:53:45 +02:00
Michael Ilseman
f7cdda2720 [gardening] Clean up many String computed vars 2019-04-08 15:16:48 -07:00
Stephen Canon
c5e3f85378 Revert SE-0246 (#23800)
* Revert "Merge pull request #23791 from compnerd/you-know-nothing-clang"

This reverts commit 5150981150, reversing
changes made to 8fc305c03e.

* Revert "Merge pull request #23780 from compnerd/math-is-terrible"

This reverts commit 2d7fedd25f, reversing
changes made to 0205150b8f.

* Revert "Merge pull request #23140 from stephentyrone/mafs"

This reverts commit 777750dc51, reversing
changes made to 0c8920e747.
2019-04-04 19:35:25 -04:00
Michael Ilseman
3b99358592 Merge pull request #23051 from milseman/textual_contiguity
[SE-0247] Add contiguous string APIs
2019-04-03 19:50:23 -07:00
Ted Kremenek
777750dc51 Merge pull request #23140 from stephentyrone/mafs
Math functions for Swift
2019-04-03 14:53:16 -07:00
Steve (Numerics) Canon
bcc7e2c901 Obscene rant about linters. 2019-04-03 15:15:28 -04:00
Karoy Lorentey
3c74c0f1cb [stdlib] Change the signature of Dictionary’s bulk initializer (#23758)
The initializer was originally introduced without proper availability; in https://github.com/apple/swift/pull/23643, we fixed this by applying the `@_alwaysEmitIntoClient` attribute. However, this had the unfortunate side-effect that the symbol disappeared from `libswiftCore.dylib`, which somehow confuses some simulator builds.

Try to figure out what’s happening by replacing the third closure argument with an integer return value. This changes the mangled name of the bulk initializer, which should make it more obvious how/why these builds fail.

rdar://problem/49479386
2019-04-03 10:51:36 -07:00
Michael Ilseman
aab8063267 [SE-0247] Add contiguous string APIs
Adds API for querying, enforcing, and using contiguous strings.
2019-04-02 20:30:02 -07:00
Karoy Lorentey
ea6ae67a9f [stlib] _NativeSet: Revert spurious change 2019-04-02 16:38:01 -07:00
Steve (Numerics) Canon
3fda509805 Implementation of ElementaryFunctions / Real protocols.
This commit implements SE-0246, by adding conformance to Real to the Float, CGFloat, Double, and Float80 types, implemented either in terms of the system's C math library, existing standard library functionality, or LLVM intrinsics. It includes basic test coverage for these new functions, and deprecates and obsoletes *some* existing functionality in the Platform overlay. We still need to make a decision about how to handle the remaining "tgmath" functions, because obsoleting them is technically a source-breaking change (if users have unqualified names like "exp(1)", it's fine, but it would break users who have used qualified names like "Darwin.exp(1)".)
2019-04-02 18:49:31 -04:00