Commit Graph

2952 Commits

Author SHA1 Message Date
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
Joe Groff
eb40d4303b Sema: Add a stdlib-internal _openExistential helper.
Leverage the "special type-checking semantics" hack to pass an opened existential down to an arbitrary subexpression. Please don't use this.
2017-03-10 13:41:00 -08:00
Joe Groff
294913e114 Fix _stdlib_getErrorDefaultUserInfo to have the signature the runtime expects.
The ABI mismatch here would cause a crash in cases when the Foundation overlay wasn't available, or its implementation of swift_Foundation_getErrorDefaultUserInfo wasn't dynamically resolvable, such as in a stripped statically linked binary. Fixes rdar://problem/29173132.
2017-03-08 14:56:02 -08:00
Max Moiseev
f4c7e0464b Merge remote-tracking branch 'origin/new-integer-protocols' into new-integer-protocols 2017-03-07 16:42:07 -08:00
Max Moiseev
835b8809d2 Merge branch 'master' into new-integer-protocols 2017-03-07 16:18:54 -08:00
Maxim Moiseev
98e6cafdc8 [stdlib] Adding a deprecated version of flatMap to warn misuses. (#7823)
Due to implicit promotion to optional it is possible to call flatMap
with a closure, that does not return an optional. This way the code
works, but is unnecessary inefficient. Such uses of flatMap can and
should be replaced with map.
2017-03-06 10:16:42 -08:00
Dave Abrahams
7af65d9e09 Merge pull request #7870 from stephentyrone/FloatingPoint-Hashable
FloatingPoint should imply Hashable. 

 `Hashable` is related to `Equatable`, and `FloatingPoint` is `Equatable`, with enough additional constraints that `Hashable` conformance is practical.  

There's *almost* no excuse for any `Equatable` thing not to also be `Hashable`; the exception is when the underlying representation may be denormalized in some way that makes it impossible or expensive to normalize (e.g. `Set`).  Floating point numbers have denormalized forms, so this comes down to the cost of normalization.  Since we can't imagine a representation whose normalization is much more expensive than the subsequent hashing step, the conformance belongs.
2017-03-05 08:12:29 -08:00
Stephen Canon
0130407e21 Make FloatingPoint imply Hashable. SR-4132. 2017-03-01 20:39:11 -05:00
Nate Cook
fa0ec5d18f [docs] Update replaceRange to replaceSubrange 2017-03-02 09:00:58 +09:00
Nate Cook
888f504d50 [docs] Fix gybbo in UnsafeRawBufferPointer docs 2017-03-01 14:30:51 +09:00
Roman Levenstein
34815ff9ef [sil-generic-specializer] Do not create specializations for functions marked with @_semantics("optimize.sil.specialize.generic.never")
Those functions are not critical for performance, but their specializations result in a stdlib code bloat.
2017-02-24 14:59:44 -08:00
Slava Pestov
66bcf5b756 stdlib: Address a couple of ABI FIXMEs by deleting code
We have an implicit conversion to AnyHashable, so there's no
need to have the special subscript on Dictionary at all.
2017-02-21 20:28:49 -08:00
Jans Pavlovs
aa9efae562 Update map example code
Changes deprecated lowercaseString calls to lowercased()
This commit only affects example code provided in comments
2017-02-19 14:19:08 +02:00
Nate Cook
3ab1060e0a [stdlib] Doc comment revisions for (un)signed integers (#7541) 2017-02-16 15:34:19 -08:00
Nate Cook
15525c0d68 [stdlib] Correct documentation for ReversedIndex.base 2017-02-16 15:46:31 -06:00
Ben Cohen
863dfca3a2 Merge pull request #7510 from airspeedswift/zip-aliases
[stdlib] Deprecate aliases on Zip2Sequence
2017-02-16 08:14:03 -08:00
Michael Gottesman
8437819b5a [CMake] Revert recent changes.
These changes caused a number of issues:

1. No debug info is emitted when a release-debug info compiler is built.
2. OS X deployment target specification is broken.
3. Swift options were broken without any attempt any recreating that
functionality. The specific option in question is --force-optimized-typechecker.

Such refactorings should be done in a fashion that does not break existing
users and use cases.

This reverts commit e6ce2ff388.
This reverts commit e8645f3750.
This reverts commit 89b038ea7e.
This reverts commit 497cac64d9.
This reverts commit 953ad094da.
This reverts commit e096d1c033.

rdar://30549345
2017-02-15 22:26:06 -08:00
Ben Cohen
800248406e [stdlib] Deprecate aliases on Zip2Sequence 2017-02-15 16:09:18 -08:00
Chris Bieneman
e096d1c033 [CMake] Simplify add_swift_library
This patch splits add_swift_library into two functions one which handles
the simple case of adding a library that is part of the compiler being
built and the second handling the more complicated case of "target"
libraries, which may need to build for one or more targets.

The new add_swift_library is built using llvm_add_library, which re-uses
LLVM's CMake modules. In adapting to use LLVM's modules some of
add_swift_library's named parameters have been removed and
LINK_LIBRARIES has changed to LINK_LIBS, and LLVM_LINK_COMPONENTS
changed to LINK_COMPONENTS.

This patch also cleans up libswiftBasic's handling of UUID library and
headers, and how it interfaces with gyb sources.

add_swift_library also no longer has the FILE_DEPENDS parameter, which
doesn't matter because llvm_add_library's DEPENDS parameter has the same
behavior.
2017-02-14 14:28:10 -08:00
practicalswift
65b0219f7b [gardening] Fix typos 2017-02-14 20:04:08 +01:00
practicalswift
3e40296cfa [gardening] Fix inconsistent headers 2017-02-13 15:21:52 +01:00
Avjinder
12de833a55 42 * 42 is 1764, not 1746. 2017-02-09 21:18:23 +05:30
Doug Gregor
12fc2d22bf [Standard library] de-GYB string interpolation. NFC 2017-02-08 21:01:18 -08:00
Doug Gregor
fbb7dcf971 Replace concrete init(stringInterpolationSegment:)'s with generic ones
Remove 16 concrete init(stringInterpolationSegment:) overloads and
replace them with 3 generic overloads, significantly reducing the
exponential blow-up from larger string interpolations.

Fixes rdar://problem/29389887.
2017-02-08 21:01:09 -08:00
Doug Gregor
e387361194 Revert "Replace concrete init(stringInterpolationSegment:)'s with generic ones"
This reverts commit f6cac54606.
2017-02-08 13:38:11 -08:00
Doug Gregor
bb365b4657 Revert "[Standard library] de-GYB string interpolation. NFC"
This reverts commit 658f244188.
2017-02-08 13:38:10 -08:00
Doug Gregor
0b4261cae1 Revert "[Standard library] Remove some gyb-related cruft from string interpolation."
This reverts commit d0811cc318.
2017-02-08 13:38:08 -08:00
Nate Cook
c25bf40c26 [stdlib] Various documentation improvements
* Revise type(of:)
* Revise withoutActuallyEscaping(_:do:)
* Add slicing / index sharing to Collection
* Other cleanups
2017-02-07 23:02:41 -06:00
Erik Eckstein
fd62be59a1 stdlib: Use the re-mangler for _typeByName
The old method of constructing a mangled class name does not work anymore with the new mangling scheme.
Also, by using the re-mangler, _typeByName now works with class names containing non-ascii characters.
2017-02-07 08:36:21 -08:00
Andrew Trick
22f166437e Revert "Revert "[stdlib] Resolve unsafeBitCast warnings in Runtime.swift.gyb."" 2017-02-03 13:31:10 -08:00
swift-ci
2fd07f22a3 Merge pull request #7227 from apple/revert-7116-unsafeBitCast-Runtime.swift.gyb 2017-02-03 10:04:49 -08:00
Doug Gregor
0f99d18343 Merge pull request #7024 from rintaro/stdlib-newtype-comparable
[stdlib] Workaround type checker ambiguity in Comparable SwiftNewtypeWrapper
2017-02-03 09:55:42 -08:00
Andrew Trick
e62a57f243 Revert "[stdlib] Resolve unsafeBitCast warnings in Runtime.swift.gyb." 2017-02-03 09:46:04 -08:00
Jordan Rose
139699432b [stdlib] Resolve unsafeBitCast warnings in Runtime.swift.gyb. (#7116)
No intended functionality change.
2017-02-03 08:25:51 -08:00
Doug Gregor
d0811cc318 [Standard library] Remove some gyb-related cruft from string interpolation.
NFC
2017-02-01 10:51:02 -08:00
Rintaro Ishizaki
f11b74176b [stdlib] Workaround type checker ambiguity in Comparable SwiftNewtypeWrapper 2017-01-31 21:29:10 +09: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
0e7863129c Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-30 16:51:16 -08:00
Joe Groff
fd91396b30 Merge pull request #7136 from jckarter/missing-slice-default-implementations
Fix source compatibility problems with conforming to multiple Collection axes at once.
2017-01-30 14:34:47 -08:00
Doug Gregor
658f244188 [Standard library] de-GYB string interpolation. NFC 2017-01-30 10:16:24 -08:00
Joe Groff
34ec424898 stdlib: Adding missing default implementations of subscript(Range<Index>) for combinations of [Mutable][RangeReplaceable][Bidirectional|RandomAccess]Collection.
These were overlooked, and somehow code that attempted to make a minimal collection conform to RangeReplaceableCollection and RandomAccessCollection managed to compile successfully in Swift 3.0, but in Swift 3.1…*something* changed to reject a type that conforms to both due to the lack of a suitable default slicing subscript implementation in the stdlib that provided all the requirements. Fill in these missing implementations, fixing rdar://problem/30228957.
2017-01-30 09:54:58 -08:00
Doug Gregor
f6cac54606 Replace concrete init(stringInterpolationSegment:)'s with generic ones
Remove 16 concrete init(stringInterpolationSegment:) overloads and
replace them with 3 generic overloads, significantly reducing the
exponential blow-up from larger string interpolations.

Fixes rdar://problem/29389887.
2017-01-27 21:54:59 -08:00
Max Moiseev
06a45cb8fd Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-27 16:36:41 -08:00