Commit Graph

148 Commits

Author SHA1 Message Date
Lance Parker e0e50e9b3e Add failing test 2018-02-28 11:27:40 -08:00
Lance Parker 7cc222e271 Ditched the simple/complex test distinction as they all pass now (#20) 2018-02-19 10:09:24 -08:00
Lance Parker 0661de22a2 [stdlib]Un-revert string comparison (#14694)
Restore (un-revert) sting comparison, with fixes

More exhaustive testing of opaque strings, which consistently reproduces prior sporadic failure. Shims fixups. Some test tweaking.
2018-02-18 10:50:33 -08:00
Lance Parker abe6a6d177 Revert string comparison (#14657) 2018-02-15 14:37:43 -08:00
Lance Parker 49bc1459ae Update string comparison tests 2018-02-14 15:44:11 -08:00
Karoy Lorentey b8d8949166 String & String views: Add bounds checking to range subscripts. 2018-01-21 12:40:21 -08:00
Karoy Lorentey 90e894729a [StringGuts] Linux support
Add support for compiling StringGuts without the Objective-C runtime.
2018-01-21 12:37:36 -08:00
Michael Ilseman 3be2faf5d3 [String] Initial implementation of 64-bit StringGuts.
Include the initial implementation of _StringGuts, a 2-word
replacement for _LegacyStringCore. 64-bit Darwin supported, 32-bit and
Linux support in subsequent commits.
2018-01-21 12:32:26 -08:00
Michael Ilseman 75463e30f3 [stdlib] Rename _StringCore to _LegacyStringCore. NFC.
In grand LLVM tradition, the first step to redesigning _StringCore is
to first rename it to _LegacyStringCore. Subsequent commits will
introduce the replacement, and eventually all uses of the old one will
be moved to the new one.

NFC.
2018-01-21 12:28:56 -08:00
Ben Cohen ca6c6b1d36 [stdlib] Cleanup DefaultIndices, delete dead code (#13952)
* Remove a bunch of Default(Bidirectional|RandomAccess)Indices usage from stdlib and test

* Remove some DefaultRandomAccessIndices and IndexDistance usage from Foundation

* Remove no-longer-used internal type in Existentials.swift

* Get rid of indicesForTraversal
2018-01-15 13:48:08 -08:00
Ben Cohen 4ddac3fbbd [stdlib] Eradicate IndexDistance associated type (#12641)
* Eradicate IndexDistance associated type, replacing with Int everywhere

* Consistently use Int for ExistentialCollection’s IndexDistance type.

* Fix test for IndexDistance removal

* Remove a handful of no-longer-needed explicit types

* Add compatibility shims for non-Int index distances

* Test compatibility shim

* Move IndexDistance typealias into the Collection protocol
2017-12-08 12:00:23 -08:00
Ben Cohen dcab9493ae Removed some warnings (#12753) 2017-11-30 15:12:56 -08:00
Nate Cook 9dce40ca24 [stdlib] Add tests for index hashability 2017-11-28 13:29:55 -06:00
Lance Parker 77b0f39cc2 Max's feedback 2017-08-29 17:23:11 -07:00
Lance Parker 19d43c24d1 Some more test cleanup 2017-08-28 22:49:19 -07:00
Lance Parker 3f60f1c80f Remove commented out code 2017-08-28 22:44:41 -07:00
Lance Parker c623881c78 Fix Linux tests 2017-08-28 21:24:11 -07:00
Lance Parker 0ebb2fecca Add COW test for String 2017-08-28 17:20:19 -07:00
Dave Abrahams 41c53ae729 [stdlib] Give Substring its own views
This necessary for ensuring the property that String doesn't keep
inaccessible memory alive.  For example, before this change,

    String(s.dropFirst().unicodeScalars)

would compile and produce a String that owned inaccessible memory.
Now it no longer compiles.

String's view's SubSequences are the same as the Substring's
view. E.g. String.UnicodeScalarView.SubSequence is
Substring.UnicodeScalarView.

New compatibility inits added, to work around the fact that many
previously failable initializers are now non-failable.
2017-07-26 15:59:51 -07:00
Dave Abrahams 1f1f35a57b [stdlib] Squash some warnings in a test 2017-07-26 15:59:12 -07:00
Dave Abrahams e6519fbd2b [stdlib] Make String.UTF8View bidirectional
This is a step along the way toward handling backward-compatiblity of UTF8View
slicing and preventing inadvertent creation of String instances that keep
inaccessible memory alive.
2017-07-17 13:53:45 -07:00
Dave Abrahams 9159239995 Un-revert "[stdlib] String index interchange, etc." (#10812)
I failed to merge the upstream changes to swift-corelibs-foundation at the same
time as I merged that #9806, and it broke on linux. Going to get it right this
time.
2017-07-07 12:13:25 -07:00
Xi Ge d9fb110674 Revert "[stdlib] String index interchange, etc." (#10812)
rdar://33186295
2017-07-07 12:03:16 -07:00
Dave Abrahams 73f116e9de [stdlib] Fix a test: String.UTF8View has its own Iterator now 2017-07-07 06:15:25 -07:00
Dave Abrahams b1d2f4c68e [stdlib] String index interchange, part III (UTF8) 2017-07-07 06:15:24 -07:00
Dave Abrahams 2e0bb2f533 [stdlib] String index interchange, part II (UTF16) 2017-07-07 06:15:23 -07:00
Dave Abrahams e523c80339 [stdlib] Index interchange, part I 2017-07-07 00:59:04 -07:00
Dave Abrahams b2e4bd5d09 [stdlib] Replace _HeapBuffer with a thin wrapper
...over ManagedBufferPointer
2017-06-01 04:40:52 -07:00
Dave Abrahams ce804529a1 [stdlib] Dump _StringStorage.grow()
This implementation detail was adding lots of needless complexity
2017-05-31 16:12:22 -07:00
Max Moiseev 178b9f0b44 [stdlib] Adding bounds check in a.subscript(Index) fast path
UnsafeBufferPoiunter subscript used in the fast path only checks bounds
in Debug mode, therefore extra checks are needed.

Addresses: <rdar://problem/31992473>
2017-05-05 15:26:24 -07:00
Graydon Hoare badf215b82 Use .skip rather than .xfail on unknown-cause stdlib String test (rdar://31992473) 2017-05-05 11:06:45 -07:00
Maxim Moiseev b93dd6602e XFAILing the String test to fix the build 2017-05-05 10:38:50 -07:00
ben-cohen a7def4bba9 Delete old unused String._splitFirst 2017-04-30 06:04:15 -07:00
Max Moiseev 8ffbc81239 Fixing some validation tests 2017-03-10 17:09:28 -08:00
Syo Ikeda e2b03a98dd [gardening] Prefer Array(seq) over seq.map { $0 } 2017-02-04 10:37:22 +09:00
ben-cohen ce0d713cd6 fixed where clauses, Optional-as-Any and unused vars 2016-12-29 07:58:12 -08:00
Dmitri Gribenko 243a35cd65 Migrate callsites from 'expectEmpty()' to 'expectNil()' 2016-09-10 20:05:42 -07:00
Doug Gregor b9363fe6bd [SE-0111] Enable SE-0111 by default. 2016-07-29 17:28:24 -07:00
Rintaro Ishizaki c6f4bcd01e [SE-0101] MemoryLayout: Migrate testsuite and benchmarks 2016-07-30 03:11:45 +09:00
Robert Widmann 35fe7c7ad6 Cleanup validation tests after SE-0089 2016-07-28 18:01:44 -07:00
Roman Levenstein 8ea999e19f Fix a failing test 2016-07-26 23:30:06 -07:00
Michael Gottesman 3b7a5c6dd8 Disable test while Roman is looking into it to fix the build.
rdar://17028332
2016-07-26 23:07:18 -07:00
swiftix 9756755e68 Merge pull request #3758 from swiftix/SE-130-implementation
Implementation of the SE-130 proposal.
2016-07-26 22:15:13 -07:00
Roman Levenstein a798852cb4 Implementation of the SE-130 proposal.
It replaces String initializers taking Character or UnicodeScalar as a repeating value by a more general initializer that takes a String as a repeating value. This is done to avoid the ambiguities in the current String API, which can be only resolved by explicit casting.
String.append(_:UnicodeScalar) APIs is also removed to match these changes.
2016-07-26 20:08:11 -07:00
Xin Tong 9709b0e510 Merge pull request #3662 from trentxintong/unicodescalar
SE-0128 - Change unicodescalar initializer to failable
2016-07-26 16:44:14 -07:00
Arnold Schwaighofer 39389b9c09 [SE-0125] Remove isUniquelyReferenced and the NonObjectiveCBase class
We can express the same using the `isUniquelyReferencedNonObjC` API.

- Rename `isUniquelyReferencedNonObjC` to `isKnownUniquelyReferenced`.
- Cleanup `ManagedBufferPointer` by removing holdsUniqueOrPinnedReference` and
  renaming `holdsUniqueReference` to `isUniqueReference`.
- No longer promise to return false from `isKnownUniquelyReferenced` for @objc
  class instances.

SR-1962
rdar://21886410
2016-07-26 07:09:29 -07:00
Xin Tong bbf86865d6 Change unicodescalar to failable
We were using a precondition which crashes the program when invalid input is
provided. We want to provide a way to gracefully check and handle invalid input
or shutdown the program if necessary.

SR-1930
2016-07-21 15:27:13 -07:00
Alexander Lash 9a4caf6c4b [core] hasPrefix/hasSuffix consider the empty string a prefix/suffix of all strings. 2016-07-20 17:46:47 -07:00
Dmitri Gribenko 1d3f595955 stdlib: re-enable validation-test/stdlib/String.swift 2016-07-15 20:33:47 -07:00
Michael Gottesman 16143ca41f Disable test to unbreak the build.
rdar://27381049
2016-07-15 15:08:54 -07:00