Commit Graph

2 Commits

Author SHA1 Message Date
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dave Abrahams
7a91b9f749 [stdlib] Remove *, /, and % from RandomAccessIndex
Before this commit, RandomAccessIndex was a refinement of
NumericOperations, which forced it to support inappropriate operations
such as multiplication.  Many obvious random-access index types can't
support multiplication (e.g. a StridedIndex adapter, which moves its
underlying index by N positions for each increment).

Along the way:

* the addition and subtraction operations on RandomAccessIndex were
  renamed to advancedBy and distanceTo, which prevents nasty ambiguities
  when a type conforms to both RandomAccessIndex and Integer, and allows
  Index DistanceTypes to actually be signed integers even when the Index
  is unsigned.

* Before this commit, using internal interfaces, it was possible to
  request static checking without also getting dynamic checks when
  static checking is impossible.  Now the relationship between static
  and dynamic checking is built into the core protocols.

* NumericOperations.swift was moved into IntegerArithmetic.swift.gyb,
  correcting missing operators by generating them programmatically and
  in preparation for renaming the protocol to something more appropriate

Fixes

  <rdar://problem/16246927> RandomAccessIndex is over-constrained

and possibly:

  <rdar://problem/15605729> Make all operators generic over
  protocols (in particular, get NumericOperations done)

Swift SVN r14854
2014-03-09 19:56:18 +00:00