Commit Graph

169 Commits

Author SHA1 Message Date
swift-ci
a61b981cd9 Merge pull request #9610 from moiseev/no-init 2017-05-15 12:04:22 -07:00
Ben Cohen
ea2f64cad2 [stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement (#8990)
* Give Sequence a top-level Element, constrain Iterator to match

* Remove many instances of Iterator.

* Fixed various hard-coded tests

* XFAIL a few tests that need further investigation

* Change assoc type for arrayLiteralConvertible

* Mop up remaining "better expressed as a where clause" warnings

* Fix UnicodeDecoders prototype test

* Fix UIntBuffer

* Fix hard-coded Element identifier in CSDiag

* Fix up more tests

* Account for flatMap changes
2017-05-14 06:33:25 -07:00
Max Moiseev
0a466e3ca0 Revert "[stdlib] Implementing copy constructors for integer types"
This reverts commit 3f0d1e61aa.

The copy constructors don't really solve any problems, but produce extra
work for the overload resolution.
2017-05-13 12:27:43 -07:00
Nate Cook
7fa74f590d [stdlib] Documentation revisions for string + ranges
* removing .characters from examples
* beginning new String doc revisions
* improvements to the String Foundation overlay docs
* minor revisions elsewhere
2017-05-13 10:06:05 -05:00
Nate Cook
7ec9e95b49 [stdlib] Documentation revisions for numeric types
* abstracts for integer types
* fixed discussions for floating-point operators
2017-05-13 10:06:00 -05:00
Max Moiseev
3f0d1e61aa [stdlib] Implementing copy constructors for integer types 2017-05-12 17:37:04 -07:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
Maxim Moiseev
e868ca7035 [stdlib] Better BinaryInteger.signum and tests 2017-05-11 14:02:59 -07:00
Max Moiseev
a797b29c1c [stdlib] A more efficient implementation of signum for integer types 2017-05-11 14:02:59 -07:00
Max Moiseev
47875fc4e0 [stdlib] Removing a few harmful overloads of <
At some point during the implementation of integer protocols these
overloads were necessary to make expressions like `i32 < 0` be faster
and unambiguous.
Now they are no longer necessary, and also cause problems for
expressions like `(u64 - u64) < u64`, where they cause the deprecated
`func - (Strideable, Strideable) -> Stride` be used, which is wrong, as
it will trap in many cases, where `func - (UInt64, UInt64) -> UInt64`
would not.

Fixes: <rdar://problem/31909031>
2017-05-05 10:51:32 -07:00
Doug Gregor
966c9b5754 [Stdlib] Remove a return statement after a fatalError().
Eliminates a warning about unreachable code because, you know, it's
unreachable code. Fixes rdar://problem/31766069.
2017-04-26 23:30:53 -07:00
Ben Cohen
7b0eb29db5 Undo Sequence constraint on BinaryInteger.Words (#9047) 2017-04-26 17:22:34 -07:00
Max Moiseev
d6dedd2523 [stdlib] Constraining BinaryInteger.Words to Sequence at least 2017-04-25 14:35:51 -07:00
Maxim Moiseev
13abb9a0a7 [stdlib] BinaryInteger func word(at:) => var words: Words (#8984)
* [stdlib] Underscoring BinaryInteger.word(at:)

* [stdlib] Implementing var words in terms of _word(at:)
2017-04-25 08:45:01 -07:00
Arnold Schwaighofer
915c066dac [stdlib/resilience] Mark FixedWidthInteger.bitwidth as inlinable
Fixes test/IRGen/enum_derived.swift test case in resilient mode.

rdar://31757974
2017-04-24 13:47:57 -07:00
Doug Gregor
225a26d25d [Stdlib] Don't redeclare the Magnitude associated type unnecessarily.
Just use a where clause on the protocol to add requirements.
2017-04-24 08:11:22 -07:00
Dave Abrahams
d3ad565b33 [stdlib] Clean up warnings 2017-04-20 14:08:57 -07:00
Maxim Moiseev
10da98abb9 Merge pull request #8851 from moiseev/integer-fixes
[stdlib] A few Swift 3 compatibility fixes
2017-04-20 10:45:02 -07:00
Maxim Moiseev
e25da82b15 Merge pull request #8863 from moiseev/resilience
[stdlib] _fixed_layout for ArithmeticOverflow
2017-04-20 10:30:25 -07:00
Max Moiseev
e611911cc3 [stdlib] _fixed_layout for ArithmeticOverflow
Fixes: <rdar://problem/31702435>
2017-04-19 11:59:04 -07:00
Max Moiseev
fe6d9255c1 [stdlib] _sizeInBits and _sizeInBytes for Swift 3 source compatibility 2017-04-19 11:24:58 -07:00
Max Moiseev
b41dd17edd [stdlib] Swift 3 XXXWithOverflow methods for integers 2017-04-19 11:24:58 -07:00
Max Moiseev
830b2edf54 [stdlib] Check overflow in integer init from literal
Fixes: <rdar://problem/29911715>
And partially: <rdar://problem/29937936>
2017-04-19 11:06:26 -07:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
Max Moiseev
b7f715f7e5 Fixing the iOS test failures 2017-04-17 14:05:34 -07:00
Max Moiseev
71b2c1fb41 Adding Swift 3 alias for _SignedInteger 2017-04-17 11:01:59 -07:00
Max Moiseev
54e5f5d741 Handling the differences in << and >> for Swift 3 vs Swift 4
In Swift 3 shifts used to be defined on the concrete integer types, so
the right-hand-side value in the shift expression could define a type
for the result, as in `1 << i32` would have the type Int32. Swift 4
makes shift operators heterogeneous, so now `1 << i32` will result in an
Int, according to the type of the left-hand-side value, which gets a
default type for integer literals.
2017-04-13 15:34:32 -07:00
Max Moiseev
3d7ddc53c9 More typealiases for Swift 3 protocols 2017-04-11 17:05:22 -07:00
Max Moiseev
def49e8fa4 Adding SignedInteger.&+ and &- for source compatibility 2017-04-11 17:05:21 -07:00
Max Moiseev
d30a2f95e6 Adding non-masking shifts on concrete types 2017-04-10 15:18:21 -07:00
Max Moiseev
cb82daa282 Speculatively replacing a couple more transparent's with inline-always'es 2017-04-10 13:43:02 -07:00
Max Moiseev
dfc8c65dca Adding overloads for << and >> with the literal on the left-hand side 2017-04-07 13:56:40 -07:00
Max Moiseev
ed90d8c908 Adding a few Swift 3 compatibilty APIs 2017-04-07 11:41:22 -07:00
Max Moiseev
4b201754c1 Replacing @_transparent with @inline(__always)
Mandatory inlining of a few very frequently used functions caused the
SIL size explosion, which in turn made the inliner use up to 6Gb of
memory to compile the standard library. @inline(__always) helps avoid
that without affecting benchmark results.

Related to: <rdar://problem/31375011>
2017-04-05 15:51:38 -07:00
Max Moiseev
9feb799c6d Adding an explicit type context 2017-04-05 11:21:50 -07:00
Max Moiseev
2f5fd8e2ed Improving benchmarks 2017-03-27 14:59:27 -07:00
Max Moiseev
4f0c7a582c Fixing some more validation tests 2017-03-13 16:37:30 -07:00
Max Moiseev
daf088ddea Default implementation of instance bitWidth for FixedWidthInteger
Conforming types already provide the static bitWidth property. Instance
one can be implemented in a protocol extension.

Resolves: <rdar://problem/30186638>
2017-03-13 15:24:02 -07:00
Max Moiseev
233fb21dd6 multipliedFullWidth(by:) and dividingFullWidth(_:) 2017-03-13 15:16:58 -07:00
Max Moiseev
48b5899c0d WithOverflow => ReportingOverflow 2017-03-13 12:22:36 -07:00
Max Moiseev
ff81681f4f Properly naming bit count properties 2017-03-13 11:50:02 -07:00
Max Moiseev
7d73b2e1ca Arithmetic => Numeric 2017-03-13 11:50:02 -07:00
Max Moiseev
187aa923ff Fixing heterogeneous <, failable init from other ints, and init from floats 2017-03-10 17:09:15 -08:00
Nate Cook
3ab1060e0a [stdlib] Doc comment revisions for (un)signed integers (#7541) 2017-02-16 15:34:19 -08:00
Max Moiseev
c342166f10 Renaming leadingZeros to leadingZeroBits. Same for trailingZeros 2017-01-30 17:16:16 -08:00
Max Moiseev
125efc1fcc Moving / down to the BinaryInteger protocol 2017-01-30 17:16:16 -08:00
Max Moiseev
5601f5fd51 Adding back a transparrent attribute in an initializer 2017-01-27 16:35:49 -08:00
Max Moiseev
90ef26824f Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-26 15:28:42 -08:00
Max Moiseev
083a2054cb [stdlib] Commenting out a few transparent annotations
To make standard library compile with resiliency on.
2017-01-24 15:59:50 -08:00
Max Moiseev
c81c3ebcdd This fixes the build with resiliency
The compiler changes introduced in
0c294314d0 now prohibit the transparent
initializer assigning to self. One such initializer was in the new
integer protocols, that made it to the master before Swift 3. Luckily it
is not used and can be safely removed for now.
2017-01-24 11:17:02 -08:00