Commit Graph

159 Commits

Author SHA1 Message Date
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
Max Moiseev
6d380d9638 Correcting the logic in the reasoning for the heterogeneous comparison implementation 2017-01-23 16:45:09 -08:00
Max Moiseev
d382ac97ea Using >= instead of > to catch overshifts correctly 2017-01-23 16:01:32 -08:00
Max Moiseev
1265f0792a Implementing arithmetic operators on NSDecimal, CGFloat, and concrete FP types 2017-01-23 10:59:24 -08:00
Max Moiseev
871d1a2805 Removing arithemtic operator default implementations from BinaryInteger and FloatingPoint 2017-01-19 14:34:23 -08:00
Max Moiseev
e600da4e25 Moving arithmetic operators back onto concrete types level temporarily 2017-01-19 12:04:52 -08:00
Max Moiseev
d82ddea20c Using chain() instead of a 2-level list comprehension in gyb 2017-01-19 12:03:56 -08:00
Max Moiseev
a8d7fc56d1 Annotating init() as transparent 2017-01-19 12:03:03 -08:00
Max Moiseev
de5b03ddc4 Getting rid of Arithmetic.init() in favor of 0 2017-01-13 17:59:35 -08:00
Max Moiseev
e1a8e28ad7 Making non-masking shift helper function public (compiler requires it now) 2017-01-11 15:43:18 -08:00
Max Moiseev
a872adad8f Fixing and XFAILing tests 2017-01-10 15:38:17 -08:00