Commit Graph

3245 Commits

Author SHA1 Message Date
Dmitri Hrybenko
395b56c287 Remove a swap file that I accidentally committed
Swift SVN r21941
2014-09-15 13:53:48 +00:00
Dmitri Hrybenko
50d497c05f stdlib/Array: fix an issue in fast enumeration
Array did not initialize fast enumeration state if it was empty.
Surprisingly, this did not break code that is generated by Clang
currently.  (But as far as I understand fast enumeration, it may abort
the program because mutation pointer is null.)

Swift SVN r21940
2014-09-15 13:49:56 +00:00
Dmitri Hrybenko
ceff82f2ba stdlib/Array: add tests for Array -> NSArray bridging
Swift SVN r21939
2014-09-15 13:49:50 +00:00
Dmitri Hrybenko
d7acb06c64 stdlib/Dictionary: use 'delayed bridging' to keep pointers, returned
from a bridged NSDictionary, stable

We used to return a fresh pointer value every time an NSDictionary
element is requested, but, unfortunately, our SDK has bugs.

Fixes rdar://18191358 for Dictionary.

Swift SVN r21905
2014-09-12 13:20:30 +00:00
Dmitri Hrybenko
2487238955 Dictionary test: generalize equalsUnordered() utility
Swift SVN r21904
2014-09-12 09:24:36 +00:00
Joe Groff
491e47cb83 Rename RawRepresentable.raw -> rawValue.
Per API review with Ali. While we're here, give the initializer a corresponding 'rawValue' argument label, and change the associated type name to RawValue to match.

Swift SVN r21888
2014-09-11 20:13:47 +00:00
Dave Abrahams
1e9e7734f0 Revert "[stdlib] any/all algorithms, keyword for contains"
This reverts r21810 and r21811 due to lack of design consensus

Swift SVN r21880
2014-09-11 17:42:32 +00:00
Doug Gregor
c3ca1475e1 Solver: don't try a default literal type binding when we have contextual type information.
When computing the set of potential bindings for a type variable with
a literal constraint, we suggest the default literal type as a
fallback. Suppress this suggestion in the cases where another
constraint provides a type that already has some kind of contextual
type information (that does conform to the protocol), making the
default literal type more of a fallback. When type-checking the given
declaration:

  var dict: NSDictionary = [
    "status": 200,
    "people": [ [ "id": 255,
                  "name": [ "first": "John", "last": "Appleseed" ] ] ] ]

it reduces the number of solution states explored by 2/3, the number
of attempted type variable bindings by 3/4, and the number of
disjunctions explored by 1/3. This optimization is useful in general,
and lets type annotations guide the type checker to a much greater
extent. It also helps with rdar://problem/18269449.

Swift SVN r21878
2014-09-11 17:11:59 +00:00
Dmitri Hrybenko
2ecb228b72 stdlib/Dictionary test: use AtomicInt to count key/value instances
Swift SVN r21872
2014-09-11 14:00:36 +00:00
Jordan Rose
48bcad35be Address review comments for r21845 and r21846, including updates to ABI.rst.
Thanks, Dmitri and Joe.

Swift SVN r21849
2014-09-10 20:35:30 +00:00
Dave Abrahams
ad3601a4a8 [stdlib] Test for sorted()'s return type
Swift SVN r21847
2014-09-10 19:10:52 +00:00
Dave Abrahams
904e0c4203 [stdlib] Fix sorted()
Remove the overload for MutableCollectionType and make it return a
regular Array, as the comment said.  Together with r21829 this fixes
<rdar://problem/18286522>

Swift SVN r21844
2014-09-10 19:05:12 +00:00
Dmitri Hrybenko
756d129ec6 Rename StdlibUnittest.{getPtr -> getPointer}
Swift SVN r21839
2014-09-10 14:41:20 +00:00
Dmitri Hrybenko
b68d147ca1 stdlib/Unmanaged: trap when attempting to create an Unmanaged from a
null pointer

Swift SVN r21838
2014-09-10 14:15:06 +00:00
Anna Zaks
122ea9dc92 Add overlay cover for dispatch_data_empty
Swift SVN r21821
2014-09-10 00:50:43 +00:00
Dmitri Hrybenko
1e76fc54ad stdlib/CommonMethods test: test return type of .all(), too
Swift SVN r21811
2014-09-09 21:20:05 +00:00
Dave Abrahams
c467825bc2 [stdlib] any/all algorithms, keyword for contains
Expose any, all on Array and all the Lazy sequence adapters.  Make the
'contains' algorithm that takes a predecate unavailable in favor of
'any', which does the same thing.

Fixes <rdar://problem/18190149> [algorithm] `contains` syntax is ambiguous

Swift SVN r21810
2014-09-09 20:39:39 +00:00
Dmitri Hrybenko
42403f9ab8 stdlib/Dictionary test: factor our testing utilities into a separate
file

Swift SVN r21806
2014-09-09 07:04:35 +00:00
Dmitri Hrybenko
c774d7aee9 stdlib/String: make this test more strict
Swift SVN r21805
2014-09-09 06:55:27 +00:00
Dave Abrahams
bf159d5e50 [stdlib] Test for r21801
Swift SVN r21802
2014-09-09 04:37:34 +00:00
Dmitri Hrybenko
28f707c47e stdlib/String: disable a test for a known bug
This bug reproduces most of the time, but now always (if the new buffer
is allocated at the same address, the bug is hidden).

Swift SVN r21763
2014-09-06 18:45:52 +00:00
Joe Groff
419ba5cbea Change RawRepresentable to use failable initializers and property requirements.
Redefine the RawRepresentable protocol to use an 'init?' method instead of 'fromRaw(Raw)', and a 'raw' get-only property instead of 'toRaw()'. Update the compiler to support deriving conformances for enums and option sets with the new protocol. rdar://problem/18216832

Swift SVN r21762
2014-09-06 18:40:14 +00:00
Anna Zaks
412d59009c CGVector initializers should have named parameters.
This ensures they are consistent with other types like CGPoint.

Swift SVN r21758
2014-09-06 00:46:19 +00:00
Greg Parker
dfa498e1d5 [test] UIImage(contentsOfFile:) is now failable.
Swift SVN r21735
2014-09-05 00:48:07 +00:00
Greg Parker
b46d8e7539 [test] NSString(UTF8String:) is now failable.
Swift SVN r21733
2014-09-05 00:29:52 +00:00
Dmitri Hrybenko
d9a6a95ff9 stdlib/NSString APIs: update test names
Swift SVN r21714
2014-09-04 18:06:41 +00:00
Doug Gregor
eaefb5e2b0 String's NSString API: Replace factory methods with failable initializers.
Addresses rdar://problem/18225788.


Swift SVN r21710
2014-09-04 17:21:33 +00:00
Doug Gregor
692ff2f52a Enable imports of failable initializers by default.
Swift SVN r21699
2014-09-04 06:32:12 +00:00
Dmitri Hrybenko
f06c1b54ef Disable a check for a String reallocation bug; it does not reproduce reliably
Swift SVN r21590
2014-08-29 20:15:37 +00:00
Argyrios Kyrtzidis
628567bfe5 [Frontend] Make it erroneous if no frontend action is specified when invoking the frontend, and update tests.
Swift SVN r21584
2014-08-29 19:17:37 +00:00
Dmitri Hrybenko
14899abdf5 stdlib/FixedPoint: define the same set of 'truncatingBitPattern'
initializers on all platforms

rdar://18167806

Swift SVN r21570
2014-08-29 10:32:33 +00:00
Dmitri Hrybenko
6f10c09545 Tests: use optimizer-friendly string concatenation
Swift SVN r21528
2014-08-28 12:44:26 +00:00
Dmitri Hrybenko
ea0676147c stdlib/String: add more tests for COW behavior in String (I verified that they
fail when fix for rdar://problem/18114265 is reverted, so I removed the
original test that depends on regular expressions and Foundation)

This uncovered more issues: <rdar://problem/18160335> String.replaceRange and
String.removeRange reallocate unique storage


Swift SVN r21525
2014-08-28 10:43:07 +00:00
Dave Abrahams
082c396cfe [stdlib] String.replaceRange: fix value semantics
Fixes <rdar://problem/18114265> Swift Compiler Optimizations for Strings causing incorrect behaviour

Swift SVN r21487
2014-08-27 19:24:55 +00:00
Dmitri Hrybenko
61ef07732f stdlib/FixedPoint: add IntXX(truncatingBitPattern:) initializers
rdar://18101336


Swift SVN r21481
2014-08-27 10:04:33 +00:00
Dmitri Hrybenko
564f2981f4 stdlib: add a test for reflecting Unmanaged; this used to crash
rdar://17635977


Swift SVN r21459
2014-08-26 16:15:25 +00:00
Anna Zaks
62e0634c2c API Notes: fixup to r21443. This fixes iOS device test.
Swift SVN r21448
2014-08-25 23:56:46 +00:00
Dmitri Hrybenko
44bf1a81a6 stdlib/Printing: print floating point numbers with appropriate precesion for
the type

Printing Float32 with %0.15g not only wastes screen space, but also causes
confusion for users, and pretends that a Float32 has more precision than it
actually does.

rdar://18043123


Swift SVN r21435
2014-08-25 13:56:38 +00:00
Dmitri Hrybenko
28e90888de Fix FloatingPointIR test for arm: there is no Float80 on arm
Swift SVN r21434
2014-08-25 13:33:05 +00:00
Dmitri Hrybenko
ea48185358 stdlib: don't silently truncate Float80 literals
We used to first truncate them to Float64, and then construct a Float80.

Swift SVN r21433
2014-08-25 13:21:54 +00:00
Dave Abrahams
6c07fb4ad1 [stdlib] Revert UnsafePointer casting change
The syntax being reverted added busywork and noise to the common case
where you want to say "I have the right address, but the wrong type,"
without adding any real safety.

Also it eliminated the ability to write UnsafePointer<T>(otherPointer),
without adding ".self" to T.  Overall, it was not a win.

This reverts commits r21324 and r21342

Swift SVN r21424
2014-08-22 21:53:12 +00:00
Dmitri Hrybenko
f7eb94bb96 Change the test to actually test the API it advertises to test
Swift SVN r21416
2014-08-22 18:13:44 +00:00
Jordan Rose
70e815b554 [test] Update tests for r21391
Swift SVN r21414
2014-08-22 16:18:57 +00:00
Greg Parker
e9095b695e [test] Update expected autoreleased objects on i386 in stdlib/Dictionary.swift.
i386 (32-bit iOS simulator) doesn't implement the return-autorelease 
optimization, so it has more actually autoreleased objects.


Swift SVN r21406
2014-08-22 07:14:47 +00:00
Nadav Rotem
cec0e61277 Remove the tests for compare() that was removed in r21398
Swift SVN r21400
2014-08-22 03:45:46 +00:00
Jordan Rose
1c0d8c9c13 [test] Add an interpreter mode to the tests.
This takes all %target-run-simple-swift and %target-run-stdlib-swift
invocations and runs them using the interpreter instead. To enable this
mode, pass --param=interpret to lit.py; you can add this flag to the
LLVM_LIT_ARGS CMake setting (which defaults to "-sv").

This doesn't support separated %target-build / %target-run steps, nor
does it work with StdlibUnittest (which uses posix_spawn to run its
subtasks). But it's a start.

<rdar://problem/17938202>

Swift SVN r21391
2014-08-21 23:50:15 +00:00
Dmitri Hrybenko
18bbf0dfef stdlib/Dictionary: implement fast enumartion for NSEnumerator of
bridged Swift.Dictionary; this allows us to autorelease less.

rdar://17944094


Swift SVN r21372
2014-08-21 20:28:28 +00:00
Dmitri Hrybenko
9404f1c055 Dictionary: in fast enumeration, don't autorelease objects that Dictionary has
a strong reference to.

rdar://17944094


Swift SVN r21368
2014-08-21 18:05:06 +00:00
Doug Gregor
fe8213eec3 Cope with leading acronyms when turning factory methods into initializers.
This allows us to properly import, e.g., +[NSURL URLWithString] as the
initializer init(string:). Fixes <rdar://problem/16906469>.

Swift SVN r21366
2014-08-21 17:41:25 +00:00
Dmitri Hrybenko
c5ec180cd8 Dictionary: remove some autorelease traffic by avoiding immutable creating
immutable NSArrays (which autorelease objects internally), and by building the
code in ARC mode (so that autorelease optimization kicks in).

rdar://17944094


Swift SVN r21365
2014-08-21 17:25:57 +00:00