Commit Graph

27 Commits

Author SHA1 Message Date
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
Max Moiseev
0b759a409c Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-23 14:26:14 -08:00
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00
Dmitri Gribenko
0e1c488f9a stdlib: print, debugPrint: 'toStream:' => 'to:' 2016-02-15 23:48:02 -08:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
Doug Gregor
42bb2528dd [Overload resolution] Prefer functions with fewer defaulted/variadic arguments.
When comparing two functions for overload resolution, break apart the
parameter lists to compare individual parameters rather than comparing
the tuples. This allows us to prefer functions with fewer arguments to
ones with more, defaulted or variadic arguments. That preference was
already encoded in the constraint optimizer, which led to some strange
behavior where the preference was expressed for function calls but not
for calls to initializers. Fixes rdar://problem/24128153.

The standard library change tweaks the anachronistic, unavailable
"print" variants somewhat. The only behavior change here is a slight
regression for cases like:

  print(a: 1, b: 2)

where we used to produce a diagnostic:

  Please wrap your tuple argument in parentheses: 'print((...))'

but we now get:

  argument labels '(a:, b:)' do not match any available overloads

However, this regression will happen at some point *anyway*, if
SE-0029 (or anything else that removes the implicit tuple splat
operation) goes through.
2016-02-05 11:41:01 -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
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
Max Moiseev
3fe0c60d7f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-17 11:00:02 -08:00
Maxim Moiseev
62c85d379d OutputStreamType => OutputStream 2015-12-16 14:45:38 -08:00
Nasser Ali AlZahrani
26669bd28e Fix typos: add missing backticks to 'Streamable' 2015-12-16 11:28:03 +11:00
Dmitri Gribenko
174d475833 stdlib: Remove unavavailable APIs that were left as migration aids
These APIs are from the Swift 1.2 => Swift 2.0 transition, and are not
relevant anymore.

Removing them reduces the surface area of the library that needs to be
reviewed.
2015-12-02 01:19:50 -08:00
Dmitri Hrybenko
f57947a7e0 stdlib: fix capitalization issues in documentation comments
Patch by Nate Cook.

rdar://22054901

Swift SVN r32226
2015-09-25 17:13:54 +00:00
Dave Abrahams
713ae47caf [stdlib] Explicitly document how to print without trailing newline.
Swift SVN r31181
2015-08-12 18:46:43 +00:00
Joe Pamer
10afd159e4 Following up on r31169, take Jordan's CR feedback and uncomment the two currently disabled migration aid overloads for 'print'.
Swift SVN r31176
2015-08-12 18:10:35 +00:00
Joe Pamer
cd492d96b5 Fix a type checker crash when the object type of a ForceValueExpr is an 'Any'.
This allows us to remove the workaround generic overloads for "print" without sacrificing good diagnostics for its unavailable overloads. (rdar://problem/21499048, rdar://problem/21582758, rdar://problem/22126141)

Swift SVN r31169
2015-08-12 15:59:31 +00:00
Arnold Schwaighofer
e0d069a0e0 stdlib: Call _print_unlocked directly in String.init
Then we can get rid of the specialized print function.

Swift SVN r31022
2015-08-05 14:44:13 +00:00
Arnold Schwaighofer
9c77c05696 stdlib: Call a private specialized version in String.init
The print abi changed so that there is no longer a way to print one item to a
stream without going through a vararg array. We call the print function in a
String initializer (e.g for string interpolation) incurring unnecessary
overhead. Use an internal specialized version of print instead.

rdar://22133281

Swift SVN r31000
2015-08-04 19:19:50 +00:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Dave Abrahams
7d5bb5f080 [stdlib] new print: move "toStream" argument to end
It reads more naturally to keep all the text arguments together.
One day maybe this will be a method on OutputStream, but probably not as
long as String conforms to it :-)

Swift SVN r30864
2015-07-31 20:19:49 +00:00
Dave Abrahams
d06a07897f [stdlib] Move _playgroundPrintHook into OutputStream
Makes for a simpler patch for the LLDB folk to apply

Swift SVN r30824
2015-07-30 23:39:47 +00:00
Dave Abrahams
c2ec35e168 [stdlib] Add _playgroundPrintHook
This hook gets all of the output for each print or debugPrint invocation
as a single blob.

Swift SVN r30818
2015-07-30 23:08:03 +00:00
Dave Abrahams
931fed01eb [stdlib] "end:" => "terminator:" in new print
API review seems to agree that's a better name choice.

Swift SVN r30809
2015-07-30 18:56:40 +00:00
Dave Abrahams
b698a088c7 [stdlib] Add new print functions (underscored)
Getting these ready for API review.

Swift SVN r30776
2015-07-29 20:30:32 +00:00