Commit Graph

2011 Commits

Author SHA1 Message Date
Dmitri Gribenko
39a3a1fb43 Eliminate boilerplate from stdlib tests 2016-09-15 10:20:09 -07:00
Yurii Samsoniuk
d24353b523 Use camel case for var names. 2016-09-15 08:49:42 +02:00
Yurii Samsoniuk
53be51fb67 Refine index out of bounds error messages for Arrays and SliceBuffer. 2016-09-15 00:04:44 +02:00
Michael Gottesman
231fb5e054 Disable validation-test/stdlib/UnicodeLongTest.swift for watchos.
rdar://28250966
2016-09-11 13:07:13 -07:00
Michael Gottesman
31195798a7 Merge remote-tracking branch 'origin/master-next' 2016-09-11 02:27:16 -07:00
Dmitri Gribenko
c9041beea3 Migrate callsites from 'expectNotEmpty()' to 'expectNotNil()' 2016-09-10 20:05:43 -07:00
Dmitri Gribenko
243a35cd65 Migrate callsites from 'expectEmpty()' to 'expectNil()' 2016-09-10 20:05:42 -07:00
Dmitri Gribenko
b3030fc96e Merge pull request #4691 from apple/stdlib-existential-collection-fix
stdlib: type-erased collections: add forwarding for '_customContainsEquatableElement()'
2016-09-09 13:49:55 -07:00
Dmitri Gribenko
92c180031f stdlib: make 'Sequence.first(where:)' a pure protocol extension (no dynamic dispatch)
SE-0032 did not propose a protocol entry point, only a protocol
extension.

Using a pure protocol extension is the right choice here because a
concrete sequence can't provide a more efficient implementation of this
method than the default one.
2016-09-09 11:30:55 -07:00
Dmitri Gribenko
34a28c2637 stdlib: add dispatch tests for 'drop(while:)' and 'prefix(while:)' 2016-09-09 09:37:47 -07:00
Dmitri Gribenko
ff4d282957 ExistentialCollection.swift.gyb: make test names unique 2016-09-09 09:31:03 -07:00
Dmitri Gribenko
1e676d0d8c stdlib: type-erased collections: add forwarding for '_customContainsEquatableElement()' 2016-09-09 09:30:56 -07:00
Michael Gottesman
b48b4d96fe Merge remote-tracking branch 'origin/master' into master-next 2016-09-07 15:35:07 -07:00
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
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
Slava Pestov
3b1721795f AST: Nuke GenericSignature::getCanonicalManglingSignature()
Now that the previous patches have shaken out implicit assumptions
about the order of generic requirements and substitutions, we can
make a more radical change, dropping redundant protocol requirements
when building the original generic signature.

This means that the canonical ordering and minimization that we
used to only perform when building the mangling signature is done
all of the time, and hence getCanonicalManglingSignature() can go
away.

Usages now either call getCanonicalSignature(), or operate on the
original signature directly.
2016-09-06 11:51:14 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Max Moiseev
9fc37efee4 [test] renaming test/1_stdlib to just test/stdlib 2016-09-01 16:51:43 -07:00
Max Moiseev
5f5de9ed5a [test] moving long stdlib tests to validation-test suite 2016-09-01 16:51:07 -07:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07: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
Greg Parker
1c58cc20ba [stdlib] Remove workaround for an old clang bug (rdar://18950072). 2016-08-24 20:14:03 -07:00
Jordan Rose
258a0ade12 [APINotes] Protocols cannot use import-as-member. (#4482)
We could support this in the future but right now it's causing problems.
There's also a potential ambiguity issue here where a protocol and class
could have the same name.

In addition to updating the importer, remove the two entries from the
CryptoTokenKit API notes that were trying to use this feature.

rdar://problem/27990168
2016-08-24 16:02:28 -07: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
Arsen Gasparyan
20aa8cbfc7 Add tests for SetAlgebra protocol 2016-08-24 10:46:18 +03: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
Paulo Faria
1ed756ec84 Add sendfile to Glibc 2016-08-21 17:43:20 -07:00
Greg Parker
f50b1e73dc Revert "Make all CF types Equatable and Hashable." 2016-08-20 04:33:55 -07:00
Jordan Rose
361ab62454 Make all CF types Equatable and Hashable. (#4394)
Like NSObject, CFType has primitive operations CFEqual and CFHash,
so Swift should allow those types to show up in Hashable positions
(like dictionaries). The most general way to do this was to
introduce a new protocol, _CFObject, and then have the importer
automatically make all CF types conform to it.

This did require one additional change: the == implementation that
calls through to CFEqual is in a new CoreFoundation overlay, but the
conformance is in the underlying Clang module. Therefore, operator
lookup for conformances has been changed to look in the overlay for
an imported declaration (if there is one).

https://bugs.swift.org/browse/SR-2388
2016-08-19 13:21:24 -07:00
Jordan Rose
ba3de9ee3b NSNumber already preserves whether a value was originally boolean. (#4366)
Use that instead of rolling it up in _SwiftTypePreservingNSNumber so that we
get the right behavior when we go to write plists.

https://bugs.swift.org/browse/SR-2381
2016-08-18 15:45:30 -07:00
Doug Gregor
27515b623e Revert "NSNumber bridging: use BOOL rather than _Bool when bridging Bools." 2016-08-18 10:36:43 -07:00
Doug Gregor
3b64ac6970 Merge pull request #4363 from DougGregor/nsnumber-bool-bridging
NSNumber bridging: use BOOL rather than _Bool when bridging Bools.
2016-08-18 10:20:13 -07:00
Doug Gregor
d68e59371a NSNumber bridging: use BOOL rather than _Bool when bridging Bools.
The Objective-C type encoding of Boolean values in NSNumber is that of
BOOL, which is either signed char or _Bool depending on the
platform. _SwiftTypePreservingNSNumber was using _Bool, which led to
inconsistencies when bridging vs. creating an NSNumber directly. Use
BOOL consistently.

Fixes rdar://problem/27894308.
2016-08-17 16:49:30 -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
Robert Widmann
740721ab2f Address Dmitri's comments on #3600 2016-08-16 23:59:00 -07: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
Slava Pestov
56e2e1327a Targeted fix for pulling in Hashable conformance for Set and Dictionary when a nil literal is bridged
When bridging values via the ObjectiveCBridgeable protocol,
SILGen has to look up conformances directly, behind the
type checker's back.

To make sure the ObjectiveCBridgeable conformance is forced,
Sema calls useObjectiveCBridgeableConformances() in the right
places.

However, another conformance we may also need when bridging
is the Hashable conformance for a Set or Dictionary's key type.

Make sure we force these too, because otherwise when bridging
a nil literal nothing needs them in Sema.

Fixes <rdar://problem/27470505>.
2016-08-15 14:29:59 -07: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
Jordan Rose
af1a8154a3 Guard against racy access to NSError.setUserInfoValueProvider. (#4280)
This API is documented in its headers to only allow being called once
for a particular domain, so we have to make sure our check for an
existing provider is synchronized with the setting.

rdar://problem/27541751
2016-08-15 13:34:30 -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
Argyrios Kyrtzidis
126602d7dd [test] Update 'validation-test/stdlib/CollectionDiagnostics.swift' 2016-08-11 14:04:51 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -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
Chris Williams
a8e3a17090 Fix FixedPointConversion tests spacing 2016-08-09 17:09:00 -07:00
Dmitri Gribenko
f1ec334fe5 stdlib: make AnyHashable(SwiftValue) unbox the value
Previously AnyHashable would consider SwiftValue to be a subclass of
NSObject (which it is in practice) and return false when trying to
compare an AnyHashable of a SwiftValue box to an AnyHashable of the
unboxed value.
2016-08-09 01:38:53 -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
Dmitri Gribenko
bfadfe37e4 stdlib: add (XFAIL'ed) tests for errors and NSErrors in AnyHashable 2016-08-09 00:49:20 -07:00
Dmitri Gribenko
3db584dc45 stdlib: AnyHashable: add a fixme 2016-08-09 00:49:20 -07:00
Dmitri Gribenko
091bd19610 stdlib: add tests for AnyHashable.base, and make test names uniform 2016-08-09 00:49:20 -07:00