Commit Graph

3053 Commits

Author SHA1 Message Date
Dave Abrahams
8cce55bdb4 [stdlib] WIP on Array Bridge/Cast Testing
Swift SVN r18113
2014-05-15 18:01:31 +00:00
Dave Abrahams
fed492b650 [stdlib] Don't assert on empty NSArrays
Empty NSArrays are usually represented by emptyNSSwiftArray, whose
element type is irrelevant.  So when doing a getObjects:range: on that,
presumably the range's length is zero and we shouldn't do any sanity
checking w.r.t. the element type.

Fixes <rdar://problem/16914909> Assertion failed attempting to append
arrays when subclassing Cocoa class

Swift SVN r18110
2014-05-15 17:25:48 +00:00
Dmitri Hrybenko
2a956966ac stdlib/runtime: teach DynamicCastToExistential1 to handle source values that
are existentials

rdar://16925792


Swift SVN r18107
2014-05-15 16:32:13 +00:00
Dmitri Hrybenko
011584a0b6 stdlib/pritning: untie string interpolation from string initializers
String interpolation invokes convertFromStringInterpolationSegment() function
now.  There is no need to add extensions to String to allow custom types to
participate in string interpolation.  Just implementing Printable will do the
right thing.


Swift SVN r18104
2014-05-15 09:56:02 +00:00
Ted Kremenek
7da31bdfdd Disable parsing of single quoted character literals, enabling under a flag.
I didn't want to rip this logic out wholesale.  There is a possibility
the character lexing can be reborn/revisited later, and
disabling it in the parser was easy.

Swift SVN r18102
2014-05-15 07:05:59 +00:00
Dmitri Hrybenko
f183e493bf stdlib/bridging: bridgeFromObjectiveC() can fail to bridge the Objective-C
object to the desired type.  Model this with an optional return type.


Swift SVN r18077
2014-05-14 19:49:22 +00:00
Dave Abrahams
a8bbc4c89b [stdlib] String internal API review changes
I had to XFAIL test/ClangModules/cf.swift, which is failing for reasons
I can't understand.  <rdar://problem/16911496>

Swift SVN r18071
2014-05-14 14:18:52 +00:00
Dmitri Hrybenko
eb9c3a406d stdlib/runtime: implement bridgeFromObjectiveC()
Swift SVN r18070
2014-05-14 13:40:46 +00:00
Ted Kremenek
9eea282719 Switch range operators ".." and "...".
- 1..3 now means 1,2
- 1...3 now means 1,2,3

Implements <rdar://problem/16839891>

Swift SVN r18066
2014-05-14 07:36:00 +00:00
Enrico Granata
8478cd9905 Add a mirror for NSSet
Part of the playgrounds effort



Swift SVN r18038
2014-05-13 23:20:32 +00:00
Doug Gregor
d5a9c2ab94 Only supersede initializers with other imported initializers when the types match.
This fixes a case where the Swift-variadic and C-varargs versions of
various initializers were superseding each other
<rdar://problem/16801456>.

It also uncovered some more cases where we weren't getting quite the
right semantics for factory-methods-as-initializers, which are also
fixed here.

Swift SVN r18010
2014-05-13 16:49:39 +00:00
Dmitri Hrybenko
de9a0c8ff0 stdlib/printing: remove ReplPrintable protocol
It is replaced by debugPrint() family of functions, that are called by REPL.

There is a regression in printing types that don't conform to Printable, this
is tracked by rdar://16898708


Swift SVN r18006
2014-05-13 16:22:56 +00:00
Dmitri Hrybenko
ed68ba833f stdlib/printing: add Streamable conformance to CString, and DebugPrintable
conformances to String and CString


Swift SVN r18003
2014-05-13 13:54:43 +00:00
Dmitri Hrybenko
2cc8fe40d4 stdlib/printing: replace four printing systems with one new one
The old ones were:

- print/println
- printAny
- printf
- Console

The new printing story is just print/println.  Every object can be printed.
You can customize the way it is printed by adopting Printable protocol.  Full
details in comments inside stdlib/core/OutputStream.swift.

Printing is not completely finished yet.  We still have ReplPrintable, which
should be removed, string interpolation still uses String constructors, and
printing objects that don't conform to Printable will result in printing
mangled names.


Swift SVN r18001
2014-05-13 13:07:59 +00:00
Doug Gregor
cdf98aa8ea The bang is also unnecessary
Swift SVN r17995
2014-05-13 04:21:29 +00:00
Chris Lattner
09ec8091d5 hopefully fix a test on the buildbot.
Swift SVN r17993
2014-05-13 03:46:45 +00:00
Doug Gregor
73528dc0e0 Enable importing factory methods as initializers by default.
Finishes <rdar://problem/16509024>.

Swift SVN r17972
2014-05-12 23:01:20 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
43fa9161ba Don't accept single quoted character literal anymore
rdar://16363872


Swift SVN r17785
2014-05-09 16:57:21 +00:00
Dmitri Hrybenko
51591fa155 stdlib/Dictionary: add implicit conversions:
* `NSDictionary` converts to `Dictionary<NSObject, AnyObject>`,
* `Dictionary<K, V>` converts to `NSDictionary`.


Swift SVN r17774
2014-05-09 11:52:05 +00:00
Dmitri Hrybenko
392f6a80d2 stdlib/Dictionary: add fast enumeration tests in Objective-C
rdar://16841394


Swift SVN r17771
2014-05-09 11:03:36 +00:00
Dave Abrahams
5c3ebfcfb6 [stdlib] test file rename missed in r17722
Swift SVN r17734
2014-05-08 23:33:49 +00:00
Dmitri Hrybenko
72606a5228 stdlib/Runtime: allow swift_bridgeToObjectiveC to bridge objc
existentials

Should fix rdar://16837253

Swift SVN r17720
2014-05-08 22:58:10 +00:00
Greg Parker
f1d020e11a <rdar://16848707> Add Dispatch overlay with covers for some libdispatch macros.
Swift SVN r17693
2014-05-08 09:47:00 +00:00
Greg Parker
d619d82388 [test] Add new file for crash testing.
Swift SVN r17305
2014-05-03 02:37:26 +00:00
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +00:00
Greg Parker
b337d35e43 [test] Add KVO test. XFAIL it pending the ObjC runtime additions.
Swift SVN r17030
2014-04-29 07:46:38 +00:00
Greg Parker
183c3a3b10 Revert r16776 (Distributed Objects unavailability).
This created multiple definitions of the unavailable classes, which broke stuff.


Swift SVN r16997
2014-04-28 22:27:55 +00:00
Dave Zarzycki
e604952ca9 Stdlib: Overflow all float to int conversions
<rdar://problem/16630580> Investigate: floating point "overflow" semantics?

Swift SVN r16805
2014-04-25 05:58:20 +00:00
Dave Zarzycki
ce2c44f495 Stdlib: test for r16764
Swift SVN r16804
2014-04-25 05:37:56 +00:00
Greg Parker
f8ad26fabe <rdar://16689104> Mark classes for Distributed Objects as unavailable.
Swift SVN r16776
2014-04-24 23:16:21 +00:00
Joe Groff
c3eda1adc4 Revert "Relax reinterpretCast assert to allow a cast to a smaller type."
This reverts commit r16725 per DaveA's request.

Swift SVN r16775
2014-04-24 23:14:33 +00:00
Joe Groff
71ce6b2313 Relax reinterpretCast assert to allow a cast to a smaller type.
It's de facto reliable that inhabited optionals are prefixed with their payload.

Swift SVN r16725
2014-04-23 23:40:22 +00:00
Greg Parker
9c0c8ac4bb [overlay] Add covers for UIKit orientation macros.
Swift SVN r16490
2014-04-18 02:45:11 +00:00
Joe Groff
822aa300e8 Remove BlockShims.mm.
Swift SVN r16485
2014-04-18 01:07:12 +00:00
Dave Abrahams
3de27d2179 [stdlib] Array: add bridgeCache/fix refCounting
Array's getObjects:range: needs to fill the supplied buffer without
incrementing the reference count.  For that reason, and to fulfill
lifetime expectations for Array elements that are computed
dynamically (e.g. from value types that are BridgedToObjectiveC), we
maintain a cache of converted objects associated with each Array.

Swift SVN r16105
2014-04-09 07:59:43 +00:00
Dave Abrahams
e115ce852a Delete mistakenly-committed test
Swift SVN r16101
2014-04-09 05:14:40 +00:00
Dave Abrahams
8be637213d Fix the matrix shootout test
new T[n] doesn't actually work.

Swift SVN r16095
2014-04-09 03:17:03 +00:00
Greg Parker
188611deb2 [test] Add test for CGPoint/CGSize/CGVector/CGRect overlays.
Swift SVN r16078
2014-04-08 22:47:04 +00:00
Dave Abrahams
6882603b68 [stdlib] Work around <rdar://problem/16530674>...
by gyb'ing up some non-generic functions.  Also test both the singly-
and multiply-referenced code paths for array replacement.

Swift SVN r15974
2014-04-05 02:58:28 +00:00
Dave Abrahams
cb59d340f8 [stdlib] Get NewArray test building and passing
Swift SVN r15946
2014-04-04 17:10:12 +00:00
Greg Parker
6d6d6896d2 Add SpriteKit overlay with a typealias for SKColor.
Swift SVN r15849
2014-04-02 23:46:56 +00:00
Dave Zarzycki
30e6d1de98 Runtime: remove dead _ObjCSuperClassHack
Swift SVN r15832
2014-04-02 21:30:31 +00:00
Greg Parker
ad3a65642b [stdlib] Implement NSObject's == and hashValue() using -isEqual: and -hash.
Swift SVN r15826
2014-04-02 20:35:24 +00:00
Dave Abrahams
cd0bf9ad27 [stdlib] Add and test the new Array core
Swift SVN r15616
2014-03-29 10:43:44 +00:00
Joe Groff
57b6afc745 stdlib: Implement implicit conversions to C*Pointer types.
Make CConstPointer<T> convertible from UnsafePointer<T>, inout T, and Array<T>, and nil; and make CMutablePointer<T> convertible from UnsafePointer<T>, inout T, inout Array<T>, and nil.

Swift SVN r15600
2014-03-29 02:50:33 +00:00
Dave Abrahams
ffa31a1e67 [stdlib] Actually test Index, revealing a bug
Swift SVN r15389
2014-03-23 08:45:45 +00:00
Greg Parker
f1ca6c0964 [test] Fix stdlib/Reflection.swift on iOS.
Swift SVN r15198
2014-03-18 19:42:44 +00:00
Greg Parker
bd9a451657 [test] Add a timeout because the Reflection test runs for hours under ASan.
Swift SVN r15159
2014-03-17 21:39:28 +00:00
Dave Zarzycki
082f8400b6 Stdlib: Ensure that the "hack" class is linkable
Swift SVN r15022
2014-03-14 00:52:37 +00:00