Commit Graph

2617 Commits

Author SHA1 Message Date
Dmitri Gribenko
ef974af339 stdlib: disable an incorrect String comparison optimization on platforms that call ICU directly
... and add a test to ensure that the next attempt at writing this
optimization won't introduce a regression.
2016-09-06 22:46:40 -06:00
Dmitri Gribenko
bfd5942f15 Merge pull request #4621 from apple/siphash
stdlib: switch string hashing on non-ObjC platforms to SipHash-1-3
2016-09-06 21:44:51 -07:00
Dmitri Gribenko
e8e8b35610 stdlib: use SipHash-1-3 for string hashing on non-ObjC platforms
Part of rdar://problem/24109692
2016-09-06 20:41:03 -07:00
Dmitri Gribenko
daa7bfc281 stdlib: add a secret key for hashing 2016-09-06 20:41:03 -07:00
Dmitri Gribenko
532cf06930 stdlib: add convenience APIs to the SipHash implementation 2016-09-06 20:41:03 -07:00
Dmitri Gribenko
e242b4a472 stdlib: implement SipHash-1-3 and SipHash-2-4 2016-09-06 20:41:03 -07:00
Doug Gregor
77a360907f Tighten up and document the type of Error._userInfo somewhat.
The implementation-detail requirement Error._userInfo is always an
NSDictionary?. However, because this requirement is declared within
the standard library, it cannot be typed as such. So, use
'AnyObject?', comment that this is always 'NSDictionary?' in practice,
and fix up the uses.

Addresses rdar://problem/27824194 as much as we can.
2016-09-06 16:54:25 -07:00
Dmitri Gribenko
e4aaba9ba6 stdlib: declare functions for assertion reporting in SwiftShims instead of using @_silgen_name 2016-09-05 22:47:24 -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
Toni Suter
c11ae52e03 Fix wrong parameter name in documentation comment 2016-09-05 16:44:59 +02:00
Dmitri Gribenko
fc6add3880 stdlib: move 'String : Comparable' conformance to a separate file
I'm about to add more code around it.
2016-09-04 14:01:35 -07:00
Dmitri Gribenko
5aa005f9dd Merge pull request #4552 from Nirma/string_buffer_check
[stdlib] rewrite optional handling using map
2016-09-04 13:52:59 -07:00
Dmitri Gribenko
cee0d7a334 stdlib: rename Reflection.swift to ReflectionLegacy.swift 2016-09-03 17:49:56 -07:00
Dmitri Gribenko
46ef62db6e stdlib: move non-legacy parts of Reflection.swift into separate files 2016-09-03 17:39:55 -07:00
Dmitri Gribenko
27edca2632 Merge pull request #4614 from apple/stdlib-fix-coding-style
stdlib: fix coding style
2016-09-02 20:52:03 -07:00
Dmitri Gribenko
31f7a0a56b stdlib: fix coding style 2016-09-02 19:47:59 -07:00
Dmitri Gribenko
c314b599fc stdlib: move 'String : Hashable' conformance to a separate file
I'm about to add more code around it.
2016-09-02 19:34:14 -07:00
Michael Gottesman
50f47189b8 Merge pull request #4596 from Nirma/repeat_fix
[stdlib] simplify repeat to while
2016-09-01 23:06:52 -07:00
Nicholas Maccharoli
0d2a20413b [stdlib] rewrite optional handling using map 2016-09-02 14:54:49 +09:00
Nicholas Maccharoli
e8b15ca17d [stdlib] simplify repeat to while 2016-09-02 12:06:01 +09:00
Dmitri Gribenko
7a386c85f1 Merge pull request #4554 from Nirma/string_constructor_simplification
[stdlib] Simplify StringUTF16's String constructor
2016-09-01 13:31:29 -07:00
Dmitri Gribenko
190df8ef56 Merge pull request #4584 from Nirma/join_cleanup
[stdlib] simplify loop logic
2016-09-01 09:35:15 -07:00
Nicholas Maccharoli
5bb7baab7f [stdlib] simplify loop logic 2016-09-01 17:58:46 +09:00
Chris Lattner
75f4c58a75 Merge pull request #4551 from Nirma/string_fix
[stdlib] Move empty check for string concatenation to front
2016-08-31 12:56:48 -07:00
Andrew Trick
7f760714ef Refine the doc comments on UnsafeRawPointer.initialize....
Memory that is initialized to a trivial type may be reinitialized
without destroying the in-memory values.
2016-08-30 12:52:02 -07:00
Nicholas Maccharoli
7c94da957e [stdlib] Simplify constructor for StringUTF16 2016-08-30 20:29:39 +09:00
Nicholas Maccharoli
3fa09465c4 [stdlib] Move empty check for string concatenation to front 2016-08-30 19:18:38 +09:00
Dave Abrahams
5c13e35f29 [stdlib] Suppress noisy warnings
We don't have a way yet to say "this is deprecated for users, but let
the stdlib use it without complaining" so we need to do refactoring
shenanigans.
2016-08-28 15:06:42 -07:00
Nicholas Maccharoli
a24094247d [stdlib] cleanup UnicodeScalar initializer for UInt16 (#4504) 2016-08-26 10:37:39 -07:00
Doug Gregor
4f9dbbfdd6 Merge pull request #4512 from DougGregor/error-code-in-runtime
Error code in runtime
2016-08-26 09:15:18 -07:00
Maxim Moiseev
1faa41246a [stdlib] Adding radar links to the FIXME(ABI) markers (#4511) 2016-08-25 16:50:14 -07:00
Doug Gregor
e1545a7d5a [Type checker/runtime] Move default implementation of Error._code into the runtime.
Rather than having Sema provide a default implementation of
Error._code when needed, introduce a runtime function to extract the
default code, so that we can provide a default implementation via a
protocol extension in the standard library.
2016-08-25 16:00:19 -07:00
Nicholas Maccharoli
2f1e5361df [stdlib] simplify repeat to while 2016-08-25 18:54:42 +09:00
Doug Gregor
57f1090a11 Revert "[Set/Dictionary] Eliminate "bridging" collection entrypoints."
This reverts commit dc0ae675bc. The
change here (presumably the change to Foundation) caused a regression
in several of the bridging-related benchmarks, e.g.,
ObjectiveCBridgeFromNSSetAnyObjectToString, DictionaryBridge,
ObjectiveCBridgeFromNSDictionaryAnyObjectToString.
2016-08-24 13:20:03 -07:00
Doug Gregor
dc0ae675bc [Set/Dictionary] Eliminate "bridging" collection entrypoints.
Remove the functions
_(set|dictionary)Bridge(From|To)ObjectiveC(Conditional) from the
standard library. These entrypoints are no longer used by the compiler
(thanks to generalized collection up/downcasting), so stop using them
in Foundation and in tests.
2016-08-22 15:14:09 -07:00
Andrew Trick
83702cc2b0 Add an @available renamed attribute for initializeFrom<C : Collection>(_ : C). (#4444)
rdar:27941024 [3.0 migration] Missing fix-it for UnsafePointer<T>.initializeFrom<C : Collection>(_ C)
2016-08-21 17:58:32 -07:00
Andrew Trick
3f2655e3d0 Add a comment to UnsafePointer assignment. (#4070)
Initializing trivial types via assignment is allowed by convention,
so make it official.
2016-08-20 15:28:52 -07:00
Doug Gregor
a45bc71560 Merge pull request #4389 from rjmccall/use-force-casts-in-collection-casts
Perform collection force-casts by force-casting the elements
2016-08-19 10:44:31 -07:00
Joe Groff
171a2df979 Merge pull request #4378 from jckarter/nil-id-as-any
Handle inaccurate ObjC nullability in `id`-as-`Any` bridging.
2016-08-18 19:17:36 -07:00
John McCall
a7a954ae8c Perform collection force-casts by force-casting the elements
instead of forcing conditional casts of the elements.

This should produce better and more compact code, allow more
efficient runtime behavior, and generate much better runtime
diagnostics if the cast fails.
2016-08-18 15:54:14 -07:00
Joe Groff
2990847df2 stdlib: Add a _bridgeAnyObjectToAny helper.
We want to be robust against unexpected `nil`s when bringing `id`s into Swift as `Any`. Add a function that builds an AnyObject?-in-an-Any when we unexpectedly receive a nil.
2016-08-18 15:09:51 -07:00
Slava Pestov
3a070b6575 Merge pull request #4347 from slavapestov/noescape-by-default-typealias-fix
Sema: Apply @escaping to typealiases with underlying function type
2016-08-17 20:40:42 -07:00
Slava Pestov
79a1512576 Sema: Three fixes for the new @escaping attribute
- If a parameter type is a sugared function type, mark the type
  as non-escaping by default. Previously, we were only doing this
  if the parameter type was written as a function type, with no
  additional sugar.

  This means in the following cases, the function parameter type
  is now non-escaping:

  func foo(f: ((Int) -> Void))

  typealias Fn = (Int) -> Void
  func foo(f: Fn)

- Also, allow @escaping to be used in the above cases:

  func foo(f: @escaping ((Int) -> Void))

  typealias Fn = (Int) -> Void
  func foo(f: @escaping Fn)

- Diagnose usages of @escaping in inappropriate locations, instead
  of just ignoring them.

It is unfortunate that sometimes we end up desugaring the typealias,
but currently there are other cases where this occurs too, such as
qualified lookpu of protocol typealiases with a concrete base
type, and generic type aliases. A more general representation for
sugared types (such as an AttributedType sugared type) would allow
us to solve this in a more satisfactory manner in the future.

However at the very least this patch factors out the common code
paths and adds comments, so it shouldn't be too bad going forward.

Note that this is a source-breaking change, both because @escaping
might need to be added to parameters with a sugared function type,
and @escaping might be removed if it appears somewhere where we
do not mark function types as non-escaping by default.
2016-08-17 19:37:23 -07:00
Max Moiseev
c2fb005510 Changing the deprecation message for StringInterpolationConvertible
Since the ExpressibleByStringInterpolation protocol is also deprecated
now, it makes little sense to suggest using it instead of
StringInterpolationConvertible. Instead, the message now recommends
considering an init(_:String).
See
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160808/026171.html
for some more details.
2016-08-17 13:56:16 -07:00
Dave Abrahams
dc777eec78 [stdlib] Deprecate ExpressibleByStringInterpolation
We know its API is
inadequate (https://bugs.swift.org/browse/SR-1260?jql=text%20~%20%22StringInterpolationConvertible%22)
and don't want to be constrained to supporting it in future versions.
2016-08-17 13:45:06 -07:00
swift-ci
ebb25cc8fa Merge pull request #4346 from CodaFi/post-fix-the-prefix-postfix-prefixed-patch 2016-08-17 00:50:12 -07:00
Robert Widmann
3814b7a23d Update the changelog 2016-08-17 00:18:09 -07:00
Robert Widmann
740721ab2f Address Dmitri's comments on #3600 2016-08-16 23:59:00 -07:00
Dmitri Gribenko
9d266d7805 Merge pull request #4317 from modocache/stdlib-warnings-arglabels
[stdlib] Fix extraneous parameters
2016-08-17 09:19:19 +03:00
Robert Widmann
e6c313bce3 Merge pull request #3600 from russbishop/se0045
[SR-1516][stdlib] Implement SE-0045 prefix(while:) and drop(while:)
2016-08-16 16:26:21 -07:00