Commit Graph

2342 Commits

Author SHA1 Message Date
Joe Groff
bb67cf815c Merge pull request #21355 from technicated/tuple-keypaths-2
Tuple KeyPaths
2019-02-25 12:56:05 -08:00
Mike Ash
4abec981c0 [Stdlib] Disable SwiftObjectNSObject test on iOS <10 and macOS <10.12 until we can figure out why it's failing there.
rdar://problem/47870743
2019-02-25 12:28:11 -05:00
Mike Ash
7522adadf3 Merge pull request #22512 from mattpolzin/sr9837
Add test that catches (currently fixed) regression - SR-9837
2019-02-21 11:36:27 -05:00
technicated
b37c2d5cf2 Fixed some tests
The IRGen test had wrong offsets for inline String element on tuples kp on 32-bit platforms
The stdlib test had hardcoded offsets (assumed 64-bit host) for tuple kp elements (Memorylayout)
2019-02-20 21:46:22 +01:00
Michael Ilseman
f87960746c Merge pull request #22108 from milseman/en_gadus_offset
[String.Index] Obsolete encodedOffset var/init
2019-02-19 14:43:26 -08:00
Michael Ilseman
de86e4f79e Merge pull request #22663 from milseman/indigenous_characters
[String] Naturalize Character
2019-02-19 10:52:04 -08:00
technicated
d474d766e2 Added stdlib/KeyPath test
Execution tests involving generic and non-generic tuples
2019-02-18 10:22:17 +01:00
technicated
1577afee80 Added more tests (related to generic tuples) 2019-02-18 10:19:43 +01:00
technicated
d7324b977e Added more tests
Testing SILGen & IRGen tuple keypath generation
Added tuple element type check in SILVerifier
2019-02-18 10:19:42 +01:00
Michael Ilseman
83e1137e21 [String] Naturalize Character
Characters should always be native, and never shared.
2019-02-15 16:50:38 -08:00
Mike Ash
de805c0112 [Stdlib] Special-case major version 9999 as always available.
rdar://problem/43776049
2019-02-15 16:23:03 -05:00
Max Moiseev
cdc4c87565 Merge pull request #22598 from moiseev/intents-macos
Match availability of INIntentError and INIntentErrorDomain in a test
2019-02-14 09:39:08 -08:00
Michael Ilseman
415cc8fb0c [String.Index] Deprecate encodedOffset var/init
String.Index has an encodedOffset-based initializer and computed
property that exists for serialization purposes. It was documented as
UTF-16 in the SE proposal introducing it, which was String's
underlying encoding at the time, but the dream of String even then was
to abstract away whatever encoding happend to be used.

Serialization needs an explicit encoding for serialized indices to
make sense: the offsets need to align with the view. With String
utilizing UTF-8 encoding for native contents in Swift 5, serialization
isn't necessarily the most efficient in UTF-16.

Furthermore, the majority of usage of encodedOffset in the wild is
buggy and operates under the assumption that a UTF-16 code unit was a
Swift Character, which isn't even valid if the String is known to be
all-ASCII (because CR-LF).

This change introduces a pair of semantics-preserving alternatives to
encodedOffset that explicitly call out the UTF-16 assumption. These
serve as a gentle off-ramp for current mis-uses of encodedOffset.
2019-02-13 18:42:40 -08:00
Maxim Moiseev
332476d340 Match availability of INIntentError and INIntentErrorDomain in a test 2019-02-13 16:41:25 -08:00
Maxim Moiseev
3a7419f51b Fix swiftVersion usage in the test 2019-02-13 16:40:20 -08:00
Philippe Hausler
1fe1b86556 Add a safe API for NSValue and migrate NSValue value fetching to the size variants for validation (#22265) 2019-02-13 14:14:41 -08:00
Ben Cohen
f15892c1a8 Merge pull request #22288 from airspeedswift/safe-conversion
[stdlib] Remove overly-permissive UnsafePointer init
2019-02-12 11:47:06 -08:00
Itai Ferber
60fbf61094 Merge pull request #22528 from itaiferber/data-nil-buffer-pointer-tests
Add unit tests covering Data.init<T>(buffer: Unsafe{Mutable}BufferPointer<T>)
2019-02-12 09:47:40 -08:00
Itai Ferber
9fb05979af Add unit tests covering Data.init<T>(buffer: Unsafe{Mutable}BufferPointer<T>) 2019-02-11 15:48:24 -08:00
Andrew Trick
28a529ceed Fix crashes in Unsafe[Raw]BufferPointer with nil baseAddress.
This fix updates various initializers to handle incoming empty buffers
that happen to have a nil base. They should simply create another
buffer with nil base rather than crashing!

It is valid for an Unsafe[Raw]BufferPointer can have a nil base
address. This allows round-tripping with C code that takes a
pointer/length pair and uses `0` as the pointer value.

The original design wrongly assumed that we would use a sentinel value
for empty buffers and was never updated for or tested with the current
design.

Fixes <rdar://problem/47946984> Regression in Foundation.Data's
UnsafeBufferPointer constructor.
2019-02-11 13:38:48 -08:00
Ben Cohen
0f339d3663 Merge branch 'master' into safe-conversion 2019-02-11 12:58:51 -08:00
Mathew Polzin
a974aaaabc Added test that Optional.none is correctly cast in a generic context. 2019-02-11 09:02:06 -08:00
Saleem Abdulrasool
920b2f7127 Merge pull request #22415 from drodriguez/standarize-darwin-glibc-msvcrt
[tests] Standarize the checks for Darwin, Glibc and MSVCRT.
2019-02-07 12:52:45 -08:00
Michael Ilseman
877a20ead0 [String] Fix crash when given null UBP 2019-02-06 14:44:01 -08:00
Daniel Rodríguez Troitiño
d08b46c47e [tests] Standarize the checks for Darwin, Glibc and MSVCRT.
Different tests used different os checks for importing Darwin, Glibc and
MSVCRT. This commit use the same pattern for importing those libraries,
in order to avoid the #else branches of the incorrect patterns to be
applied to the wrong platform. This was very normal for Android, which
normally should follow the Linux branches, but sometimes was trying to
import Darwin or not importing anything.

The standarized pattern imports Darwin for macOS, iOS, tvOS and watchOS.
It imports Glibc for Linux, FreeBSD, PS4, Android, Cygwin and Haiku; and
imports MSVCRT for Windows. If a new platform is introduced, the else
branch will report an error, so the new platform can be added to one of
the branches (or maybe add a new specific branch).

In some cases  the standard pattern was modified because some test required
it (importing extra modules, or extra type aliases), and in some other
cases some branches were removed because the test will not have used
them (but it is not exhaustive, so there might be some unnecessary
branches).

This should, at least, fix three tests for Android (the three
dynamic_replacement*.swift ones).
2019-02-06 10:51:55 -08:00
Scott Perry
9b45fc46ee Only instanciate one test suite--this was confusing the test framework, causing some strange crashes 2019-02-05 17:10:18 -08:00
Scott Perry
b467e24a9e Apply public documentation and type modifications from proposal acceptance 2019-02-04 13:28:36 -08:00
Jordan Rose
b0f5815d2b Merge pull request #20951 from pitiphong-p/encoders-nested-key-edge-case-bug
Reuse the container when requesting for a new nested container with the old key in JSONEncoder and PlistEncoder
2019-02-04 13:19:42 -08:00
Lily Vulcano
337904fb2e Merge pull request #22311 from millenomi/fix_kvo-take-2
Take 2 of “[SDK] Fix multiple issues with Swift KVO”
2019-02-01 17:18:53 -08:00
Max Moiseev
91d8615cb9 Merge pull request #22275 from airspeedswift/unsafe-conversion
[stdlib] Restore concrete initializers on Unsafe{Raw}Pointer
2019-02-01 15:04:55 -08:00
Lily Vulcano
bdb4686375 Take 2 of “[SDK] Fix multiple issues with Swift KVO”
This reproposes @lilyball’s fixes in https://github.com/apple/swift/pull/20103 while adding her fix to ensure observations are removed before observed objects in 32-bit testing.
2019-02-01 14:07:44 -08:00
Joe Shajrawi
596dfd9dfb Merge pull request #22297 from millenomi/revert-fix_kvo
Simulator build fix — (temporarily) revert "Merge pull request #20103 from lilyball/fix_kvo"
2019-02-01 13:02:56 -08:00
Maxim Moiseev
2270ac0e90 Add a few tests for UnsafeMutablePointer => UnsafePointer conversions 2019-02-01 12:32:51 -08:00
Max Moiseev
556e089d19 Merge pull request #22138 from moiseev/spring-cleaning
[stdlib] Remove a bunch of declarations marked as obsoleted in 4
2019-02-01 11:03:37 -08:00
Lily Vulcano
ac7a93963c Revert "Merge pull request #20103 from lilyball/fix_kvo"
This reverts commit 7c514196fc, reversing
changes made to 2d7c31b24c.

This patch will be reproposed with fixes.
2019-02-01 10:55:06 -08:00
Arnold Schwaighofer
d3eb822044 test/stdlib/KVOKeyPaths.swift fails i386 and blocks PR testing (#22294)
SR-9838
rdar://47735786
2019-02-01 08:54:12 -08:00
Ben Cohen
351c1291a9 Restore concrete initializers on Unsafe{Raw}Pointer 2019-01-31 17:11:16 -08:00
Lily Vulcano
7c514196fc Merge pull request #20103 from lilyball/fix_kvo
[SDK] Fix multiple issues with Swift KVO
2019-01-30 14:35:14 -08:00
Lily Vulcano
1087adb943 The error is right: these should be @objc. 2019-01-30 13:35:05 -08:00
Lily Ballard
5811a04e8f Add some tests for KeyPath issues
Test to make sure the `String -> KeyPath` table used for the
`NSKeyValueObservingCustomization` callbacks isn't screwed up by
observing another object's property with the same name from within the
callbacks.

Test `NSSortDescriptor.keyPath` to ensure it's also not screwed up by
creating sort descriptors for the same property on different objects.
2019-01-30 12:41:14 -08:00
Maxim Moiseev
02cc2256e9 [stdlib] Remove a bunch of declarations marked as obsoleted in 4 2019-01-29 11:13:47 -08:00
Ben Rimmington
7b2d43e53d [SR-7076] Codable tests for ContiguousArray
<https://bugs.swift.org/browse/SR-7076>

Follow-up to apple/swift#20715
2019-01-29 15:15:21 +00:00
Karoy Lorentey
587a9a824c Merge pull request #22081 from lorentey/hashvalue-fixit
[Sema] Add dedicated fix-it for NSObject.hashValue overrides
2019-01-28 07:50:20 -08:00
Erik Eckstein
cc35f385ed Runtime: fix mangling of nested private generic classes
The generated mangled names were wrong and couldn't be demangled.
For example the runtime generated class name for PrivateGeneric was wrong:

class OuterClass {
    private class PrivateGeneric<T, U> { }
}

rdar://problem/47529629
2019-01-25 16:49:08 -08:00
Steve (Numerics) Canon
ba2b7e2f80 Fixup jsInteger function. 2019-01-25 15:25:01 -05:00
Steve (Numerics) Canon
0f89ac2d99 Disable floating-point SIMD Codable tests entirely
These are still breaking on 10.11, so we'll turn them off for now.
2019-01-25 13:52:38 -05:00
Steve (Numerics) Canon
a328c2511e Ensure that integer values used in SIMD Codable test are representable as JS "integers" 2019-01-25 13:30:42 -05:00
Stephen Canon
dd0cddff9c Disable some SIMD Codable tests that are failing on i386. (#22116)
It looks like JSONEncoder can't round-trip floating-point values on i386 only. Likely an x87 excess-precision bug, but I don't have time to investigate right now. Tracked by https://bugs.swift.org/browse/SR-9759
2019-01-25 11:12:46 -05: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
Karoy Lorentey
6af814d76c [test] Test new fix-it for NSObject.hashValue overrides 2019-01-23 19:44:01 -08:00