Commit Graph

2342 Commits

Author SHA1 Message Date
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
Dave Abrahams
155e862317 [stdlib] Range: allow range to be offset by DistanceType
Swift SVN r14690
2014-03-05 20:12:06 +00:00
Joe Groff
f6d4485a3c stdlib/runtime: Create an _ObjCBridgeable protocol and 'bridgeAny' runtime function.
For container bridging, implement a '_bridge<T>' function that converts a Swift value to AnyObject using a runtime check for its _ObjCBridgeable conformance, crashing if one doesn't exist.

Swift SVN r14645
2014-03-04 16:50:11 +00:00
Greg Parker
d63772a7e7 [test] Move arch-specific string appending test to NewStringAppending.swift.
NewString.swift may now be asan-safe too, but I didn't try it.


Swift SVN r14385
2014-02-26 07:28:15 +00:00
Greg Parker
6f0ada02e8 [stdlib] Add conversion of nil to COpaquePointer. Test some nil uses.
Swift SVN r14195
2014-02-21 01:21:46 +00:00
Dave Abrahams
1bdf9d915d [stdlib] Make unique reference checking work
Think the scenarios through more carefully, create more reliable tests.
Fixes <rdar://problem/16105759> Too many retains for COW optimization

Swift SVN r14140
2014-02-20 11:14:09 +00:00
Joe Groff
73e564428f stdlib/runtime: Stub out a mechanism for introspecting value structure.
Define a "Mirror" protocol with methods for querying the number of children a structured value has, getting the name and mirror for each of those children, and a string and "IDE representation" of the value, as needed by playgrounds and by our planned generic printing facility.

In the runtime, define a "reflect" function that can provide a Mirror for any object, either using a "Reflectable" protocol conformance if available, or falling back to a magic implementation in the runtime that grovels the type metadata. Stub out a bare minimum default implementation.

Swift SVN r14139
2014-02-20 08:26:27 +00:00
Dave Abrahams
67734b1835 [stdlib] CollectionOfOne<T>
A simple collection of one element

Swift SVN r13976
2014-02-17 04:56:11 +00:00
Dave Abrahams
ea242f2238 [stdlib] Add Bit type
Will serve as an IndexType for CollectionOfOne<T>

Open Question: should this become a full-fledged Int1 type, generated by
FixedPoint.gyb?

Swift SVN r13974
2014-02-17 04:23:51 +00:00
Joe Groff
3fded63cac stdlib: Proof-of-concept 'print' implementation for an arbitrary Array.
Mock up a naive Printable protocol, and do some dirty tricks in the runtime to implement a 'printAny' function that uses swift_conformsToProtocol to look up a conformance to Printable if the type has one, or falls back to a dumb opaque printing if it doesn't. Use this to make Array<T> Printable in some way or another for all T.

Swift SVN r13902
2014-02-14 05:15:33 +00:00
John McCall
0224e93a2b Only look through UncheckedOptional<T> on explicit accesses.
Add .Some and .None members.

Swift SVN r12951
2014-01-25 03:07:30 +00:00
Jordan Rose
02e2018197 Fix many extra trailing underscores in block shim symbols.
...which would of course prevent them from being used. Sadly, this includes
the one I just added, since I didn't actually test it against the original
project until now.

Add a regression test that all block shims have valid manglings without
any unmangled suffixes.

Swift SVN r12672
2014-01-21 23:45:06 +00:00