Commit Graph

21492 Commits

Author SHA1 Message Date
Dmitri Hrybenko
ff8f68f3c6 StdlibUnittest: use builder syntax for 'xfail' and 'skip' annotations
Swift SVN r21106
2014-08-08 13:41:07 +00:00
Dmitri Hrybenko
4fa064696d NSString APIs test: attempt to fix the test on iOS by removing a dependency on
a file in the source tree


Swift SVN r21105
2014-08-08 11:58:56 +00:00
Jordan Rose
3d45b04657 [stdlib] Make StaticString and AssertString Printable.
Swift SVN r21094
2014-08-07 17:35:08 +00:00
Dmitri Hrybenko
6f20c51e3e stdlib: fix crashes in CGPoint, CGSize, CGRect mirrors
rdar://17933906


Swift SVN r21091
2014-08-07 15:59:24 +00:00
Dmitri Hrybenko
f2436065db StdlibUnittest: run tests out of process
The test harness now can recover after test crashes, allowing:

- check for crashes themselves (without reporting them to the Python lit driver,
  which is about 10x slower -- even if CrashTracer is disabled);

- recover from unexpected test crashes and run the rest of the tests;

- this lays the groundwork for assertions that end the test execution, but
  allow the rest of the tests to run (rdar://17906801).

Note that we don't spawn a fresh process for every test.  We create a child
process and reuse it until it crashes.


Swift SVN r21090
2014-08-07 15:14:57 +00:00
Nadav Rotem
4cf6181785 Replace @semantics("readonly") with @effects(readonly).
Swift SVN r21088
2014-08-07 07:22:18 +00:00
Jordan Rose
73cce9702e [CMake] Remove the CMakeLists file from apinotes/.
Also, move the ObjectiveC overlay into its own directory, so that we can
use the directory name as an indicator of what overlays exist.

This is in preparation for DevPubs providing the contents of the apinotes/
directory. The downside here is that adding new apinotes files doesn't
automatically trigger a rebuild; I intend to mitigate that somewhat by at
least triggering one when the revision number of the DevPubs repo changes.

Swift SVN r21078
2014-08-06 23:07:24 +00:00
John McCall
77ea35ab46 Introduce a flag to mark classes with Swift-native
refcounting and take advantage of it.

Also, set the Swift1 flag in classes we generate.

Also, initialize a global cache of the non-pointer-isa
mask and use that instead of object_getClass, at least
within the runtime.

Also, centralize the runtime on a _swift_getSuperclass
function and make that use a direct access while we
await word from Greg on the desired ABI requirements.

Swift SVN r21077
2014-08-06 21:51:45 +00:00
Joe Groff
8e093f1bcb Runtime: Fix logic inversion in objc_rootWeakRetained (which is really UnownedRetain).
We want to initialize the side weak reference the first time we retain a new unowned reference, not reinitialize the weak reference every time we retain it. Unowned @objc references are still racy, but this fixes the obvious brokenness behind <rdar://problem/17623813>.

Swift SVN r21074
2014-08-06 21:19:17 +00:00
Dmitri Hrybenko
f538edd90a Add Foundation dependency to fix the build in some configurations
Swift SVN r21069
2014-08-06 18:07:06 +00:00
Dmitri Hrybenko
3277397330 Correct the string interpolation optimization (r21066): UnicodeScalar is
Streamable

Swift SVN r21067
2014-08-06 16:41:26 +00:00
Dmitri Hrybenko
e921cc1c11 stdlib: dispatch directly to the property getter in _toStringReadOnly
+10% on Richards, +6% on StringInterpolation

Swift SVN r21066
2014-08-06 10:05:14 +00:00
Dmitri Hrybenko
20f74214ca stdlib: refactor StringInterpolation.swift.gyb to use SwiftIntTypes instead of
duplicating it


Swift SVN r21065
2014-08-06 09:17:00 +00:00
Dmitri Hrybenko
06ac06667a stdlib: underscore-prefix toStringReadOnly, fix 80-columns violations
Swift SVN r21064
2014-08-06 09:02:52 +00:00
Nadav Rotem
d96e940c36 Mark the concatination of two strings as @readonly.
Swift SVN r21061
2014-08-06 05:19:51 +00:00
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
bc144c313e NSString test: disable the problematic test on iOS simulator and iOS 7.*
Swift SVN r21043
2014-08-05 21:24:51 +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
8c41e1892b stdlib/NSString APIs on String: change stringByRemovingPercentEncoding property
type to be an optional string; add tests


Swift SVN r21021
2014-08-04 18:02:14 +00:00
Dmitri Hrybenko
67de904c15 stdlib/NSString APIs on String: change stringByAppendingPathExtension() to
return an optional String.  This behavior is not documeted, though.


Swift SVN r21016
2014-08-04 16:41:37 +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
edc664c36f stdlib/NSString APIs on String: change return type of
stringByAddingPercentEncodingWithAllowedCharacters() and
stringByAddingPercentEscapesUsingEncoding() to String?, and add API notes for
NSString to the same effect


Swift SVN r21007
2014-08-04 14:13: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
Chris Hanson
91069e1647 Get XCTAssertEqual working with [T] and [T:U]
XCTest's equality assertions need overrides in order to work with Array<T> and
Dictionary<T,U>.

Addresses <rdar://problem/17257148>.

Swift SVN r20993
2014-08-04 02:10:03 +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
Doug Gregor
c25eac69c2 Dynamic casting: fix an overrelease in object-to-value casting via bridging.
When the dynamic cast caller asked to take on success but not destroy
on failure, we still performed the release on failure. Test case to
follow.


Swift SVN r20975
2014-08-03 19:51:27 +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
Joe Groff
dc926bc649 Runtime: Intercept -_tryRetain on the magic base classes of bridged containers.
Strings that get used to name SpriteKit nodes on Mavericks end up weakly referenced by NSMapTables using the legacy GC-compatible weak pointer personality, which for our bridged objects ended up falling into the default NSObject implementation of reference counting via the "_tryRetain" SPI, causing heap corruption. I tried really hard to isolate a test case and failed, but this fixes the Adventure crasher in <rdar://problem/17887502>.

Swift SVN r20966
2014-08-03 05:33:09 +00:00
Doug Gregor
c66a1ef98f Dynamic casting: handle value-to-class-existential casts via bridging.
This allows one to cast a value type (say, [String]) to AnyObject or
NSCoding, for example. It's another piece of <rdar://problem/17637959>.


Swift SVN r20964
2014-08-03 05:15:47 +00:00
Doug Gregor
4c06dff759 Dynamic casting: Handle object-to-value casts that use bridging.
For example, this allows dynamic casts from NSArray to [Int], using
bridging. Part of <rdar://problem/17637959>.


Swift SVN r20963
2014-08-03 04:11:45 +00:00