Commit Graph

98 Commits

Author SHA1 Message Date
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
Doug Gregor
cccfe7ab1f [Printing] Print tuple labels when available.
When printing a tuple via print(...), print tuple labels when they are
available. This is possible now that the runtime metadata properly
stores tuple labels. Fixes rdar://problem/23130016.
2016-09-21 09:00:22 -07: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
Dave Abrahams
54cae5d453 [stdlib] Streamable => TextOutputStreamable
This is logically part of
[SE-0086](https://github.com/apple/swift-evolution/blob/master/proposals/0086-drop-foundation-ns.md)
since it goes with 2a4e916 (Rename OutputStream to TextOutputStream [SE-0086])
2016-08-08 17:03:42 -07:00
Dave Abrahams
98ae7dc012 [stdlib] staging for s/Streamable/TextOutputStreamable/
swiftpm uses it, so we need to do this in steps.
2016-08-08 16:44:29 -07:00
Nate Cook
559092bbf2 [stdlib] Revise stdlib documentation comments
- Expand pre-example explanations
- Update documentation for SE-0118
- Removing remaining 'iff' usage
- Revise Array discussion
- Fix formIndex(_:offsetBy) parameter formatting
- Improve index/formIndex(_:offsetBy:(limitedBy:)?) discussion
- Update Quick Look discussions
- Fixes grammar inconsistencies
- Adds parameter / return documentation
- Adds and expands on examples
- Revises AnyObject discussion for new `id` bridging rules
- Revise readLine, print, and assertion functions
- Add missing docs to String index-moving methods
2016-08-05 16:07:46 -05:00
Robert Widmann
14dc86cf15 Polish off uses of dynamicType in codebase 2016-07-29 16:58:40 -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
Tony Parker
cecc463bd0 Rename NSOutputStream to OutputStream 2016-07-21 14:06:15 -07:00
Tony Parker
bd13c75605 Add a typealias to avoid a build ordering dependency between projects 2016-07-19 09:09:42 -07:00
Tony Parker
2a4e916296 Rename OutputStream to TextOutputStream [SE-0086] 2016-07-18 16:47:23 -07:00
Rintaro Ishizaki
6ef62f3c73 [stdlib] Better diagnosis for unavailable APIs
Added tests for expected-error and fix-its.

- Add arguments signature regardless that is the same as before.
  Because the error message looks more natural.
  e.g. "makeIterator" => "makeIterator()",
  "replaceSubrange" => "replaceSubrange(_:with:)"
- Any${ExistentialCollection}.underestimateCount() was a method, not
  computed property.
- 'LazySequenceType' has been renamed to 'LazySequenceProtocol', but not
  'LazyCollectionProtocol'
- Streamable.writeTo(_:) had no argument label.
- Fixed typo in print() debugPrint() error message (not working for now)
- Repeated.init(): changed `renamed` to `message` because the arugment
  order has changed.
- Marked `public` for some unavailable method on `Sequence`
- Sequence.split(_:maxSplit:allowEmptySlices) was replaced with
  split(separator:maxSplits:omittingEmptySubsequences:),
  not split(separator:omittingEmptySubsequences:isSeparator:)
- Sequence.split(_:allowEmptySlices:isSeparator) was replaced with
  split(maxSplits:omittingEmptySubsequences:isSeparator:),
  not split(_:omittingEmptySubsequences:isSeparator:)
- Sequence.startsWith(_:isEquivalent:) or startsWith(_:) had no label on
  the first argument.
- transcode(_:_:_:_:stopOnError), not transcode(_:_:_:_:stoppingOnError)
- Removed mutating methods from UnsafePointer.
  alloc(_:), dealloc(_:), setter:memory, initialize(_:), destroy(),
  and destroy(_:)
2016-07-01 14:52:09 +09:00
Nate Cook
44b2d56a7f [stdlib] Revise documentation for string-related types
This documentation revision covers a large number of types & protocols:
String, its views and their indices, the Unicode codec types and protocol,
as well as Character, UnicodeScalar, and StaticString, among others.

This also includes a few small changes across the standard library for
consistency.
2016-05-22 03:04:22 -05:00
Max Moiseev
ccc318c91a [stdlib] Adding @available attribute to Streamable.writeTo(target:)
Fixes [SR-1575](https://bugs.swift.org/browse/SR-1575)
2016-05-20 14:14:41 -07:00
Nate Cook
9f326385d6 [stdlib] Revise documentation for core types and protocols
This adds to and expands upon documentation for some core parts of the
standard library, including Optional, ErrorProtocol, AnyObject, and Bool.
2016-05-09 16:41:20 -05: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
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
Daniel Duan
276370b599 [stdlib] apply SE-0040 to stdlib 2016-03-11 16:01:41 -08:00
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Ted Kremenek
838d5864ba Merge pull request #1498 from ianpartridge/print-using-fwrite
[stdlib] Use fwrite(3) in _Stdout.write()
2016-03-08 21:52:42 -08:00
Ted Kremenek
90ce8daf0b Merge pull request #1552 from hughbe/stdlib-newlines
[gardening] Remove double new lines from stdlib files
2016-03-05 14:40:04 -08:00
Hugh Bellamy
c1b25bb32f [gardening] Remove double new lines from stdlib files 2016-03-05 15:44:54 +00:00
Ian Partridge
1fcf15b150 [stdlib] Ignore errors from fwrite() 2016-03-02 17:29:18 +00:00
Ian Partridge
1ee493218b [stdlib] Add _fixLifetime() to avoid ARC leak 2016-03-01 22:23:39 +00:00
Ian Partridge
fbf11ce054 [stdlib] Fix indentation 2016-03-01 20:49:53 +00:00
Ian Partridge
9412c21345 [stdlib] Use fwrite(3) in ASCII fastpath only 2016-03-01 20:18:32 +00:00
Ian Partridge
259d57bbe7 [stdlib] Use fwrite(3) in print() 2016-03-01 15:55:52 +00:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Dmitri Gribenko
82998a155a stdlib: _TeeStream: unlock streams in the order opposite to locking order 2016-02-22 18:16:38 -08:00
Dmitri Gribenko
e2f5e05ec4 stdlib: Streamable.writeTo() => .write(to:) 2016-02-22 18:16:37 -08:00
Dmitri Gribenko
b1ef18fb75 stdlib: lowercase cases of AncestorRepresentation and DisplayStyle enums 2016-02-19 16:06:26 -08:00
Max Moiseev
55fde4c923 making tests pass 2016-02-10 16:08:40 -08:00
Max Moiseev
39fdbca8d0 making Swift build succesfully after the merge 2016-02-04 16:48:14 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Kevin Ballard
ac1996000e [Stdlib] Remove all redundant stdout locking when printing
* Switch to calling `putchar_unlocked()` instead of `putchar()` for
  actual printing. We're already locking stdout with `flockfile()`, so
  there's no need for the redundant lock that `putchar()` uses.
* Add an explicit lock to the output stream in `dump()`. This means the
  entire dump is printed with the lock held, which will prevent the
  output of `dump()` from mixing with prints on other threads.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `_adHocPrint()`. The output stream is already locked while this
  function is executing. Rename the function to `_adHocPrint_unlocked()`
  to make this explicit.
* Use `targetStream.write()` and `_print_unlocked()` instead of
  `print()` in `_dumpObject()`. This removes the redundant locking, and
  also eliminates the creation of intermediate strings. Rename the
  function to `_dumpObject_unlocked()` to make this explicit.
* Use `targetStream.write()`, `_print_unlocked()`, and
  `_debugPrint_unlocked()` in `_dumpSuperclass()`. This removes the
  redundant locking, and also eliminates the creation of intermediate
  strings. Rename the function to `_dumpSuperclass_unlocked()` to make
  this explicit.
* Use `_debugPrint_unlocked()` instead of `debugPrint()` in
  `String.init(reflecting:)`. This shouldn't really make much of a
  difference but it matches the usage of `_print_unlocked()` in
  `String.init(_:)`.

The net result is that all printing is still covered under locks like
before, but stdout is never recursively locked. This should result in
slightly faster printing. In addition, `dump()` is now covered under a
single lock so it can't mix its output with prints from other threads.
2016-02-02 13:40:55 -08:00
Austin Zheng
77918a86ac [SR-88] Reinstate Mirror migration changes, fix test issues
This reverts commit 182bb7f812.
2016-01-27 20:40:52 -08:00
Andrew Trick
182bb7f812 Revert "Merge pull request #1058 from austinzheng/az-port-mirror"
This pull request broke the following tests on several build configurations
(eg --preset=buildbot,tools=RA,stdlib=DA)

    1_stdlib/Reflection.swift
    1_stdlib/ReflectionHashing.swift
    1_stdlib/UnsafePointer.swift.gyb

This reverts commit c223a3bf06, reversing
changes made to 5c2bb09b09.
2016-01-27 10:43:08 -08:00
Austin Zheng
10d5b23c30 [SR-88] Reinstate mirror migration commit
Changes:
- Reverted commit reverting original SR-88 commit
- Removed mirror children helper collections and related code
- Rewrote some tests to keep them working properly
- Wrote two more tests for the three pointer APIs to ensure no crashes if created using a value > Int64.max

This reverts commit 8917eb0e5a.
2016-01-26 19:28:32 -08:00
Dmitri Gribenko
9bcd5a1056 Collection.length => .count 2016-01-22 18:41:19 -08:00
Mark Lacey
8917eb0e5a Revert "[Runtime][StdLib] Migrate mirrors to use CustomReflectable API, rewrite dump()"
This reverts commit 9798dfd4aa because it
broke the stdlib build.
2016-01-22 08:41:07 -08:00
Austin Zheng
9798dfd4aa [Runtime][StdLib] Migrate mirrors to use CustomReflectable API, rewrite dump()
Jira: SR-88
Changes:
- Removed stdlib type conformances to _Reflectable
- Conformed stdlib types to CustomReflectable, CustomPlaygroundQuickLookable
- Rewrote dump() function to not use _reflect()
- CGRect, CGPoint, CGSize now conform to CustomDebugStringConvertible
- Rewrote unit tests for compatibility with new API
2016-01-21 09:44:15 -08:00
Dmitri Gribenko
74ce1ca79c Add unavailable declarations for Swift 2.2 -> 3 migration 2016-01-19 14:32:59 -08:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
ken0nek
e7e70cea92 Add spaces before and after closure arrow in stdlib 2015-12-23 04:52:15 +09:00
Max Moiseev
f4aaece75e revisiting CString related String extensions 2015-12-17 17:27:29 -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
Maxim Moiseev
62c85d379d OutputStreamType => OutputStream 2015-12-16 14:45:38 -08:00
Max Moiseev
d610fa0d1c Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-10 10:29:52 -08:00