Commit Graph

10 Commits

Author SHA1 Message Date
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
Doug Gregor
772352e524 Add requirement StringProtocol.SubSequence : StringProtocol 2017-10-01 15:08:23 -07:00
Arnold Schwaighofer
c665c326d4 Add missing REQUIRES: executable_test
To get check-swift-only_non_executable clean again.
2017-09-12 14:50:15 -07:00
Michael Ilseman
3243b8a59f [stdlib] Availability checking for String.*View.popFirst
Collection's popFirst is only present when the Collection is its own
SubSequence type. String and String's views are no longer their own
SubSequenes, so popFirst is no longer present. Unfortunately, this
breaks code in swift-version 3 and it also gives a terrible diagnostic
to users. This change introduces an implementation for swift-version 3
mode and better diagnostics for Swift 4 code. Tests included.
2017-08-09 19:41:52 -07:00
Dave Abrahams
05ff40d125 [stdlib] Backward-compatible String.UTF8View slicing
When slicing String.UTF8View in Swift 3 mode, in the absence of type
context, produce String.UTF8View.
2017-07-20 14:54:16 -07:00
Dave Abrahams
38828872b9 [stdlib] Add missing unwraps for backward compatibility
Otherwise, the result would have been an infinite recursion.
2017-07-14 15:30:06 -07:00
Dave Abrahams
e59cb97048 [stdlib/Foundation] Swift 3 backward compatibility hack
Since samePosition(in:) now unconditionally returns optionals,
String.UTF16View.Index.distance(to: String.UTF16View.Index) must accept an
optional to keep some code working.

Fixes <rdar://33307780>.
2017-07-14 15:30:06 -07:00
Dave Abrahams
807410b99e [stdlib] Make String("...") non-failable in Swift 4 2017-05-24 16:11:34 -07:00
Maxim Moiseev
8876655f6b [stdlib] Reverting the String.init?(_: String) behavior (#9659) 2017-05-17 13:56:15 -07:00
Max Moiseev
12f8b390c1 [stdlib] Mark String.init?(_: String) obsoleted in Swift 4
It is still possible to get the same behavior by providing an explicit
type context, or in a generic code, but otherwise, `String("")!` will
not compile.
2017-05-13 11:45:26 -07:00