Commit Graph

8969 Commits

Author SHA1 Message Date
Maxim Moiseev
b5f28bfb35 Merge pull request #10430 from moiseev/focus-shim
[overlay] Implement UIFocusEnvironment.contains using a shim
2017-06-21 08:56:29 -07:00
Jordan Rose
e9622db324 [Foundation] Make CocoaError.Code and URLError.Code Hashable. (#10437)
This is consistent with imported error codes, which are always
Hashable. URLError.Code was also Hashable in Swift 3.1 by virtue of
being defined as an enum; the change to a struct broke that.

rdar://problem/32066434
2017-06-20 20:15:48 -07:00
Jordan Rose
f868d6dffe Fix up 08c2a7a3ac for 32-bit platforms. (#10433)
...where swift::TwoWordPair is defined a little less freely.
2017-06-20 19:24:36 -07:00
Jordan Rose
08c2a7a3ac Finish off the log part of _swift_checkClassAndWarnForKeyedArchiving. (#10418)
Logs a warning the first time a problematic class is archived or
unarchived. We expect people to actually fix these issues, so the
performance of the warning isn't too important.

Sample output:

  [timestamp] Attempting to archive Swift class '_Test.Outer.ArchivedThenUnarchived', which does not have a stable runtime name.
  [timestamp] Use the 'objc' attribute to ensure that the runtime name will not change: "@objc(_TtCC5_Test5Outer22ArchivedThenUnarchived)"
  [timestamp] If there are no existing archives containing this class, you can choose a unique, prefixed name instead: "@objc(ABCArchivedThenUnarchived)"

Finishes rdar://problem/32414508
2017-06-20 17:15:28 -07:00
Max Moiseev
52522f118c [overlay] Implement UIFocusEnvironment.contains using a shim
Addresses: <rdar://problem/32538412>
2017-06-20 17:14:24 -07:00
Joe Groff
860e3a4ca4 Merge pull request #10419 from jckarter/key-path-alignment
KeyPaths: Pointer-align pointer fields within key path patterns.
2017-06-20 19:44:10 -04:00
Joe Groff
752beac4f1 KeyPaths: Pointer-align pointer fields within key path patterns.
To get the full benefit of dyld3 on Darwin platforms, pointer relocations need to be pointer-aligned, which unfortunately requires growing some key path data structures a little bit. This does tidy up some code that had to hack around our lack of unaligned load/store operations on UnsafeRawPointer, at least. While we're here, we can also simplify the identification strategy for reabstracted stored properties; we only need the property index to identify, not the absolute offset. rdar://problem/32318829
2017-06-20 14:42:05 -07:00
Itai Ferber
e0f75bf841 Merge pull request #10343 from itaiferber/cg-types-codable-conformance
Add Codable conformance to common CG types
2017-06-20 09:32:56 -07:00
Roman Levenstein
2f920c4ad2 Add a new frontend option -sil-serialize-witness-tables to force serialization of SIL witness tables
This option is supposed to be used only for compiling overlays. User code should never be compiled with this option.
2017-06-19 19:49:01 -07:00
Itai Ferber
fedf8e6908 Add Codable conformance to common CG types
Give custom Codable implementations for CGAffineTransform, CGPoint,
CGSize, CGRect, and CGVector, along with unit tests.
2017-06-19 17:23:11 -07:00
Dave Abrahams
1da820da74 Merge pull request #10275 from natecook1000/nc-dict-grouping
[stdlib] Move Dictionary(grouping:by) down a level
2017-06-19 16:56:04 -07:00
Slava Pestov
23e86cfbaa Merge pull request #10383 from slavapestov/resilient-build-fix
stdlib: Add another missing @_versioned annotation
2017-06-19 15:04:41 -07:00
Kuba (Brecka) Mracek
fec8d72ea3 Debugger hook/breakpoint for issue reporting from the Swift runtime (#10293)
* Implements a debugger hook (breakpoint) API and data structure. This structure is passed to the debugger and describes extra information about a fatal error or a non-fatal warning, which should be logged as a runtime issue.

This debugger hook is then used from two places, which currently only log to stderr:
- Runtime exclusivity violations.
- Swift 3 implicit Obj-C entrypoints.

A subsequent LLDB support will be able to catch these callbacks and show the runtime issues in a better way than just logging them to stderr.  When the debugger is not attached, this shouldn't have any effect.
2017-06-19 14:28:19 -07:00
Slava Pestov
0b35e49cd7 stdlib: Add another missing @_versioned annotation
We cannot diagnose uses of a non-public conformance yet, so this
was resulting in a linker failure.

Fixes <rdar://problem/32536790>.
2017-06-19 14:07:45 -07:00
Arnold Schwaighofer
62c1f215ce Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library (#10373)
* Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library

Should fix the linkage issue on linux
2017-06-19 10:59:05 -07:00
Arnold Schwaighofer
e5aca4124b Cleanup - remove dead code from previous EmptyBoxType change 2017-06-17 09:35:21 -07:00
Arnold Schwaighofer
48e889b51b IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums (#10326)
* IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums

We map nil to the .None case of Optional. Instead use a singleton object.

SR-5148
rdar://32618580
2017-06-17 09:33:41 -07:00
Philippe Hausler
29f080f0c3 [Foundation] 1-ary IndexPath forms invalid range on slices 2017-06-16 17:41:19 -07:00
Joe Groff
cf3da5f3de Merge pull request #10302 from jckarter/keypath-indirect-offset
[SR-5036]: Segfault using KeyPath with NSObject
2017-06-16 19:16:24 -04:00
Philippe Hausler
c358afe655 [Foundation] Adjust Double and Float bridges to be more lenient 2017-06-16 15:18:27 -07:00
Philippe Hausler
689fc28edc [Foundation] Add migration hints for deprecated NSNumber based initializers 2017-06-16 15:18:27 -07:00
Joe Groff
fe88bd5f3f KeyPaths: Correctly instantiate offsets for final stored properties in NSObject subclasses.
We need to use the ivar offset variables in this case, since the Swift field offset vector doesn't pick up the adjusted offsets from the ObjC runtime. Fixes SR-5036 | rdar://problem/32488871.
2017-06-16 14:42:32 -07:00
Philippe Hausler
1ca142eba4 [Foundation] Correct NSRange equality typo and add unit tests for newly added NSRange behaviors (#10282) 2017-06-16 13:38:31 -07:00
swift-ci
3548c45423 Merge pull request #10323 from moiseev/public-starttime 2017-06-16 13:23:07 -07:00
Max Moiseev
e2788fd6eb Fix access level for extern_proc.p_starttime
Fixes: <rdar://problem/31549450>
2017-06-16 11:39:35 -07:00
Nate Cook
695a7f975e [stdlib] Move Dictionary(grouping:by) down a level 2017-06-16 00:51:38 -05:00
swift-ci
bdd5c38c66 Merge pull request #10284 from jrose-apple/avoid-deserialization-failures-on-bots 2017-06-15 12:00:51 -07:00
Maxim Moiseev
a8f3f29917 [overlay] Adding back dependencies on os and XPC to CloudKit (#10258) 2017-06-15 11:50:54 -07:00
Jordan Rose
2b415a3848 [StdlibUnittest] Avoid serializing references to ObjC runtime APIs.
Specifically, objc_setUncaughtExceptionHandler, whose nullability is
now annotated in Swift 4 mode when using the Xcode 9 SDKs. That means
it has a different signature in Swift 3 and Swift 4 mode, which means
that references from SIL will fail when deserialized in the other
mode. (The recovery support added in earlier commits doesn't cover
serialized SIL.)

This resulted in crashes when building with
-build-serialized-stdlib-unittest, which enables -sil-serialize-all /
"magic performance mode" when building the StdlibUnittest module like
it does the standard libarry.

None of this affects developer code, because developer code doesn't
serialize anything (if they're playing by the rules).
2017-06-15 11:14:12 -07:00
Maxim Moiseev
07031ab480 Merge branch 'master' into watchkit-deps 2017-06-14 16:49:51 -07:00
Mishal Shah
c5ff1f2cac Update master to build with Xcode 9 beta 1, OS X 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-06-14 16:20:35 -07:00
Max Moiseev
bba4d9eada [overlay] Add mising dependencies to WatchKit overlay
Fixes: <rdar://problem/32776189>
2017-06-14 15:38:49 -07:00
Maxim Moiseev
a31e2bde14 Merge pull request #10097 from apple/stringprotocol-reform
[stdlib] Eliminate over-constraint on StringProtocol
2017-06-14 15:13:56 -07:00
Itai Ferber
5daa71c8ad Merge pull request #10249 from itaiferber/master
Allow SingleValueContainers to decode collections
2017-06-14 14:24:15 -07:00
Max Moiseev
5b9cba1830 [overlay] Update CloudKit overlay dependencies
Fixes: <rdar://problem/32769260>
2017-06-14 12:21:42 -07:00
Maxim Moiseev
651aaa8b54 Merge pull request #10206 from moiseev/unambiguous-bitpattern
[stdlib] Resolve the ambiguity for Int32.init(bitPattern:)
2017-06-14 11:34:32 -07:00
Itai Ferber
48d183e62a Allow SingleValueContainers to decode collections
SingleValueDecondingContainers in JSON and Plist previously held the
assertion that attempting to decode an array or dictionary from them
was a type mismatch (since those represented unkeyed and keyed
containers, respectively). This assertion is no longer true, though,
since encode<T : Encodable>(_:) and decode<T : Decodable>(_:) allow
you to do just that.

This lifts the assertion and adds unit tests to both implementations to
ensure this works. (Addresses https://bugs.swift.org/browse/SR-5089)
2017-06-14 11:14:20 -07:00
Graydon Hoare
fc3c5196bf Merge pull request #10237 from graydon/rdar-32547102-float-varargs-overflow-to-gp-args-area
Rdar 32547102 float varargs overflow to gp args area
2017-06-13 22:40:13 -07:00
Graydon Hoare
08503998ab [varargs] Don't put excess float varargs in GPR area, fix rdar://32547102 2017-06-13 20:25:45 -07:00
Graydon Hoare
8e6a775181 [varargs] Add comment to help future devs avoid losing a few hours. 2017-06-13 20:25:45 -07:00
Max Moiseev
90a20ea015 [stdlib] Resolve the ambiguity for Int32.init(bitPattern:)
When this initializer is invoked with an integer literal, the expression
is ambiguous, since both UIn32 and Float are
RepresentableByIntegerLiteral.

Fixes: https://bugs.swift.org/browse/SR-5176
2017-06-13 17:28:19 -07:00
Erik Eckstein
ce188682e5 runtime: remove an unnecessary helper function to get the class name 2017-06-13 15:20:07 -07:00
Nate Cook
0ebf95b8ac Merge pull request #10209 from natecook1000/nc-fixes-75-3
Documentation edits
2017-06-13 16:21:42 -05:00
Nate Cook
825e9d077d [stdlib] More documentation revisions / consistency fixes. 2017-06-13 14:08:00 -05:00
Erik Eckstein
1bff67f573 runtime: use class_getName instead of NSStringFromClass in _swift_checkClassAndWarnForKeyedArchiving 2017-06-13 09:25:42 -07:00
Nate Cook
b7af9bfe83 [stdlib] Remove SeeAlso tags 2017-06-13 11:23:51 -05:00
John McCall
3578e20a1f Merge pull request #10213 from rjmccall/cf-create-is-plus-one
Annotate a couple of +1-returning functions appropriately
2017-06-12 23:15:50 -04:00
John McCall
eb6cebdfa2 Annotate a couple of +1-returning functions appropriately instead of
trying to compensate in the caller.

One of the callers was apparently not _cocoaStringSlice trying to compensate,
so this probably also fixes a leak.
2017-06-12 20:42:57 -04:00
Slava Pestov
88f33767c3 stdlib: Make _HeapBufferHeader @_versioned to fix resilient build 2017-06-12 14:41:45 -07:00
Nate Cook
0a7780c213 [stdlib] Various minor documentation revisions 2017-06-12 16:20:11 -05:00