Commit Graph

203 Commits

Author SHA1 Message Date
Maxim Moiseev
9d8755511d fixing validation tests 2015-12-17 16:26:43 -08:00
Dmitri Gribenko
15a9649062 Repeated(repeating:length:) => repeatElement(_:count:) 2015-12-17 16:24:47 -08:00
Dmitri Gribenko
86f1258810 Repeat => Repeated 2015-12-17 16:24:11 -08:00
Dmitri Gribenko
73ce9ae7e9 Collection.count => .length
And other API changes that naturally fall out from this, like
Array(repeating:count:) => Array(repeating:length:).
2015-12-17 15:55:29 -08:00
Doug Gregor
2f5f94a12c Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-omit-needless-words 2015-12-15 17:11:37 -08:00
Max Moiseev
2021dd5a4d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-15 12:49:22 -08:00
Erik Eckstein
0830c36974 [tests] add import statements to prevent unresolved symbols when compiling StdlibUnittest with -sil-serialize-all.
This is the second part of 308f39fe56.
It fixes (better: works-around) linker errors when testing in optimized mode.
2015-12-15 10:46:10 -08:00
Max Moiseev
806be29941 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-14 12:05:35 -08:00
Arsen Gasparyan
52890e5c30 Replace if true {} with do {} 2015-12-13 10:54:54 +03:00
Doug Gregor
06c5e9cd5b Enable "omit needless words" by default.
Most of this is in updating the standard library, SDK overlays, and
piles of test cases to use the new names. No surprises here, although
this shows us some potential heuristic tweaks.

There is one substantive compiler change that needs to be factored out
involving synthesizing calls to copyWithZone()/copy(zone:). Aside from
that, there are four failing tests:

    Swift :: ClangModules/objc_parse.swift
    Swift :: Interpreter/SDK/Foundation_test.swift
    Swift :: Interpreter/SDK/archiving_generic_swift_class.swift
    Swift :: Interpreter/SDK/objc_currying.swift

due to two independent remaining compiler bugs:
  * We're not getting partial ordering between NSCoder's
  encode(AnyObject, forKey: String) and NSKeyedArchiver's version of
  that method, and
  * Dynamic lookup (into AnyObject) doesn't know how to find the new
  names. We need the Swift name lookup tables enabled to address this.
2015-12-11 14:46:50 -08:00
Dmitri Gribenko
f846ef6fd1 RangeReplaceableCollection.removeRange() => .removeSubrange() 2015-12-09 17:17:51 -08:00
Dmitri Gribenko
9a9ff305f1 RangeReplaceableCollection.replaceRange() => .replaceSubrange() 2015-12-09 17:17:34 -08:00
Maxim Moiseev
844b81c46b SequenceType => Sequence 2015-12-09 17:16:56 -08:00
Dmitri Gribenko
4b1be0e78f removeAtIndex() => removeAt() 2015-12-09 17:15:01 -08:00
Dmitri Gribenko
df17ddbc9b init(count: Int, repeatedValue: Element) => init(repeating:count:)
Affected types: _ArrayType, Array, ArraySlice, ContiguousArray, Repeat,
String (initializers from Character and UnicodeScalar)
2015-12-09 17:14:37 -08:00
Dmitri Gribenko
2cf172160c Rename SequenceType.Generator associated type to SequenceType.Iterator 2015-12-09 17:11:05 -08:00
Xin Tong
eadac91a6b Fix a bug in how DSE tracks alive components in partial dead stores. rdar://23218844
Also enable test case disabled to appease the bots.

Swift SVN r32842
2015-10-23 04:34:47 +00:00
Arnold Schwaighofer
9147eab1a7 XFAIL test case that is currently failing when run with optimization
rdar://23218844

Swift SVN r32826
2015-10-22 16:03:47 +00: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
e1131ce3ee stdlib: Add back a test I removed
Reapply of 31476.

Swift SVN r31491
2015-08-26 15:14:20 +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
2588f44d83 stdlib: Add back a test I removed
Swift SVN r31476
2015-08-26 03:57:24 +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
David Farler
313a4c93c6 Review: Index protocol extensions
- Add Strict/Defaulted Index types to StdlibUnittest
- Test whether a random access index calls its more efficient
  customization by tracking successor calls.
- Fix the RandomAccessIndex.advancedBy(n, limit:) API by de-underscoring
  the limit parameter
- Inline some internal transparent default implementations to their only
  call site
- Attach _RandomAccessAmbiguity type to RandomAccessIndex

rdar://problem/22085119

Swift SVN r30979
2015-08-04 03:13:14 +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
Dmitri Hrybenko
4b008e6f31 stdlib: rename RangeReplaceableCollectionType.splice() to insertContentsOf()
rdar://21972324

Swift SVN r30608
2015-07-25 00:36:39 +00:00
Dmitri Hrybenko
d97ac3e64c stdlib: rename RangeReplaceableCollectionType.extend() to appendContentsOf()
rdar://21972324

Swift SVN r30607
2015-07-25 00:36:37 +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
Dave Abrahams
ce93b0a9e0 [stdlibunittest] Still more de-boilerplating WIP
Swift SVN r29951
2015-07-08 00:28:33 +00:00
Arnold Schwaighofer
ee0a1d1a58 More executable tests in validation-test
Swift SVN r29279
2015-06-03 23:28:45 +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
Dmitri Hrybenko
61214ec55b stdlib: remove Sliceable conformance from String
Swift SVN r28442
2015-05-11 20:58:31 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Dmitri Hrybenko
c109ec9125 stdlib: protocol extensions: de-underscore count()
Swift SVN r28246
2015-05-07 00:30:38 +00:00
Dmitri Hrybenko
e253881b02 stdlib: protocol extensions: de-underscore indices
Swift SVN r28245
2015-05-07 00:30:35 +00:00
Dmitri Hrybenko
25e74d21db stdlib: protocol extensions: de-underscore last
Swift SVN r28243
2015-05-07 00:30:32 +00:00
Dmitri Hrybenko
b08a57f752 stdlib tests: fix coding style
Swift SVN r28071
2015-05-02 03:33:10 +00:00
John McCall
0388c87613 Fix validation tests for error-handling import.
Swift SVN r28070
2015-05-02 02:46:34 +00:00
Dave Abrahams
4ce1891cae [stdlib] String is no longer a SequenceType
<rdar://20494686>

String itsef should only expose Unicode-correct algorithms, like proper
substring/prefix/suffix search, enumerating words/lines/paragraphs, case
folding etc. Promoting sequence-centric algorithms to methods on String
is not acceptable since it invites users to write wrong code. Thus,
String has to lose its SequenceType conformance.

Nevertheless, we recognize that sometimes it is useful to manipulate the
String contents on lower levels (UTF-8, UTF-16, Unicode scalars,
extended grapheme clusters), for example, when implementing high-level
Unicode operations, so we can't remove low-level operations
altogether. For this reason, String provides nested "views" for the
first three low-level representations, but grapheme clusters were in a
privileged position -- String itself is a collection of grapheme
clusters. We propose to add a characters view that will represent the
String as a collection of Character values.

Swift SVN r28065
2015-05-02 01:52:02 +00:00
Ted Kremenek
9f5437e2bc Make 'toInt()' unavailable instead of deprecated.
Swift SVN r28029
2015-05-01 06:25:52 +00:00
Doug Gregor
0523a09560 Update validation testsuite for the argument label default changes.
Swift SVN r27706
2015-04-24 20:31:43 +00:00
Dave Abrahams
ac3f047496 [stdlib] Renaming fallout from Mirror API review
toString(x)      => String(x)
toDebugString(x) => String(reflecting: x)
Printable        => CustomStringConvertible
DebugPrintable   => CustomDebugStringConvertible

Also updated comments to clarify these protocols

Swift SVN r27090
2015-04-07 20:32:26 +00:00
Mark Lacey
b7dc974c1f Fix test by adjusting spacing around range operator.
Swift SVN r26544
2015-03-25 18:15:38 +00:00
Dave Abrahams
2822677b4b [stdlib] Clean up some endline layout in the tests
Just following our coding convention...

Swift SVN r26507
2015-03-24 23:55:55 +00:00
Dmitri Hrybenko
87aa7a25ba Update String test to new Foundation API (nullability audit)
Swift SVN r26493
2015-03-24 18:00:09 +00:00
Dmitri Hrybenko
e460eb6264 Revert "[stdlib] Replace aString.toInt() with Int(aString)"
This reverts commit r25636.  It depends on integer parsing APIs, which
are being moved to SwiftExperimental.

Swift SVN r25889
2015-03-09 19:04:18 +00:00
Graham Batty
dd92de792f Use ICU to implement basic string functions.
Swift SVN r25803
2015-03-06 19:15:34 +00:00