Commit Graph

65 Commits

Author SHA1 Message Date
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
748efed913 [Accessibility] Protocol witnesses must be as accessible as the protocol.
...unless the type has less accessibility than the protocol, in which case
they must be as accessible as the type.

This restriction applies even with access control checking disabled, but
shouldn't affect any decls not already marked with access control modifiers.

Swift SVN r19382
2014-06-30 23:38:35 +00:00
Dave Abrahams
8e7d45f2c0 [stdlib] Normalize .gyb files
- Follow LLVM conventions for emacs mode specification

- Use local variables suffix to make the output read-only (at least on
  Emacs)

- But drop the admonitions not to edit the generated files;
  line-directive mostly takes care of that problem now.

Swift SVN r19381
2014-06-30 23:24:17 +00:00
Jordan Rose
5e59d30c6f Update stdlib for memberwise access control.
As before, there may be more things marked @public than we actually want
public. Judicious use of the frontend option -disable-access-control may
help reduce the public surface area of the stdlib.

Swift SVN r19353
2014-06-30 18:50:50 +00:00
Jordan Rose
8c1fcfa055 Make some more stdlib things public.
Swift SVN r19351
2014-06-30 18:50:46 +00:00
Dmitri Hrybenko
612e1a8700 stdlib/unittest/checkSliceable: check the empty slice endIndex..<endIndex
Swift SVN r19231
2014-06-26 14:02:41 +00:00
Dmitri Hrybenko
4671211ce3 stdlib/String: fix two bugs in UnicodeScalarView
If underlying NSString contained isolated surrogates, then we were crashing in
following ways:

- subscripting by index could crash;

- index pointing to the second code unit sequence was not moved backwards
  correctly.  Instead of moving it to pointing to the beginning of the view it
  could be moved to point to the code unit before the beginning of the view.



Swift SVN r19230
2014-06-26 13:47:00 +00:00
Doug Gregor
37df5c430c Update standard library to use [T] array syntax.
Swift SVN r19190
2014-06-25 23:39:20 +00:00
Dmitri Hrybenko
6b2c727850 stdlib/String: change UTF-16/UTF-16 transcoder in UTF16View to replace
ill-formed code unit sequences with U+FFFD

rdar://17451259


Swift SVN r19187
2014-06-25 22:28:33 +00:00
Dmitri Hrybenko
9bd0b1e8d3 stdlib: fix some bugs in UTF-16/UTF-8 transcoder that is hidden inside String
implementation:

- don't crash on NSStrings that contain isolated surrogates (partial fix, there
  is a different code path that dispatches CoreFoundation and it still
  crashes);

- insert U+FFFD according to Unicode recommendation;

- fix decoding of surrogate pairs when the internal buffer is almost full
  (we used to drop characters in that case, rdar://16833733 + dups).


Swift SVN r19147
2014-06-24 21:59:19 +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
Dmitri Hrybenko
aa7d6d690d Work around SIL optimizer bug to allow stdlib to be built with
optimizations

Swift SVN r19050
2014-06-20 20:03:47 +00:00
Dmitri Hrybenko
f370ca0746 stdlib: fix a bunch of various Unicode issues, primarily in UTF-8 decoding
In UTF-8 decoder:
- implement U+FFFD insertion according to the recommendation given in the
  Unicode spec.  This required changing the decoder to become stateful, which
  significantly increased complexity due to the need to maintain an internal
  buffer.
- reject invalid code unit sequences properly instead of crashing rdar://16767868
- reject overlong sequences rdar://16767911

In stdlib:
- change APIs that assume that UTF decoding can never fail to account for
  possibility of errors
- fix a bug in UnicodeScalarView that could cause a crash during backward
  iteration if U+8000 is present in the string
- allow noncharacters in UnicodeScalar.  They are explicitly allowed in the
  definition of "Unicode scalar" in the specification.  Disallowing noncharacters
  in UnicodeScalar prevents actually using these scalar values as internal
  special values during string processing, which is exactly the reason why they
  are reserved in the first place.
- fix a crash in String.fromCString() that could happen if it was passed a null
  pointer

In Lexer:
- allow noncharacters in string literals.  These Unicode scalar values are not
  allowed to be exchanged externally, but it is totally reasonable to have them
  in literals as long as they don't escape the program.  For example, using
  U+FFFF as a delimiter and then calling str.split("\uffff") is completely
  reasonable.

This is a lot of changes in a single commit; the primary reason why they are
lumped together is the need to change stdlib APIs to account for the
possibility of UTF decoding failure, and this has long-reaching effects
throughout stdlib where these APIs are used.


Swift SVN r19045
2014-06-20 13:07:40 +00:00
Dmitri Hrybenko
4fd936efab Add a comment blurb at the top of StdlibUnittest.swift.gyb
Swift SVN r18961
2014-06-17 21:13:34 +00:00
Dmitri Hrybenko
4904685f8f Extract some unit testing helpers from NSStringAPI into a module
Swift SVN r18956
2014-06-17 16:25:37 +00:00