Commit Graph

37 Commits

Author SHA1 Message Date
Andrew Trick
0b75ee975e Remove "illegal" UnsafePointer casts from the stdlib.
Update for SE-0107: UnsafeRawPointer

This adds a "mutating" initialize to UnsafePointer to make
Immutable -> Mutable conversions explicit.

These are quick fixes to stdlib, overlays, and test cases that are necessary
in order to remove arbitrary UnsafePointer conversions.

Many cases can be expressed better up by reworking the surrounding
code, but we first need a working starting point.
2016-07-28 20:42:23 -07:00
Robert Widmann
4c2dbe1723 [stdlib][SE-0089] Finish off Lossless String Conversion (#3761)
* Rename string reflection init

* Addressing PR comments and updating some tests

* Update test suite for lossless string conversion
2016-07-28 17:13:25 -07:00
Xiaodi Wu
670dbdc408 [SE-0134] Rename UTF8-related properties on String 2016-07-27 21:13:58 -05:00
Andrew Trick
c7aa8284c9 Add basic CString <-> UTF8 API variants.
As proposed by SE-0107: UnsafeRawPointer:
https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md#cstring-conversion
Adds String.init(cString: UnsafePointer<UInt8>)
Adds String.nulTerminatedUTF8CString: ContiguousArray<CChar>

This is necessary for eliminating UnsafePointer conversion.  Such
conversion is extremely common for interoperability between Swift
strings and C strings to bridge the difference between CChar and
UTF8.CodeUnit. The standard library does not provide any convenient
utilities for converting between the differently typed
buffers. These APIs will handle the simplest cases involving C
interoperability. More convenience can be added later.
2016-07-22 23:41: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
Andrew Trick
5a8271c621 Rename UnsafePointer allocate & deallocate. (#3608)
As proposed in SE-0107: UnsafeRawPointer:
Rename 'init(allocatingCapacity:)' to 'UnsafeMutablePointer.allocate(capacity:)'
Rename 'deallocateCapacity' to 'deallocate(capacity:)'

`allocate` should not be an initializer. It's primary function is to allocate
memory, not initialize a pointer.
2016-07-19 11:48:18 -07:00
Dave Abrahams
4f68309b10 isEquivalent: => by areEquivalent: 2016-07-19 07:12:59 -06:00
Michael Gottesman
fc37603c5f Revert "Implement SE-0118" 2016-07-18 16:44:58 -07:00
Dave Abrahams
8ef5c5d019 isEquivalent: => by areEquivalent: 2016-07-18 14:29:09 -06:00
Michael Gottesman
40e1991e12 Revert "Name and label changes for closure parameters (for review only) (#2981)"
This reverts commit 18406900ba.
2016-07-15 19:45:26 -07:00
Dave Abrahams
18406900ba Name and label changes for closure parameters (for review only) (#2981)
Implement SE-0118 Name and label changes for closure parameters

[SE-0118](https://github.com/apple/swift-evolution/blob/master/proposals/0118-closure-parameter-names-and-labels.md)
2016-07-15 15:31:48 -07:00
rintaro ishizaki
ea2c7a6916 [test] Utilize %target-run-simple-swift where possible 2016-06-15 11:49:44 +09:00
Dave Abrahams
9bee5d182f [stdlib] location/formLocation => index/formIndex 2016-04-26 17:46:16 -07:00
Dmitri Gribenko
0984f81a50 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-22 18:56:35 -07:00
Dave Abrahams
47a870cc50 [stdlib] Use location/formLocation for all index movement 2016-04-21 17:13:41 -07:00
Arnold Schwaighofer
c4666a77a7 Fast path hasPrefix for ASCII Strings
We are no longer failing the un-XFAILed test case because we are not calling
into CoreFoundation.

rdar://25797140
2016-04-19 10:23:17 -07:00
Dmitri Gribenko
c52787e900 Merge commit '9cdbec13eee72feccfc5f8b987882a8c52e8107b' into swift-3-indexing-model 2016-04-14 16:23:53 -07:00
Dmitri Gribenko
10697f939f Merge commit '510f29abf77e202780c11d5f6c7449313c819030' into swift-3-indexing-model 2016-04-14 13:45:27 -07:00
Jordan Rose
bc83940301 Make pointer nullability explicit using Optional.
Implements SE-0055: https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md

- Add NULL as an extra inhabitant of Builtin.RawPointer (currently
  hardcoded to 0 rather than being target-dependent).
- Import non-object pointers as Optional/IUO when nullable/null_unspecified
  (like everything else).
- Change the type checker's *-to-pointer conversions to handle a layer of
  optional.
- Use 'AutoreleasingUnsafeMutablePointer<NSError?>?' as the type of error
  parameters exported to Objective-C.
- Drop NilLiteralConvertible conformance for all pointer types.
- Update the standard library and then all the tests.

I've decided to leave this commit only updating existing tests; any new
tests will come in the following commits. (That may mean some additional
implementation work to follow.)

The other major piece that's missing here is migration. I'm hoping we get
a lot of that with Swift 1.1's work for optional object references, but
I still need to investigate.
2016-04-11 20:06:38 -07:00
Max Moiseev
0124bd261f [stdlib][swift-3-indexing-model] un-commenting and un-spliting .lazy usages 2016-04-11 17:58:52 -07:00
Max Moiseev
1a875cb922 [stdlib][swift-3-indexing-model] speeding up the compilation 2016-04-08 11:06:05 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Dmitri Gribenko
6985b958fd Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-04 11:42:17 -07:00
Slava Pestov
49c54870c1 Serialization: Auto-linking recursively walks modules imported from -sil-serialize-all modules 2016-04-01 12:21:36 -07:00
Dave Abrahams
01127b32d5 index(n, stepsFrom: i)
M-x findr-query-replace

\<advance(\([^:]+?\),\([
]+\)by: *\([^(),]*\|[^(),]+([^()]*)[^(),]*\)\(,\(?:[
]+\)limit: *\(?:[^()]*\|[^()]+([^()]*)[^()]*\)\)?)

index(\3,\2stepsFrom: \1\4)
2016-03-25 17:54:39 -07:00
Shawn Erickson
fe9482b6bb New indexing model: WIP fixed compile issues in various stdlib tests 2016-03-13 21:00:01 -07:00
Jordan Rose
e4e9c71d8f StdlibUnittest: Rename enum cases and static vars to match API guidelines. 2016-02-24 18:23:59 -08:00
Dmitri Gribenko
e81f99d7ea stdlib: Sequence.startsWith() => .starts(with:) 2016-02-23 18:12:09 -08:00
Dmitri Gribenko
65d840c0ae stdlib: lowercase cases in Optional and ImplicitlyUnwrappedOptional 2016-02-18 00:40:33 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
Max Moiseev
55fde4c923 making tests pass 2016-02-10 16:08:40 -08:00
Chris Lattner
92750511df Convert the last uses of __FILE__ etc in the testsuite over to the new
syntax.  I left the tests for the deprecation warnings in
test/expr/expressions.swift.
2016-02-04 15:41:09 -08:00
Dmitri Gribenko
544f36a360 Simplify StringAPI.swift XFAILs 2016-02-04 09:48:38 -08:00
Guillaume Lessard
8e8ce7a057 Make tests runnable on Linux
Documenting a few failed test cases along the way
2016-01-29 07:15:49 -07:00
Guillaume Lessard
814bc3531e Remove Foundation-API tests 2016-01-28 19:18:15 -07:00
Guillaume Lessard
afcbecccff File rename 2016-01-28 13:08:08 -07:00