Commit Graph

77 Commits

Author SHA1 Message Date
Erik Eckstein
adef0368bb tests: add import statements to workaround linker errors in all relevant tests.
This is needed if we compile StdlibUnittest with -sil-serialize-all
So far I added the imports only in files which needed them. But this may change, depending on the optimizer (inlining).
Adding them in all files doesn't harm and avoids confusion if someone makes an unrelated change which would result in such a linker error.
2016-01-21 09:59:50 -08:00
Dmitri Gribenko
3877d04a73 Merge pull request #731 from ken0nek/add-spaces-before-and-after-arrow
Add spaces before and after closure arrow
2015-12-23 10:53:22 -08:00
ken0nek
3ac60b13f5 Add spaces before and after closure arrow in test 2015-12-23 04:38:46 +09:00
ken0nek
fcd8fcee91 Convert [Cc]an not -> [Cc]annot 2015-12-23 00:55:48 +09:00
Dmitri Gribenko
a892381a1b Merge pull request #711 from glessard/nsstringapi-curry-fix
Return a closure instead of using curried syntax
2015-12-21 08:50:01 -08:00
Guillaume Lessard
a8f83ef208 Return a closure instead of using curried syntax 2015-12-21 08:56:44 -07:00
Daniel Duan
ebb0c3a204 replaced single-line ++/-- with +=/-= 2015-12-15 09:05:37 -08:00
Arsen Gasparyan
52890e5c30 Replace if true {} with do {} 2015-12-13 10:54:54 +03:00
Nick van der Ploeg
42b4b02df3 Fixed typos in comments throughout the project. 2015-12-07 12:15:52 -06:00
Jordan Kay
008a42fd65 Fix misspellings 2015-12-03 14:28:54 -05:00
Dmitri Hrybenko
6536edd68c stdlib: fix coding style
Swift SVN r32425
2015-10-03 21:13:15 +00:00
Arnold Schwaighofer
eb3d5e4d4a Revert "stdlib: Move the darwin String implementation over to use the ICU library."
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Add back a test I removed"
Revert "stdlib: Fix hasPrefix,hasSuffix tests"
Revert "stdlib: Add documentation for the cached ascii collation tables"

This reverts commit 31493, 31492, 31491, 31490, 31489.

There are linking errors in SwiftExternalProjects (we probably have to link
against libicucore somewhere).

Swift SVN r31543
2015-08-27 21:02:32 +00:00
Arnold Schwaighofer
5edbd46d53 stdlib: Fix hasPrefix,hasSuffix tests
Comparing unicodeScalars like this is not valid.

Reapply of 31477.

Swift SVN r31492
2015-08-26 15:14:21 +00:00
Arnold Schwaighofer
e4935d0b67 Add test cases to exercise the native String vs cocoa buffer String path.
Reapply of r31475.

Swift SVN r31490
2015-08-26 15:14:19 +00:00
Arnold Schwaighofer
502f1e3de1 stdlib: Move the darwin String implementation over to use the ICU library.
Reapply of 31474 with a fix in _compareCocoaBuffer to use the bufferSizeRhs
variable instead of bufferSizeLhs for the right hand side buffer.

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 r31489
2015-08-26 15:14:18 +00:00
Arnold Schwaighofer
2d8f29e710 Revert "stdlib: Fix hasPrefix,hasSuffix tests"
Revert "stdlib: Add back a test I removed"
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Move the darwin String implementation over to use the ICU library."

This reverts commit r31477, r31476, r31475, r31474.

Commit r31474 broke the ASAN build.

Swift SVN r31488
2015-08-26 13:09:03 +00:00
Arnold Schwaighofer
3cc2dae6e6 stdlib: Fix hasPrefix,hasSuffix tests
Comparing unicodeScalars like this is not valid.

Swift SVN r31477
2015-08-26 03:57:25 +00:00
Arnold Schwaighofer
65f6b840c1 Add test cases to exercise the native String vs cocoa buffer String path.
Swift SVN r31475
2015-08-26 03:57:23 +00:00
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