Skip to content

Commit

Permalink
Merge pull request #11 from apple/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
JacobMao authored May 25, 2018
2 parents 90b06be + 24abeca commit a3fbb5f
Show file tree
Hide file tree
Showing 2,356 changed files with 84,215 additions and 37,812 deletions.
146 changes: 146 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
Adrian-Constantin Popescu <epsilon.gamma@gmail.com> <adrian-constantin.popescu@outlook.com>
Alex Blewitt <alblue@apple.com> <alex.blewitt@gmail.com>
Alex Hoppen <alex@alexhoppen.de> <alex@ateamer.de>
Alex Hoppen <alex@alexhoppen.de> <ahoppen@apple.com>>
Alexis Beingessner <abeingessner@apple.com> <a.beingessner@gmail.com>
Alper Çugun <github@alper.nl> <alper@users.noreply.github.com>
Amr Aboelela <amraboelela@gmail.com> <amraboelela@users.noreply.github.com>
Ankit Aggarwal <ankit_aggarwal@apple.com> <ankit.spd@gmail.com>
Argyrios Kyrtzidis <kyrtzidis@apple.com> <akyrtzi@gmail.com>
Arsen Gasparyan <to.arsen.gasparyan@gmail.com> <frootloops@users.noreply.github.com>
Ben Cohen <ben_cohen@apple.com>
Ben Cohen <ben_cohen@apple.com> <airspeedswift@users.noreply.github.com>
Ben Cohen <ben_cohen@apple.com> <ben@airspeedvelocity.net>
Ben Langmuir <blangmuir@apple.com> <ben.langmuir@gmail.com>
Brent Royal-Gordon <brent@brentdax.com> <brent@architechies.com>
Brian Croom <bcroom@apple.com> <brian.s.croom@gmail.com>
Brian Gesiak <bgesiak@fb.com> <modocache@gmail.com>
Bryan Chan <bryan.chan@ca.ibm.com> <bryanpkc@gmail.com>
Calvin Hill <mr_j.c.h@hotmail.com> <return@users.noreply.github.com>
Chris Bieneman <beanz@apple.com>
Chris Bieneman <beanz@apple.com> <cbieneman@apple.com>
Chris Lattner <clattner@nondot.org> <clattner@apple.com>
Chris Lattner <clattner@nondot.org> <lattner@users.noreply.github.com>
Chris Lattner <clattner@nondot.org> <sabre@iMac.local>
Chris Williams <cwilliams@fitbit.com> <ultramiraculous@users.noreply.github.com>
codester <sahil.profile@gmail.com> codestergit <sahil.profile@gmail.com>
Dan Liew <dliew@apple.com> <36706441+danliew-apple@users.noreply.github.com>
Daniel Duan <daniel@duan.org> <danmarner@gmail.com>
Dante Broggi <34220985+Dante-Broggi@users.noreply.github.com>
Dave <davesweeris@mac.com>
Dave Abrahams <dabrahams@apple.com> <dave@boostpro.com>
Dave Abrahams <dabrahams@apple.com> <dave@fripp.apple.com>
Dave Abrahams <dabrahams@apple.com> <dave@Skree.local>
Dave Abrahams <dabrahams@apple.com> <dave@Wingy.local>
Dave Lee <davelee@lyft.com> <davelee.com@gmail.com>
David Rönnqvist <david.ronnqvist@gmail.com> <david.ronnqvist@skype.net>
David Rönnqvist <david.ronnqvist@gmail.com>
David Ungar <dungar@apple.com> <ungar@mac.com>
David Zarzycki <dave@znu.io> <zarzycki@apple.com>
David Zarzycki <dave@znu.io> <zarzycki@icloud.com>
David Zarzycki <dave@znu.io> <zarzycki@mac.com>
Davide Italiano <ditaliano@apple.com> <dcci@users.noreply.github.com>
Davide Italiano <ditaliano@apple.com> <dccitaliano@gmail.com>
Dmitri Gribenko <gribozavr@gmail.com> <dgribenko@apple.com>
Doug Coleman <doug_coleman@apple.com> <doug.coleman@gmail.com>
Enrico Granata <egranata@apple.com> <egranata@egranata.apple.com>
Enrico Granata <egranata@apple.com> <granata.enrico@gmail.com>
Erik Eckstein <eeckstein@apple.com>
Erik Eckstein <eeckstein@apple.com> <eeckstein@rad-main.corp.apple.com>
Erik Verbruggen <erik.verbruggen@me.com> <erikjv@users.noreply.github.com>
Ewa Matejska <ematejska@apple.com>
Ewa Matejska <ematejska@apple.com> <ematejska@Ewas-MacBook-Pro.local>
Ewa Matejska <ematejska@apple.com> <ewamatejska@Ewas-iMac.local>
Florent Bruneau <florent.bruneau@intersec.com> <florent.bruneau_github@m4x.org>
Francis Ricci <fjricci@fb.com> <francisjricci@gmail.com>
GauravDS <er.gauravds@gmail.com> <gaurav.sharma@punchh.com>
Graydon Hoare <ghoare@apple.com> <graydon@users.noreply.github.com>
Greg Parker <gparker@apple.com> <gparker-github@sealiesoftware.com>
Greg Titus <gregomni@gmail.com>
Guillaume Lessard <dhtnstff@gmail.com> <glessard@users.noreply.github.com>
Hamish <hamish2knight@gmail.com>
Han Sangjin <tinysun@jssolution.co.kr> <tinysun.net@gmail.com>
Harlan Haskins <harlan@apple.com> <harlan@harlanhaskins.com>
Harlan Haskins <harlan@apple.com> <hbh@google.com>
Hitster GTD <hitstergtd@users.noreply.github.com>
Huon Wilson <huon@apple.com> <dbau.pp+github@gmail.com>
Ingmar Stein <IngmarStein@users.noreply.github.com>
Itai Ferber <iferber@apple.com> <itai@itaiferber.net>
Jacob Bandes-Storch <jacob@bandes-stor.ch> <jacob@bandes-storch.net>
Jacob Mizraji <jmizraji@apple.com> <jacobmizraji@gmail.com>
Janosch Hildebrand <jnosh@jnosh.com> <jnosh+git@jnosh.com>
Janosch Hildebrand <jnosh@jnosh.com> <jnosh+github@jnosh.com>
Javier Soto <jsbustos@twitch.tv> <javier.api@gmail.com>
Javier Soto <jsbustos@twitch.tv> <javiers@twitter.com>
Joe <joe@iachieved.it>
Joe <joewillsher@icloud.com>
joe DeCapo <joe@polka.cat>
Joe Groff <jgroff@apple.com> <arcata@gmail.com>
Joe Shajrawi <shajrawi@apple.com> <joeshajrawi@iMac-2.local>
Joe Shajrawi <shajrawi@apple.com> <joeshajrawi@Joes-iMac-Pro.local>
Johannes Weiß <johannesweiss@apple.com> <github@tux4u.de>
John Regner <john@johnregner.com> <regnerjr@gmail.com>
Karoy Lorentey <klorentey@apple.com> <karoly@lorentey.hu>
Keith Smiley <k@keith.so> <keithbsmiley@gmail.com>
Kevin Ballard <kevin@sb.org> <kevin.ballard@postmates.com>
Kevin Saldaña <ksaldana1@gmail.com>
Kim Topley <ktopley@apple.com>
Kosuke Ogawa <ogawa_kousuke@aratana.jp> <koogawa.app@gmail.com>
Kuba Mracek <mracek@apple.com> <jbrecka@apple.com>
Kuba Mracek <mracek@apple.com>
Luiz Fernando Silva <luizinho_mack@yahoo.com.br>
Luqman Aden <luqman@apple.com> <luqman_aden@apple.com>
Marcelo Fabri <me@marcelofabri.com> <marcelofabri@users.noreply.github.com>
Mark Lacey <mark.lacey@apple.com> <rudkx@icloud.com>
Mark Lacey <mark.lacey@apple.com> <rudkx@users.noreply.github.com>
Matt Rajca <matt.rajca@me.com> <mattrajca@users.noreply.github.com>
Max Moiseev <moiseev@apple.com>
Max Moiseev <moiseev@apple.com> <maxim.moiseev@gmail.com>
Max Moiseev <moiseev@apple.com> <moiseev@users.noreply.github.com>
Maxwell Swadling <maxs@apple.com> <maxwellswadling@gmail.com>
Maxwell Swadling <maxs@apple.com> <mswadling@apple.com>
Mayur Raiturkar <mayur@mayur.xyz> <mayurkr@users.noreply.github.com>
Michael Gottesman <mgottesman@apple.com> <gottesmm@users.noreply.github.com>
Michael Ilseman <milseman@apple.com> <michael.ilseman@gmail.com>
Mike Ash <mikeash@apple.com> <mike@mikeash.com>
Mike Ferris <mferris@apple.com> <mike@lorax.com>
Mishal Awadah <mawadah@apple.com>
Mishal Shah <mishal_shah@apple.com>
Mishal Shah <mishal_shah@apple.com> <shahmishal@users.noreply.github.com>
Nadav Rotem <nrotem@apple.com> <nadavrot@users.noreply.github.com>
Nate Cook <natecook@apple.com> <nate@Nates-MacBook-Pro.local>
Nate Cook <natecook@apple.com> <natecook@gmail.com>
Nate Cook <natecook@apple.com> <natecook1000@users.noreply.github.com>
Nate Cook <natecook@apple.com> <nmersethcook@apple.com>
Nathan Lanza <lanza@fb.com> <nathan@lanza.io>
Nicole Jacque <jacque@apple.com>
Niels Andriesse <andriesseniels@gmail.com> <nielsandriesse@users.noreply.github.com>
Paul Meng <mno2@mno2.org> <mno2.csie@gmail.com>
Pavel Yaskevich <pyaskevich@apple.com> <xedin@apache.org>
Paweł Szot <pszot@pgs-soft.com>
Paweł Szot <pszot@pgs-soft.com> <qwertyszot@gmail.com>
Pete Cooper <peter_cooper@apple.com>
Philip Ridgeway <pridgeway@vernier.com> <philip.ridgeway@gmail.com>
Richard Wei <rxwei@apple.com> <rxwei@google.com>
Rintaro Ishizaki <rishizaki@apple.com> <fs.output@gmail.com>
Robert Widmann <rwidmann@apple.com> <devteam.codafi@gmail.com>
Roman Levenstein <rlevenstein@apple.com> <swiftix@users.noreply.github.com>
Ross Bayer <ross.m.bayer@gmail.com> <Rostepher@users.noreply.github.com>
Ross Bayer <ross.m.bayer@gmail.com>
Russ Bishop <rbishopjr@apple.com> <russ@plangrid.com>
Ryan Lovelett <ryan@lovelett.me> <RLovelett@users.noreply.github.com>
Shawn Erickson <shawn.erickson@citrix.com> <shawnce@gmail.com>
Slava Pestov <spestov@apple.com> <spestov@rad-main.corp.apple.com>
Slava Pestov <spestov@apple.com> <sviatoslav.pestov@gmail.com>
Stephen Canon <scanon@apple.com>
Stephen Canon <scanon@apple.com> <stephentyrone@gmail.com>
Sukolsak Sakshuwong <sukolsak@gmail.com>
Todd Fiala <tfiala@apple.com> <todd.fiala@gmail.com>
Toni Suter <tonisuter@me.com> <tonisuter@users.noreply.github.com>
Vedant Kumar <vsk@apple.com> <vk@vedantk.com>
Xi Ge <xi_ge@apple.com> <xi_ge@rad-main.corp.apple.com>
Xin Tong <xin_tong@apple.com> <trent.xin.tong@gmail.com>
Xin Tong <xin_tong@apple.com> <trentxintong@Xins-MacBook-Pro.local>
Yuka Ezura <ezura@users.noreply.github.com> <2020337+ezura@users.noreply.github.com>
Yurii Samsoniuk <ura@google.com> <mr.sigito@gmail.com>
Zac Bowling <zbowling@google.com> <zac@zacbowling.com>
173 changes: 163 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Swift 5.0
class Node {
var children = [Node]()

var depth: Int {
var depth: Int = 0 {
didSet {
if depth < 0 {
// Will not recursively call didSet, as setting depth on self (same
Expand All @@ -49,10 +49,6 @@ Swift 5.0
}
}
}

init(depth: Int) {
self.depth = depth
}
}
```

Expand All @@ -61,6 +57,147 @@ Swift 5.0
Swift 4.2
---------

* [SE-0185][]

Protocol conformances are now able to be synthesized in extensions in the same
file as the type definition, allowing automatic synthesis of conditional
conformances to `Hashable`, `Equatable` and `Codable` (both `Encodable` and
`Decodable`). For instance, if there is a generic wrapper type that can only
be `Equatable` when its wrapped type is also `Equatable`, the `==` method can
be automatically constructed by the compiler:

```swift
struct Generic<Param> {
var property: Param
}

extension Generic: Equatable where Param: Equatable {}
// Automatically synthesized inside the extension:
// static func ==(lhs: Generic, rhs: Generic) -> Bool {
// return lhs.property == rhs.property
// }
```

Code that wants to be as precise as possible should generally not
conditionally conform to `Codable` directly, but rather its two constituent
protocols `Encodable` and `Decodable`, or else one can only (for instance)
decode a `Generic<Param>` if `Param` is `Encodable` in addition to
`Decodable`, even though `Encodable` is likely not required:

```swift
// Unnecessarily restrictive:
extension Generic: Codable where Param: Codable {}

// More precise:
extension Generic: Encodable where Param: Encodable {}
extension Generic: Decodable where Param: Decodable {}
```

Finally, due to `Decodable` having an `init` requirement, it is not possible
to conform to `Decodable` in an extension of a non-final class: such a class
needs to have any `init`s from protocols be `required`, which means they need
to be in the class definition.


* [SE-0054][]

`ImplicitlyUnwrappedOptional<T>` is now an unavailable typealias of `Optional<T>`.
Declarations annotated with `!` have the type `Optional<T>`. If an
expression involving one of these values will not compile successfully with the
type `Optional<T>`, it is implicitly unwrapped, producing a value of type `T`.

In some cases this change will cause code that previously compiled to
need to be adjusted. Please see [this blog post](https://swift.org/blog/iuo/)
for more information.

* [SE-0206][]

The standard library now uses a high-quality, randomly seeded, universal
hash function, represented by the new public `Hasher` struct.

“Random seeding” varies the result of `hashValue` on each execution of a
Swift program, improving the reliability of the standard library's hashed
collections such as `Set` and `Dictionary`. In particular, random seeding
enables better protection against (accidental or deliberate) hash-flooding
attacks.

This change fulfills a long-standing prophecy in Hashable's documentation:

> Hash values are not guaranteed to be equal across different executions of
> your program. Do not save hash values to use during a future execution.

As a consequence of random seeding, the elements in `Set` and `Dictionary`
values may have a different order on each execution. This may expose some
bugs in existing code that accidentally relies on repeatable ordering.

Additionally, the `Hashable` protocol now includes an extra function
requirement, `hash(into:)`. The new requirement is designed to be much
easier to implement than the old `hashValue` property, and it generally
provides better hashing. To implement `hash(into:)`, simply feed the exact
same components of your type that you compare in `Equatable`'s `==`
implementation to the supplied `Hasher`:

```swift
struct Foo: Hashable {
var a: String?
var b: [Int]
var c: [String: Int]

static func ==(lhs: Foo, rhs: Foo) -> Bool {
return lhs.a == rhs.a && lhs.b == rhs.b && lhs.c == rhs.c
}

func hash(into hasher: inout Hasher) {
hasher.combine(a)
hasher.combine(b)
hasher.combine(c)
}
}
```

Automatic synthesis for `Hashable` ([SE-0185]) has been updated to generate
`hash(into:)` implementations. For example, the `==` and `hash(into:)`
implementations above are equivalent to the ones synthesized by the
compiler, and can be removed without changing the meaning of the code.

Synthesis has also been extended to support deriving `hashValue` from
`hash(into:)`, and vice versa. Therefore, code that only implements
`hashValue` continues to work in Swift 4.2. This new compiler functionality
works for all types that can implement `Hashable`, including classes.

Note that these changes don't affect Foundation's hashing interface. Classes
that subclass `NSObject` should override the `hash` property, like before.

In certain controlled environments, such as while running particular tests,
it may be helpful to selectively disable hash seed randomization, so that
hash values and the order of elements in `Set`/`Dictionary` values remain
consistent across executions. You can disable hash seed randomization by
defining the environment variable `SWIFT_DETERMINISTIC_HASHING` with the
value of `1`. The Swift runtime looks at this variable during process
startup and, if it is defined, replaces the random seed with a constant
value.

* [SR-106][]

The behavior of `.description` and `.debugDescription` for floating-point
numbers has been changed. Previously these unconditionally printed a fixed
number of decimal digits (e.g. 15 and 17 for Double, respectively). They now
print exactly as many digits as are needed for the resulting string to
convert back to the original source value, and no more. For more details,
see the original bug report and the linked pull request.

* [SE-0193][]

Various function-like declarations can now be marked as `@inlinable`,
making their bodies available for optimizations from other modules.

Inlinable function bodies must only reference public declarations, unless
the referenced declaration is marked as `@usableFromInline`.

Note that the presence of the attribute itself does not force inlining or
any other optimization to be performed, nor does it have any effect on
optimizations performed within a single module.

* The C `long double` type is now imported as `Float80` on i386 and x86_64
macOS and Linux. The tgmath functions in the Darwin and glibc modules now
 support `Float80` as well as `Float` and `Double`. Several tgmath
Expand Down Expand Up @@ -103,16 +240,18 @@ Swift 4.2

* [SE-0143][]

Runtime query of conditional conformances is now implemented. Therefore,
a dynamic cast such as `value as? P`, where the dynamic type of `value`
conditionally conforms to `P`, will succeed when the conditional
requirements are met.
Runtime query of conditional conformances is now implemented. Therefore,
a dynamic cast such as `value as? P`, where the dynamic type of `value`
conditionally conforms to `P`, will succeed when the conditional
requirements are met.

**Add new entries to the top of this section, not here!**

Swift 4.1
---------

### 2018-03-29 (Xcode 9.3)

* [SE-0075][]

Compile-time testing for the existence and importability of modules is now
Expand Down Expand Up @@ -6968,7 +7107,21 @@ Swift 1.0
[SE-0197]: <https://github.com/apple/swift-evolution/blob/master/proposals/0197-remove-where.md>
[SE-0198]: <https://github.com/apple/swift-evolution/blob/master/proposals/0198-playground-quicklook-api-revamp.md>
[SE-0199]: <https://github.com/apple/swift-evolution/blob/master/proposals/0199-bool-toggle.md>

[SE-0200]: <https://github.com/apple/swift-evolution/blob/master/proposals/0200-raw-string-escaping.md>
[SE-0201]: <https://github.com/apple/swift-evolution/blob/master/proposals/0201-package-manager-local-dependencies.md>
[SE-0202]: <https://github.com/apple/swift-evolution/blob/master/proposals/0202-random-unification.md>
[SE-0203]: <https://github.com/apple/swift-evolution/blob/master/proposals/0203-rename-sequence-elements-equal.md>
[SE-0204]: <https://github.com/apple/swift-evolution/blob/master/proposals/0204-add-last-methods.md>
[SE-0205]: <https://github.com/apple/swift-evolution/blob/master/proposals/0205-withUnsafePointer-for-lets.md>
[SE-0206]: <https://github.com/apple/swift-evolution/blob/master/proposals/0206-hashable-enhancements.md>
[SE-0207]: <https://github.com/apple/swift-evolution/blob/master/proposals/0207-containsOnly.md>
[SE-0208]: <https://github.com/apple/swift-evolution/blob/master/proposals/0208-package-manager-system-library-targets.md>
[SE-0209]: <https://github.com/apple/swift-evolution/blob/master/proposals/0209-package-manager-swift-lang-version-update.md>
[SE-0210]: <https://github.com/apple/swift-evolution/blob/master/proposals/0210-key-path-offset.md>
[SE-0211]: <https://github.com/apple/swift-evolution/blob/master/proposals/0211-unicode-scalar-properties.md>
[SE-0212]: <https://github.com/apple/swift-evolution/blob/master/proposals/0212-compiler-version-directive.md>

[SR-106]: <https://bugs.swift.org/browse/SR-106>
[SR-419]: <https://bugs.swift.org/browse/SR-419>
[SR-1009]: <https://bugs.swift.org/browse/SR-1009>
[SR-1446]: <https://bugs.swift.org/browse/SR-1446>
Expand Down
Loading

0 comments on commit a3fbb5f

Please sign in to comment.