Commit Graph

109 Commits

Author SHA1 Message Date
Arnold Schwaighofer
5a25a00d1f stdlib: Move the darwin String implementation over to use the ICU library.
We no longer create intermediate NSString copies to compare and hash swift
Strings. Instead we call directly into the ICU library.

I measured a 1.2 to 2x improvement on dictionary benchmarks as a result of this.
The SuperChars benchmark is also about 1.2x faster because of this.

Pure ASCII comparison has gotten a little bit slower (20% on a pure comparison
micro-benchmark) because we no longer do a memcmp. Doing a memcmp on ASCII is
not the same as the default unicode collation. Instead we have to a string scan.
The default unicode collation does not order like ASCII does and ignores
characters (for example the \0 character).

rdar://18992510

Swift SVN r31474
2015-08-26 03:36:59 +00:00
Dave Abrahams
146d2daa9d [stdlib] Add missing nullability to reflected NSString API
getBytes still lacks the ability to take an optional buffer, but Ali
agrees that we can leave that off for this release in light of the fact
that we have lengthOfBytesUsingEncoding.

Swift SVN r31223
2015-08-13 20:11:40 +00:00
Dave Abrahams
06bb06452b [stdlib] String.init(data: NSData, encoding: UInt)
Fixes <rdar://19872780>

Swift SVN r31191
2015-08-12 21:44:13 +00:00
Dave Abrahams
880f28b3fd [stdlib] Add missing 10.10 NSString APIs.
containsString and localizedCaseInsensitiveContainsString were
introduced in 10.10, release-noted, but never
documented (<rdar://22236574>), so we missed them.

Fixes <rdar://18776075> String.containsString doesn't work in Swift

Swift SVN r31152
2015-08-12 00:37:43 +00:00
Dave Abrahams
383a0564f7 Warning suppression in tests
Swift SVN r31062
2015-08-06 22:13:03 +00:00
David Farler
311baf73cf Index protocol extensions
- Remove free Swift functions for advance and distance and replace
  them with protocol extension methods:
  - advancedBy(n)
  - advancedBy(n, limit:)
  - distanceTo(end)
- Modernize the Index tests
  - Use StdlibUnittest
  - Test for custom implementation dispatch

Perf impact: No significant changes reported in the
Swift Performance Measurement Tool.

rdar://problem/22085119

Swift SVN r30958
2015-08-03 20:06:44 +00:00
Dave Abrahams
ad43a596bd [stdlib] Retire the old lazy subsystem...
...replacing it with the new, after passing API review!

* The lazy free function has become a property.

* Before we could extend protocols, we lacked a means for value types to
  share implementations, and each new lazy algorithm had to be added to
  each of up to four types: LazySequence, LazyForwardCollection,
  LazyBidirectionalCollection, and LazyRandomAccessCollection. These
  generic adapters hid the usual algorithms by defining their own
  versions that returned new lazy generic adapters. Now users can extend
  just one of two protocols to do the same thing: LazySequenceType or
  LazyCollectionType.

* To avoid making the code duplication worse than it already was, the
  generic adapters mentioned above were used to add the lazy generic
  algorithms around simpler adapters such as MapSequence that just
  provided the basic requirements of SequenceType by applying a
  transformation to some base sequence, resulting in deeply nested
  generic types as shown here. Now, MapSequence is an instance of
  LazySequenceType (and is renamed LazyMapSequence), and thus transmits
  laziness to its algorithms automatically.

* Documentation comments have been rewritten.

* The .array property was retired

* various renamings

* A bunch of Gyb files were retired.

Swift SVN r30902
2015-08-01 03:52:13 +00:00
Dmitri Hrybenko
f5de8757e4 stdlib: remove Word and UWord
These types are leftovers from the early pre-1.0 times when Int and UInt
were always 64-bit on all platforms.  They serve no useful purpose
today.  Int and UInt are defined to be word-sized and should be used
instead.

rdar://18693488

Swift SVN r30564
2015-07-24 05:01:32 +00:00
David Farler
1f2390f1c7 Drop APIs from NSPathUtilities.h on String
rdar://problem/18848175

Swift SVN r30507
2015-07-22 22:12:56 +00:00
Dave Abrahams
70ee2adc84 [stdlibunittest] More de-boilerplating WIP
Step 2.

Swift SVN r29936
2015-07-07 04:54:03 +00:00
Greg Parker
d833ef8ab8 [test] Fix some watchOS test failures.
Swift SVN r29229
2015-06-02 09:14:18 +00:00
Arnold Schwaighofer
f7771859d8 Rename the optimize_test feature to executable_test and document that feature.
Swift SVN r29213
2015-06-01 23:44:13 +00:00
Arnold Schwaighofer
3643c614a3 Run tests in optimize test modes
This runs all files that have a target-build-swift or target-run-stdlib-swift
RUN line in optimize test mode.

Swift SVN r29206
2015-06-01 21:23:31 +00:00
Dmitri Hrybenko
1058f68bc6 Foundation overlay: add overlays for new NSString APIs
rdar://20856757

Swift SVN r29019
2015-05-26 03:29:01 +00:00
Ted Kremenek
a2c4ea971f Revert "Foundation overlay: add overlays for new NSString APIs"
Revert until our Jenkins devices support the underlying NSString API.  Keeping
this blocks iOS testing.

Swift SVN r28987
2015-05-24 16:55:25 +00:00
Dmitri Hrybenko
d45413efb8 Foundation overlay: add overlays for new NSString APIs
Swift SVN r28984
2015-05-24 10:39:21 +00:00
Joe Groff
32fb006386 Clang Importer: Enable OptionSetType import.
Update the tests to match.

Swift SVN r28906
2015-05-22 05:47:37 +00:00
Dmitri Hrybenko
53f3ccf850 stdlib: change CollectionType.count() into a property
Swift SVN r28829
2015-05-20 09:14:43 +00:00
Dmitri Hrybenko
843d8a4eb7 stdlib: protocol extensions: de-underscore map()
Swift SVN r28502
2015-05-13 01:58:46 +00:00
Slava Pestov
224286e60f Fix warnings in NSStringAPI test
Swift SVN r28477
2015-05-12 18:19:32 +00:00
Dmitri Hrybenko
61214ec55b stdlib: remove Sliceable conformance from String
Swift SVN r28442
2015-05-11 20:58:31 +00:00
Dmitri Hrybenko
e24c262d6e Foundation overlay: add String.stringByApplyingTransform()
This API is new in OS X 10.11 and iOS 9.0.

rdar://20645458

Swift SVN r28315
2015-05-08 08:36:44 +00:00
Dmitri Hrybenko
8b392eeea9 Revert "Remove Array.count, it is redundant with protocol extensions"
This reverts commit r28247 while we discuss the change.

Swift SVN r28292
2015-05-07 21:45:30 +00:00
Ted Kremenek
7a96e55cde Revert "Foundation overlay: add String.stringByApplyingTransform()"
Speculatively reverted because of iOS bot failure.

Swift SVN r28261
2015-05-07 14:00:16 +00:00
Dmitri Hrybenko
15a558f919 Foundation overlay: add String.stringByApplyingTransform()
This API is new in OS X 10.11 and iOS 9.0.

rdar://20645458

Swift SVN r28257
2015-05-07 06:54:15 +00:00
Dmitri Hrybenko
58601fafc8 Remove Array.count, it is redundant with protocol extensions
Swift SVN r28247
2015-05-07 00:30:41 +00:00
Dmitri Hrybenko
c109ec9125 stdlib: protocol extensions: de-underscore count()
Swift SVN r28246
2015-05-07 00:30:38 +00:00
Dmitri Hrybenko
035d72d5a7 stdlib: protocol extensions: de-underscore contains()
Swift SVN r28236
2015-05-07 00:30:24 +00:00
Dmitri Hrybenko
78d1196f33 stdlib: protocol extensions: de-underscore elementsEqual
Swift SVN r28234
2015-05-07 00:30:22 +00:00
Dmitri Hrybenko
e43ad56a1c stdlib: protocol extensions: de-underscore startsWith()
Swift SVN r28233
2015-05-07 00:30:21 +00:00
Ted Kremenek
92e6051cce Revert "[stdlib] NSStringAPI: add stringByApplyingTransform"
Right now this is breaking our iOS bots.  Let's temporarily revert while we investigate.

Swift SVN r28201
2015-05-06 15:58:05 +00:00
Dave Abrahams
a3270c105c [stdlib] NSStringAPI: add stringByApplyingTransform
Swift SVN r28171
2015-05-05 17:35:43 +00:00
Ted Kremenek
bde7daa23d Revert "[stdlib] NSStringAPI: add stringByApplyingTransform"
This is breaking NSStringAPI.swift on the bots.

Swift SVN r28084
2015-05-02 07:16:48 +00:00
Dave Abrahams
af07713820 [stdlib] NSStringAPI: add stringByApplyingTransform
Swift SVN r28082
2015-05-02 05:52:28 +00:00
Dmitri Hrybenko
b08a57f752 stdlib tests: fix coding style
Swift SVN r28071
2015-05-02 03:33:10 +00:00
John McCall
ac50cbc801 Enable error-handling in import by default.
Swift SVN r28048
2015-05-01 20:35:28 +00:00
Doug Gregor
793b3326af Implement the new rules for argument label defaults.
The rule changes are as follows:
  * All functions (introduced with the 'func' keyword) have argument
  labels for arguments beyond the first, by default. Methods are no
  longer special in this regard.
  * The presence of a default argument no longer implies an argument
  label.

The actual changes to the parser and printer are fairly simple; the
rest of the noise is updating the standard library, overlays, tests,
etc.

With the standard library, this change is intended to be API neutral:
I've added/removed #'s and _'s as appropriate to keep the user
interface the same. If we want to separately consider using argument
labels for more free functions now that the defaults in the language
have shifted, we can tackle that separately.

Fixes rdar://problem/17218256.

Swift SVN r27704
2015-04-24 19:03:30 +00:00
Chris Willmore
98d17e318d Add support for AppleTV simulator tests.
You can run tests with e.g. 'ninja check-swift-appletvsimulator-x86_64'.

Swift SVN r27297
2015-04-14 23:53:03 +00:00
Dmitri Hrybenko
ab408d4dc3 Update the compiler and SDK overlay for nullability and generics in Foundation
We have an SPI between the Swift compiler and Foundation based on the
SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH preprocessor macro that allows us to
request the new API.  rdar://20270080 tracks removing it.

Swift SVN r26475
2015-03-24 02:18:06 +00:00
Dmitri Hrybenko
61ae51da28 Fix bad indentation in the NSStringAPI test.
Swift SVN r26393
2015-03-21 05:50:45 +00:00
Dmitri Hrybenko
c3f07f47ec Add a more thorough test for String.localizedStringWithFormat()
rdar://20171815

Swift SVN r26392
2015-03-21 05:41:47 +00:00
Maxwell Swadling
8d4df82360 [stdlib] made String.utf16count unavailable
fixes rdar://problem/17627758

Swift SVN r25214
2015-02-12 01:12:23 +00:00
Maxwell Swadling
3e160b0b7a added tests for rdar://problem/18317906
Swift SVN r25206
2015-02-11 23:26:19 +00:00
Dave Abrahams
5228d9e350 [stdlib] Add "copy init" methods for bridged types
Fixes <rdar://problem/19755780>

Swift SVN r25187
2015-02-11 19:27:09 +00:00
Maxwell Swadling
b1c233dad5 [stdlib] removed mixed string/nsstring operations
Related to rdar://problem/19169066

Swift SVN r25100
2015-02-09 21:05:33 +00:00
Maxwell Swadling
2eb96bafee [stdlib] reverted removal of mixed string type operators
Fixes rdar://problem/19656287

This reverts changes from r24931, r24911, r24760 and r24536.

Swift SVN r24938
2015-02-04 04:01:32 +00:00
Maxwell Swadling
a0cad601e1 [stdlib] removed mixed string type operators
Fixes rdar://problem/19656287

Swift SVN r24931
2015-02-04 00:56:36 +00:00
Maxwell Swadling
56026ee9f1 [stdlib] fixed ambiguous overloads
This fixes rdar://problem/19656287. This is a work around while we do
not have a way to remove implicit bridging conversions.
This means comparing a String and an NSString will use NSString
comparison.

Swift SVN r24911
2015-02-03 00:54:19 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Dmitri Hrybenko
311957061a Stop using Unsafe[Mutable]Pointer.null()
This API will be removed per rdar://19159145 (it is redundant with nil
literals and the default initializer).

Swift SVN r24795
2015-01-28 08:42:26 +00:00