Commit Graph

5783 Commits

Author SHA1 Message Date
Ben Cohen
c3239b90b4 Neaten breadcrumb cast 2019-01-31 21:09:40 -08:00
Ben Cohen
779ea19a6a Revert count(where:) 2019-01-31 18:57:17 -08:00
Ben Cohen
2010f02e8a Remove overly-permissive UnsafePointer init 2019-01-31 18:05:11 -08:00
Ben Cohen
351c1291a9 Restore concrete initializers on Unsafe{Raw}Pointer 2019-01-31 17:11:16 -08:00
John McCall
8be4ec32e6 Protocol requirement overrides must match in mutating-ness.
Without this change, SILGen will crash when compiling a use of the
derived protocol's requirement: it will instead attempt to use
the base protocol's requirement, but the code will have been
type-checked incorrectly for that.

This has a potential for source-compatibility impact if anyone's
using explicit override checking for their protocol requirements:
reasonable idioms like overriding a mutating requirement with a
non-mutating one will no longer count as an override.  However,
this is arguably a bug-fix, because the current designed intent
of protocol override checking is to not allow any differences in
type, even "covariant" changes like making a mutating requirement
non-mutating.  Moreover, we believe explicit override checking in
protocols is quite uncommon, so the overall compatibility impact
will be low.

This also has a potential for ABI impact whenever something that
was once an override becomes a non-override and thus requires a
new entry.  It might require a contrived test case to demonstrate
that while using the derived entry, but it's quite possible to
imagine a situation where the derived entry is not used directly
but nonetheless has ABI impact.

Furthermore, as part of developing this patch (earlier versions of
which used stricter rules in places), I discovered a number of
places where the standard library was unintentionally introducing
a new requirement in a derived protocol when it intended only to
guide associated type deduction.  Fixing that (as I have in this
patch) *definitely* has ABI impact.
2019-01-30 01:33:09 -05:00
Maxim Moiseev
d00307202b Uncomment 'obsoleted: 5.0' on a flatMap variant 2019-01-29 16:26:46 -08:00
Maxim Moiseev
02cc2256e9 [stdlib] Remove a bunch of declarations marked as obsoleted in 4 2019-01-29 11:13:47 -08:00
Ravi Kandhadai
ee222c3fdf [Constant Evaluator] Add support for string appends and equals to
the constant evaluator.
2019-01-25 18:51:33 -08:00
Saleem Abdulrasool
72f0efe76e Merge pull request #22027 from linux-on-ibm-z/master_s390x_string_comparison
fixed small String comparison for big_endian
2019-01-25 18:32:03 -08:00
Ben Cohen
80f0a697fc Remove a couple of obsoleted-in-4.0 methods 2019-01-25 13:33:21 -08:00
Stephen Canon
3501568fc0 Make SIMD types Codable. (#22092)
* Make SIMD types codable. We're considering this a bugfix.

This is a very tiny ABI change, in that user-defined SIMD types compiled with an earlier version of 5.0 will be missing the necessary conformance to Codable. Discussed with Ben, and we're OK with this because we don't think there are such types yet, and it can be fixed with a recompile.

* Add basic tests
2019-01-24 23:08:29 -05:00
Ravi Kandhadai
a0277e2010 [stdlib] Fixing a buggy example in the comments in the file UnsafeRawPointer.swift 2019-01-23 13:08:47 -08:00
Xiaodi Wu
870dae5204 [docs] hasPrefix and hasSuffix don't match scalars (#22056) 2019-01-23 10:21:55 -06:00
Michael Ilseman
81e87ac838 Merge pull request #21959 from milseman/fast_foundation
[String] Add UTF-8 fast-paths for Foundation initializers
2019-01-22 16:26:36 -08:00
Michael Ilseman
3df92911f9 [String] Speed up ASCII checking.
Perform ASCII checking using pointer-width strides, making sure to
align properly.
2019-01-22 15:06:03 -08:00
Scott Perry
df3a058a6f s/shortestEditScript/difference/g per proposal feedback 2019-01-21 22:31:04 -08:00
samding01
197c9634b4 fixed small String comparsion for big_endian 2019-01-21 19:09:07 +00:00
Ben Cohen
4363f61dec Mark ClosedRange->Range conversion inlinable 2019-01-18 17:27:27 -08:00
Mike Ash
ae0f04ab23 Merge pull request #21958 from mikeash/rename-avoid-more-objc-conflicts
[stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
2019-01-18 17:18:03 -05:00
Slava Pestov
5e2e467b05 Merge pull request #21631 from Azoy/something-something-string-storage
[stdlib] NFC: Simplify _getCString
2019-01-18 13:28:36 -05:00
Michael Ilseman
a088e13224 [String] Add UTF-8 fast-paths for Foundation initializers
Many Foundation initializers could benefit from faster string
construction and subsequent reads in Swift 5. Add UTF-8 fast paths for
when constructing a string from a valid UTF-8 code units.
2019-01-17 14:15:40 -08:00
Mike Ash
faceaaa0ab [stdlib][Foundation] Avoid coexistence conflicts with JSONEncoder/Decoder and _stdlib_AtomicInt.
JSONEcoder/Decoder get another underscore in their ObjC name, as the one with a single underscore conflicts with older Swifts that had _JSONEcoder/Decoder as internal rather than fileprivate.

_JSONEncoder/Decoder get another underscore in their Swift name to avoid conflicting with the ObjC name from the ones in older overlays.
2019-01-17 17:12:01 -05:00
Ben Cohen
eb083ce84d Revert "implement ManagerBuffer.reallocated to allow realloc'ing the storage" (#21874)
* Revert "implement ManagerBuffer.reallocated to allow realloc'ing the storage"
2019-01-16 10:22:58 -08:00
Mike Ash
fa5888fb3f [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request #19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438
2019-01-15 12:21:20 -05:00
John McCall
f771e4c36d Merge pull request #21237 from drodriguez/aapcs64-valist
[stdlib][SR-2239] Refactor AAPCS64 variable argument list support.
2019-01-14 23:48:14 -05:00
Max Moiseev
22b514353c Merge pull request #20715 from anayini/contiguous-array-codable
[SR-7076] Make ContiguousArray Codable
2019-01-14 17:07:39 -08:00
Scott Perry
c0c068d663 Match indentation style 2019-01-14 15:53:24 -08:00
Max Moiseev
3b6c6cc0a5 Merge pull request #19532 from dlbuckley/SR-8649_ranges_codable
SR-8649: Range types conform to Codable
2019-01-14 14:38:32 -08:00
swift-ci
77ec709128 Merge pull request #21820 from freak4pc/sm/typo 2019-01-14 09:07:29 -08:00
Scott Perry
1af14db552 Initial import of diffing package into standard library 2019-01-13 20:17:20 -08:00
swift-ci
b3a20520f7 Merge pull request #21711 from apple/marcrasi-const-evaluator-strings 2019-01-12 12:32:19 -08:00
Shai Mishali
6bfe3dadc5 Minor typo fix understimatedCap -> underestimatedCap 2019-01-12 15:37:01 +02:00
Joe Groff
9669c3a703 KeyPaths: Don't relative-reference selector refs.
ld64 doesn't like this. Instead, generate a stub function to grab the instantiated selector. Fixes rdar://problem/47184763.
2019-01-10 14:32:50 -08:00
Daniel Rodríguez Troitiño
7cfaf9fae2 [stdlib][SR-2239] Refactor AAPCS64 variable argument list support.
This refactoring uses large portions of the already existing code for
x86_64 and s390 to implement AAPCS64 __VaListBuilder. The parts where
each implementation differ are the x86_64 header, and the order of the
general and vector registers.

The changes also addresses many of the request from the reviewers in
 #20862 which were not addressed originally, like the reuse of the
already existing code, and the generalizations for the code to be useful
for platforms different than Linux (Android, for example).
2019-01-09 13:45:04 -08:00
Saleem Abdulrasool
5282e92e47 Merge pull request #21707 from compnerd/placeholder-less
[build] remove special placeholder libraries
2019-01-08 16:23:32 -08:00
Lance Parker
15aaa1e777 [stdlib]String normalization functions (#21026)
* fast/foreignNormalize functions
2019-01-08 13:55:29 -08:00
Marc Rasi
0eff06e4f9 const evaluator: string values and init operations 2019-01-08 11:57:27 -08:00
Saleem Abdulrasool
6dac8dd092 build: cleanup swiftCore link definition
Colocate the target specific library specification.  Inline the single
site use of the place holder ICU_UC and ICU_I18N libraries rather than
trying to create special library processing code for that.
2019-01-08 08:31:35 -08:00
Saleem Abdulrasool
5482409fb7 build: clean up unused variable (NFC)
Remove the unused parameter from the build (NFC).
2019-01-08 08:31:35 -08:00
Pavol Vaskovic
66bc1661b2 Merge pull request #21658 from palimondo/within-one-stem
[stdlib] Use ContiguousArray internally in Sequence dropLast, prefix, suffix
2019-01-08 12:22:11 +01:00
Michael Munday
8d4608f8e4 [string] Improve some small string comments
Clarify the expected behavior of some small string helper functions.
2019-01-08 06:15:54 -05:00
Michael Munday
9587582c86 [string] Fix string implementation for big endian platforms
This commit supersedes 2866b4a which was overwritten by 4ab45df.

Store small string code units in little-endian byte order. This way
the code units are in the same order on all machines and can be
safely treated as an array of bytes.
2019-01-07 09:01:43 -05:00
Raj Barik
fc90a0009a Add @inline(__always) to stdlib function for performance parity 2019-01-05 17:39:59 -08:00
Pavol Vaskovic
c887116862 [stdlib] dropLast, prefix, suffix: ContiguousArray
Nano-optimization:
Following the template used in methods `map` and `_filter`, internally use ContiguousArray before converting to an Array on return.
2019-01-05 14:28:37 +01:00
Pavol Vaskovic
a1fb6f1278 [stdlib] Gardening: ringBuffer position index 2019-01-05 14:27:03 +01:00
Raj Barik
3faf741288 Merge pull request #21617 from rajbarik/raj-perf-stdlib
Add inline(always) to AnyCollection routines like _suffix, _prefix, _drop, ...
2019-01-04 08:39:57 -08:00
Johannes Weiss
3f4990dc3c Merge pull request #21611 from weissi/jw-make-urbp-contiguous
conform Unsafe(Mutable)RawBufferPointer conform to _HasContiguousBytes
2019-01-04 10:36:08 +00:00
Azoy
5532a16205 simplify _getCString 2019-01-03 22:00:58 -06:00
Kuba Mracek
b9b4c789f3 Fix a data race on _swiftEmptyArrayStorage reported by TSan. Array.append(contentsOf) used to write a 0 into _buffer.count causing a race. 2019-01-03 17:26:18 -08:00
Nate Cook
f19aca6cb0 [WIP] Revise documentation for Swift 5 stdlib additions (#21333)
* Revise the Unicode scalar/Character properties
* Minor revisions to `compactMapValues` docs.
* Add documentation for AdditiveArithmetic, revise Numeric
* Apply minor style updates to count(where:).
* Revise string interpolation docs.

- Convert table of interpolation examples to a list of examples. Tables
aren't supported by Swift markup, so this wouldn't render properly in
Xcode or on the web.
- Add a description of what a user must implement in a custom
string interpolation type to get the behavior they want.

* Revise isMultiple(of:) docs.

- In particular, add emphasis to mathematical symbols and equations to
match how we document such things elsewhere.
- I'm using asterisks for single symbols, and underscores for equations
because it's easier to read in-source when you don't have to escape
multiplication within emphasis.

* Add some abstracts to the SIMD vector types.

- Adds a dictionary of spelled out numbers. Only numbers < 10
  should be spelled out according to editorial.
- Adds abstracts to some of the basic members.
- Includes parameter descriptions for the xyzw properties and inits,
but not for the unlabeled initializers. Combined with the protocol
extension method abstracts, this should complete coverage of the concrete
types.
2019-01-03 18:19:20 -06:00