Commit Graph

30 Commits

Author SHA1 Message Date
Max Moiseev
29b26cf3b8 [stdlib] making Set conform to SetAlgebra
Since the API is not quite the same, needed to introduce several
overloads that accept Set<> and not any S : Sequence.
Some dynamic casts were removed from methods, since Set.init already
handles situations where sequence being passed is in fact a Set.
Verified there is no significant change in performance after vs before
the change.
2016-01-22 15:00:57 -08:00
Dave Abrahams
ed8c302a93 [stdlib] Move tests that challenge a debug compiler
...into the validation suite.  This is the wrong solution but at least
the bots will continue to run all the tests and we won't regress.

Swift SVN r24934
2015-02-04 01:53:14 +00:00
Dave Abrahams
644c5650c3 [stdlib] Re-enable disabled tests and fix the bugs
...that crept in because they weren't being run

Swift SVN r24933
2015-02-04 01:53:13 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Chris Lattner
92ceaddb40 redisable some of the more egregiously slow tests.
Swift SVN r24326
2015-01-09 21:35:03 +00:00
Maxwell Swadling
efddf5f7de Fixed tests not running
"long_tests" is now obsolete

Swift SVN r24292
2015-01-09 02:09:49 +00:00
Chris Willmore
03a6190a1f <rdar://problem/19031957> Change failable casts from "as" to "as!"
Previously the "as" keyword could either represent coercion or or forced
downcasting. This change separates the two notions. "as" now only means
type conversion, while the new "as!" operator is used to perform forced
downcasting. If a program uses "as" where "as!" is called for, we emit a
diagnostic and fixit.

Internally, this change removes the UnresolvedCheckedCastExpr class, in
favor of directly instantiating CoerceExpr when parsing the "as"
operator, and ForcedCheckedCastExpr when parsing the "as!" operator.

Swift SVN r24253
2015-01-08 00:33:59 +00:00
Chris Lattner
a51df49fad Change these test to require long_tests, since they take > 40s to run, each.
Swift SVN r24073
2014-12-22 20:09:52 +00:00
David Farler
324411a44b Don't trap when creating a Set from a literal with duplicate elements
rdar://problem/19178760

Swift SVN r23791
2014-12-08 23:09:04 +00:00
Jordan Rose
933ac28760 [test] Add type annotations to Set.swift test.
Previously, these functions each took over a second to type-check on my
machine; now they're all below one second, and one unused function has
been deleted outright. (-Wunused, anyone?)

I filed rdar://problem/19181998 for one strange case, but this is mostly
just the usual "type-checker is slow and tries too many things".

Swift SVN r23790
2014-12-08 23:07:08 +00:00
David Farler
50e9ef81a5 Add unoptimized autorelease expectations for 32-bit Set downcasting tests
Swift SVN r23787
2014-12-08 22:18:04 +00:00
Dmitri Hrybenko
06ad5b8c8a Set tests: change the intersection operator test to actually use the
operator

Swift SVN r23754
2014-12-06 04:10:24 +00:00
Chris Willmore
36d0f187ec Sema, SILGen, ClangImporter: Add special support for Set<T>
Add the following functionality to the Swift compiler:

* covariant subtyping of Set
* upcasting, downcasting of Set
* automatic bridging between Set and NSSet, including
    * NSSet params/return values in ObjC are imported as Set<NSObject>
    * Set params/return values in Swift are visible to ObjC as NSSet

<rdar://problem/18853078> Implement Set<T> up and downcasting

Swift SVN r23751
2014-12-06 02:52:33 +00:00
David Farler
faa96d9b8b Add experimental Set operators
rdar://problem/19151468

Swift SVN r23749
2014-12-06 01:57:07 +00:00
David Farler
16633eac05 Rename any/removeAny to first/removeFirst
Sticking with the original design.

Also added a trap test for removeFirst() since its precondition
is that the set be non-empty, similar to Array.

Swift SVN r23712
2014-12-05 01:42:45 +00:00
David Farler
e7506e8eab Remove underscore from _Set<T>
rdar://problem/19132138

Make Set<T> visible by removing the underscore. Also, remove the pesky
${_Self} gyb variable that was for a temporary convenience in hiding Set.

Swift SVN r23699
2014-12-05 00:21:35 +00:00
David Farler
ad67a452dc Set.any should be a method
Although Set.any will always return the same element when not modifying
the set, that is an implementation detail. It should be a method.

Swift SVN r23697
2014-12-05 00:01:21 +00:00
David Farler
e1dd3bad59 Set: Rename removeFirst -> removeAny and first -> any
Rename in Set<T>:

func removeFirst() -> T
to
func removeAny() -> T?

var first: T?
to
var any: T?

- FWIW, `any` more closesly matches NSSet's `anyObject()` and constructs
  in other languages, so `first` seems to be a bit of a surprise.
- `first` implies an ordering of some kind, iterating over `Set` as a
  `SequenceType` does have a somewhat reliably "first" element, but it
  also has a linguistic tension with the fact that Set<T> is
  semantically unordered.
- `first` may be further confused if there ever is an OrderedSet<T>,
  which ought to be the first element in its semantic ordering.

Swift SVN r23696
2014-12-04 23:54:57 +00:00
David Farler
8cca355015 Fix reversed negation symbols in test comments
Swift SVN r23677
2014-12-04 02:16:20 +00:00
David Farler
85f300609b Add exclusiveOr, exclusiveOrInPlace to Set<T>
rdar://problem/19124388

Swift SVN r23674
2014-12-04 02:06:19 +00:00
David Farler
6757a7d7f6 Commit next revision of Set<T> public API
The public API is mostly solid at this point, with only a few minor
changes to naming and a couple of extra methods to bring it to parity
with Array.

Also removed the quick-and-dirty operators <, >, <=, and >= which were
used as a convenient shorthand for strict subset, strict superset,
subset, and superset respectively (< is retained for Comparable
conformance).

Swift SVN r23657
2014-12-03 22:22:24 +00:00
David Farler
f70b912bfe Remove redundant tests for Set any()
Swift SVN r23600
2014-12-01 22:39:48 +00:00
David Farler
7493240117 Add any() -> T? to Set
rdar://problem/19062929

Swift SVN r23599
2014-12-01 22:08:51 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
David Farler
e6c41fbebe Remove redundant copy of Set.contains test
Swift SVN r23405
2014-11-18 08:38:14 +00:00
David Farler
6c8c32ff9d Expect autoreleased keys at Set objc entry points
This should fix Set tests that call objectEnumerator and member.

rdar://problem/19004241

Swift SVN r23404
2014-11-18 08:37:24 +00:00
David Farler
3f67608410 Remove unused equalsUnordered in Set tests
Swift SVN r23282
2014-11-12 20:54:03 +00:00
David Farler
d0718c69fc Prefix Set<T> with underscore for API development
Swift SVN r23263
2014-11-12 07:07:01 +00:00
David Farler
c453eb4c48 Add Set type.
<rdar://problem/14661754> TLF: [data-structure] Set<T> data type + Bridging from NSSet

Swift SVN r23262
2014-11-12 07:07:00 +00:00