Commit Graph

1470 Commits

Author SHA1 Message Date
Maxim Moiseev
b7661c5991 [overlay] The AssetsLibrary APIs have been deprecated since iOS 9
Addresses: <rdar://problem/39029315>
2018-08-06 13:10:05 +08:00
Philippe Hausler
ae9f5e3cde [Foundation] handle ambiguity in swift 4 mode for Data.init with byte sequences 2018-08-01 09:43:55 -07:00
Mishal Shah
13f5118a92 Update master to build with Xcode 10 beta 5, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs 2018-07-31 13:05:42 -07:00
Karoy Lorentey
d03786ee1c [ObjectiveC] NSObject: Clarify hashing implementation
NSObject defines its own interface for hashing and equality. Subclasses must implement custom hashing by overriding the hash property, or NSSet and NSDictionary will not work correctly.

Unfortunately, we currently define NSObject.hashValue and NSObject.hash(into:) as overridable, which leads people to accidentally override one of these instead of hash. hashValue is explicitly declared open, while hash(into:) is automatically synthesized as such.

Making hashValue non-open is a potentially source breaking change, but we can at least provide an explicit, non-overridable definition for hash(into:), and update the documentation to explain the contract.
2018-07-26 16:09:54 +01:00
Ben Cohen
345879429b [stdlib] Take several underscored stdlib functions private (#18134)
* Make _sanityCheck internal

* Make _debugPrecondition internal

* Make Optional._unsafelyUnwrappedUnchecked internal.

* Make _precondition internal

* Switch Foundation _sanityChecks to assertions

* Update file check tests

* Remove one more _debugPrecondition

* Update Optimization-with-check tests
2018-07-24 18:26:19 -07:00
Doug Gregor
b70466dc63 [Type Checker] Add a request kind for computing 'ValueDecl::isObjC()'.
Still a WIP
2018-07-18 14:50:39 -07:00
ktopley-apple
f83c17ca7f Merge pull request #18044 from ktopley-apple/ktopley-dispatch-rdar40951342
Add documentation comments.
2018-07-18 13:34:49 -07:00
ktopley-apple
f0edc02f4e Merge pull request #17399 from mwwa/dispatch-source-nullability
dispatch_source_create returns NULL but is marked up as nonnull
2018-07-18 11:01:11 -07:00
Kim Topley
354bc9e00f Add documentation comments.
rdar://problem/40951342
2018-07-18 10:28:51 -07:00
ktopley-apple
ccdcd94120 Merge pull request #17982 from ktopley-apple/ktopley-dispatch-rdar40775762
Change the signature for DispatchData.enumerateBytes() to match that …
2018-07-18 08:03:49 -07:00
Kim Topley
7b0991f0a8 Change the signature for DispatchData.enumerateBytes() to match that of Data.enumerateBytes() for Swift 4.2 and obsolete the old version.
rdar://problem/40775762
2018-07-17 11:00:55 -07:00
Kim Topley
fc08a12a61 Fix warning for uninitialized va_list variable.
rdar://problem/40626177
2018-07-17 08:21:39 -07:00
Matt Wright
1ff4ca0d41 dispatch_source_create returns NULL but is marked up as nonnull
dispatch_source_create is marked up as non-null but can actually return
null in programming error issues. In order to maintain the nullabilty
contract, these issues will now cause the overlay to assert and crash
rather than return a null pointer out of a non-null call.

Resolves: <rdar://problem/39937177>
2018-07-13 10:47:09 -07:00
Ben Cohen
d82eed458e Migrate UnsafeMutableAudioBufferListPointer off _writeBackMutableSlice. (#17824)
The current behavior is the default you get "for free" from
MutableCollection so there's no good reason for accessing the std lib
file directly, and it requires access to std lib internals to do so.
2018-07-12 10:49:36 -07:00
Michael Gottesman
5648ef219d [+0-all-args] Clean up remains of +1 convention from the runtime. 2018-07-06 23:10:12 -07:00
Mishal Shah
95c80cf2ce Merge pull request #17761 from apple/update-master-xcode-10-beta-3
Update master to build with Xcode 10 beta 3, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs
2018-07-05 15:53:29 -07:00
Stephen Canon
86ba697151 Add constraints to FixedWidthInteger.Stride and .Magnitude (#17716)
* Add constraints to FixedWidthInteger.Stride and .Magnitude

Add the constraint that these associatedtypes themselves conform to FixedWidthInteger and to SignedInteger and UnsignedInteger, respectively. These are effectively part of the semantic requirement of the protocol already, because the requirements on .min and .max effectively force FixedWidthInteger to be twos-complement, which requires Magnitude not be Self for signed types. Also, in practice it's generally necessary to have these two constraints in order to effectively use the FixedWidthInteger protocol anyway; witness that by adding them to the protocol, we eliminate them as constraints from a number of extensions.

This also resolves https://bugs.swift.org/browse/SR-8156
2018-07-05 15:04:33 -04:00
Mishal Shah
811b1d0879 Update master to build with Xcode 10 beta 3, OS X 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs 2018-07-05 10:57:03 -07:00
Ben Cohen
59dea67f0f Remove unused NSRange slice variable (#17747) 2018-07-04 14:45:40 -07:00
Tony Parker
8009e87716 Merge pull request #17607 from lutherjm/pr/40440282
URLComponents is missing percentEncodedQueryItems.
2018-06-29 13:06:48 -07:00
Tony Parker
f9ab5c86c3 Merge pull request #17613 from lutherjm/pr/41378853
URL is missing several URLResourceValues
2018-06-29 10:05:11 -07:00
Ben Cohen
a4230ab2ad [stdlib] Update stdlib to 4.0 and reorganize compatibility shims (#17580)
* Update stdlib to 4.0 and move all compatibility shims into a dedicated source file
2018-06-29 06:26:52 -07:00
Jim Luther
4f0d568c3a Fixed indentation in changes. 2018-06-28 18:22:05 -07:00
Jim Luther
6fbb2a4b25 Fixed indentation in changes. Fixed availability in test. 2018-06-28 18:19:23 -07:00
Jim Luther
0801977f21 URL is missing several URLResourceValues 2018-06-28 15:39:36 -07:00
Jim Luther
a7d3efd6f8 URLComponents is missing percentEncodedQueryItems. I added it and modified the URLComponents test code to make sure it works. 2018-06-28 14:10:47 -07:00
Doug Gregor
f232af5535 [Mangling] Allow standard substitutions in protocol mangling.
Protocol name mangling didn’t always go through a path that allowed the use
of standard substitutions. Enable standard substitutions for protocol name
manglings where they make sense.

Removes ~277k from the standard library binary size.
2018-06-19 23:24:38 -07:00
agnosticdev
0d983964f7 network-typos: Added another file to this commit 2018-06-19 06:12:19 -05:00
agnosticdev
adf06f2842 network-typos: Fixed a few typos while reading through the Network SDK 2018-06-19 06:07:58 -05:00
Jordan Rose
a6ae2d7742 Hack: Force UIEdgeInsets.zero to always come from the SDK (#17122)
...instead of relying on the one in the overlay in pre-4.2 versions of
Swift. This caused crashes in deserialization, which (deliberately)
doesn't respect availability.

There are three changes here:

- Remove UIEdgeInsets.zero and UIOffset.zero from the UIKit overlay.
- Always use the 4.2 name for UIEdgeInsetsZero and UIOffsetZero from
  the underlying UIKit framework. (This is the nested name.)
- Ignore the unavailability messages for those two constants in
  pre-4.2 Swift, since we're now relying on them being present.

The latter two, the compiler changes, can go away once UIKit's API
notes no longer specify different pre-4.2 behavior, but meanwhile we
need to keep compatibility with the SDKs released in Xcode 10b1.

https://bugs.swift.org/browse/SR-7879
2018-06-12 13:40:23 -07:00
Philippe Hausler
d6bf8e3180 [Foundation] adjust inline of append and initialization functions (#17027)
* [Foundation] adjust inline of append and initialization functions and use _copyContents(initialzing:) to avoid performance regressions while using generic collection/sequence APIs

* Add the Array<UInt8> specialization back for append to Data
2018-06-11 15:09:41 -07:00
Mishal Shah
3f8ce7d2f9 Update master to build with Xcode 10 beta 1, OS X 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs. 2018-06-04 23:14:19 -07:00
swift-ci
daeaaf8d91 Merge pull request #16010 from phausler/update_data_inlines 2018-05-30 13:12:22 -07:00
swift-ci
9cd43a0663 Merge pull request #10435 from kballard/url_resolvingBookmarkData 2018-05-28 16:46:44 -07:00
Philippe Hausler
fc2c628014 Remove last public inlines 2018-05-25 13:00:02 -07:00
Philippe Hausler
69e46e6af6 Remove additional inlines 2018-05-25 11:27:29 -07:00
Michael Ilseman
614016fecd [String.Index] Simplify and prepare for more resilience.
Simplify String.Index by sinking transcoded offsets into the .utf8
variant. This is in preparation for a more resilient index type
capable of supporting existential string indices.
2018-05-24 14:47:04 -07:00
Philippe Hausler
2b80e0ca42 [Foundation] Migrate Data to a ABI stable variant
This has one known performance regression; appending with a sequence (not an Array, but something like a Repeated<UInt8>) is slower. We aknowlege this regression and plan to offer an update later that has a specialized variation of this API that optimizes to a memset/memset_pattern. This set of changes is limited to specifically targeting ABI stability and inline characteristics of Data and leaves that optimization as a future addition.
2018-05-23 15:00:26 -07:00
Mike Ash
5b991f30b8 [Runtime] Redo the ErrorObject/dlsym interface to use a struct containing all the bridging points. This allows for better static typing and reduces the amount of dynamic symbol lookups.
rdar://problem/39810532
2018-05-21 17:10:46 -04:00
Ben Langmuir
2e6c7ee76d Revert "[Runtime] Look up Error bridging symbols indirectly through special symbols that won't be stripped in static builds." 2018-05-19 10:05:00 -07:00
Mike Ash
3cc86eb836 [Runtime] Look up Error bridging symbols indirectly through special symbols that won't be stripped in static builds.
This fixes a problem where error bridging didn't work in stripped executables using the static versions of the Swift libraries. ErrorObject.mm looks up some symbols with dlsym, but stripping makes it so it can't find those. This change makes a separate set of symbols explicitly made for ErrorObject.mm to look up, and marks them as dynamically referenced so stripping won't remove them. Longer term, we'd like a better solution for looking up these symbols, but this will do for now.

rdar://problem/39810532
2018-05-17 11:43:15 -04:00
Itai Ferber
c7feef6dec Merge pull request #16393 from itaiferber/localizedString-for-nullability-fix
Correct cast from IUO in Locale.localizedString(for:)
2018-05-07 09:11:59 -07:00
Itai Ferber
6fa55556a3 Fix a cast to an IUO which can actually be nil. 2018-05-04 14:57:41 -07:00
Jordan Rose
fc99de452d Foundation: resolve some warnings (#16078)
- JSONEncoder.swift: tell the compiler that yes, this is supposed to
  be casting to 'T' and not 'T?'.

- NSObject.swift: mark NSKeyValueObservation members explicitly @objc
  and @nonobjc.

- NSStringAPI.swift: remove unnecessary @usableFromInline.

No intended functionality change.
2018-05-01 15:41:21 -07:00
Itai Ferber
ae8718f083 Merge pull request #16182 from itaiferber/recoverableerror-escaping-resulthandler
RecoverableError's resultHandler needs @escaping
2018-04-30 10:54:00 -07:00
Jordan Rose
f9f91ef233 Dispatch: Simplify DispatchData.append(_: UnsafeBufferPointer<T>) (#16080)
The deprecation warning guides us towards UnsafeRawBufferPointer,
so sure, let's use that.

No intended functionality change.
2018-04-30 09:22:35 -07:00
Mox Soini
d4511da4f8 Make _fastEnumerationStorageMutationsPtr internal
...and make Foundation use it's own fileprivate _fastEnumerationStorageMutationsPtr
2018-04-27 00:00:26 +03:00
Itai Ferber
c87bf17efe Mark resultHandler as @escaping 2018-04-26 10:55:40 -07:00
Slava Pestov
28ce9204fe stdlib: More SE-0193 updates 2018-04-24 21:21:22 -07:00
Karoy Lorentey
7d679f8d39 [SE-0206][CoreFoundation] _CFObject: Provide default implementation for _hash(into:)
Without this change, the Hashable synthesizer attempts to add hash(into:) methods directly on CF types, which (somewhat unsurprisingly) fails with assertion below. (This situation is unique to CF types, which are imported with an implicit _CFObject conformance; we usually have an extension context or a non-imported type decl in which to put the derived methods.)

Assertion failed: (!decl->isForeign() && "Use getForeignMetadataLayout()"), function getClassMetadataLayout, file /Users/klorentey/Swift/swift/lib/IRGen/MetadataLayout.cpp, line 83.
0  swift                    0x000000010ccd29c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010ccd30d6 SignalHandler(int) + 694
2  libsystem_platform.dylib 0x00007fff600e0d9a _sigtramp + 26
3  swift                    0x000000010e04f1ed cmark_strbuf__initbuf + 122440
4  libsystem_c.dylib        0x00007fff5ffa6f79 abort + 127
5  libsystem_c.dylib        0x00007fff5ff6f090 basename_r + 0
6  swift                    0x00000001096e8f95 swift::irgen::IRGenModule::getClassMetadataLayout(swift::ClassDecl*) + 53
7  swift                    0x00000001095b9e25 swift::irgen::emitVirtualMethodValue(swift::irgen::IRGenFunction&, llvm::Value*, swift::SILDeclRef, swift::CanTypeWrapper<swift::SILFunctionType>) + 133
8  swift                    0x00000001095ba252 swift::irgen::emitVirtualMethodValue(swift::irgen::IRGenFunction&, llvm::Value*, swift::SILType, swift::SILDeclRef, swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 690
9  swift                    0x00000001096bef49 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 33497
10 swift                    0x00000001096b3067 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8055
11 swift                    0x00000001095c8d8b swift::irgen::IRGenerator::emitLazyDefinitions() + 1051
12 swift                    0x000000010968eb16 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**, unsigned int) + 1382
13 swift                    0x000000010968f05e swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, unsigned int, llvm::GlobalVariable**) + 94
14 swift                    0x000000010952cfc0 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 15488
15 swift                    0x0000000109528332 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2962
16 swift                    0x00000001094e4848 main + 2328
17 libdyld.dylib            0x00007fff5feecc41 start + 1
Stack dump:
[…]
1.	While emitting IR SIL function "@$SSo10CGColorRefas8HashableSCsACP4hash4intoys6HasherVz_tFTW".
 for 'hash(into:)' in module 'CoreGraphics'
2018-04-24 17:42:42 +01:00