Commit Graph

49 Commits

Author SHA1 Message Date
Graham Batty
dc6a776d10 stdlib: Use config directives to work without objective-c.
Swift SVN r23211
2014-11-10 20:06:25 +00:00
Graham Batty
373414864d Revert "Use config directives to carve out a 'portable' kernel stdlib."
This reverts commit r23202 pending further discussion.

Swift SVN r23205
2014-11-10 18:46:42 +00:00
Graham Batty
dfa260fab1 Use config directives to carve out a 'portable' kernel stdlib.
Swift SVN r23202
2014-11-10 18:03:09 +00:00
Dave Abrahams
d1b6dfa48f [stdlib] pick off more public non-protocol docs
137 undocumented public non-operator APIs remain in core

Swift SVN r22253
2014-09-24 03:58:14 +00:00
Dave Abrahams
42cef97f6b [stdlib] Misc protocol comment propagation
171 undocumented non-operator public APIs remain in core

Swift SVN r22246
2014-09-24 00:27:58 +00:00
Dave Abrahams
02ebcad780 [stdlib] document remaining Policy.swift protocols
Swift SVN r22088
2014-09-18 18:44:42 +00:00
Dave Abrahams
cacec2666f [stdlib] doc-comment BitwiseOperationsType
Swift SVN r22056
2014-09-18 00:55:49 +00:00
Dave Abrahams
52dd5d1771 [stdlib] doc-comment more public protocols
covers part of Policy.swift

Swift SVN r22051
2014-09-18 00:08:52 +00:00
Dmitri Hrybenko
ea48185358 stdlib: don't silently truncate Float80 literals
We used to first truncate them to Float64, and then construct a Float80.

Swift SVN r21433
2014-08-25 13:21:54 +00:00
Doug Gregor
15b1790245 Fix generic definitions of &= and ^= for bitwise types <rdar://problem/18018525>.
Swift SVN r21202
2014-08-14 17:27:42 +00:00
Dmitri Hrybenko
938e7c2676 stdlib: introduce UnicodeScalarLiteralConvertible protocol
This allows UnicodeScalars to be constructed from an integer, rather
then from a string.  Not only this avoids an unnecessary memory
allocation (!) when creating a UnicodeScalar, this also allows the
compiler to statically check that the string contains a single scalar
value (in the same way the compiler checks that Character contains only
a single extended grapheme cluster).

rdar://17966622

Swift SVN r21198
2014-08-14 16:04:39 +00:00
Dmitri Hrybenko
a79339ee8f stdlib/Assert: adopt new names for trapping functions:
assert() / assertionFailure() -- debug mode
precondition() / preconditionFailure() -- debug and release modes
fatalError() -- always traps


Swift SVN r20890
2014-08-01 10:22:23 +00:00
Dave Abrahams
214e2f03de [stdlib] Drop @availability for renamed protocols
...now that seed 5 has branched.

Fixes <rdar://problem/17672088> #Seed 6: Remove @availability for protocols

Swift SVN r20632
2014-07-28 18:14:27 +00:00
Dave Abrahams
4ece9b1734 [stdlib] Default bitwise assignment operators
|=, &=, and ^= now come along for free with a BitwiseOperationsType
conformance, so we can remove the special-cased operators for
RawOptionSetType.

Also, release notes.

Swift SVN r20630
2014-07-28 16:39:23 +00:00
Dmitri Hrybenko
ca07053adc stdlib: rename fatalError() to debugTrap()
Part of rdar://17792445


Swift SVN r20619
2014-07-28 11:14:52 +00:00
Joe Groff
61f64f3323 stdlib: Add a '??' nil-coalescing operator.
Similar to nil-coalescing operators in other languages, this operator takes an optional on the left and a non-optional expression on the right, and if the optional is nil, evaluates the right side, otherwise returning the value from the optional itself. <rdar://problem/15247356>

Swift SVN r20593
2014-07-26 19:48:50 +00:00
Dave Abrahams
b81c4b2dca Revert "[stdlib] Concise operators for advance(i, +/-n)"
This reverts r20561 until we've had a chance to discuss it in a design meeting

Swift SVN r20579
2014-07-25 23:52:38 +00:00
Dave Abrahams
71d8e16fbf [stdlib] bitwise assignments for NS_OPTIONS
Fixes <rdar://problem/17797711>

This is rather a kluge because of two other problems.  Having these
fixed would allow a cleaner solution:

<rdar://problem/17815538> synthesize an allZeros static var for
BitwiseOperationsType conformance of imported NS_OPTIONS

<rdar://problem/17815767> Adding three overloads to stdlib slows
Fibonacci by 18-19%

Swift SVN r20563
2014-07-25 22:05:08 +00:00
Dave Abrahams
b2ac0e32dd [stdlib] Concise operators for advance(i, +/-n)
Fixes <rdar://problem/17814560>.

Swift SVN r20561
2014-07-25 20:53:38 +00:00
Dmitri Hrybenko
9b1cf666c2 stdlib: add semantic requirements to the doc comments of Equatable and
Comparable


Swift SVN r20555
2014-07-25 18:43:46 +00:00
Dmitri Hrybenko
c52e9270b8 stdlib: fix grammar in doc comments
Swift SVN r20552
2014-07-25 18:28:01 +00:00
Dmitri Hrybenko
2470d2f439 stdlib: add doc comments for Equatable and Comparable
Swift SVN r20551
2014-07-25 18:21:51 +00:00
Chris Lattner
6d0934d33d Introduce a new 'renamed' modifier on unavailable attributes. This allows Xcode
to emit fixit's when we rename something, e.g.:

t.swift:6:9: error: 'float' has been renamed to Float
var y : float
        ^~~~~
        Float

Adopt this in the stdlib.



Swift SVN r20549
2014-07-25 18:00:37 +00:00
Dmitri Hrybenko
fbcbd2e118 stdlib/Hashable: add a doc comment about hashValue/equality comparison
consistency requirement

Swift SVN r20538
2014-07-25 10:31:44 +00:00
Dmitri Hrybenko
61e5cbb805 stdlib: coding style: don't hide 'public' at the end of line with attributes
Swift SVN r20394
2014-07-23 13:44:42 +00:00
Dmitri Hrybenko
2b5d0166c5 stdlib: underscore-prefix MaxBuiltinIntegerType and MaxBuiltinFloatType
Swift SVN r20388
2014-07-23 11:40:45 +00:00
Dave Abrahams
df33434197 Revert "[stdlib] Remove protocol availability annotations"
I think I did this too early; it's supposed to be after Beta5.
This reverts r20348

Swift SVN r20350
2014-07-22 23:44:00 +00:00
Dave Abrahams
d6eaa1b156 [stdlib] Remove protocol availability annotations
These were for the transition from Beta 3 to Beta 4.  Now that we've
shipped Beta 4, they're obsolete.  Fixes <rdar://problem/17672088>

Swift SVN r20348
2014-07-22 23:42:28 +00:00
Joe Groff
54fb27b9a2 Mark assignment operators in the stdlib as 'assignment'.
Swift SVN r20296
2014-07-22 05:16:04 +00:00
Dave Abrahams
b5f682b4d3 [stdlib] @availability for renamed protocols
Swift SVN r19964
2014-07-14 23:09:09 +00:00
Chris Lattner
57cd2506ff Change "operator infix" to "infix operator" for consistency with the rest of the declaration
modifiers and with the func implementations of the operators.  This resolves the rest of:
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword




Swift SVN r19931
2014-07-14 16:39:10 +00:00
Chris Lattner
8991456ff2 Switch infix/postfix/prefix to be declaration modifiers instead of attributes,
eliminating the @'s from them when used on func's.  This is progress towards
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword

This also consolidates rejection of custom operator definitions into one
place and makes it consistent, and adds postfix "?" to the list of rejected
operators.

This also changes the demangler to demangle weak/inout/postfix and related things
without the @.



Swift SVN r19929
2014-07-14 15:51:49 +00:00
Chris Lattner
d3ee7520fe remove the old .. operator.
Swift SVN r19926
2014-07-14 14:29:47 +00:00
Doug Gregor
a5c079af59 Replace the class_protocol attribute with a "class" requirement.
This only tackles the protocol case (<rdar://problem/17510790>); it
does not yet generalize to an arbitrary "class" requirement on either
existentials or generics.

Swift SVN r19896
2014-07-13 06:57:48 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Doug Gregor
2f3f6acf21 Make "true" and "false" Boolean literal constants for the BooleanLiteralConvertible protocol.
Introduce the new BooleanLiteralConvertible protocol for Boolean
literals. Take "true" and "false" as real keywords (which is most of the
reason for the testsuite churn). Make Bool BooleanLiteralConvertible
and the default Boolean literal type, and ObjCBool
BooleanLiteralConvertible. Fixes <rdar://problem/17405310> and the
recent regression that made ObjCBool not work with true/false.


Swift SVN r19728
2014-07-09 16:57:35 +00:00
Chris Lattner
02999cac51 Reinstate the @ on the @objc attribute. This is largely a revert of r19555 with a few tweaks.
Swift SVN r19706
2014-07-08 21:50:34 +00:00
Jordan Rose
da29f099f0 Update stdlib for accessibility modifiers becoming context-sensitive keywords.
Swift SVN r19672
2014-07-08 02:17:46 +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
Dmitri Hrybenko
4814e00fda stdlib/String: implement Unicode extended grapheme cluster segmentation
algorithm

The implementation uses a specialized trie that has not been tuned to the table
data.  I tried guessing parameter values that should work well, but did not do
any performance measurements.

There is no efficient way to initialize arrays with static data in Swift.  The
required tables are being generated as C++ code in the runtime library.

rdar://16013860


Swift SVN r19340
2014-06-30 14:38:53 +00:00
Chris Lattner
68be2902c2 remove some operator definitions that aren't implemented anywhere. We should add these
back when/if they are added to the stdlib.


Swift SVN r19326
2014-06-29 00:46:32 +00:00
Jordan Rose
cca27d02a0 Tag everything in the standard library with accessibility attributes.
Keep calm: remember that the standard library has many more public exports
than the average target, and that this contains ALL of them at once.
I also deliberately tried to tag nearly every top-level decl, even if that
was just to explicitly mark things @internal, to make sure I didn't miss
something.

This does export more than we might want to, mostly for protocol conformance
reasons, along with our simple-but-limiting typealias rule. I tried to also
mark things private where possible, but it's really going to be up to the
standard library owners to get this right. This is also only validated
against top-level access control; I haven't fully tested against member-level
access control yet, and none of our semantic restrictions are in place.

Along the way I also noticed bits of stdlib cruft; to keep this patch
understandable, I didn't change any of them.

Swift SVN r19145
2014-06-24 21:32:18 +00:00
Michael Gottesman
8de060ff3f Revert "[stdlib] mask unused bits in uniqueness checks"
Revert "[stdlib] Use an enum for ArrayBuffer storage"

This reverts commit r18996.
This reverts commit r18954.

The optimizer is not ready yet to handle this change especially given
the time until Beta 3. After speaking with DaveA, we agreed to revert
this and take such large changes onto private branches until we are sure
that the optimizer is ready to handle them rather than risking
performance regressions due to hitting the "optimization cliff".

Swift SVN r19026
2014-06-20 01:41:04 +00:00
Chris Lattner
62cad3dce8 add a "..<" operator, which is an alias for ".." and switch the stdlib to use it.
Until I have a chance to update the testsuite, we'll accept both.



Swift SVN r18998
2014-06-19 05:42:29 +00:00
Dave Abrahams
a4c232bab8 [stdlib] Use an enum for ArrayBuffer storage
instead of reinterpretCasting all over the place.  This should make it
easier on the ARC optimizer.

Addresses <rdar://problem/17312221>

Swift SVN r18954
2014-06-17 11:22:34 +00:00
Dmitri Hrybenko
b118f463d3 stdlib/BitwiseOperations: fix the comment
Swift SVN r18491
2014-05-21 11:58:43 +00:00
Dmitri Hrybenko
3ca4c987f8 stdlib/Fixed point: switch allZeros to be a static property
Swift SVN r18490
2014-05-21 11:31:21 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
29cebdf797 Splitting the standard library: step 1: move stdlib -> stdlib/core
Swift SVN r5864
2013-06-28 02:31:01 +00:00