Commit Graph

21665 Commits

Author SHA1 Message Date
Enrico Granata
d611059b70 Refactor the UnsafePointers Mirrors to use the all-powerful Mirror Generator
Reduces some boilerplate



Swift SVN r19640
2014-07-07 22:11:32 +00:00
Enrico Granata
36f035e25e Per Dave, generators don't really need to be reflected
Swift SVN r19639
2014-07-07 21:42:07 +00:00
Enrico Granata
9a9d3649aa Refactor SpriteKit mirrors to use The Mirror Generator
These were especially painful to look at, since they were identical and could not be unified due to an IRGen bug



Swift SVN r19638
2014-07-07 21:39:12 +00:00
Enrico Granata
86ebdaffc1 The Mirrors Generator II
Feedback from Dave and Dmitri - the Mirrors.gyb file is now split in three parts:
 - Boilerplate, the value, valueType, objectIdentifier and disposition properties
 - Decl, the type declaration proper, with no opening brace
 - Conformance, the extension that provides Reflectable conformance on the original type
 
This is substantially no feature change, but it should make for easier editing, and a generally more readable experience



Swift SVN r19637
2014-07-07 21:27:20 +00:00
Doug Gregor
e9439ff7da Remove implicit conversion from _DictionaryElement.
Swift SVN r19626
2014-07-07 19:51:58 +00:00
Joe Groff
8b61c71f07 Overlay NSApplicationMain to fix its argv type.
<rdar://problem/17577380>

Swift SVN r19625
2014-07-07 19:03:48 +00:00
Doug Gregor
d8de1a9ef9 Remove two more implicit conversions used only within the standard library.
Swift SVN r19624
2014-07-07 18:57:36 +00:00
Doug Gregor
2bddbc7711 Replace OnHeap<T>'s implicit conversion with a computed property.
No user-visible change.

Swift SVN r19623
2014-07-07 18:57:35 +00:00
Doug Gregor
d62d98de18 Replace an implicit conversion with a computed property (library implementation detail).
Swift SVN r19622
2014-07-07 18:57:35 +00:00
Jordan Rose
2836c474ec [Accessibility] Public enum cases cannot have private payloads.
...because you can't match them properly in switches.

In the future, we could consider allowing private enum cases in a
resilient public enum, which essentially forces the user to consider the
default case.

Swift SVN r19620
2014-07-07 18:39:35 +00:00
Jordan Rose
2ebcd5d831 Hide the representations of DictionaryIndex and DictionaryGenerator.
Enum cases can't be less public than the enum type in 1.0, so add a trivial
layer of indirection to these types so the "enum-ness" is internal while the
type itself remains public.

Swift SVN r19619
2014-07-07 18:39:33 +00:00
Doug Gregor
0c31ff5681 Move bridging conversions into the type checker.
Previously, bridged value types and their corresponding Objective-C
classes allow inter-conversion via a number of user-defined conversion
functions in the Foundation module. Instead, make this a general
feature of the type checker so we can reason about it more
directly. Fixes <rdar://problem/16956098> and
<rdar://problem/17134986>, and eliminates 11 (half) of the
__conversion functions from the standard library and overlays.

A few notes:
  - The XCTest changes are because a String can no longer directly
  conform to CVarArg: this is a Good Thing (TM), because it should be
  ambiguous: did you mean to pass it as an NSString or a C string?
  - The Objective-C representations for the bridged collections are
  hard-coded in the type checker. This is unfortunate and can be
  remedied by adding another associated type to the
  _BridgedToObjectiveC protocol.

Swift SVN r19618
2014-07-07 18:04:18 +00:00
Dmitri Hrybenko
b20abdfcbe stdlib: fix grammar in Array comments (they used to say 'a Array')
rdar://17075487


Swift SVN r19612
2014-07-07 15:31:11 +00:00
Dmitri Hrybenko
09bbec7464 stdlib: fix a crash in String.rangeOfString when the result is NSNotFound
rdar://17550857


Swift SVN r19611
2014-07-07 15:25:10 +00:00
Dmitri Hrybenko
a9ee1f88ac stdlib: remove withUnsafePointerToObject
It is completely unused, and I am not even convinced it is safe.  It
assumes that size of ImplicitlyUnwrappedOptional<T> is equal to pointer
size (while this is true for Objective-C pointer types, there was no
precondition that enforced this).

Swift SVN r19604
2014-07-07 10:53:34 +00:00
Dmitri Hrybenko
6f5a2e5d87 stdlib: remove LifetimeManager, it is completely unused,
withUnsafePointer-like functions provide safer idioms

Swift SVN r19603
2014-07-07 10:32:19 +00:00
Dmitri Hrybenko
f61bf5d8ba stdlib: remove withObjectAtPlusZero(), now we have built-in CF bridging
support

Swift SVN r19601
2014-07-07 10:13:44 +00:00
Dmitri Hrybenko
1911aaed9f stdlib: hide isUniquelyReferenced
Swift SVN r19598
2014-07-07 10:01:48 +00:00
Dmitri Hrybenko
62c772ad6a stdlib: hide Objective-C bridging implementation details
Swift SVN r19595
2014-07-07 09:46:07 +00:00
Dmitri Hrybenko
00fe3bcda3 stdlib: hide swift_keepAlive
Swift SVN r19594
2014-07-07 09:46:02 +00:00
Dmitri Hrybenko
735bf5e785 stdlib: hide swift_bufferAllocate
Swift SVN r19593
2014-07-07 09:45:59 +00:00
Dmitri Hrybenko
8a3c73e08a stdlib: hide countLeadingZeros
Swift SVN r19592
2014-07-07 09:45:56 +00:00
Jordan Rose
56ec3c901c [Accessibility] Properly treat typealiases as distinct types.
getAnyNominal() looks through sugar, so it was matching typealiases to
nominal types before the specific check for typealiases.

Swift SVN r19586
2014-07-06 22:07:28 +00:00
Dmitri Hrybenko
1b589e15ca stdlib: Remove a redundant _precondition from _asUTF16CodeUnit
Swift SVN r19583
2014-07-06 12:58:45 +00:00
Dmitri Hrybenko
e95a9e9b72 stdlib: rename private API _asUnicodeCodePoint to _asUnicodeScalar
Swift SVN r19582
2014-07-06 12:50:07 +00:00
Chris Lattner
190d4901ae improve the doc comment on toInt to be more specific about what it does.
Swift SVN r19577
2014-07-04 21:18:47 +00:00
Chris Lattner
0ad1c248c8 fix <rdar://problem/17493994> String.toInt() returns 0 (not nil) for some non-numeric characters
Swift SVN r19575
2014-07-04 21:02:49 +00:00
Dmitri Hrybenko
81f1e660a0 stdlib: hide encodeBitsAsWords
rdar://17315534


Swift SVN r19569
2014-07-04 17:04:48 +00:00
Dmitri Hrybenko
594dfe5e2d stdlib: hide swift_MagicMirrorData_summaryImpl
rdar://17315534


Swift SVN r19568
2014-07-04 16:08:29 +00:00
Dmitri Hrybenko
7f351643d9 stdlib: hide roundUpToAlignment
rdar://17315534


Swift SVN r19566
2014-07-04 15:57:47 +00:00
Dmitri Hrybenko
29ab26ca39 stdlib/UnicodeScalar: hide UnicodeScalar.isPrint(), it is not
Unicode-aware

rdar://17550187

Swift SVN r19564
2014-07-04 13:13:42 +00:00
Dmitri Hrybenko
6e5060d471 stdlib/UnicodeScalar: remove arithmetic operations, they interact in
non-obvious ways with double-quoted literal sytax; "1" - "1" used to compile

rdar://17225816


Swift SVN r19563
2014-07-04 13:11:52 +00:00
Dmitri Hrybenko
cf2c5386a9 stdlib: change ReverseRange.isEmpty() into a property
Swift SVN r19562
2014-07-04 12:46:21 +00:00
Dmitri Hrybenko
ac7fee3a64 stdlib: add Dictionary.isEmpty property
Swift SVN r19561
2014-07-04 11:27:48 +00:00
Dmitri Hrybenko
3422201d21 stdlib/String: move lowercaseString and uppercaseString properties to
Foundation, and have them forward to Foundation.

This is slower than it could be, but at least this way we produce correct
results.

Another part of rdar://17550187


Swift SVN r19560
2014-07-04 09:27:32 +00:00
Dmitri Hrybenko
8361bccc5a stdlib: fix some 80-cols violations
Swift SVN r19559
2014-07-04 08:09:44 +00:00
Chris Lattner
7a56499d61 Start making @objc not start with an @ sign:
- Change the parser to accept "objc" without an @ sign as a contextual
   keyword, including the dance to handle the general parenthesized case.
 - Update all comments to refer to "objc" instead of "@objc".
 - Update all diagnostics accordingly.
 - Update all tests that fail due to the diagnostics change.
 - Switch the stdlib to use the new syntax.

This does not switch all tests to use the new syntax, nor does it warn about
the old syntax yet.  That will be forthcoming.  Also, this needs a bit of 
refactoring, which will be coming up.



Swift SVN r19555
2014-07-04 05:57:57 +00:00
Anna Zaks
c1537fdcdd Reject explicit uses of CFRetain/CFRelease/CFAutorelease
Ban use of CFRetain, CFRelease, CFAutorelease used for manual memory management as well as a bunch of other similar APIs, such as CGColorRelease.
Addresses radar://16892185

Swift SVN r19552
2014-07-04 02:29:05 +00:00
Jordan Rose
bdd1ec3116 Update stdlib and tests for accessibility, again.
I'll be turning on access control early next week.

Swift SVN r19551
2014-07-04 01:53:53 +00:00
Jordan Rose
cdd8532f33 Remove @private from the stdlib.
@private can't safely be used with inlineable code at this time, which
unfortunately covers the entire standard library.

Swift SVN r19550
2014-07-04 01:53:52 +00:00
Enrico Granata
314dbc6ed1 Forgot to add the most important part of the patch to the previous commit.
Swift SVN r19544
2014-07-03 23:44:21 +00:00
Enrico Granata
b0548f13cd Start using the Mirror Generator
This commit removes Mirrors for RangeGenerators, since Dave and I discussed that these won't be necessary in practice
Also, it removes the Mirrors for Range types from Range.swift.gyb, and instead adds a new RangeMirrors.swift.gyb used to generate range types Mirrors



Swift SVN r19543
2014-07-03 23:43:14 +00:00
Anna Zaks
6aadb1a647 APIs in XCTest now uses UInt, not Int.
Fixup for r19536.

Swift SVN r19538
2014-07-03 22:33:07 +00:00
Enrico Granata
d6586cb7a7 The Mirrors Generator
This is a .gyb file based upon Dave's trick of allowing boilerplate templates (r19490)
As per comments, this will generate all the common cruft of getting a Mirror up and running - yes including the Reflectable conformance on the type!

It could likely be extended to specify a full Mirror, either by defaulting missing parts, or by letting you specify them as arguments to the template
However, since we can have other templates that use this as a foundation, those expansions might be best served being their own templates based upon this

Also, the members this doesn't generate for you are usually the ones you care about when writing a Mirror, so probably passing them as arguments to this template generator would only make things look uglier/less obvious when skimming through the code



Swift SVN r19534
2014-07-03 21:46:13 +00:00
Dave Abrahams
8db106ea17 [stdlib] Optimize Array member sort
Have it use withUnsafeMutableStorage just like the overloaded free
algorithm does.

Swift SVN r19533
2014-07-03 21:45:50 +00:00
Dave Abrahams
1f68ff48cc [stdlib] Detect/fix potential memory-safety issue
When a user violates the inout rules by "re-entering" an array that is
currently undergoing mutation, it must not admit a memory-safety
violation.  To ensure that it doesn't, temporarily make the buffer being
operated on inaccessible through the original array.

Swift SVN r19532
2014-07-03 21:44:49 +00:00
Dmitri Hrybenko
0c205b3e5e stdlib/OutputStream: fix println() comments
Swift SVN r19525
2014-07-03 19:57:51 +00:00
Doug Gregor
0598b6db5e Casting runtime: Use the runtime's constant for reserved bits in an ObjC pointer.
Previously, we had a predicate that only worked properly for 64-bit
architectures; the 32-bit platforms don't have tagged pointers, and
have an annoying tendency to allocate objects with the high bit of the
address set. Fixes <rdar://problem/17544277>.

Swift SVN r19523
2014-07-03 17:55:38 +00:00
Jordan Rose
8080ca6820 [Accessibility] Public functions/initializers may not use private types.
Also, don't diagnose accessibility violations on implicit decls. Every now
and then the compiler needs to bend the rules, such as when providing an ==
implementation for a local enum.

Swift SVN r19519
2014-07-03 17:45:36 +00:00
Dave Abrahams
6dde77adca [stdlib] Delete Range.swift
This was a part of r19497 that I failed to commit.

Swift SVN r19517
2014-07-03 17:15:21 +00:00