Commit Graph

76 Commits

Author SHA1 Message Date
Joe Groff
32fb006386 Clang Importer: Enable OptionSetType import.
Update the tests to match.

Swift SVN r28906
2015-05-22 05:47:37 +00:00
Dmitri Hrybenko
2e67af546b Add the file I forgot to commit in r28833
Swift SVN r28837
2015-05-20 18:31:26 +00:00
Dmitri Hrybenko
3cc2161e6f SDK overlay: add generic API overlays for NSUndoManager
Patch by Michael J LeHew Jr.

Swift SVN r28833
2015-05-20 18:02:00 +00:00
Dmitri Hrybenko
53f3ccf850 stdlib: change CollectionType.count() into a property
Swift SVN r28829
2015-05-20 09:14:43 +00:00
Doug Gregor
36a0c434ea Generalize _BridgedNSError to RawRepresentable types with any integral RawValue.
Part of rdar://problem/20577517, which will depend on this protocol.

Swift SVN r28795
2015-05-19 22:40:15 +00:00
Doug Gregor
94aafe1f33 De-underscore _MachError, _POSIXError, _NSCocoaError, _NSURLError.
Turns rdar://problem/20536610 into API, per scattered but positive API
review feedback.

Swift SVN r28756
2015-05-19 05:53:36 +00:00
Doug Gregor
bddf134a87 Factor _NSCocoaError into a struct whose values are split across frameworks.
The Cocoa error domain is comprised on error codes from Foundation,
CoreData, and AppKit. Rather than try to collect all of the error
codes into a single enum in Foundation, use a struct that conforms to
ErrorType. Part of rdar://problem/20536610.

Swift SVN r28755
2015-05-19 05:53:34 +00:00
Dmitri Hrybenko
313701286b stdlib: Various punctuation and markup improvements to the comments.
Patch by Brian Lanier.

Swift SVN r28659
2015-05-16 03:04:51 +00:00
Doug Gregor
1d6602ed73 Add bridging for the Mach error domain.
Swift SVN r28626
2015-05-15 16:53:29 +00:00
Doug Gregor
af6d4c5b6f Map the NSError POSIX domain into our error-handling scheme.
More of rdar://problem/20536610. _POSIXError is underscored because
this work needs to go to API review still.

Now with a proper build condition for _POSIXError on Darwin.

Swift SVN r28625
2015-05-15 16:22:20 +00:00
Ted Kremenek
2c3d0308a3 Revert "Map the NSError POSIX domain into our error-handling scheme."
This is breaking the bots.

Swift SVN r28615
2015-05-15 06:01:48 +00:00
Doug Gregor
1fa59f475a Map the NSError POSIX domain into our error-handling scheme.
More of rdar://problem/20536610. _POSIXError is underscored because
this work needs to go to API review still.

Swift SVN r28613
2015-05-15 05:31:25 +00:00
Dmitri Hrybenko
d8d50e1815 stdlib: in Array bridging code, use the same pattern as Set and Dictionary use
Also, simplify the code by removing an unused parameter.  NFC.

Swift SVN r28607
2015-05-15 03:44:37 +00:00
Dmitri Hrybenko
7c8a394cb1 Move NSObject extensions to the ObjectiveC overlay
NSObject is defined in the ObjectiveC module, not in Foundation.

rdar://20526438

Swift SVN r28591
2015-05-15 00:34:25 +00:00
Doug Gregor
75f88af29a Make NSError error domain enums Equatable and Hashable.
Swift SVN r28568
2015-05-14 16:42:12 +00:00
Doug Gregor
7449c3b6ff Use protocol extensions to eliminate boilerplate in bridged NSError domains.
Swift SVN r28567
2015-05-14 16:42:10 +00:00
Doug Gregor
79e93e358c Add _NSURLError enum to cover the NSURLError error domain.
Swift SVN r28564
2015-05-14 06:53:55 +00:00
Doug Gregor
88b679969c Get availability annotations right for NSCocoaError.
Fix the script to not wantonly drop availability annotations, and
update NSCocoError accordingly. Also drop in a reinterpret-casting
rawValue initializer, which matches what we get when importing enums
from C.

Swift SVN r28563
2015-05-14 06:53:52 +00:00
Doug Gregor
cfbe2e0921 Hard-code the Cocoa error domain mapping using the results of a simple script.
Bridging the Cocoa error domain requires us to gather constants from
Foundation, CoreData, and AppKit, then pulling those into a single
(_)NSCocoaError enum that conforms to
_ObjectiveCBridgeableErrorType.

Rather than using a table extracted from the appropriate Cocoa headers
and pushing that through gyb, just hardcode the resuting Swift code,
which is produced (manually) by an enumeration-parsing script. Thanks
to Dave for pointing out that I was holding gyb wrong.

... and apologies for the Perl.

Long term, we need a better solution here, but this will suffice for
the short term.

Swift SVN r28560
2015-05-14 05:39:45 +00:00
Doug Gregor
7cd80ec5dd Factor creation of enums for the Cocoa error domains into a reusable gyb template.
We'll need these for a number of framework overlays.

Swift SVN r28530
2015-05-13 21:02:41 +00:00
Doug Gregor
ce37291d10 Update NSCocoaError to contain the entire Cocoa domain.
Extend the NSCocoaError enum to cover all of the error codes in the
Cocoa error domain. Note that we need to do something awful for the
AppKit and CoreData errors, effectively redeclaring all of the
constants locally, because we cannot import AppKit and CoreData into
the Foundation overlay. It's not clear whether this blatant layering
violation will stand, but this at least improves coverage.

Also note that there are a number of warnings when building this code,
because some of the availability checks specify availability earlier
than our minimum deployment target. They're harmless and can be
cleaned up later.

Part of rdar://problem/20536610.

Swift SVN r28522
2015-05-13 20:19:45 +00:00
Ted Kremenek
7f1119f690 Underscore properties of ErrorType.
The internal details of ErrorType are still being designed.
They should be underscored in the meantime to
indicate they are still evolving.

Implements rdar://problem/20927102.

Swift SVN r28500
2015-05-13 00:24:09 +00:00
Ted Kremenek
62feb5c949 Change @availability to @available.
This came out of today's language review meeting.
The intent is to match #available with the attribute
that describes availability.

This is a divergence from Objective-C.

Swift SVN r28484
2015-05-12 20:06:13 +00:00
Dave Abrahams
5c55682d8b [stdlib] Capitalize keywords in doc comments
Again, the text is a lot more readable that way.

Swift SVN r28472
2015-05-12 16:59:13 +00:00
Dave Abrahams
106b39a497 [stdlib] Indent bullet continuations in doc comments
The text is a lot more readable that way.

Swift SVN r28471
2015-05-12 16:59:08 +00:00
Dmitri Hrybenko
61214ec55b stdlib: remove Sliceable conformance from String
Swift SVN r28442
2015-05-11 20:58:31 +00:00
Chris Lattner
c1df892d47 improve stdlib hygiene a bit.
Swift SVN r28392
2015-05-10 02:55:18 +00:00
Dmitri Hrybenko
e24c262d6e Foundation overlay: add String.stringByApplyingTransform()
This API is new in OS X 10.11 and iOS 9.0.

rdar://20645458

Swift SVN r28315
2015-05-08 08:36:44 +00:00
Ted Kremenek
9f9bb725cf Rename '_ErrorType' to 'ErrorType'.
Swift SVN r28293
2015-05-07 21:59:29 +00:00
Dmitri Hrybenko
8b392eeea9 Revert "Remove Array.count, it is redundant with protocol extensions"
This reverts commit r28247 while we discuss the change.

Swift SVN r28292
2015-05-07 21:45:30 +00:00
Ted Kremenek
7a96e55cde Revert "Foundation overlay: add String.stringByApplyingTransform()"
Speculatively reverted because of iOS bot failure.

Swift SVN r28261
2015-05-07 14:00:16 +00:00
Dmitri Hrybenko
15a558f919 Foundation overlay: add String.stringByApplyingTransform()
This API is new in OS X 10.11 and iOS 9.0.

rdar://20645458

Swift SVN r28257
2015-05-07 06:54:15 +00:00
Dmitri Hrybenko
58601fafc8 Remove Array.count, it is redundant with protocol extensions
Swift SVN r28247
2015-05-07 00:30:41 +00:00
Dmitri Hrybenko
c109ec9125 stdlib: protocol extensions: de-underscore count()
Swift SVN r28246
2015-05-07 00:30:38 +00:00
Dmitri Hrybenko
e253881b02 stdlib: protocol extensions: de-underscore indices
Swift SVN r28245
2015-05-07 00:30:35 +00:00
Dave Abrahams
04d6928390 [stdlib] Pinging the compiler doesn't usually help
Swift SVN r28225
2015-05-06 23:06:58 +00:00
Chris Lattner
37f5452d15 require -> guard.
Swift SVN r28223
2015-05-06 22:53:38 +00:00
Ted Kremenek
92e6051cce Revert "[stdlib] NSStringAPI: add stringByApplyingTransform"
Right now this is breaking our iOS bots.  Let's temporarily revert while we investigate.

Swift SVN r28201
2015-05-06 15:58:05 +00:00
Dmitri Hrybenko
0453656f31 Adapt to Foundation API modernization: NSRectEdge is now an enum
This commit adds the initializers requested in rdar://20169260.

Swift SVN r28185
2015-05-05 22:50:59 +00:00
Dave Abrahams
a3270c105c [stdlib] NSStringAPI: add stringByApplyingTransform
Swift SVN r28171
2015-05-05 17:35:43 +00:00
Ted Kremenek
bde7daa23d Revert "[stdlib] NSStringAPI: add stringByApplyingTransform"
This is breaking NSStringAPI.swift on the bots.

Swift SVN r28084
2015-05-02 07:16:48 +00:00
Dave Abrahams
af07713820 [stdlib] NSStringAPI: add stringByApplyingTransform
Swift SVN r28082
2015-05-02 05:52:28 +00:00
John McCall
ac50cbc801 Enable error-handling in import by default.
Swift SVN r28048
2015-05-01 20:35:28 +00:00
Joe Groff
3cad008353 stdlib: Comment out NSArray: CollectionType conformance.
Dmitri notes that this should be API reviewed.

Swift SVN r28002
2015-04-30 22:26:13 +00:00
Joe Groff
b66675237a stdlib: Uncomment FIXME'd NSArray: CollectionType conformance.
Swift SVN r27999
2015-04-30 21:59:44 +00:00
Chris Lattner
31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00
Dmitri Hrybenko
5ae502d1f5 Revert "NSStringAPI: Remove useless forced cast"
This reverts commit r27809.  We're still building with SDKs that
requires the cast.

Swift SVN r27815
2015-04-27 19:39:33 +00:00
Slava Pestov
0de6e67a2f NSStringAPI: Remove useless forced cast
Swift SVN r27809
2015-04-27 18:55:49 +00:00
Dmitri Hrybenko
44ef30a5af stdlib: fix grammar in an error message
Swift SVN r27734
2015-04-26 00:08:13 +00:00
Dmitri Hrybenko
bc50b2f58d stdlib: stop using CFSetCreateCopy() in set bridging
Use -[NSSet copyWithZone:] instead.

CFSetCreateCopy() is buggy in OSes that ship today: it copies the set
unconditionally, even if it is immutable, resulting in O(n) bridging.

Swift SVN r27733
2015-04-26 00:08:13 +00:00