Commit Graph

2520 Commits

Author SHA1 Message Date
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
Dave Abrahams
fb70778e35 [stdlib] Remove Obsolete CodePoints type
CodePoints was built upon StringByteData, a UTF-8 String
representation.  Its replacement is UTF16Scalars.

Swift SVN r12111
2014-01-10 01:24:25 +00:00
Dave Abrahams
bf3ca81ee7 [stdlib] File renames associated with protocol name changes
Swift SVN r12063
2014-01-08 20:06:29 +00:00
Dave Zarzycki
6e7bb68279 15763917 stdlib/POSIX should probably be removed
Foundation vends wrappers for most of this stuff anyway. We should
duplicate or "innovate" here.

Swift SVN r12002
2014-01-07 19:10:42 +00:00
Dave Abrahams
afbbbd1287 [stdlib] Add a facility for calling "C" functions that take va_list arguments
This code has only been tested on x86_64, but is designed to work on
the other platforms supported by Apple.

Swift SVN r11561
2013-12-22 02:37:33 +00:00
Dave Abrahams
549b2f1368 [stdlib] Turn the String append speed test into a reallocation test
Swift SVN r11056
2013-12-10 00:18:26 +00:00
Dave Abrahams
00e4a84b74 [stdlib] Begin exposing the NSString API directly on String
Because we're using a "brute-force" combination of conversion to
NSString and forwarding, this code will continue to work when String
is replaced by NewString.  It may not be fast yet, but at least it
will flesh out the experience for Cocoa programmers

Swift SVN r11034
2013-12-09 18:44:58 +00:00
Dmitri Hrybenko
f08ee12841 stdlib/FloatingPoint: add APIs to handle special floating point values
See IEEEFloatingPointNumber protocol for a full list of new APIs and
documentation.


Swift SVN r10826
2013-12-05 01:36:15 +00:00
Anna Zaks
b687c3ce9c Add runtime integer truncation checking to the conversion constructors
Add new builtins(by generalizing, renaming, and extending the builtins used for compile time integer literal checking). These new builtins truncate integers and check for overflow/truncation errors at runtime. Use these for FixedPoint conversion constructors.

Fix a routine in stdlib's String implementation and a test that relied on bitwise behavior of the constructors (and triggered overflows).

TODO:
- Teach CCP about these to get static checking.
- Add special builtins for same size signed <-> unsigned conversions.

Swift SVN r10432
2013-11-13 21:54:34 +00:00
Dave Abrahams
38b9e6808f [stdlib] CharacterEncoding.swift => Unicode.swift
Also enshrine the tests in the test suite

Swift SVN r10057
2013-11-08 22:17:50 +00:00
Dave Abrahams
645ce0b664 [stdlib] Add support for bound protocols
Protocols with associated types can't currently be used as existential
types.  Combined with the inability to create type constraints on
generic functions nested in generic types based on the outer type and
the inability to create closures of generic type and the inability to
create protocol constraints that require generic functions and the
inability to create protocols with init() requirements... and this is
what we get.

Swift SVN r10034
2013-11-08 06:29:29 +00:00
Howard Hinnant
46f26de87b Inlined countLeadingZeros per Dmitri's suggestion.
Swift SVN r9970
2013-11-05 20:20:19 +00:00
Chris Lattner
50054458e7 remove SIMD vector support from the stdlib. I think we all really want this,
but we don't have time right now to make it great.  This shrinks the stdlib
by 9000 lines :-)


Swift SVN r9902
2013-11-03 16:10:57 +00:00
Dave Abrahams
f7b6fbb10a [stdlib] NewString.swift: integrate into the stdlib and testing framework
Swift SVN r9741
2013-10-28 23:03:52 +00:00
Dmitri Hrybenko
70329a2efb Add a test that I wrote a while ago, but forgot to 'svn add'
Swift SVN r9478
2013-10-18 03:54:49 +00:00
Howard Hinnant
b78fefdf0b Vector is dead. Long live Array.
Swift SVN r9432
2013-10-16 23:57:29 +00:00
Dave Abrahams
b5842cb6b4 [stdlib] Initial implementation of Character
This type can't do much but store an arbitrary very short string right now, but it works

Swift SVN r8850
2013-10-02 18:56:19 +00:00
Dave Abrahams
4bb2b89d67 [stdlib] Make && and || work on LogicValue, rather than just Bool
Swift SVN r8681
2013-09-26 00:27:54 +00:00
Dmitri Hrybenko
6a403387e8 Move some interpreter-based tests that test stdlib from test/ to test/stdlib/
Swift SVN r7705
2013-08-29 00:13:23 +00:00
John McCall
68d5fbc5e1 Don't drop .o files from tests.
Swift SVN r6800
2013-08-01 01:31:34 +00:00
John McCall
b6d49ea46d Give some dynamic behavior to TypeLowering and lay out
some groundwork for more customization.

Swift SVN r6799
2013-08-01 01:28:39 +00:00
Chris Lattner
fa49d75eb4 Add bool, int8, and float vectors of size 2 definitions and some supported operations.
Swift SVN r6768
2013-07-30 23:54:18 +00:00
Joe Groff
6e00dbf9b9 Remove the Swift version of the demangler.
This creates a regression in REPL printing for class instances, which now will print the mangled class name of the instance, since Object.className was using the Swift demangler to demangle the type name. REPL printing is getting an overhaul so I think this is OK for now.

Swift SVN r6704
2013-07-29 20:50:06 +00:00