Commit Graph

1397 Commits

Author SHA1 Message Date
Nadav Rotem
59e033f710 Make toStringReadOnly non-public.
Swift SVN r21054
2014-08-05 23:49:11 +00:00
Nadav Rotem
e67c274cbe Convert the toString overloads to GYB.
Swift SVN r21053
2014-08-05 23:48:43 +00:00
Nadav Rotem
744d1fb7b9 Remove the non-generic toString versions and create a single @readonly toString function that can be used by convertFromStringInterpolationSegment.
Swift SVN r21050
2014-08-05 22:59:13 +00:00
Nadav Rotem
ae52323dab toString() optimizations:
1. Remove incorrect @readonly semantics on two functions.
2. Overload toString for some of the popular types and add readonly semantics so that we can optimize them away.



Swift SVN r21045
2014-08-05 22:09:53 +00:00
Dmitri Hrybenko
ab8b14f2d5 StdlibUnittest: allow xfail and skip annotations on tests
rdar://17906092


Swift SVN r21040
2014-08-05 15:03:54 +00:00
Dmitri Hrybenko
b09698a6e6 stdlib: privatize lazyConcatenate() and related APIs
Swift SVN r21039
2014-08-05 14:55:09 +00:00
Dmitri Hrybenko
1335a05e15 stdlib: remove FIXMEs from stdlib doc comments and add a test to catch these in
future

rdar://17906333


Swift SVN r21037
2014-08-05 09:31:10 +00:00
Enrico Granata
a472b40551 Add Mirror conformances for StrideTo and StrideThrough. These are mostly there to embellish the labels for child elements, as the default struct Mirror is doing a good enough job on its own. Fixes rdar://17876067
Swift SVN r21023
2014-08-04 19:07:33 +00:00
Dmitri Hrybenko
a75c7a427a stdlib/NSString APIs on String: add more tests and fix a crash in
_countFormatSpecifiers() that was triggered by non-BMP characters in the format
string


Swift SVN r21014
2014-08-04 15:37:58 +00:00
Doug Gregor
015bf179fe Use preferred formatting for && in an "if" across lines. NFC
Swift SVN r21008
2014-08-04 14:42:46 +00:00
Dmitri Hrybenko
ddefab2bee stdlib: adjust the suggested default implementation to reserve the correct
amount of storage


Swift SVN r21004
2014-08-04 10:58:59 +00:00
Dave Abrahams
7eacae411a [stdlib] Make String.extend/append overloads available
These will probably be faster than the generic versions, so why not
expose them?

Swift SVN r20998
2014-08-04 06:44:34 +00:00
Dave Abrahams
e70c19f021 [stdlib] Don't allow String() + Character("x")
Symmetry with what we did for Arrays says that Strings shoudl only
concatenate to Strings using "+".  We have append() for adding single
characters.

Swift SVN r20997
2014-08-04 06:44:34 +00:00
Dave Abrahams
70b388ba77 [stdlib] Add append() to ExtensibleCollectionType
If you can be grown by an arbitrary sequence of your element type, you
can be grown by a single element.

Swift SVN r20996
2014-08-04 06:44:33 +00:00
Doug Gregor
91fb509558 Outside function input types, ban single-element tuples with a label and variadic tuples.
Addresses <rdar://problem/15456156> and <rdar://problem/17466857>, and
sets us up for more simplification in the type system.


Swift SVN r20995
2014-08-04 04:43:32 +00:00
Dave Abrahams
1ec2b36fc1 [stdlib] Implement String.reserveCapacity
Fixes <rdar://problem/16970908>

Swift SVN r20989
2014-08-03 23:55:57 +00:00
Dave Abrahams
9fc959b862 [stdlib] UnicodeScalarView : RangeReplaceableCollectionType
Fixes <rdar://problem/17860946> Full Array mutation APIs for String and UnicodeScalarView

Swift SVN r20983
2014-08-03 22:44:03 +00:00
Dave Abrahams
0c5cbd88ca [stdlib] String : RangeReplaceableCollectionType
Addresses <rdar://problem/17860946> Full Array mutation APIs for String and UnicodeScalarView

Swift SVN r20980
2014-08-03 22:02:42 +00:00
Dmitri Hrybenko
aaaedefb63 stdlib/pointer types: give all pointers to objects (COpaquePointer,
Unsafe*Pointer) equivalent APIs, and change the initializer from a bare integer
to require a 'bitPattern:' label.

rdar://17895306


Swift SVN r20979
2014-08-03 21:47:31 +00:00
Dave Abrahams
9bec796c94 [stdlib] Lazy and eager concatenate
Swift SVN r20978
2014-08-03 21:34:28 +00:00
Dmitri Hrybenko
6e401c20ca stdlib: add a mirror for the Unicode scalar String view
Swift SVN r20977
2014-08-03 20:01:34 +00:00
Dmitri Hrybenko
4c0075f5bd stdlib: fix mirrors for UTF8 and UTF16 String views so that they actually work
instead of causing a stack overflow

rdar://17897212


Swift SVN r20974
2014-08-03 19:44:17 +00:00
Dmitri Hrybenko
56473c34cd stdlib: change out-of-bounds subscripting traps on mirrors to be
_preconditionFailure()s.  Some of these checks are clearly redundant (for
example, the check of array subscript), but since we have no tests for
these traps (and reflection is not fast in general), I prefer to keep this
transformation as straightforward as possible.


Swift SVN r20971
2014-08-03 18:42:53 +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
Doug Gregor
54c4dbb666 Fix weird formatting; NFC
Swift SVN r20968
2014-08-03 05:57:48 +00:00
Doug Gregor
e32acec6e3 VarArgs: use "is" checking on metatypes to check for floating-point arguments on x86-64.
Previously, we were checking whether a particular argument could be
dynamic-casted to a Float or Double (via as?). However, now that
dynamic casting considers bridging, this would try to pass an NSNumber
in a floating-point register, and hilarity ensues. Fixes the
regression I introduced with object-to-value bridging in r20963.


Swift SVN r20967
2014-08-03 05:56:19 +00:00
Dmitri Hrybenko
6d4f8adbf5 stdlib/String: fix a race in _StringBuffer.grow()
rdar://17855614


Swift SVN r20960
2014-08-02 22:50:45 +00:00
Doug Gregor
a53f7f5dbf Formatting cleanup and comments; NFC
Swift SVN r20952
2014-08-02 16:36:18 +00:00
Dave Abrahams
a7e485d601 [stdlib] _StringCore.replaceRange precondition checks
Swift SVN r20949
2014-08-02 06:01:12 +00:00
Dave Abrahams
6edfddcc1f [stdlib] Remove obsolete _precondition check
Range now guarantees it won't be inverted.

Swift SVN r20948
2014-08-02 06:01:11 +00:00
Dave Abrahams
f270a5b6f3 [stdlib] _StringCore : RangeReplaceable
Swift SVN r20947
2014-08-02 05:44:40 +00:00
Dmitri Hrybenko
eff9c61a14 stdlib: attempt to fix Runtime.swift test on some systems; looks like a
compiler bug -- all I changed is inlined the _withUninitializedString
function into the caller

Swift SVN r20942
2014-08-02 02:16:24 +00:00
Dmitri Hrybenko
000df9699d stdlib: remove @semantics("readonly") from toString while this change is being
discussed and redesigned


Swift SVN r20939
2014-08-02 01:20:22 +00:00
Doug Gregor
c593d49b08 Rework the _ObjectiveCBridgeable to use inout parameters rather than returns.
The _forceBridgeFromObjectiveC and _conditionallyBridgeFromObjectiveC
requirements of the _ObjectiveCBridgeable protocol previously returned
Self and Self?, respectively, where 'Self' is the value type that is
bridged. This use of returns is fairly hostile to the idea of calling
the witnesses for these requirements from the C++ part of the runtime,
leading to "interesting" tricks with OpaqueExistentialContainer that
made it hard to use these witnesses within the dynamic casting
infrastructure.

Replace the returns with inout Self? parameters, which are far easier
to deal with in the C++ part of the runtime. Despite the churn because
we're changing the _ObjectiveCBridgeable protocol, this is NFC.

Swift SVN r20934
2014-08-02 01:03:41 +00:00
Dave Abrahams
921045c7f8 [stdlib] Enable commented test part
As I was reducing a test case for a typechecker bug, I ended up
commenting out important test code in the regression suite.  This
restores it (and makes it work).

Swift SVN r20925
2014-08-01 23:01:02 +00:00
Dave Abrahams
1f8ec23ebe [stdlib] Correct/test _StringCore.reserveCapacity
The old one could never have worked.

Swift SVN r20916
2014-08-01 21:35:15 +00:00
Dmitri Hrybenko
142a32a944 stdlib/Assert: allow string interpolation in assertion messages
rdar://17248446


Swift SVN r20892
2014-08-01 13:44:38 +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
5f02ce8f03 [stdlib] Use Range<UnsafePointer> in _StringBuffer.grow()
Swift SVN r20876
2014-08-01 01:47:50 +00:00
Dave Abrahams
5465993f81 [stdlib] UnsafePointer : RandomAccessIndexType
It can be useful to form Ranges of these things, and there's no reason
it shouldn't be efficient to measure them, for example.

Swift SVN r20875
2014-08-01 01:46:09 +00:00
Nadav Rotem
6cc5fa218e Mark another function as @readonly.
Swift SVN r20860
2014-07-31 23:30:42 +00:00
Nadav Rotem
08e5bff61b Mark some more conversion functions as @readonly.
On -Ounchecked we are now able to zap this expression (from Richards):
  UnicodeScalar(UInt32(2)+"0".value)

However, on -O we still check for overflow and actually need to construct the string.



Swift SVN r20856
2014-07-31 22:15:36 +00:00
Nadav Rotem
52ecfc8a27 Mark some more string builders as @readonly.
This accelerates Richards by 4X because we don't need to construct debug strings such as:

debug("TCB \(tcb!.id) state \(tcb!.state.bits)")



Swift SVN r20853
2014-07-31 21:55:29 +00:00
Jordan Rose
a627411b43 [ClangImporter] Imported NS_OPTIONS structs should not conform to BooleanType.
In general, RawOptionSetType no longer inherits from BooleanType.

Swift SVN r20846
2014-07-31 19:23:08 +00:00
Dave Abrahams
8419d20f1c [stdlib] ImplicitlyUnwrappedOptional is not Boolean
Swift SVN r20839
2014-07-31 18:40:29 +00:00
Dave Abrahams
020c5893a7 [stdlib] AutoreleasingUnsafePointer is not Boolean
Swift SVN r20838
2014-07-31 18:32:02 +00:00
Dave Abrahams
104da6740b [stdlib] Make && and || generic
...instead of using Existentials, which don't specialize well.

Swift SVN r20837
2014-07-31 18:22:56 +00:00
Dave Abrahams
ea21309150 [stdlib] _StringCore: ExtensibleCollectionType
Swift SVN r20825
2014-07-31 14:57:42 +00:00
Dave Abrahams
1614ed7386 [stdlib] Improve comments
Fill in what some default implementations would look like, if we had
that feature.  At least it will help implementors.

Swift SVN r20824
2014-07-31 14:57:41 +00:00
Dmitri Hrybenko
8150b9296b stdlib: fix leaks of Swift.String when passing them from runtime to
Swift (in mirrors and demangling)

Swift SVN r20823
2014-07-31 14:48:54 +00:00