Commit Graph

472 Commits

Author SHA1 Message Date
Dave Abrahams
212f39e307 [stdlib] Rename Indexable.swift => Container.swift
Now that the protocol name changed, get the filename straightened out
too.

Swift SVN r11959
2014-01-06 22:30:27 +00:00
Doug Gregor
1ee513e7e8 Use Builtin.Word for array lengths, string literal lengths, etc.
This eliminates a number of 64-bit integer/64-bit pointer assumptions
in the type checker and SILGen.


Swift SVN r11863
2014-01-03 18:53:01 +00:00
Dave Zarzycki
632264cbd1 stdlib: checkpoint 15612767: Int should become a separate, platform-sized type
1) Abstract away assumptions about all LLVM types being prefixed by 'Int'.
2) Thread through the ability to create a "word" sized type. This is
   blocked by a couple bugs.
3) Fix a bug where Int8/UInt8 did not conform to ArrayBounds.
   (This bug dates back to when FixedPoint.swift was hand maintained.)

Swift SVN r11858
2014-01-03 07:50:08 +00:00
Dave Abrahams
b86ebcc042 [stdlib] Rename Char.swift => UnicodeScalar.swift
Swift SVN r11846
2014-01-03 01:37:33 +00:00
Dave Abrahams
0ca0b46065 [stdlib] Rename NewString.swift -> String.swift
Swift SVN r11845
2014-01-03 01:32:20 +00:00
Dave Abrahams
dc26363d29 [stdlib] Remove String.swift
It was only serving up a single typealias

Swift SVN r11832
2014-01-02 22:09:08 +00:00
Dave Zarzycki
d24e2454de stdlib: add overflow checking to div and rem
Swift SVN r11783
2014-01-01 03:32:01 +00:00
Dave Zarzycki
0228f019c1 stdlib: make unary + generic over SignedNumbers
Swift SVN r11774
2013-12-31 20:16:13 +00:00
Dave Zarzycki
3feaac40c6 stdlib: drop IEEE from type/protocol names
Swift SVN r11768
2013-12-31 05:28:57 +00:00
Dave Zarzycki
a38ce8d8ef stdlib: move related NumericOperations out of Policy.swift
Swift SVN r11762
2013-12-31 03:41:30 +00:00
Dave Zarzycki
44269cc01d stdlib: Move IEEE754 support into its own file
Swift SVN r11761
2013-12-31 02:42:16 +00:00
Dave Zarzycki
f4e60d11b3 stdlib: Move the LogicValue implementation into its own file
Swift SVN r11759
2013-12-31 02:31:01 +00:00
Dave Zarzycki
c550e75954 stdlib: consolidate compiler protocols into a dedicated file
Annotating each protocol with "NOTE: ..." doesn't scale.

Swift SVN r11758
2013-12-31 02:08:59 +00:00
Dave Zarzycki
669ca06213 stdlib: mark SignedNumber methods as @transparent
Swift SVN r11757
2013-12-31 01:54:11 +00:00
Dave Zarzycki
9bfa643933 stdlib: abs() should use Builtin.*fabs* on floats
Swift SVN r11745
2013-12-30 21:42:22 +00:00
Doug Gregor
8383a25989 Remove the __less__ hack; use < instead.
Note that we have to work around <rdar://problem/14432081> a bit.

Swift SVN r11726
2013-12-29 21:05:16 +00:00
Doug Gregor
d1054b9e86 Eliminate the __equal__ protocol requirement; use == directly.
This is DaveA's patch, slightly tweaked, which works properly now that
<rdar://problem/15715996> is fixed.

Swift SVN r11725
2013-12-29 20:45:25 +00:00
Dave Abrahams
afbbbd1287 [stdlib] Add a facility for calling "C" functions that take va_list arguments
This code has only been tested on x86_64, but is designed to work on
the other platforms supported by Apple.

Swift SVN r11561
2013-12-22 02:37:33 +00:00
Dave Abrahams
68c47c7121 [stdlib] Remove ObjectPointer.swift; it was not ready for prime-time
Swift SVN r11131
2013-12-11 17:20:06 +00:00
Dave Abrahams
4c98b501a6 [stdlib] Expose NSString.stringWithContentsOfFile on String
Along the way created bridging utilities for ObjectiveC functions that
take "out" arguments and added an fmap for operating on Optionals

Swift SVN r11123
2013-12-11 07:24:05 +00:00
Doug Gregor
a5167f6bac Remove the type-checker performance workaround in <rdar://problem/14925518>
Swift SVN r11118
2013-12-11 03:40:22 +00:00
Dmitri Hrybenko
b55f943d0d stdlib/FixedPoint: fix indentation
Swift SVN r11089
2013-12-10 20:44:03 +00:00
Joe Groff
ab95d6cd11 stdlib: Add a BitwiseOperations protocol.
Collect the bitwise logical operators under a protocol. Add an 'allZeros' static method to produce the 'zero' identity value for the type when used with bitwise operations.

Swift SVN r11068
2013-12-10 04:03:20 +00:00
Jordan Rose
b4fe56eb1c Actually fix the Makefile build for multi-file Swift libraries.
The hack to get the LLVM build system to do what we want is to define a
custom build rule for "XYZ.o" and then add "XYZ" as a dummy source file
to the SOURCES variable, which the LLVM Makefile system uses. To make it
clear that something unusual is going on here, I've changed all existing
instances of this to use "XYZ.o" in SOURCES, rather than having that name
be derived from "XYZ.swift" or whatever.

The actual Swift source files go in SWIFT_SOURCES for the time being
(and possibly forever, since Swift sources will always be built together).

Swift SVN r11058
2013-12-10 00:23:43 +00:00
Anna Zaks
b75cb37cf8 Reapply r10534 in a more convenient form.
Swift SVN r10944
2013-12-06 22:10:52 +00:00
Dave Abrahams
983438948f [stdlib] Rip out mistakenly committed test code
Swift SVN r10920
2013-12-06 06:02:25 +00:00
Dave Abrahams
01b2a39029 [stdlib] Add a length property to NewString
Swift SVN r10919
2013-12-06 06:02:24 +00:00
Dmitri Hrybenko
f08ee12841 stdlib/FloatingPoint: add APIs to handle special floating point values
See IEEEFloatingPointNumber protocol for a full list of new APIs and
documentation.


Swift SVN r10826
2013-12-05 01:36:15 +00:00
Doug Gregor
95ebc6b596 Eliminate the use of the T(x) syntax as type coercion.
Long ago we decided to eliminate the use of this syntax for type
coercion, but we didn't have a good replacement (now we do: x as T)
and the type checker used this ability to handle string
interpolation. Switch string interpolation over to disjunction
constraints.


Swift SVN r10789
2013-12-04 21:11:57 +00:00
Dave Zarzycki
d08712cb35 15242776 stdlib: merge "Array" and "Slice" into Array.swift
The "HArray" name is temporary.

Swift SVN r10708
2013-12-01 08:16:43 +00:00
Dave Abrahams
88b0edaf82 [stdlib] NewString: conversion from string literals
Swift SVN r10651
2013-11-22 00:40:08 +00:00
Dave Zarzycki
18fc62f4eb 15489271 Adopt @transparent on min/max static var min/max decls of the integer types
Swift SVN r10534
2013-11-17 23:16:41 +00:00
Dave Zarzycki
2c24ee6a29 Switch integer min/max static funcs to static vars
Swift SVN r10533
2013-11-17 22:42:54 +00:00
Dmitri Hrybenko
81dc5deee8 Change 'def' keyword back to 'func'
Swift SVN r10522
2013-11-17 07:45:28 +00:00
Anna Zaks
3e8fa762ec Dynamically and statically dianose a conversion of a negative integer to an unsigned int.
Swift SVN r10513
2013-11-16 01:26:54 +00:00
Anna Zaks
0f390c9c54 Add dynamic checking for sign errors(overflows) during signed <-> unsigned conversions for integers of the same type.
Add unsafe alternatives to allow unsafe conversions:
 - asUnsigned()
 - asSigned()

Swift SVN r10476
2013-11-15 00:16:18 +00:00
Dave Zarzycki
16f2b951e6 15466633 _getBuiltinArrayBoundValue should be @transparent
Swift SVN r10459
2013-11-14 08:11:40 +00:00
Chris Lattner
3f0976677f secondary cleanups now that bool is a struct: we can directly access .value
to convert a Bool to i1 and can use the Bool ctor to convert i1 to Bool.



Swift SVN r10437
2013-11-13 23:39:26 +00:00
Anna Zaks
b687c3ce9c Add runtime integer truncation checking to the conversion constructors
Add new builtins(by generalizing, renaming, and extending the builtins used for compile time integer literal checking). These new builtins truncate integers and check for overflow/truncation errors at runtime. Use these for FixedPoint conversion constructors.

Fix a routine in stdlib's String implementation and a test that relied on bitwise behavior of the constructors (and triggered overflows).

TODO:
- Teach CCP about these to get static checking.
- Add special builtins for same size signed <-> unsigned conversions.

Swift SVN r10432
2013-11-13 21:54:34 +00:00
Anna Zaks
084bdfd05f Change the signature of the trunc builtins to return a tuple containing teh overflow bit as well as the result.
This is a first step in generalizing the builtin to handle non-constant int to int truncations.

Swift SVN r10341
2013-11-11 21:20:04 +00:00
Dmitri Hrybenko
e36ebb217c Remove empty files
Swift SVN r10074
2013-11-09 08:01:08 +00:00
Dave Abrahams
38b9e6808f [stdlib] CharacterEncoding.swift => Unicode.swift
Also enshrine the tests in the test suite

Swift SVN r10057
2013-11-08 22:17:50 +00:00
Dave Abrahams
645ce0b664 [stdlib] Add support for bound protocols
Protocols with associated types can't currently be used as existential
types.  Combined with the inability to create type constraints on
generic functions nested in generic types based on the outer type and
the inability to create closures of generic type and the inability to
create protocol constraints that require generic functions and the
inability to create protocols with init() requirements... and this is
what we get.

Swift SVN r10034
2013-11-08 06:29:29 +00:00
Chris Lattner
50054458e7 remove SIMD vector support from the stdlib. I think we all really want this,
but we don't have time right now to make it great.  This shrinks the stdlib
by 9000 lines :-)


Swift SVN r9902
2013-11-03 16:10:57 +00:00
Chris Lattner
68af974227 Remove 'axle' related code and build machinery. It turns out that we
will not be pursuing this project in the immediate future.



Swift SVN r9901
2013-11-03 16:04:27 +00:00
Dave Abrahams
21d196a9ef [stdlib] Implement basic transcoding of UTF8 and UTF16
Swift SVN r9896
2013-11-02 01:32:49 +00:00
Dmitri Hrybenko
91ce21666d Change 'func' keyword to 'def'
I tried hard find all references to 'func' in documentation, comments and
diagnostics, but I am sure that I missed a few.  If you find something, please
let me know.

rdar://15346654


Swift SVN r9886
2013-11-02 01:00:42 +00:00
Greg Parker
beaa56d8e9 Add Builtin.Word and use it to implement swift.Word.
Swift SVN r9864
2013-11-01 00:11:22 +00:00
Greg Parker
b342f68392 Fix Float80 suppression.
Swift SVN r9838
2013-10-31 01:47:27 +00:00
Dmitri Hrybenko
c216a848b9 stdlib/FloatingPoint: port floating point implementation to gyb
No changes in functionality intended.


Swift SVN r9799
2013-10-30 17:14:12 +00:00