Commit Graph

35 Commits

Author SHA1 Message Date
Erik Eckstein
a4c7d89671 fix coding style in stdlib: move non-attribute keywords in same line as function declaration
Swift SVN r22275
2014-09-25 08:43:55 +00:00
Dave Abrahams
9623c52879 [stdlib] Misc protocol comment propagation
197 undocumented non-operator public APIs remain in core

Swift SVN r22224
2014-09-23 19:35:29 +00:00
Dave Abrahams
b5680b24ae [stdlib] Document Stride protocols
Also flesh out some RandomAccessIndexType docs

Swift SVN r22103
2014-09-18 22:23:08 +00:00
Dave Abrahams
33bebac909 [stdlib] Boilerplate doc-comment wording change
Swift SVN r22042
2014-09-17 21:19:24 +00:00
Dave Abrahams
ed36ddf74b [stdlib] Doc-comment index protocols
Swift SVN r21998
2014-09-16 23:37:32 +00:00
Dave Abrahams
f3d1e5f448 [stdlib] Miscellaneous comments and cleanups
Swift SVN r21979
2014-09-16 20:00:31 +00:00
Dave Abrahams
9bec796c94 [stdlib] Lazy and eager concatenate
Swift SVN r20978
2014-08-03 21:34:28 +00:00
Dmitri Hrybenko
5746e4e9ca stdlib: rename _fatalError to _sanityCheckFailure. Name similarity between
fatalError and _fatalError has caused some damage already, as some
memory-safety checks in Mirrors are _fatalErrors.


Swift SVN r20969
2014-08-03 15:20:37 +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
b2ac0e32dd [stdlib] Concise operators for advance(i, +/-n)
Fixes <rdar://problem/17814560>.

Swift SVN r20561
2014-07-25 20:53:38 +00:00
Dave Abrahams
7d30512409 [stdlib] Improved doc comments
Swift SVN r20557
2014-07-25 20:18:15 +00:00
Mark Lacey
c69ea64c0d Add specializations of prefix/postfix increment/decrement for integer types.
A few benchmarks in PreCommitBench improve at Onone (typically by a few
percent but for StringWalk it is 10%).

Swift SVN r20468
2014-07-24 05:10:12 +00:00
Dmitri Hrybenko
37cd51b76a stdlib: don't use 'private' in stdlib
In this case, internal is as good as private.


Swift SVN r20387
2014-07-23 11:07:50 +00:00
Dave Abrahams
4e54fafb35 [stdlib] Fix symmetry of bounded advance()
It wasn't properly handling the cases where the bound was in the
opposite direction from the amount, when advancing random access
indices.

Swift SVN r20123
2014-07-18 00:11:43 +00:00
Mark Lacey
41643d0ef3 Revert "Remove @transparent from a few functions in the stdlib."
This reverts commit r19996.

I'll either fix <rdar://problem/17687851>, or work around it in a
different way.

Swift SVN r20020
2014-07-16 08:09:56 +00:00
Mark Lacey
36b035b93b Remove @transparent from a few functions in the stdlib.
Marking these generic functions as transparent results in our not
emitting diagnostics for unreachable code if these functions are the
only code in a block and inlining generic code is enabled (due to
<rdar://problem/17687851>).

I don't believe other diagnostics benefit in any way from having these
marked as @transparent, and removing @transparent actually improved
Ackerman at -O3 by 15%.

Swift SVN r19996
2014-07-16 01:22:59 +00:00
Chris Lattner
e0b0205cd7 Remove the @assignment attribute entirely. It doesn't do anything except
enforce its own little constraints.  The type checker isn't using it for
anything, and it is just clutter.

This resolves <rdar://problem/16656024> Remove @assignment from operator implementations



Swift SVN r19960
2014-07-14 22:44:25 +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
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
Dave Abrahams
bec9a26380 [stdlib] Strideable refines Comparable
We can stop handling Comparable explicitly as part of RandomAccessIndex,
because RandomAccessIndex is Strideable

Swift SVN r19794
2014-07-10 06:56:36 +00:00
Dave Abrahams
eb1a5cfac4 [stdlib] Add Strideable protocol
And make RandomAccessIndex refine it.

* had to XFAIL
  test/Prototypes/TextFormatting.swift (<rdar://problem/17619178>)

* Had to compromise on the name of Strideable's associated
  type (<rdar://problem/17619038>)

Swift SVN r19785
2014-07-10 05:39:13 +00:00
Dave Abrahams
3e3f4a6e52 Revert "infix + and - for RandomAccessIndex"
This commit was premature; we're having trouble with protocols that needs to be
resolved first.

This reverts r19778

Swift SVN r19780
2014-07-10 04:47:12 +00:00
Dave Abrahams
64c6d32a99 [stdlib] infix + and - for RandomAccessIndex
A step towards implementing generalized striding

Swift SVN r19778
2014-07-10 04:16:53 +00:00
Dave Abrahams
b56c3a84d3 [stdlib] Drop Sliceable conformance for Range<T>
Sliceable is a totally non-critical protocol and Range slicing wasn't
even being tested.  Along with r19771, fixes <rdar://problem/16363898>

Swift SVN r19775
2014-07-10 02:08:46 +00:00
Dave Abrahams
58f94698c3 [stdlib] Disallow indexing integer ranges with Int
This horrible hack prevents the user from indexing Range<I>, for all
integer types I, outside of a generic context.  This seems to be the
best we can do to prevent confusion given the current language.

Addresses <rdar://problem/16363898>

Unfortunately, I can't make this work for slicing ranges yet.

Swift SVN r19771
2014-07-10 01:20:57 +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
Jordan Rose
f0fc440785 One last cleanup for access control.
Swift SVN r19662
2014-07-08 00:59:07 +00:00
Dave Abrahams
94e04be86d [stdlib] Make RandomAccessIndex Comparable
Swift SVN r19647
2014-07-07 23:01:02 +00:00
Dmitri Hrybenko
8361bccc5a stdlib: fix some 80-cols violations
Swift SVN r19559
2014-07-04 08:09:44 +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
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
Ted Kremenek
58558fcca3 Rename 'succ' and 'pred' to 'successor' and 'predecessor' respectively.
This is motivated by <rdar://problem/17051606>.

This ends up renaming variables as well, which seems right for
consistency since we use "predicate" as variable name.

Swift SVN r19135
2014-06-24 19:27:19 +00:00
Arnold Schwaighofer
da6d9152b6 Differentiate between user assertion and preconditions and the like
assert() and fatalError()
These functions are meant to be used in user code. They are enabled in debug
mode and disabled in release or fast mode.

_precondition() and _preconditionFailure()
These functions are meant to be used in library code to check preconditions at
the api boundry. They are enabled in debug mode (with a verbose message) and
release mode (trap). In fast mode they are disabled.

_debugPrecondition() and _debugPreconditionFailure()
These functions are meant to be used in library code to check preconditions that
are not neccesarily comprehensive for safety (UnsafePointer can be null or an
invalid pointer but we can't check both). They are enabled only in debug mode.

_sanityCheck() and _fatalError()
These are meant to be used for internal consistency checks. They are only
enabled when the library is build with -DSWIFT_STDLIB_INTERNAL_CHECKS=ON.

I modified the code in the standard library to the best of my judgement.

rdar://16477198

Swift SVN r18212
2014-05-16 20:49:54 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dave Abrahams
0a7c28b9ef [stdlib] Factor out Index.swift
Indices are substantial enough that they deserve their own file

Swift SVN r13948
2014-02-16 08:33:09 +00:00