Commit Graph

241 Commits

Author SHA1 Message Date
Maxim Moiseev
a5ff35cd41 [stdlib] extendingOrTruncating: => truncatingIfNeeded: 2017-07-26 11:09:36 -07:00
Michael Ilseman
2f0dafbac3 Merge pull request #11191 from milseman/very_persistent
[stdlib] Fix bug in Substring's _persistentContent
2017-07-26 08:57:53 -07:00
Omar Sharif Fathi
888fe8df3d Update String.swift 2017-07-26 02:40:45 +02:00
Michael Ilseman
b37417bdb5 [String] Delete dead code; NFC 2017-07-24 16:09:54 -07:00
Max Moiseev
5f1c3f7021 [overlay] Generalize Foundation StringProtocol extensions 2017-07-07 15:34:56 -07:00
Max Moiseev
1a1c1a0d21 [stdlib] StringProtocol no longer refines RangeReplaceableCollection
https://bugs.swift.org/browse/SR-5379
2017-07-06 09:40:10 -07:00
Maxim Moiseev
a31e2bde14 Merge pull request #10097 from apple/stringprotocol-reform
[stdlib] Eliminate over-constraint on StringProtocol
2017-06-14 15:13:56 -07:00
Nate Cook
825e9d077d [stdlib] More documentation revisions / consistency fixes. 2017-06-13 14:08:00 -05:00
Nate Cook
b7af9bfe83 [stdlib] Remove SeeAlso tags 2017-06-13 11:23:51 -05:00
Dave Abrahams
eb04df45f4 [stdlib] Eliminate over-constraint on StringProtocol 2017-06-03 17:18:20 -07:00
Roman Levenstein
ecff16cba3 Reduce code size of the stdlib
This should reduce the code size of the stdlib by 1.5%.
2017-06-03 14:22:12 -07:00
Ben Cohen
d0c0043f93 [stdlib] Use ephemeral string for substring comparison (#10009)
* Use _ephemeralString for substring comparison

Add back != for String/Substring comparison

* OK fine, Linux, if you're going to be difficult

* Different forms of comparison, tests
2017-06-03 11:20:01 -07:00
Roman Levenstein
00d663d172 [sil-generic-specializer] Add @_semantics("optimize.sil.specialize.generic.partial.never") to disable partial specialization on functions
This new @_semantics is used to annotate some very big functions in the standard library. It reduced the code size of the stdlib by 2%.
2017-06-01 16:33:18 -07:00
Dave Abrahams
4f5e14845b [stdlib] Eliminate optionals from specialization code
Apparently this makes the optimizer happier.  Still waiting on #9792 for truly
efficient specialization.

https://github.com/apple/swift/pull/9792
2017-05-22 15:59:43 -07:00
Dave Abrahams
d6fee05375 [stdlib] Enable interchange among StringProtocol models 2017-05-17 17:21:43 -07:00
Maxim Moiseev
8876655f6b [stdlib] Reverting the String.init?(_: String) behavior (#9659) 2017-05-17 13:56:15 -07:00
Nate Cook
817a1efa3b [stdlib] Documentation revisions
- remove additional 'characters' references from String docs
- improved language around escaping pointer arguments
- key path type abstracts
- codable type abstract revisions
- a few more NSString API fixes
2017-05-17 11:58:08 -05:00
practicalswift
aae419ad30 [gardening] Fix word processing artefacts 2017-05-15 11:30:25 +02:00
Ben Cohen
ea2f64cad2 [stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement (#8990)
* Give Sequence a top-level Element, constrain Iterator to match

* Remove many instances of Iterator.

* Fixed various hard-coded tests

* XFAIL a few tests that need further investigation

* Change assoc type for arrayLiteralConvertible

* Mop up remaining "better expressed as a where clause" warnings

* Fix UnicodeDecoders prototype test

* Fix UIntBuffer

* Fix hard-coded Element identifier in CSDiag

* Fix up more tests

* Account for flatMap changes
2017-05-14 06:33:25 -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
Nate Cook
f650e0a7da [stdlib] String and range expressions
* finish string documentation revisions
* revise examples throughout to use range expressions instead of e.g.
  prefix(upTo: _)
2017-05-13 10:06:12 -05:00
Nate Cook
7fa74f590d [stdlib] Documentation revisions for string + ranges
* removing .characters from examples
* beginning new String doc revisions
* improvements to the String Foundation overlay docs
* minor revisions elsewhere
2017-05-13 10:06:05 -05:00
Max Moiseev
f8bb0d88d7 Revert "[stdlib] Removing a String.init?(_: String), non-failable is enough"
This reverts commit 46415e7dbd.
2017-05-12 20:47:34 -07:00
Max Moiseev
46415e7dbd [stdlib] Removing a String.init?(_: String), non-failable is enough 2017-05-12 14:48:30 -07:00
Dave Abrahams
41c244a065 [stdlib] Unicode[Encoding|Parser] => Unicode.[Encoding|Parser] 2017-05-11 17:21:39 -07:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
Dave Abrahams
97f875ad84 [stdlib] De-underscore Unicode "namespace" 2017-05-11 15:23:25 -07:00
Max Moiseev
109c213358 [stdlib] Prioritizing non-failing String.init_:String) 2017-05-10 15:58:00 -07:00
Max Moiseev
cce957ba98 [stdlib] Removing the StringProtocol.init<T: StringProtocol> 2017-05-10 15:58:00 -07:00
Dave Abrahams
c64534a873 [stdlib] API adjustments in preparation for proposal update 2017-05-09 11:19:24 -07:00
Dave Abrahams
e7b32f9dc9 [stdlib] UnicodeEncoding: hide/internalize APIs we're not sure about
The best high-level APIs for decoding/transcoding are still under active
investigation.  It's likely we want more views.  Therefore, leave
de-underscored/public only the lowest-level APIs for now.
2017-05-09 10:20:29 -07:00
Dave Abrahams
fd8cfea3ac [stdlib] String initialization with encoding and CString interop 2017-05-08 19:50:38 -07:00
Dave Abrahams
c5d6880053 [stdlib] Add ASCII UnicodeEncoding, drop uses of legacy codecs
Preparation for new C-string interop.
2017-05-07 20:43:44 -07:00
Dave Abrahams
f155d499c0 [stdlib] Drop redundant constraint 2017-05-02 16:54:27 -07:00
Max Moiseev
bfb1824f44 [stdlib] Adding the StringProtocol 2017-05-01 16:41:26 -07:00
Max Moiseev
288eee0b1b [stdlib] New overload for joined()
Now that `String` conforms to the `BidirectionalCollection` protocol, in
the expression `let x = [""].joined()` the best matching overload for
`joined` is no longer the one returning `String`.

Fixes: <rdar://problem/31899440>
2017-05-01 12:41:57 -07:00
Andrew Bennett
ca31338e49 Simplifying implementation of ExpressibleByStringLiteral (#7125)
* Simplify conforming to ExpressibleByStringLiteral with default implementations

* attributes on default implementations

* ExpressibleByUnicodeScalarLiteral validation test

* more generic default implementations

* clean up test

* remove unneeded implementations

* remove test verification

* indent

* revert @effects and affected methods

* fix test generics with _ protocols

* Add semantic tests

* clean up tests

* Fix redundant conformance requirements
2017-04-21 20:45:28 -07:00
Max Moiseev
b9fb3badc8 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-03-22 12:30:24 -07:00
Roman Levenstein
2c811b82a1 Adjust some tests to pass in non-resilient and resilient modes. 2017-03-16 19:46:11 -07:00
Max Moiseev
27889c6376 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-06 15:54:44 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Max Moiseev
61b923f396 Using init(extendingOrTruncating:) instead of a deprecated init(truncatingBitPattern:) 2016-12-15 14:53:31 -08:00
Max Moiseev
70b2343626 Merge branch 'master' into new-integer-protocols 2016-11-28 15:25:01 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Max Moiseev
953d919a22 Merge branch 'master' into new-integer-protocols 2016-11-16 14:46:31 -08:00
Max Moiseev
8fea72db20 Using more masking shifts 2016-11-16 14:45:32 -08:00
Nate Cook
bd6025f463 [stdlib] Various documentation fixes
- Fix incorrect type in Float(_:String) examples
- Expand discussions for ExpressibleBy_Literal protocols
- Add notes about non-escaping unsafe pointers from closures
- Add note about isEmpty to Collection.count discussions
- Describe imported `Bool` types
- Clean up some floating point discussions
- Provide some additional operator documentation
- Revise documentation for CVarArg functions
- Fix incorrect Set method parameter descriptions
- Clarify array bridging behavior
- Add collection subscript complexity notes
2016-11-11 11:23:49 -06:00
Dmitri Gribenko
77813904f8 stdlib: replace error-prone pairs of isASCII/startASCII calls with an API that returns Optional 2016-09-05 22:47:24 -07:00
Dmitri Gribenko
fc6add3880 stdlib: move 'String : Comparable' conformance to a separate file
I'm about to add more code around it.
2016-09-04 14:01:35 -07:00
Dmitri Gribenko
5aa005f9dd Merge pull request #4552 from Nirma/string_buffer_check
[stdlib] rewrite optional handling using map
2016-09-04 13:52:59 -07:00