Commit Graph

2617 Commits

Author SHA1 Message Date
Brian Gesiak
063bcbe021 [stdlib] Fix extraneous parameters
Fix "extraneous duplicate parameter name" warnings in the stdlib.
2016-08-16 11:59:32 -04:00
Russ Bishop
f0e6c306e4 [stdlib][SE-45] Add prefix(while:) and drop(while:) to Sequence
Includes lazy implementation courtesy of Nate Cook
2016-08-15 14:13:27 -07:00
Ted Kremenek
b9f8e0356c Merge pull request #4282 from rintaro/se-0118-unavailable
stdlib: Add unavailable declarations for APIs renamed in SE-0118
2016-08-14 10:16:03 -07:00
Ted Kremenek
7c844b96da Merge pull request #4285 from rintaro/print-fixit
stdlib: Add unavailable declarations with fix-it for 'print' and 'debugPrint'
2016-08-13 22:55:16 -07:00
Ted Kremenek
8f92d9d5e2 Merge pull request #4291 from atrick/fix
Fix UnsafeRawPointer.load to use Builtin.loadRaw.
2016-08-13 22:00:06 -07:00
Andrew Trick
aacee48cca Fix UnsafeRawPointer.load to use Builtin.loadRaw.
This API should have been converted to use the
new Builtin before it was introduced here:
commit a41484ea2b
Author: Andrew Trick <atrick@apple.com>
Date:   Fri Jul 22 13:32:08 2016
    Add UnsafeRawPointer type and API. (#3677)

But it looks like that was dropped during during some local merge. It's not
likely to be a problem until developers start adopting the new API and the
optimizer starts using TBAA aggressively. The other "raw" API's are binding
memory or using memmove, so those are safe.

rdar:23406272.
2016-08-13 18:49:32 -07:00
Rintaro Ishizaki
2a9b78e193 stdlib: Add unavailable declarations for APIs renamed in SE-0118
Sequence.sort(_:) => sorted(by:)
Sequence.sort() => sorted()
Sequence.elementsEqual(_:isEquivalent) => elementsEqual(_:by:)
Sequence.contains(_:) => contains(where:)
Sequence reduce(_:combine:) => reduce(_:_:)
UnicodeCodec.encode(_:output:) => encode(_:into:)
ManagedBuffer.create(_:initialValue:)
  => create(minimumCapacity:makingHeaderWith:)
ManagedBufferPointer.init(bufferClass:minimumCapacity:initialValue)
  => init(bufferClass:minimumCapacity:makingHeaderWith:)
2016-08-14 03:28:01 +09:00
Rintaro Ishizaki
2202581fdb stdlib: Add unavailable declarations with fix-it for 'print' and 'debugPrint' 2016-08-13 18:36:49 +09:00
Ted Kremenek
b5d9ffb258 Merge pull request #4259 from natecook1000/nc-fixes-04
[stdlib] Documentation revisions
2016-08-12 21:48:48 -07:00
Han Sangjin
cc0c2bf619 [cmake] Change CMake Policy CMP0054 for Cygwin (#4274)
In CMake 3.4.3, if `CMP0054` policy isn't set to any value, `cmake`
uses the OLD behavior and issues a long warning message for every
`if()` statement having a quoted variable whose value is an other
variable's name.

For example,
```
set(FOO 1)
set(VAR_A FOO)
set(VAR_B BAR)
if ("${VAR_A}" STREQUAL "FOO")
endif()
if ("${VAR_B}" STREQUAL "BAR")
endif()
```
issues `CMP0054` warning message for `"${VAR_A}"` and not for
`"${VAR_B}"`.

Cygwin `cmake` defines the variable `CMAKE_SYSTEM_NAME` as `CYGWIN`
and defines the variable `CYGWIN` as 1(TRUE).

Linux `cmake` defines the variable `CMAKE_SYSTEM_NAME` as `Linux`
and there is no variable `Linux`.

So, if we didn't set any value to `CMP0054` policy, every
`if ("${CMAKE_SYSTEM_NAME}" ...)` generated long warning message in
Cygwin, but did not generate in Linux.
2016-08-12 17:40:52 -07:00
Gary Liu
dd13eb926e Endian fix for Strings in s390x (#4194)
1. The change in StaticString's withUTF8Buffer is to store the UTF-8 code unit properly in the buffer.

2. The change in StringCore's _nthContiguous is to represent the UTF-16 data correctly when it contains the high byte.

We ran validation tests and foundation tests with the change on x86-64 and s390x. No new regression is observed.
2016-08-12 16:30:36 -07:00
Dave Abrahams
e6dec58cc5 Merge pull request #4041 from xwu/memory-layout-of-value
[stdlib] Implement SE-0136 (Restore MemoryLayout.*(ofValue:))
2016-08-12 11:09:17 -07:00
Nate Cook
8b39706c3f [stdlib] Documentation revisions
- Various edits
- Standardized complexity formatting
2016-08-12 12:24:36 -05:00
Ted Kremenek
91ae793b58 Merge pull request #4200 from benrimmington/wrap-text-output-streamable
[stdlib] Wrap comments to 80 columns, NFC
2016-08-11 21:45:10 -07:00
swift-ci
d6fefcbc99 Merge pull request #4252 from rintaro/lifetimemanager-noescape 2016-08-11 21:26:27 -07:00
Rintaro Ishizaki
d7a867590d stdlib: Remove recently added @noescape 2016-08-12 12:48:22 +09:00
Dave Abrahams
4201e1b121 Re-Revert "staging for move to PlaygroundSupport"
This reverts commit ab56e2179c.

The last dependency has been excised from swift-corelibs-foundation
2016-08-11 10:42:30 -07:00
Dmitri Gribenko
fb80d65b84 Merge pull request #4217 from apple/stdlib-string-fixme-abi
stdlib: add a couple of ABI FIXMEs to String implementation
2016-08-10 20:46:21 -07:00
Dmitri Gribenko
25a3c75830 Merge pull request #4209 from scallanan/po-binary-only
[stdlib] Make the stringForPrintObject function not inlined by default.
2016-08-10 20:45:51 -07:00
Jordan Rose
ab56e2179c Re-apply "staging for move to PlaygroundSupport" (#4215)
Reverts apple/swift#4196; swift-corelibs-foundation is still depending on it.
2016-08-10 18:14:38 -07:00
Dmitri Gribenko
d1801be1ef stdlib: add a couple of ABI FIXMEs to String implementation
We should not make grapheme segmentation algorithm inlineable now (and
possibly ever).  The immediate reason is that Unicode 8.0 grapheme
segmentation algorithm has been changed significantly in Unicode 9.0.
Unicode 9.0 requires a stateful algorithm.  Current indices and
iterators just don't have the storage for that state, so we can't mark
them as fragile.
2016-08-10 18:05:29 -07:00
Dmitri Gribenko
1bd106cc80 Merge pull request #4192 from rintaro/withunsafepointers-diag
stdlib: Add unavailable declaration for 'withUnsafePointers' and 'readLine'
2016-08-10 16:40:19 -07:00
Sean Callanan
694ef45a09 Added an explicatory comment, thanks to Dmitri Gribenko for the suggestion. 2016-08-10 15:57:25 -07:00
Sean Callanan
8ab85d7a3e Put @_sematics on its own line, thanks to Erik Eckstein for the comment. 2016-08-10 15:35:32 -07:00
Sean Callanan
b57926895f [stdlib] Make the stringForPrintObject function not inlined by default.
Inlining it causes the lldb "po" command to generate a 50KB binary blob that
needs to be injected into the target process.  It is much faster to just call
into the standard-library binary.

<rdar://problem/27710066>
2016-08-10 15:11:34 -07:00
Ben Rimmington
4c804058f9 [stdlib] Wrap comments to 80 columns, NFC 2016-08-10 20:11:42 +01:00
Dave Abrahams
ce815e6a02 Revert "staging for move to PlaygroundSupport"
This reverts commit 43ebd517d3.
2016-08-10 11:23:48 -07:00
Ted Kremenek
420088fbc4 Merge pull request #3356 from ultramiraculous/failable-float-to-int
SE-0080 (3/5) - Failable initializers for Float->Int
2016-08-10 08:36:33 -07:00
Rintaro Ishizaki
75ec5186e0 stdlib: Add unavailable declaration for readline(stripNewline:) 2016-08-10 23:25:20 +09:00
Rintaro Ishizaki
2d7d11fb68 stdlib: Add unavailable declarations for withUnsafeMutablePointers 2016-08-10 23:11:28 +09:00
Chris Williams
636c5aa5f7 Restore unavailable FloatingPoint abs function 2016-08-09 17:09:00 -07:00
Chris Williams
bc3d6164ba Restore updated FloatingPoint init documentation 2016-08-09 17:09:00 -07:00
Dmitri Gribenko
eaccba53ef Merge pull request #4147 from rintaro/underestimatecount-fixit
stdlib: Fix-it for underestimateCount() renaming
2016-08-09 13:30:12 -07:00
Dmitri Gribenko
a1c5185884 Merge pull request #4148 from rintaro/reversecollection-fixit
stdlib: Fix-it for missing ReverseCollection renaming
2016-08-09 13:30:04 -07:00
Dmitri Gribenko
bc1865427a Merge pull request #4149 from rintaro/zip2-diag
stdlib: Add unavailable Zip2Sequence initializer
2016-08-09 13:29:52 -07:00
Rintaro Ishizaki
4c2b49b225 stdlib: Add unavailable Zip2Sequence initializer
Without this, the compiler suggests to add `_sequence1:_sequnece2` label.
2016-08-09 23:15:23 +09:00
Rintaro Ishizaki
d75a7104d5 stdlib: doc comment: ReverseCollection => ReversedCollection 2016-08-09 22:01:36 +09:00
Rintaro Ishizaki
9a8c389f8a stdlib: Fix-it for missing ReverseCollection renaming
Two-step fix-it:
  ReverseCollection(c) => ReversedCollection(c) => c.reversed()
2016-08-09 21:57:26 +09:00
Rintaro Ishizaki
5b8a78473e stdlib: Fix-it for underestimateCount() renaming
underestimateCount() has been replaced by underestimatedCount property.
2016-08-09 21:00:33 +09:00
Dmitri Gribenko
fb52e6dfd8 stdlib: coding style and doc comment fixes 2016-08-09 00:49:20 -07:00
Dmitri Gribenko
b162f60070 runtime: make _SwiftNativeNSError use the Hashable conformance, if available
If the Swift error wrapped in a _SwiftNativeNSError box conforms to
Hashable, the box now uses the Swift's conformance to Hashable.

Part of rdar://problem/27574348.
2016-08-09 00:49:20 -07:00
Ted Kremenek
1865f7d0db Revert "[stdlib] Deprecate ContiguousArray (do not merge yet)" 2016-08-08 21:36:14 -07:00
Dave Abrahams
b23af7ce3b Merge pull request #4091 from apple/deprecate-indexable
Deprecate the Indexable protocols
2016-08-08 21:01:39 -07:00
Ted Kremenek
0cdcd18d20 Merge pull request #4086 from apple/deprecate-contiguousarray
[stdlib] Deprecate ContiguousArray (do not merge yet)
2016-08-08 17:48:12 -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
Ted Kremenek
92f0d9ea30 Merge pull request #4114 from atrick/rawptr-diag
Improve diagnostics on invalid UnsafePointer conversion.
2016-08-08 14:23:49 -07:00
Dave Abrahams
8a73f0b98e [stdlib] Change Indexable deprecation messages
It's important to let people know that, in contrast with existing
practice in other frameworks, we really are going to remove the
deprecated API, and soon.
2016-08-08 13:44:41 -07:00
Andrew Trick
56f68c4cce Improve diagnostics on invalid UnsafePointer conversion.
The only remaning issue is that we should have a warning to rename
Unsafe[Mutable]Pointer<Void> to Unsafe[Mutable]RawPointer.
2016-08-08 12:54:21 -07:00
Xiaodi Wu
f9435b9ce8 [stdlib] Restore MemoryLayout.*(ofValue:) 2016-08-08 10:46:37 -05:00