Commit Graph

3245 Commits

Author SHA1 Message Date
Dale Buckley
dd394d9883 Added tests for codable Range types 2018-10-31 15:37:58 +00:00
Karoy Lorentey
6593817e81 [test] Update BridgeStorage tests 2018-10-31 12:19:52 +00:00
Xi Ge
f4033bb506 Merge pull request #20165 from nkcsgexi/disable-tests
[test] disable two tests to unblock CI.
2018-10-30 15:04:07 -07:00
Xi Ge
e929a2c515 [test] disable stdlib/VarArgs.swift. rdar://45654446 2018-10-30 15:02:05 -07:00
Karoy Lorentey
14d796d828 Merge pull request #20129 from lorentey/make-nsobject-hashvalue-final
[ObjectiveC] Make NSObject.hashValue non-overridable
2018-10-30 12:43:05 +00:00
Karoy Lorentey
0b5b998327 [ObjectiveC] Make NSObject.hashValue non-overridable
We deprecated overriding it in 4.2 with a custom compiler warning. This removes the ability to override it entirely.

The correct way to customize hashing for NSObject subclasses is to override the `hash` property.
2018-10-29 19:14:37 +00:00
Stephen Canon
65c7d141c8 Conform Float80 to CVarArgs when available. (#20122)
When I added support for importing long double as Float80 on Intel, I neglected to conform it to CVarArgs. This patch fixes that, which most importantly lets users use String(format:) with Float80 values.
2018-10-29 15:05:37 -04:00
Slava Pestov
38fdb6b7ff Update various tests to not use Swift 3 code
Completely mechanical changes:

- Explicit @objc in a few places
- Some imported APIs changed
- For the mix-and-match tests, just test version 4/5 instead of 3/4
2018-10-26 20:15:01 -04:00
Karoy Lorentey
1195fcf0e0 [test] Update tests for _HeapBuffer changes 2018-10-26 23:53:34 +01:00
Mark Lacey
f14942646d Remove unused typealias. 2018-10-25 17:14:15 -07:00
Mark Lacey
958ee1a82b Add more type checker performance tests.
Also move one from fast to slow based on the fact that it wasn't
representative of the original issue (which was an expression that
didn't typecheck successfully).
2018-10-25 16:21:17 -07:00
Jordan Rose
e596e1f8ea Merge pull request #19702 from jrose-apple/who-remembers-mavericks
[test] Tweak some tests so that they run consistently on OS X 10.9
2018-10-22 15:47:08 -07:00
Daniel Rodríguez Troitiño
e1908d71c9 [android] Force parsing of literal as unsigned.
0xffffffff do not fit into Int, and even if it doesn't, Swift
doesn't change the default to be UInt and fit, so we have to
be explicit.
2018-10-19 12:32:47 -07:00
Saleem Abdulrasool
7031a736bf Merge pull request #19479 from drodriguez/android-aarch64-test-fix-2
[android] Make some stdlib tests in Android follow Linux branches.
2018-10-15 11:54:35 -07:00
Daniel Rodríguez Troitiño
c69f082e3c [android] Make some stdlib tests in Android follow Linux branches. 2018-10-10 16:01:36 -07:00
Mike Ash
101c7cbbdb [Runtime] Fix a leak when reading a weak property with Mirror.
SR-8878 rdar://problem/44872927
2018-10-09 12:48:44 -04:00
Karoy Lorentey
4967393618 Merge pull request #19688 from lorentey/hashed-bridgeobject
[stdlib] Set, Dictionary: Replace _Variant enums with _BridgeStorage
2018-10-08 12:07:40 +01:00
Mike Ash
f4db1dd7a4 Merge pull request #19614 from mikeash/no-internal-export
[Stdlib] Change SWIFT_RUNTIME_STDLIB_INTERNAL to not export the symbol.
2018-10-05 09:26:03 -04:00
Karoy Lorentey
e112de3efa [test] Update Set/Dictionary tests 2018-10-05 12:33:25 +01:00
Jordan Rose
7c9376db3a [SDK] Get the preferred @encode string for MapKit types dynamically (#19691)
On older OSs, CLLocationCoordinate2D was an anonymous struct with a
typedef, which meant its Objective-C type encoding string was "{?=dd}"
instead of "{CLLocationCoordinate2D=dd}". This incompatibility led to
us rejecting casts from NSValues created with CLLocationCoordinate2Ds
in Objective-C on older OSs because they didn't match the type
encoding provided. Instead, we can try to create an NSValue the way
the frameworks do, and see what /its/ type encoding is. This is what
SceneKit already does.

There's an extra wrinkle here because the convenience methods for
encoding CLLocationCoordinate2Ds are actually added in MapKit rather
than CoreLocation. That means that if someone's app just uses
CoreLocation, we can't rely on those convenience methods to get the
correct type encoding. In this case, the best thing we can do is just
give up and use the static encoding.

This whole thing is indicative of a bigger problem, namely that
NSValue normally doesn't try to validate types at all. However, Swift
bridge casting really does want to distinguish, say, a
CLLocationCoordinate2D from a CGPoint, and checking the NSValue encode
string was a way to do that. But this shows that it's still not safe
to assume that's consistent against everything in a process even if
they're all using @encode on the real struct (or the Swift
equivalent), because the different parts of the process may have been
compiled against different SDKs.

This change does not attempt to solve that problem.

Finishes rdar://problem/44866579
2018-10-03 17:31:20 -07:00
Jordan Rose
21fe402c82 [test] Disable some tests on OS X 10.9 that require a newer Foundation 2018-10-03 16:54:38 -07:00
Jordan Rose
38b3c25b15 [test] XFAIL some String tests on older Apple OSs 2018-10-03 16:54:38 -07:00
Mike Ash
e18e03171f [Stdlib] Change SWIFT_RUNTIME_STDLIB_INTERNAL to not export the symbol.
The functions in LibcShims are used externally, some directly and some through @inlineable functions. These are changed to SWIFT_RUNTIME_STDLIB_SPI to better match their actual usage. Their names are also changed to add "_swift" to the front to match our naming conventions.

Three functions from SwiftObject.mm are changed to SPI and get a _swift prefix.

A few other support functions are also changed to SPI. They already had a prefix and look like they were meant to be SPI anyway. It was just hard to notice any mixup when they were #defined to the same thing.

rdar://problem/35863717
2018-10-03 09:55:33 -04:00
Mike Ash
537e0e3183 [SDK] Rename _NSKeyValueObservation to NSKeyValueObservation in source code.
Keep the _NSKeyValueObservation in the runtime name, since we need to avoid colliding with the name used in the pre-ABI-stable libraries.

rdar://problem/44914709
2018-10-02 10:36:08 -04:00
Jordan Rose
c4c430e155 [test] Don't check for "HK$" in stdlib/TestLocale.swift on older OS X
Apparently this changed at some point in the past (it used to just be
"$"). The actual value isn't so important, so just skip that part.

Part of rdar://problem/44866579
2018-09-30 20:17:17 -07:00
Jordan Rose
b475568f29 [test] Separate stdout and stderr in SwiftObjectNSObject.swift
remote-run doesn't always preserve the interleaving, but we don't need
stdout at all given what's being checked; it's just used to show how
far the test got before failing. The output being FileChecked is going
through NSLog, which uses stderr.

Part of rdar://problem/44866579
2018-09-30 20:17:17 -07:00
Jordan Rose
1f7a7b64bb [test] XFAIL MapKit NSValue bridging tests on older OSs for now
Part of rdar://problem/44866579. This bears further investigation.
2018-09-30 20:17:17 -07:00
Maxim Moiseev
8168fb8b97 Add #colorLiteral test for CGColor 2018-09-28 13:23:21 -07:00
Maxim Moiseev
7c7a976185 Add a test for try! location reporting 2018-09-26 11:22:41 -07:00
Doug Gregor
d73a2e0d39 [Runtime] Properly form generic arguments for metadata-to-demangle-tree.
When mapping from type metadata to a demangle tree, fill in the complete
set of generic arguments. Most of the effort here is in dealing with
extensions that involve same-type constraints on a generic parameter, e.g.,

  extension Array where String == Element { }
  extension Dictionary where Key == Value { }

In such cases, the metadata won’t contain generic arguments for every
generic parameter. Rather, the generic arguments for non-key generic
parameters will need to be computed based on the same-type requirements
of the context. Do so, and eliminate the old hacks that put the generic
arguments on the innermost type. We don’t need them any more.

Part of rdar://problem/37170296.
2018-09-25 23:10:08 -07:00
Pavel Yaskevich
c7adca26b9 Merge pull request #19525 from xedin/allow-empty-labels-for-special-names
[AST/Printing] Don't omit empty labels in special names
2018-09-25 00:58:04 -07:00
Pavel Yaskevich
63b802ca88 [AST/Printing] Don't omit empty labels in special names
This makes diagnostics more verbose and accurate, because
it's possible to distinguish how many parameters there are
based on the message itself.

Also there are multiple diagnostic messages in a format of
`<descriptive-kind> <decl-name> ...` that get printed as
e.g. `subscript 'subscript'` if empty labels are omitted.
2018-09-24 18:36:53 -07:00
Saleem Abdulrasool
e0e75ead37 Merge pull request #19434 from compnerd/a-stable-future
runtime: remove unnecessary preprocessor condition, flip cases (NFC)
2018-09-24 14:33:41 -07:00
Mike Ash
1fb165a0ea Merge branch 'master' into rename-conflicting-classes-and-methods 2018-09-24 10:17:22 -04:00
Doug Gregor
3ea48770fe [Runtime] Handle non-key arguments when substituting from metadata.
Reimplement SubstGenericParametersFromMetadata to cope with non-key
generic parameters, which are counted when referring to generic parameters
from metadata but do not have corresponding generic arguments.
2018-09-22 23:32:49 -07:00
Mike Ash
49c3547449 Merge remote-tracking branch 'origin/master' into rename-conflicting-classes-and-methods 2018-09-21 15:52:38 -04:00
Saleem Abdulrasool
687aeaa37d runtime: remove unnecessary preprocessor condition, flip cases (NFC)
The use of `__APPLE__` is unnecessary as the case is guarded by the
`SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT` preprocessor guard which is implicitly
specific to that environment.  Additionally, flip the condition around so that
the positive (which is the future) appears ahead of the negative case.
2018-09-20 15:27:48 -07:00
eeckstein
814e656cf9 Merge pull request #19388 from eeckstein/mangling-prefix
change mangling prefix from $S to $s
2018-09-20 09:16:30 -07:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Joe Groff
93b5de61e7 Implement the final approved syntax for SE-227 identity key paths.
`\.self` is the final chosen syntax. Implement support for this syntax, and remove the stopgap builtin and `WritableKeyPath._identity` property that were in place before.
2018-09-19 11:45:13 -07:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Ben Rimmington
cec9faf1c0 [SE-0211] Emoji properties require ICU 57 or later 2018-09-13 18:18:33 +01:00
Ben Cohen
e338344bae Remove overloads that were needed pre-conditional conformance 2018-09-11 21:00:36 -07:00
Itai Ferber
bc47a7a5e3 Merge pull request #19028 from itaiferber/fixme-synthesized-impl-in-codable-tests
Remove unnecessary Codable impls in JSON/plist tests
2018-09-06 10:07:06 -07:00
Doug Gregor
0a8058ca6a [Integer protocols] Make BinaryInteger.Words conform to RandomAccessCollection.
Require that BinaryInteger.Words conform to RandomAccessCollection with
an Index type of Int, simplifying clients.

Fixes rdar://problem/36410936.
2018-09-05 16:22:27 -07:00
Anton Pogonets
e33a977a19 Use uninitialized dealloc in swift_deallocError (#19059) 2018-09-05 13:16:53 -07:00
Stephen Canon
190c7d6b9f Default implementation of isMultiple(of:) on BinaryInteger
In order to provide source compatibility with existing user types conforming to BinaryInteger, we want to have a default implementation available. It's somewhat difficult to provide a good default implementation that correctly handles arbitrary non-symmetrical ranges in the face of negative divisors, so fall back on testing divisibility of the magnitudes, which avoids the problem.

On the plus side, this default implementation works fine for types conforming to UnsignedInteger, which lets us move the FixedWidthInteger implementation down to FixedWidthInteger & SignedInteger, and simplify it in the process.
2018-09-04 16:32:14 -04:00
Stephen Canon
c1f25e0673 [SE-0225] Implementation of isMultiple for BinaryInteger. (#18689)
* Implement SE-0225 (BinaryInteger.isMultiple(of:))

A default implementation is provided for FixedWidthInteger, with very basic test coverage included.
2018-09-04 10:31:05 -04:00
Xiaodi Wu
2f4e70bf7f [Foundation][SR-3125] Fix Decimal init from (U)Int64 (#18486)
* [Foundation][SR-3125] Fix Decimal init from (U)Int64

* Minor edits mostly to appease the ToT compiler
2018-09-02 06:20:23 +07:00
Max Moiseev
e8b6091755 [stdlib] Deprecate Collection.index(of:) and index(where:) (#19071)
This should have been done for Swift 4.2 according to SE-0204, but
better later than never. Deprecating these methods as of Swift 5.0.

Also modfying the tests to check for the deprecation message.

Fixes: <rdar://problem/43694210>
2018-08-30 19:32:27 -07:00