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.
...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
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
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
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
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
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
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
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
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