Skip to content

Merge main 2022-05-27 #4596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 91 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
6fd3ae7
[Wasm] Specify the least valid pointer for wasm32
kateinoigakukun Sep 14, 2021
e313df8
[build-script] Add option to build lld as part of LLVM
ahoppen Feb 11, 2022
3843c7c
Update SWIFT_COMPILER_VERSION language features
beccadax Apr 28, 2022
50e5997
[stdlib] Port SE-0329 Clock APIs to WASI
kateinoigakukun Apr 29, 2022
8ce878f
Do not suggest moving `any` or `some` to the beginning of a compositi…
moritzdietsche May 7, 2022
f5d920f
Merge branch 'apple:main' into fix-it-for-repeated-any-or-some-in-com…
moritzdietsche May 8, 2022
c163e0f
[Tests] Make OS features consistent
bnbarham May 19, 2022
29ec7d4
Merge branch 'apple:main' into fix-it-for-repeated-any-or-some-in-com…
moritzdietsche May 22, 2022
20e0e15
[dbg-info][move-function] Add DWARF filecheck lines for conditional c…
gottesmm May 12, 2022
e9c14cd
[ASTPrinter] Print the desugared constraint type following the 'any'
hborla May 24, 2022
dd4cdfb
[C++-Interop] Fix EffectiveClangContext for NS_OPTIONS EnumDecl lookup.
plotfi May 24, 2022
7687a63
Sema: Use the availability of the extended nominal as a floor for the…
tshortli May 20, 2022
38dfb99
[ASTPrinter] Put desugaring constraints for existential types behind a
hborla May 24, 2022
7712387
[Build System] Don't clean sourcekit-lsp prior to running tests
ahoppen Feb 8, 2022
e39caea
[Test] Run test with 64-bit SIL on 64-bit arch.
nate-chandler May 24, 2022
bdc1f40
[Gardening] Recapitalized type.
nate-chandler May 19, 2022
180095a
[ShrinkBorrowScope] Adopt iterative dataflow.
nate-chandler May 16, 2022
3c7ad60
[ShrinkBorrowScope] Adopt VisitBarrierAccessScopes.
nate-chandler May 20, 2022
b36cbed
Merge pull request #41266 from ahoppen/pr/dont-clean-sourcekitlsp
ahoppen May 24, 2022
c7cbe46
Merge pull request #59048 from nate-chandler/test/20220524/require-64…
swift-ci May 24, 2022
6b5ca84
Merge pull request #59036 from gottesmm/pr-c405f97a46f28343218bd193f0…
gottesmm May 24, 2022
b996bb5
build: start building static version of ICU for Windows
compnerd May 23, 2022
5bd541c
Merge pull request #58934 from nate-chandler/rdar93186505
nate-chandler May 24, 2022
158db44
[Gardening] Recapitalized type.
nate-chandler May 19, 2022
fdc35a1
[LexicalDestroyHoisting] Adopt iterative dataflow.
nate-chandler May 16, 2022
e68c12f
[LexicalDestroyHoisting] Adopt VisitBarrierAccessScopes.
nate-chandler May 21, 2022
5bef9f2
[SymbolGraphGen] Add filename and module name to symbols' doc comment…
QuietMisdreavus May 24, 2022
1d50072
Set `SWIFT_ABI_WASM32_LEAST_VALID_POINTER` to 4096
MaxDesiatov May 24, 2022
7cb0c28
Merge pull request #59041 from hborla/protocol-typealias-existential
hborla May 24, 2022
0ce821a
Merge pull request #58939 from nate-chandler/rdar93369506
nate-chandler May 24, 2022
8775148
[SILOpt] Used SetVector for fast contains check.
nate-chandler May 24, 2022
4e9992c
[CSClosure] Fix crash in `fallthrough` statement checking
xedin May 24, 2022
d95cd97
[Sema] Improving implicit closure capture diagnostic wording
LucianoPAlmeida Apr 27, 2022
8506f71
Merge pull request #59040 from tshortli/extensions-have-availability-…
tshortli May 25, 2022
7e40114
Sema: Downgrade diagnostics about inheritance from a less available t…
tshortli May 25, 2022
baa4123
use getConformingProtocols when printing opaque generic types (#58991)
QuietMisdreavus May 25, 2022
050f3e2
Merge pull request #59032 from compnerd/i-c-u-statically
compnerd May 25, 2022
645d73f
Merge pull request #58480 from beccadax/so-i-put-versions-in-your-ver…
swift-ci May 25, 2022
594d3ad
Merge pull request #39300 from kateinoigakukun/katei/wasm-least-valid…
kateinoigakukun May 25, 2022
8cc2a55
Merge pull request #59065 from tshortli/downgrade-inheritance-from-le…
tshortli May 25, 2022
e2012dd
Merge pull request #41314 from ahoppen/pr/build-lld
ahoppen May 25, 2022
c74cbce
Fix incorrect derivative (#41423)
philipturner May 25, 2022
ebd04d8
Merge pull request #58456 from LucianoPAlmeida/SR-16092-diagnostics
LucianoPAlmeida May 25, 2022
e75c56b
[SwiftSyntax] Fix assertion failure if regex literal was not terminat…
ahoppen May 25, 2022
0b2b9a3
Merge pull request #59057 from nate-chandler/perf/20220524/use-setvec…
nate-chandler May 25, 2022
ccbef09
Add release notes for SE-0329: Clock, Instant, and Duration
phausler May 25, 2022
0b74559
Merge pull request #59069 from ahoppen/pr/unterminated-regex-literal
ahoppen May 25, 2022
663722d
Parameterized Existential Types Are Enabled By Default
CodaFi May 25, 2022
2a4c268
Merge branch 'main' into pr/se-0329-notes
DougGregor May 25, 2022
7eb3657
Merge pull request #59070 from phausler/pr/se-0329-notes
DougGregor May 25, 2022
1ec678e
Update CHANGELOG
CodaFi May 25, 2022
3c76bd8
Merge Two Tests
CodaFi May 25, 2022
299d109
Merge pull request #59042 from plotfi/enum-cxx-interop-options-struct
plotfi May 25, 2022
b278d74
Update Tests
CodaFi May 25, 2022
a7053e4
[interop][swiftToCxx] emit empty skeleton C++ classes for Swift struc…
hyp May 25, 2022
1bbf180
Add cursory release note for Regex.
stephentyrone May 25, 2022
e45a29c
Merge pull request #59075 from CodaFi/param-etricity
CodaFi May 25, 2022
e660493
Merge pull request #59059 from xedin/rdar-93796211
xedin May 25, 2022
aefec8d
Merge pull request #59079 from stephentyrone/regex-release-note
swift-ci May 25, 2022
405a028
[Isolation] Factor out the "not a value" check from "okay across acto…
DougGregor May 24, 2022
a8e1629
Sendable checking for overrides.
DougGregor May 25, 2022
717da76
[SE-0338] Perform Sendable checking when exiting an actor via conform…
DougGregor May 25, 2022
3faf8c3
[SE-0338] Diagnose Sendable when leaving an actor to call nonisolated…
DougGregor May 25, 2022
3d30527
[Autolink Extract] Filter out common Swift libraries from being linke…
artemcm May 24, 2022
882e1f8
Add SE-0338 to the ChangeLog now that it's implemented
DougGregor May 25, 2022
49ac2f9
CI: add support to skip testing selectively on full builds
compnerd May 24, 2022
133dbe4
[Test] Do not load string processing when recovery is disabled
bnbarham May 25, 2022
efc9469
Merge pull request #58975 from bnbarham/make-features-consistent
bnbarham May 25, 2022
174bbd2
Handle ParamDecls and VarDecls in Argument Matching Diagnostics
CodaFi May 25, 2022
bd2ffdb
Merge pull request #59078 from hyp/eng/value-type-empty-skeleton
hyp May 26, 2022
0eafd08
Merge pull request #58742 from moritzdietsche/fix-it-for-repeated-any…
LucianoPAlmeida May 26, 2022
9aaea55
Sema: Simplify logic for building extension generic signature
slavapestov Mar 14, 2022
6390fcb
Merge pull request #59086 from DougGregor/se-0338-sendable
DougGregor May 26, 2022
8f072d1
[Runtime] Don't try to demangle unprefixed untrusted names. Remove op…
mikeash May 26, 2022
f62037c
Merge pull request #59060 from compnerd/skipping
compnerd May 26, 2022
0a5b3f0
[TypeChecker] SE-0324: Extend Swift -> C pointer conversions to `inout`
xedin May 24, 2022
c5c1e28
[AST Mangler] Don't mangle marker protocols in retroactive conformances.
DougGregor May 26, 2022
39edb8b
[AST Mangler] Don't look into invalid conformances.
DougGregor May 26, 2022
b0c4947
Merge pull request #59051 from xedin/rdar-92583588
xedin May 26, 2022
7898b5a
[CSSimplify] Disfavor choices that have injected `callAsFunction`
xedin May 17, 2022
b6baa3f
Merge pull request #58514 from kateinoigakukun/katei/upstream-clock-cpp
kateinoigakukun May 26, 2022
0bf212a
Merge pull request #59095 from mikeash/dont-trust-unmangled-names
mikeash May 26, 2022
5eba174
Merge pull request #59093 from DougGregor/marker-protocol-retroactive…
DougGregor May 26, 2022
bf66515
add default values for SymbolGraphOptions (#59037)
QuietMisdreavus May 26, 2022
7d8af2d
Merge pull request #58953 from xedin/fix-callAsFunction-perf
xedin May 26, 2022
c9ddfbc
Merge pull request #59090 from CodaFi/unknown-unknowns
CodaFi May 26, 2022
a07636b
Merge pull request #41820 from slavapestov/simpler-extension-generic-…
slavapestov May 26, 2022
84c547a
Merge pull request #59087 from bnbarham/fix-test
xymus May 26, 2022
0bf6fc3
Merge pull request #59063 from artemcm/AutoLinkExtractFilterCommon
artemcm May 26, 2022
f36e72b
Merge remote-tracking branch 'apple/main' into katei/merge-main-2022-…
kateinoigakukun May 27, 2022
f7cfc7f
build lld explicitly for darwin build environment
kateinoigakukun May 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 101 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,83 @@ _**Note:** This is in reverse chronological order, so newer entries are added to

## Swift 5.7

* [SE-0338][]:

Non-isolated async functions now always execute on the global concurrent pool,
so calling a non-isolated async function from actor-isolated code will leave
the actor. For example:

```swift
class C { }

func f(_: C) async { /* always executes on the global concurrent pool */ }

actor A {
func g(c: C) async {
/* always executes on the actor */
print("on the actor")

await f(c)
}
}
```

Prior to this change, the call from `f` to `g` might have started execution of
`g` on the actor, which could lead to actors being busy longer than strictly
necessary. Now, the non-isolated async function will always hop to the global
cooperative pool, not run on the actor. This can result in a behavior change
for programs that assumed that a non-isolated async function called from a
`@MainActor` context will be executed on the main actor, although such
programs were already technically incorrect.

Additionally, when leaving an actor to execution on the global cooperative
pool, `Sendable` checking will be performed, so the compiler will emit a
diagnostic in the call to `f` if `c` is not of `Sendable` type.

* [SE-0350][]:

The standard library has a new `Regex<Output>` type.

This type represents an _extended regular expression_, allowing more fluent
string processing operations. A `Regex` may be created by
[initialization from a string][SE-0355]:
```
let pattern = "a[bc]+" // matches "a" followed by one or more instances
// of either "b" or "c"
let regex = try! Regex(pattern)
```
Or via a [regex literal][SE-0354]:
```
let regex = #/a[bc]+/#
```
In Swift 6, `/` will also be supported as a delimiter for `Regex` literals.
You can enable this mode in Swift 5.7 with the `-enable-bare-slash-regex`
flag. Doing so will cause some existing expressions that use `/` as an
operator to no longer compile; you can add parentheses or line breaks as a
workaround.

There are [new string-processing algorithms][SE-0357] that support
`String`, `Regex` and arbitrary `Collection` types.

* [SE-0329][]:
New types representing time and clocks were introduced. This includes a protocol `Clock` defining clocks which allow for defining a concept of now and a way to wake up after a given instant. Additionally a new protocol `InstantProtocol` for defining instants in time was added. Furthermore a new protocol `DurationProtocol` was added to define an elapsed duration between two given `InstantProtocol` types. Most commonly the `Clock` types for general use are the `SuspendingClock` and `ContinuousClock` which represent the most fundamental clocks for the system. The `SuspendingClock` type does not progress while the machine is suspended whereas the `ContinuousClock` progresses no matter the state of the machine.

```swift
func delayedHello() async throws {
try await Task.sleep(until: .now + .milliseconds(123), clock: .continuous)
print("hello delayed world")
}
```

`Clock` also has methods to measure the elapsed duration of the execution of work. In the case of the `SuspendingClock` and `ContinuousClock` this measures with high resolution and is suitable for benchmarks.

```swift
let clock = ContinuousClock()
let elapsed = clock.measure {
someLongRunningWork()
}
```

* [SE-0309][]:

Protocols with associated types and `Self` requirements can now be used as the
Expand Down Expand Up @@ -72,10 +149,26 @@ _**Note:** This is in reverse chronological order, so newer entries are added to

* [SE-0353][]:

Further generalizing the above, protocol-constrained types can also be used with `any`:
Protocols with primary associated types can now be used in existential types,
enabling same-type constraints on those associated types.

```
let strings: any Collection<String> = [ "Hello" ]
```

Note that language features requiring runtime support like dynamic casts
(`is`, `as?`, `as!`), as well as generic usages of parameterized existentials
in generic types (e.g. `Array<any Collection<Int>>`) involve additional
availability checks to use. Back-deploying usages in generic position can be
worked around with a generic type-erasing wrapper struct, which is now much
simpler to implement:

```swift
func findBestGraph(_: [any Graph<Int>]) -> any Graph<Int> {...}
struct AnyCollection<T> {
var wrapped: any Collection<T>
}

let arrayOfCollections: [AnyCollection<T>] = [ /**/ ]
```

* [SE-0358][]:
Expand Down Expand Up @@ -9354,21 +9447,27 @@ Swift 1.0
[SE-0326]: <https://github.com/apple/swift-evolution/blob/main/proposals/0326-extending-multi-statement-closure-inference.md>
[SE-0327]: <https://github.com/apple/swift-evolution/blob/main/proposals/0327-actor-initializers.md>
[SE-0328]: <https://github.com/apple/swift-evolution/blob/main/proposals/0328-structural-opaque-result-types.md>
[SE-0329]: <https://github.com/apple/swift-evolution/blob/main/proposals/0329-clock-instant-duration.md>
[SE-0331]: <https://github.com/apple/swift-evolution/blob/main/proposals/0331-remove-sendable-from-unsafepointer.md>
[SE-0333]: <https://github.com/apple/swift-evolution/blob/main/proposals/0333-with-memory-rebound.md>
[SE-0334]: <https://github.com/apple/swift-evolution/blob/main/proposals/0334-pointer-usability-improvements.md>
[SE-0335]: <https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md>
[SE-0336]: <https://github.com/apple/swift-evolution/blob/main/proposals/0336-distributed-actor-isolation.md>
[SE-0337]: <https://github.com/apple/swift-evolution/blob/main/proposals/0337-support-incremental-migration-to-concurrency-checking.md>
[SE-0338]: <https://github.com/apple/swift-evolution/blob/main/proposals/0338-clarify-execution-non-actor-async.md>
[SE-0340]: <https://github.com/apple/swift-evolution/blob/main/proposals/0340-swift-noasync.md>
[SE-0341]: <https://github.com/apple/swift-evolution/blob/main/proposals/0341-opaque-parameters.md>
[SE-0343]: <https://github.com/apple/swift-evolution/blob/main/proposals/0343-top-level-concurrency.md>
[SE-0345]: <https://github.com/apple/swift-evolution/blob/main/proposals/0345-if-let-shorthand.md>
[SE-0346]: <https://github.com/apple/swift-evolution/blob/main/proposals/0346-light-weight-same-type-syntax.md>
[SE-0347]: <https://github.com/apple/swift-evolution/blob/main/proposals/0347-type-inference-from-default-exprs.md>
[SE-0349]: <https://github.com/apple/swift-evolution/blob/main/proposals/0349-unaligned-loads-and-stores.md>
[SE-0350]: <https://github.com/apple/swift-evolution/blob/main/proposals/0350-regex-type-overview.md>
[SE-0352]: <https://github.com/apple/swift-evolution/blob/main/proposals/0352-implicit-open-existentials.md>
[SE-0353]: <https://github.com/apple/swift-evolution/blob/main/proposals/0353-constrained-existential-types.md>
[SE-0354]: <https://github.com/apple/swift-evolution/blob/main/proposals/0354-regex-literals.md>
[SE-0355]: <https://github.com/apple/swift-evolution/blob/main/proposals/0355-regex-syntax-run-time-construction.md>
[SE-0357]: <https://github.com/apple/swift-evolution/blob/main/proposals/0357-regex-string-processing-algorithms.md>
[SE-0358]: <https://github.com/apple/swift-evolution/blob/main/proposals/0358-primary-associated-types-in-stdlib.md>

[SR-75]: <https://bugs.swift.org/browse/SR-75>
Expand Down
27 changes: 23 additions & 4 deletions include/swift/AST/Availability.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ class VersionRange {
return getLowerEndpoint() >= Other.getLowerEndpoint();
}

// Returns true if all the versions in the Other range are versions in this
// range and the ranges are not equal.
bool isSupersetOf(const VersionRange &Other) const {
if (isEmpty() || Other.isAll())
return false;

if (isAll() || Other.isEmpty())
return true;

return getLowerEndpoint() < Other.getLowerEndpoint();
}

/// Mutates this range to be a best-effort underapproximation of
/// the intersection of itself and Other. This is the
/// meet operation (greatest lower bound) in the version range lattice.
Expand Down Expand Up @@ -244,10 +256,17 @@ class AvailabilityContext {
/// Returns true if \p other makes stronger guarantees than this context.
///
/// That is, `a.isContainedIn(b)` implies `a.union(b) == b`.
bool isContainedIn(AvailabilityContext other) const {
bool isContainedIn(const AvailabilityContext &other) const {
return OSVersion.isContainedIn(other.OSVersion);
}

/// Returns true if \p other is a strict subset of this context.
///
/// That is, `a.isSupersetOf(b)` implies `a != b` and `a.union(b) == a`.
bool isSupersetOf(const AvailabilityContext &other) const {
return OSVersion.isSupersetOf(other.OSVersion);
}

/// Returns true if this context has constraints that make it impossible to
/// actually occur.
///
Expand All @@ -272,7 +291,7 @@ class AvailabilityContext {
///
/// As an example, this is used when figuring out the required availability
/// for a type that references multiple nominal decls.
void intersectWith(AvailabilityContext other) {
void intersectWith(const AvailabilityContext &other) {
OSVersion.intersectWith(other.getOSVersion());
}

Expand All @@ -283,7 +302,7 @@ class AvailabilityContext {
/// treating some invalid deployment environments as available.
///
/// As an example, this is used for the true branch of `#available`.
void constrainWith(AvailabilityContext other) {
void constrainWith(const AvailabilityContext &other) {
OSVersion.constrainWith(other.getOSVersion());
}

Expand All @@ -295,7 +314,7 @@ class AvailabilityContext {
///
/// As an example, this is used for the else branch of a conditional with
/// multiple `#available` checks.
void unionWith(AvailabilityContext other) {
void unionWith(const AvailabilityContext &other) {
OSVersion.unionWith(other.getOSVersion());
}

Expand Down
5 changes: 4 additions & 1 deletion include/swift/AST/DiagnosticsParse.def
Original file line number Diff line number Diff line change
Expand Up @@ -1816,7 +1816,10 @@ ERROR(version_component_not_number,none,
ERROR(compiler_version_too_many_components,none,
"compiler version must not have more than five components", ())
WARNING(unused_compiler_version_component,NoUsage,
"the second version component is not used for comparison", ())
"the second version component is not used for comparison in legacy "
"compiler versions%select{|; are you trying to encode a new Swift "
"compiler version for compatibility with legacy compilers?}0",
(bool))
ERROR(empty_version_component,none,
"found empty version component", ())
ERROR(compiler_version_component_out_of_range,none,
Expand Down
22 changes: 18 additions & 4 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,9 @@ NOTE(non_sendable_nominal,none,
NOTE(add_nominal_sendable_conformance,none,
"consider making %0 %1 conform to the 'Sendable' protocol",
(DescriptiveDeclKind, DeclName))
NOTE(add_generic_parameter_sendable_conformance,none,
"consider making generic parameter %0 conform to the 'Sendable' protocol",
(Type))
REMARK(add_predates_concurrency_import,none,
"add '@preconcurrency' to %select{suppress|treat}0 "
"'Sendable'-related %select{warnings|errors}0 from module %1"
Expand Down Expand Up @@ -4570,6 +4573,12 @@ ERROR(concurrent_access_of_inout_param,none,
ERROR(non_sendable_capture,none,
"capture of %1 with non-sendable type %0 in a `@Sendable` closure",
(Type, DeclName))
ERROR(implicit_async_let_non_sendable_capture,none,
"capture of %1 with non-sendable type %0 in 'async let' binding",
(Type, DeclName))
ERROR(implicit_non_sendable_capture,none,
"implicit capture of %1 requires that %0 conforms to `Sendable`",
(Type, DeclName))

NOTE(actor_isolated_sync_func,none,
"calls to %0 %1 from outside of its actor context are "
Expand Down Expand Up @@ -4648,9 +4657,10 @@ ERROR(isolated_parameter_not_actor,none,

WARNING(non_sendable_param_type,none,
"non-sendable type %0 %select{passed in call to %4 %2 %3|"
"exiting %4 context in call to non-isolated %2 %3|"
"passed in implicitly asynchronous call to %4 %2 %3|"
"in parameter of %4 %2 %3 satisfying non-isolated protocol "
"requirement|"
"in parameter of %4 %2 %3 satisfying protocol requirement|"
"in parameter of %4 overriding %2 %3|"
"in parameter of %4 '@objc' %2 %3}1 cannot cross actor boundary",
(Type, unsigned, DescriptiveDeclKind, DeclName, ActorIsolation))
WARNING(non_sendable_call_param_type,none,
Expand All @@ -4659,8 +4669,10 @@ WARNING(non_sendable_call_param_type,none,
(Type, bool, ActorIsolation))
WARNING(non_sendable_result_type,none,
"non-sendable type %0 returned by %select{call to %4 %2 %3|"
"call from %4 context to non-isolated %2 %3|"
"implicitly asynchronous call to %4 %2 %3|"
"%4 %2 %3 satisfying non-isolated protocol requirement|"
"%4 %2 %3 satisfying protocol requirement|"
"%4 overriding %2 %3|"
"%4 '@objc' %2 %3}1 cannot cross actor boundary",
(Type, unsigned, DescriptiveDeclKind, DeclName, ActorIsolation))
WARNING(non_sendable_call_result_type,none,
Expand All @@ -4670,8 +4682,10 @@ WARNING(non_sendable_call_result_type,none,
WARNING(non_sendable_property_type,none,
"non-sendable type %0 in %select{"
"%select{asynchronous access to %5 %1 %2|"
"asynchronous access from %5 context to non-isolated %1 %2|"
"implicitly asynchronous access to %5 %1 %2|"
"conformance of %5 %1 %2 to non-isolated protocol requirement|"
"conformance of %5 %1 %2 to protocol requirement|"
"%5 overriding %1 %2|"
"%5 '@objc' %1 %2}4|captured local %1 %2}3 cannot "
"cross %select{actor|task}3 boundary",
(Type, DescriptiveDeclKind, DeclName, bool, unsigned, ActorIsolation))
Expand Down
3 changes: 3 additions & 0 deletions include/swift/AST/PrintOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ struct PrintOptions {
/// types.
bool PrintExplicitAny = false;

/// Whether to desugar the constraint for an existential type.
bool DesugarExistentialConstraint = false;

/// Whether to skip keywords with a prefix of underscore such as __consuming.
bool SkipUnderscoredKeywords = false;

Expand Down
29 changes: 17 additions & 12 deletions include/swift/AST/TypeRefinementContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ class TypeRefinementContext : public ASTAllocated<TypeRefinementContext> {
/// The root refinement context.
Root,

/// The context was introduced by a declaration (e.g., the body of a
/// function declaration or the contents of a class declaration).
/// The context was introduced by a declaration with an explicit
/// availability attribute. The context contains both the signature and the
/// body of the declaration.
Decl,

/// The context was introduced by an API boundary; that is, we are in
/// a module with library evolution enabled and the parent context's
/// contents can be visible to the module's clients, but this context's
/// contents are not.
APIBoundary,
/// The context was introduced implicitly by a declaration. The context may
/// cover the entire declaration or it may cover a subset of it. For
/// example, a public, non-inlinable function declaration in an API module
/// will have at least two associated contexts: one for the entire
/// declaration at the declared availability of the API and a nested
/// implicit context for the body of the function, which will always run at
/// the deployment target of the library.
DeclImplicit,

/// The context was introduced for the Then branch of an IfStmt.
IfStmtThenBranch,
Expand Down Expand Up @@ -131,7 +135,8 @@ class TypeRefinementContext : public ASTAllocated<TypeRefinementContext> {
}

Decl *getAsDecl() const {
assert(IntroReason == Reason::Decl || IntroReason == Reason::APIBoundary);
assert(IntroReason == Reason::Decl ||
IntroReason == Reason::DeclImplicit);
return D;
}

Expand Down Expand Up @@ -163,8 +168,8 @@ class TypeRefinementContext : public ASTAllocated<TypeRefinementContext> {

SourceRange SrcRange;

/// A canonical availability info for this context, computed top-down from the root
/// context (compilation deployment target).
/// A canonical availability info for this context, computed top-down from the
/// root context.
AvailabilityContext AvailabilityInfo;

/// If this context was annotated with an availability attribute, this property captures that.
Expand Down Expand Up @@ -194,8 +199,8 @@ class TypeRefinementContext : public ASTAllocated<TypeRefinementContext> {

/// Create a refinement context for the given declaration.
static TypeRefinementContext *
createForAPIBoundary(ASTContext &Ctx, Decl *D, TypeRefinementContext *Parent,
const AvailabilityContext &Info, SourceRange SrcRange);
createForDeclImplicit(ASTContext &Ctx, Decl *D, TypeRefinementContext *Parent,
const AvailabilityContext &Info, SourceRange SrcRange);

/// Create a refinement context for the Then branch of the given IfStmt.
static TypeRefinementContext *
Expand Down
4 changes: 0 additions & 4 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,6 @@ namespace swift {
/// in calls to generic functions.
bool EnableOpenedExistentialTypes = false;

/// Enable support for parameterized protocol types in existential
/// position.
bool EnableParameterizedExistentialTypes = false;

/// Enable experimental flow-sensitive concurrent captures.
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;

Expand Down
7 changes: 6 additions & 1 deletion include/swift/Basic/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ class Version {
/// Return this Version struct as the appropriate version string for APINotes.
std::string asAPINotesVersionString() const;

/// Parse a version in the form used by the _compiler_version \#if condition.
/// Parse a version in the form used by the _compiler_version(string-literal)
/// \#if condition.
///
/// \note This is \em only used for the string literal version, so it includes
/// backwards-compatibility logic to convert it to something that can be
/// compared with a modern SWIFT_COMPILER_VERSION.
static Optional<Version> parseCompilerVersionString(StringRef VersionString,
SourceLoc Loc,
DiagnosticEngine *Diags);
Expand Down
4 changes: 0 additions & 4 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,6 @@ def enable_explicit_existential_types :
Flag<["-"], "enable-explicit-existential-types">,
HelpText<"Enable experimental support for explicit existential types">;

def enable_parameterized_existential_types :
Flag<["-"], "enable-parameterized-existential-types">,
HelpText<"Enable experimental support for parameterized existential types">;

def enable_experimental_opened_existential_types :
Flag<["-"], "enable-experimental-opened-existential-types">,
HelpText<"Enable experimental support for implicitly opened existentials">;
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SILOptimizer/Analysis/Reachability.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class BackwardReachability {
/// Effect effectForPhi(SILBasicBlock *);
///
/// /// The uses from which reachability will begin.
/// ArrayRef<SILInstruction *> gens();
/// iterable gens();
/// }
template <typename Effects>
class IterativeBackwardReachability final {
Expand Down
Loading