Commit Graph

684 Commits

Author SHA1 Message Date
Ben Cohen
3bdada1773 Merge pull request #6506 from airspeedswift/im-not-warning-you-again
[stdlib] Squash various warnings
2017-01-06 16:51:06 -08:00
Max Moiseev
27889c6376 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-06 15:54:44 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Ben Cohen
4dc5eacef5 Merge branch 'master' into im-not-warning-you-again 2017-01-05 10:11:48 -08:00
JP Simard
65688bdc39 [gardening] replace unused closure parameters with '_' in stdlib source (#6522)
* replace unused closure parameters with '_' in stdlib source

* fold some _ closure arguments into line above

* fold more _ closure arguments into line above
2017-01-03 20:10:41 -07:00
JP Simard
ea5b665afa prefer '-> Void' over '-> ()'
Apple and the Swift community has settled on this style:
https://devforums.apple.com/message/1133616#1133616

> FWIW, we've recently decided to standardize on () -> Void
> (generally, () for parameters and Void for return types) across all of our
> documentation.
2016-12-31 17:55:19 -08:00
ben-cohen
c7785533a1 add FIXME for default: warning 2016-12-29 13:20:59 -08:00
Max Moiseev
3059b3cdd1 Merge branch 'master' into new-integer-protocols 2016-11-30 10:45:10 -08:00
Max Moiseev
70b2343626 Merge branch 'master' into new-integer-protocols 2016-11-28 15:25:01 -08:00
practicalswift
5bc293cc09 [gardening] Add missing licensing headers. 2016-11-28 21:40:06 +01:00
Dave Abrahams
1f19884c01 Assertion failures from StdlibUnittest dump their descriptions 2016-11-23 02:14:39 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Max Moiseev
c0d624f6e2 Minor improvements 2016-11-18 18:56:26 -08:00
practicalswift
17503b0d85 [gardening] Use American English. 2016-11-06 10:12:04 +01:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Ben Cohen
fe4186b0b9 Supress various warnings in StdlibUnittest.swift.gyb 2016-10-06 16:14:26 -07:00
Ben Cohen
24dc2af4a9 supress unused loop counter warning (#5134) 2016-10-05 17:02:34 -07:00
Greg Parker
9666d8d39a [test] Add a timeout to runRaceTest(). Use it to limit test AtomicInt.swift. (#4815)
[test] Add a timeout to runRaceTest(). Use it to limit test AtomicInt.swift.

This cuts AtomicInt.swift's execution time from several hours to
about ten minutes on slow hardware and slow build configurations.
2016-09-19 21:46:25 -07:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00
Dmitri Gribenko
30509f1b64 StdlibUnittest: add an argument label to checkHashable
I think it improves readability of the callsite.
2016-09-15 10:20:09 -07:00
Dmitri Gribenko
a4af3e62c3 StdlibUnittest: remove 'expectEmpty()' and 'expectNotEmpty()' 2016-09-12 10:33:07 -07:00
Dmitri Gribenko
b8a475be72 StdlibUnittest: rename 'expectEmpty()' and 'expectNotEmpty()' to 'expectNil()' and 'expectNotNil()'
The new names are what people generally expect.  The old names made more
sense in the old times when the 'Optional.None' case could not be
created with the 'nil' keyword.
2016-09-10 20:05:42 -07:00
Dmitri Gribenko
10b339d2cb StdlibUnittest: improve error messages in checkComparable() 2016-09-06 22:46:40 -06:00
Dmitri Gribenko
6b4427b573 StdlibUnittest: expose cartesianProduct() helper 2016-09-06 20:41:03 -07:00
Dmitri Gribenko
08c772fdac StdlibUnittest: add an allowBrokenTransitivity flag to checkEquatable()
This will be used for testing Swift errors bridged to NSErrors.
2016-08-09 00:49:20 -07:00
Dmitri Gribenko
5a7e8f3337 StdlibUnittest: change Minimal~Class types to actually be classes 2016-08-09 00:49:20 -07:00
Dmitri Gribenko
fd627ff015 StdlibUnittest: add expectEqual(_: Any.Type, _: Any.Type) 2016-08-08 17:56:05 -07:00
Dmitri Gribenko
f45565ca6c StdlibUnittest: add a new overload of expectEqual() 2016-08-07 13:46:31 -07:00
Dmitri Gribenko
3dc793ce8a StdlibUnittest: add checkStrideable() 2016-08-07 03:57:15 -07:00
Michael Ilseman
b7c9eddd11 [noescape by default] drop @noescape from stdlib 2016-08-04 16:09:01 -07:00
Jordan Rose
f42158b12e Revert "[Sema] ban multi-arguments to tuple coercion" (#3922)
It breaks cases where there really is a single unlabeled argument of tuple type, like this:

  let pairs = [(1, "A"), (2, "B")]
  print(pairs.map { $0.0 })
2016-08-01 19:22:19 -07:00
Daniel Duan
c9b73dacc2 [Sema] ban multi-arguments to tuple coercion
Implements part of SE-0110. Single argument in closures will not be accepted if
there exists explicit type with a number of arguments that's not 1.

```swift
let f: (Int, Int) -> Void = { x in } // this is now an error
```

Note there's a second part of SE-0110 which could be considered additive,
which says one must add an extra pair of parens to specify a single arugment
type that is a tuple:

```swift
let g ((Int, Int)) -> Void = { y in } // y should have type (Int, Int)
```

This patch does not implement that part.
2016-07-31 16:22:57 -07:00
Robert Widmann
b79fa44da5 Merge pull request #3878 from CodaFi/decltype
[SE-0096] Implement type(of:)
2016-07-29 18:05:01 -07:00
Doug Gregor
b9363fe6bd [SE-0111] Enable SE-0111 by default. 2016-07-29 17:28:24 -07:00
Robert Widmann
14dc86cf15 Polish off uses of dynamicType in codebase 2016-07-29 16:58:40 -07:00
Michael Ilseman
ccda8f33d1 [noescape by default] Proliferate @escaping
Adds an explicit @escaping throughout the standard library, validation
test suite, and tests. This will be necessary as soon as noescape is
the default for closure parameters.
2016-07-29 13:48:07 -07:00
Robert Widmann
4c2dbe1723 [stdlib][SE-0089] Finish off Lossless String Conversion (#3761)
* Rename string reflection init

* Addressing PR comments and updating some tests

* Update test suite for lossless string conversion
2016-07-28 17:13:25 -07:00
Dmitri Gribenko
2d2c76f6ec stdlib: AnyHashable tests: finish tests for CF types 2016-07-28 01:35:58 -07:00
John McCall
c8c41b385c Implement SE-0077: precedence group declarations.
What I've implemented here deviates from the current proposal text
in the following ways:

- I had to introduce a FunctionArrowPrecedence to capture the parsing
  of -> in expression contexts.

- I found it convenient to continue to model the assignment property
  explicitly.

- The comparison and casting operators have historically been
  non-associative; I have chosen to preserve that, since I don't
  think this proposal intended to change it.

- This uses the precedence group names and higherThan/lowerThan
  as agreed in discussion.
2016-07-26 14:04:57 -07:00
Dmitri Gribenko
4027ceb61f StdlibUnittest: add GenericMinimalHashableValue<T> 2016-07-26 03:10:52 -07:00
Dmitri Gribenko
9ac1bb108a StdlibUnitttest: optimize checkEquatable()
checkEquatable() used to be O(n^3), now it is O(n^2).
2016-07-26 03:10:52 -07:00
Joe Groff
c6b713e858 Update StdlibUnittest for id-as-Any. 2016-07-25 06:01:21 -07:00
Andrew Trick
ecc6bd51ad Type system support for raw pointer conversion. (#3685)
* [Type System] Handle raw pointer conversion.

As proposed in SE-0107: UnsafeRawPointer.
https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md#implicit-argument-conversion

UnsafeMutablePointer<T> -> UnsafeMutableRawPointer
UnsafeMutablePointer<T> -> UnsafeRawPointer
UnsafePointer<T> -> UnsafeRawPointer
UnsafeMutableRawPointer -> UnsafeRawPointer

inout:
&anyVar -> UnsafeMutableRawPointer
&anyVar -> UnsafeRawPointer

array -> UnsafeRawPointer
string -> UnsafeRawPointer

varArray -> UnsafeMutableRawPointer

* Rename expectEqual(_, _, sameValue:) to expectEqualTest to workaround a type system bug.

<rdar://26058520> Generic type constraints incorrectly applied to functions with the same name

This is exposed by additions to the type system for UnsafeRawPointer.

Warning: unit tests fail very confusingly without this fix.
2016-07-23 11:30:49 -07:00
Luke Larson
74e0498015 Revert "Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs."
This reverts commit 62d1fa760c.
2016-07-19 15:18:17 -07:00
Tony Parker
fe932663a8 Merge pull request #3598 from parkera/se86_rename_process
Rename Process to CommandLine
2016-07-19 13:45:23 -07:00
Mishal Shah
62d1fa760c Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-07-19 22:31:34 +02:00
Joe
a6dad0091b [SE-0095] Initial parsing implementation for '&' composition syntax
This commit defines the ‘Any’ keyword, implements parsing for composing
types with an infix ‘&’, and provides a fixit to convert ‘protocol<>’

- Updated tests & stdlib for new composition syntax
- Provide errors when compositions used in inheritance.
Any is treated as a contextual keyword. The name ‘Any’
is used emit the empty composition type. We have to
stop user declaring top level types spelled ‘Any’ too.
2016-07-19 12:01:02 -07:00
Andrew Trick
5a8271c621 Rename UnsafePointer allocate & deallocate. (#3608)
As proposed in SE-0107: UnsafeRawPointer:
Rename 'init(allocatingCapacity:)' to 'UnsafeMutablePointer.allocate(capacity:)'
Rename 'deallocateCapacity' to 'deallocate(capacity:)'

`allocate` should not be an initializer. It's primary function is to allocate
memory, not initialize a pointer.
2016-07-19 11:48:18 -07:00
Dave Abrahams
7ac11087de [stdlib] Minor fixups for SE-0118 implementation 2016-07-19 07:35:46 -07:00