Commit Graph

26 Commits

Author SHA1 Message Date
Dmitri Gribenko
9bcd5a1056 Collection.length => .count 2016-01-22 18:41:19 -08:00
Dmitri Gribenko
73ce9ae7e9 Collection.count => .length
And other API changes that naturally fall out from this, like
Array(repeating:count:) => Array(repeating:length:).
2015-12-17 15:55:29 -08:00
Dmitri Gribenko
df17ddbc9b init(count: Int, repeatedValue: Element) => init(repeating:count:)
Affected types: _ArrayType, Array, ArraySlice, ContiguousArray, Repeat,
String (initializers from Character and UnicodeScalar)
2015-12-09 17:14:37 -08:00
Arnold Schwaighofer
859fbc0162 More executable_test for the test directory
Swift SVN r29280
2015-06-03 23:28:51 +00:00
Joe Pamer
9bf1f91893 Prevent the type checker from going exponential on straightforward bindings of named patterns to nested array literals. I have a more principled fix for these kinds of issues in the works, but this will unblock a lot of users until those changes land. (rdar://problem/19810828)
Swift SVN r28544
2015-05-14 00:15:57 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Chris Willmore
c7c7388cf2 Change do-while to repeat-while.
Change all uses of "do { ... } while <cond>" to use "repeat" instead.
Rename DoWhileStmt to RepeatWhileStmt. Add diagnostic suggesting change
of 'do' to 'repeat' if a condition is found afterwards.

<rdar://problem/20336424> rename do/while loops to repeat/while & introduce "repeat <count> {}" loops

Swift SVN r27650
2015-04-23 22:48:31 +00:00
Chris Lattner
a730912d77 revert the non-debug-printing pieces of r20661.
Swift SVN r20680
2014-07-29 18:05:32 +00:00
Chris Lattner
7676259ecc Fix http://swiftwtf.tumblr.com/post/91934970718/xcode-6-beta-3 to compile into the
behaviorly correct code by CSE'sing subscripts that are identical.

Also, add a dump() method to PathComponent to help visualize / debug LValue structures.



Swift SVN r20661
2014-07-29 00:27:43 +00:00
Joe Groff
88f2632a44 Allow trailing closures with a line break before '{'.
Swift SVN r19322
2014-06-28 05:12:48 +00:00
Doug Gregor
f0159f40a1 Ban the "new" syntax for creating an array <rdar://problem/16951969>.
We haven't been advertising this syntax much, and it's closure form
was completely broken anyway, so don't jump through hoops to provide
great Fix-Its here. 


Swift SVN r19277
2014-06-26 23:51:47 +00:00
Doug Gregor
e064416c8f Update the rest of the testsuite for the array syntax change.
Swift SVN r19223
2014-06-26 05:39:25 +00:00
Doug Gregor
9210cd5ff4 Replace T[] array syntax with [T] in the test suite
Swift SVN r19192
2014-06-25 23:39:24 +00:00
Chris Lattner
70076cf958 switch the testsuite to use the ..< operator instead of ..
Swift SVN r19003
2014-06-19 17:18:23 +00:00
Joe Pamer
1c53181667 Again, fix two problems with implicit conversions:
- rdar://problem/16776273, wherein conversions between nil and .None were permitted
due to an implicit conversion between nil and COpaquePointer.
- rdar://problem/16877526, where we needed to add new equality overloads to handle
conversions between nil and .None given the supression of user conversions.

(Some minor tweaks this time around for better interoperability with AnyObject.)

Swift SVN r18498
2014-05-21 18:56:35 +00:00
Joe Pamer
1d34a88477 Revert "Fix two problems with implicit conversions: - rdar://problem/16776273, wherein conversions between nil and .None were permitted due to an implicit conversion between nil and COpaquePointer. - rdar://problem/16877526, where we needed to add new equality overloads to handle conversions between nil and .None given the supression of user conversions. (Thanks to Ted for the overloads and test.)"
This reverts commit r18473.

Swift SVN r18477
2014-05-21 00:28:46 +00:00
Joe Pamer
f469d8f1f6 Fix two problems with implicit conversions:
- rdar://problem/16776273, wherein conversions between nil and .None were permitted
due to an implicit conversion between nil and COpaquePointer.
- rdar://problem/16877526, where we needed to add new equality overloads to handle
conversions between nil and .None given the supression of user conversions.
(Thanks to Ted for the overloads and test.)

Swift SVN r18473
2014-05-20 23:53:34 +00:00
Joe Pamer
a22b391e2a Greatly improve performance for type checking large, type-annotated, array literal expressions by directly applying contextual type information to its constituent element expressions. (rdar://problem/16736884)
There's a lot more that can be done with this, but for now this change will make the OpenGLES template usable.

Swift SVN r18353
2014-05-18 21:27:41 +00:00
Joe Groff
0540da70e2 Replace an 'as T' hack with a 'reinterpretCast' hack.
The runtime implementation of 'as T' freaks out in cases involving protocols. This is an expedient workaround that fixes <rdar://problem/16950035>.

Swift SVN r18263
2014-05-17 19:23:52 +00:00
Ted Kremenek
172cc3c984 Fix my last commit to accommodate for rename of NativeArray.
Swift SVN r18151
2014-05-16 00:45:48 +00:00
Ted Kremenek
5e966fdd52 Add basic '==' for Array, NativeArray, and Slice.
I suspect this can be made much better.  It only
works for comparing Array<T> and Array<T>,
NativeArray<T> and NativeArray<T>, etc., not
NativeArray<T> and Array<T>.  I also suspect
the implementation can be made better.  The goal
was to make this functional, as this basic
functionality was missing.

Implements <rdar://problem/16768095>.

Swift SVN r18150
2014-05-16 00:32:00 +00:00
Joe Groff
f1fa77e140 IRGen: Fix heap array destructor for types where size != stride.
Use TypeInfo::indexArray to get the bounds of the array instead of duplicating its logic incorrectly. Fixes <rdar://problem/16916422>.

Swift SVN r18115
2014-05-15 18:15:04 +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
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
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Doug Gregor
86cf79a746 Add a range subscript operation for SliceInt64 that produces a slice, e.g.,
a[5..9]

will return a 4-element slice of the array a. Addresses
<rdar://problem/11329415>.


Swift SVN r1665
2012-04-27 00:07:52 +00:00