Commit Graph

24 Commits

Author SHA1 Message Date
Michael Gottesman
751e8c51ac [python] Make python lint pass (#4296) 2016-08-14 22:49:14 -04:00
Chris Williams
2f74e7618d Add max/min helpers to SwiftIntTypes 2016-08-01 14:27:51 -07:00
Stephen Canon
6429eabf74 Implement the new FloatingPoint protocols from SE-0067.
There are a couple of features that are not yet implemented, because they require additions to the Builtin module.  Specifically, this implementation does not have:

- formRemainder(dividingBy:)
- formSquareRoot()
- addProduct(_:,_:)

Also missing are the generic initializers and comparisons whose implementation depends on having new Integer protocols.

The last remaining feature of SE-0067 is that while the basic operators +,-,*,/, etc are moved onto the FloatingPoint protocol, they are still required on the concrete types in order to disambiguate overloads.  Fixing this seems to require either modifying the overload resolution rules or removing these operators from some other protocols.  Or it might just require that someone smarter than me looks at the problem.

Passes all the existing tests (with the included changes).  I'm working on additional tests for the new features.
2016-05-09 10:34:13 -04:00
practicalswift
1edb62dc38 [Python] Make flake8 linting pass without errors/warning (w/ default rules) 2016-03-13 20:19:51 +01:00
practicalswift
0796eaad1f [Python] Fix 80-column violations 2016-03-09 23:52:11 +01:00
practicalswift
183da818df [Python] Fix five classes of PEP-8 violations (E101/E111/E128/E302/W191)
* E101: indentation contains mixed spaces and tabs
* E111: indentation is not a multiple of four
* E128: continuation line under-indented for visual indent
* E302: expected 2 blank lines, found 1
* W191: indentation contains tabs
2016-03-07 22:36:23 +01:00
practicalswift
04afd6e640 [Python] Improve consistency: "block comment should start with '# '" (PEP-8) 2016-03-05 14:03:16 +01:00
practicalswift
f6d6585ee0 [Python] Improve Python consistency: Use function_name(…) throughout (PEP8) 2016-02-29 22:49:19 +01:00
practicalswift
970216434d [Python] Fix "too many leading '#' for block comment"
See discussion with @gribozavr in https://github.com/apple/swift/pull/1287#issuecomment-183413319
2016-02-12 23:02:10 +01:00
practicalswift
679f1853d2 PEP8: Fix all violations of type "at least two spaces before inline comment" (E261) 2016-01-24 10:10:55 +01:00
practicalswift
1cd4d4e9c9 [gardening] Fix violations of non-controversial PEP8 rules
Fixes:
* multiple statements on one line (colon) (E701)
* missing whitespace around arithmetic operator (E226)
* missing whitespace around operator (E225)
* closing bracket does not match visual indentation (E124)
* blank line contains whitespace (W293)
* continuation line missing indentation or outdented (E122)
* continuation line over-indented for hanging indent (E126)
* missing expected blank line (E301)
* trailing whitespace (W291)
* unexpected spaces around keyword / parameter equals (E251)
* whitespace after '(', '[' or '{' (E201)
* whitespace before ')', ']' or '}' (E202)
* whitespace before ',' or ':' (E203)
2016-01-23 09:23:33 +01:00
practicalswift
22d043fcc0 [gardening] Fix violations of non-controversial PEP8 rules.
Fixes:
* blank line at end of file
* closing bracket does not match indentation of opening bracket's line
* continuation line over-indented for hanging indent
* continuation line over-indented for visual indent
* continuation line unaligned for hanging indent
* inline comment should start with '# '
* missing whitespace around arithmetic operator
* missing whitespace around bitwise or shift operator
* multiple imports on one line
* multiple spaces after ':'
* multiple spaces after operator
2016-01-16 00:47:43 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Maxwell Swadling
83f92fcb22 [stdlib] removed &%
We believe this operator is not useful.

rdar://problem/17926954

Swift SVN r25197
2015-02-11 21:52:50 +00:00
Maxwell Swadling
2cc0ef6f03 [stdlib] Removed &/
We believe this operator is not useful.

rdar://problem/17926954

Swift SVN r25159
2015-02-11 01:36:55 +00:00
Dmitri Hrybenko
ff771d0984 stdlib: use fixed-width Builtin.IntXX types for Swift.Int and UInt
Using the unknown-sized Builtin.Word types complicates producing
compile-time overflow diagnostics.  If we don't know the target Word
size, we don't know if there is an overflow.  But SIL optimizer does not
know the size of Word, this is the point of having the Word type in the
first place.

Also, this opens up more possibilities for optimizations.

rdar://17604532

Swift SVN r24788
2015-01-28 05:22:42 +00:00
Flash Sheridan
ac30c67fd9 Revert the risky part of the change until I can investigate a bot failure report. The error below sounds like a genuine bug, though not one that I saw, but other errors didn't seem connected to my change.
/Users/buildslave/jenkins/workspace/swift_tools-RA_stdlib-RD/megaclang/src/tools/swift/validation-test/stdlib/NumericDiagnostics.swift.gyb:29:33: error: expected diagnostic not produced
      x1_UInt8 * x2_Float80  // expected-error{{ }}


Swift SVN r24238
2015-01-07 06:37:43 +00:00
Flash Sheridan
c5ebf4f2b5 Add tests for Float80, but only on the desktop; which is tricky, since Gyb doesn't know its destination.
Now 3835 tests.  Reviewed by Dmitri.

Swift SVN r24237
2015-01-07 04:58:25 +00:00
Flash Sheridan
c11eb40008 Iterate over more documented operators, now that the documentation has improved; now 3460 tests.
Replace hard-coded lists of real-number types, and of arithmetic and logical operators I’m testing, with lists added to SwiftIntTypes.py, which becomes a bit of a misnomer.  
Separate them into ones which only work on integer types, and those which also allow reals.
Do a double loop, over just the integers and then the reals as well.
Change the run line to allow importing StdlibUnittest with help from Dmitri, which I won't actually need until I do result type checking.

Approved by Dmitri.

Swift SVN r24029
2014-12-19 04:20:03 +00:00
Dmitri Hrybenko
60cf5d3d1b SwiftIntTypes.py: remove transitional '_new' suffix from a function name
Swift SVN r21579
2014-08-29 15:38:22 +00:00
Dmitri Hrybenko
40103a1309 SwiftIntTypes.py: remove unused code
Swift SVN r21578
2014-08-29 15:18:14 +00:00
Dmitri Hrybenko
14899abdf5 stdlib/FixedPoint: define the same set of 'truncatingBitPattern'
initializers on all platforms

rdar://18167806

Swift SVN r21570
2014-08-29 10:32:33 +00:00
Dmitri Hrybenko
7255f900b9 stdlib: move test for floating point conversion traps to the validation
testsuite

Fixes for traps will follow.


Swift SVN r21108
2014-08-08 15:20:05 +00:00
Dmitri Hrybenko
ac0d9b8175 stdlib/CGFloat: GYB'ify initializers that convert between CGFloat and
integer types.  Never miss an integer type again.

rdar://17853313

Swift SVN r20751
2014-07-30 11:24:11 +00:00