Commit Graph

2063 Commits

Author SHA1 Message Date
Doug Gregor
0674058ba0 Introduce more AST function conversions for @preconcurrency-adjusted types.
When referring to a `@preconcurrency` function as a value, use the normal
type for the initial declaration reference and then introduce an
appropriate function conversion expression to the adjusted type.

Fixes more issues related to rdar://94597323.
2022-06-30 17:00:56 -07:00
Doug Gregor
01c2e42354 Introduce a function conversion for "adjusted" dynamic member references.
When we have adjusted the type of a dynamic member reference (e.g.,
for `@objc optional` methods) due to `@preconcurrency` or similar,
form the original dynamic member reference based on the original type
and then introduce an appropriate conversion. This better reflects the
adjustment in the AST, eliminating a SIL verifier crash.

Fixes rdar://94597323.
2022-06-30 17:00:32 -07:00
Doug Gregor
248b72bbff Track the pre-adjusted "reference" type for declaration reference. 2022-06-30 17:00:32 -07:00
Doug Gregor
1063e8126e [Constraint system] Track the original opened type for a selected overload. 2022-06-30 17:00:31 -07:00
Pavel Yaskevich
3fd3ff0637 [TypeChecker] Adjust Double<->CGFloat conversion to always preserve its location
Unfortunately current approach of making a conversion independent of location
doesn't work when conversion is required for multiple arguments to the
same call because solver expects that either there are no Double<->CGFloat
conversions, or one of them has already been applied which is not the case.

The reason why locations weren't preserved in the first place is due to
how a solution is applied to AST - AST is mutated first and then, if there
are any conversions, they are applied to the already mutated version of
original AST. This creates a problem for Double<->CGFloat which depends
on an overload choice of injected call and it's impossible to find it based
on the mutated AST. But it turns out that this is only an issue in two
specific cases - conversions against contextual type and after optional injection.
This situations could be mitigated by dropping parts of the locator which are
unimportant for the Double<->CGFloat conversion - anchor in case of contextual
and `OptionalPayload` element(s) in case of optional injection.

Resolves: https://github.com/apple/swift/issues/59374
2022-06-28 13:47:47 -07:00
Doug Gregor
5c05da0a1d Merge pull request #59699 from ktoso/revert-dist-properties
[Distributed] Revert "#59481 distributed-computed-properties"
2022-06-24 21:29:41 -07:00
Holly Borla
0053526c5d Merge pull request #41909 from hborla/existential-any-anyobject
[Sema] Use `ExistentialType` for `Any` and `AnyObject`.
2022-06-24 20:51:50 -07:00
Konrad `ktoso` Malawski
6a2778645f Revert "Merge pull request #59481 from xedin/distributed-computed-properties"
This reverts commit 8125a85a8f, reversing
changes made to 728971c5b7.
2022-06-25 08:49:00 +09:00
Pavel Yaskevich
dc314eb3ae [CSApply] Generalize fully type-checked target printing
Changes `Fully type-checked` output to print any target that
could be represented as an ASTNode.
2022-06-20 11:32:25 -07:00
Konrad `ktoso` Malawski
8125a85a8f Merge pull request #59481 from xedin/distributed-computed-properties
[TypeChecker] Implement distributed computed properties
2022-06-18 15:58:44 +09:00
Pavel Yaskevich
a391043e84 Merge pull request #59260 from amritpan/multi-statement-closure-output
[CSApply] Fixed type-checked subexpression output bug for multi-state…
2022-06-17 23:24:44 -07:00
Holly Borla
429488f6c9 [Sema] Use ExistentialType for Any and AnyObject. 2022-06-17 18:29:15 -07:00
Amritpan Kaur
d7266d6733 [CSApply] Denote type-checked expressions as partially, fully, or type-checked to show their application solution status, as applicable for tap expressions and multi-statement closures. 2022-06-17 18:01:29 -07:00
Pavel Yaskevich
fa2e64c1fd [Distributed] Sema: Add a new distributed-thunk attribute
The attribute comes handy during solution application to
determine whether the call is using a distributed thunk.
2022-06-17 12:35:54 -07:00
Pavel Yaskevich
1032da2d6e [CSApply] Fix distributed thunk requirement check to handle non-parameter/capture base
If distributed memeber is referenced on a base that represents
a result of some expression which is not a variable, parameter,
or a capture it should always be dispatched via a thunk.
2022-06-17 12:35:54 -07:00
Pavel Yaskevich
4fa74c238f [AST] ApplyExpr: Rename shouldApplyDistributedThunk to usesDistributedThunk
Since the thunk is applied to expression during solution application,
the use of this flag has shifted towards stating the fact.
2022-06-17 12:35:54 -07:00
Pavel Yaskevich
cae01486c6 [CSApply] Distributed: Inject distributed thunk when necessary
Replace distributed member references with distributed thunks
when access happens outside of distributed actor context. This
significantly simplifies distributed compute properties implementation.
2022-06-17 12:35:48 -07:00
Amritpan Kaur
3a38d7a899 [CSApply] Fixed type-checked subexpression output bug for multi-statement closures. 2022-06-16 17:10:14 -07:00
Pavel Yaskevich
066bbd18eb [CSClosure] Fix handling of property wrapped pattern bindings
Property wrappers trigger initializer synthesis. Synthesized
initializers should not be re-typechecked when encountered e.g.
 while re-solving closure with a different contextual type.

Resolves: https://github.com/apple/swift/issues/59294
Resolves: rdar://94506352
2022-06-07 13:41:53 -07:00
Pavel Yaskevich
644a720ce6 Merge pull request #59003 from xedin/rdar-92177656
[TypeChecker] Rework type-checking of `for-in` statements
2022-06-02 14:58:56 -07:00
Anthony Latsis
d113ca6bd2 CSApply: Fix several issues with non-failable to failable/throwing initializer delegation/chaining diagnostics
* Delegated-to `Optional` ctors were always handled as if they were failable, resulting in false-positive delegation errors.
* Delegations via `try?` were not diagnosed if the called ctor had IUO failability on top of being `throws`. SILGen would then handle the `try?` as if it was a `try!`.
* Delegations via `try?` were diagnosed with the wrong message if the `try?` was nested inside a `try!`, e.g. `try! try self.init(nonFailable:)`
* If there are issues with both `try?` and failability of the called initializer, diagnose both.
2022-06-01 00:11:45 +03:00
Pavel Yaskevich
b7860ea055 [TypeChecker] Split for-in sequence into parsed and type-checked versions 2022-05-30 23:17:41 -07:00
Pavel Yaskevich
5f0dcb572b [ConstraintSystem] Implicitly open existential type of for-in sequence
This allows to use `for-in` statement to iterate over i.e. `any Collection`
and other existentials that conform to `Sequence` protocol.
2022-05-30 23:17:41 -07:00
Pavel Yaskevich
86165291aa [TypeChecker] Change the way for-in statement in type-checked
Instead of asking SILGen to build calls to `makeIterator` and
`$generator.next()`, let's synthesize and type-check them
together with the rest of for-in preamble. This greatly simplifies
interaction between Sema and SILGen for for-in statements.
2022-05-30 23:17:41 -07:00
Pavel Yaskevich
22daa865b5 [ConstraintSystem] Make for-in solution application target standalone
Previously for-in target was actually an expression target, which means
certain type-checking behavior. These changes make it a standalone target
with custom behavior which would allow solver to introduce implicit
`makeIterator` and `next` calls and move some logic from SILGen.
2022-05-30 23:17:41 -07:00
Doug Gregor
6d82448dc8 Add -enable-experimental-feature X for experimental features.
Experimental features can only be enabled in non-production (+Asserts)
builds. They can be detected with `hasFeature` in the same manner as
"future" features.

The `-enable-experimental-feature X` flag will also look for future
features by that name, so that when an experimental feature becomes an
accepted future feature, it will still be enabled in the same manner.

Switch variadic generics over to this approach, eliminating the
specific LangOption for it.
2022-05-26 11:50:39 -07:00
Pavel Yaskevich
0a5b3f0727 [TypeChecker] SE-0324: Extend Swift -> C pointer conversions to inout
Fixes an oversight where `inout` -> C pointer conversion wasn't covered
by implementation of new pointer conversion semantics proposed by SE-0324.

Resolves: rdar://92583588
2022-05-25 20:55:22 -07:00
Pavel Yaskevich
1359840ab3 Merge pull request #58400 from xedin/too-complex-improvements
[ConstraintSystem] Improve precision of "too complex" diagnostic
2022-04-27 19:58:31 -07:00
Pavel Yaskevich
a40e8e80c1 [ConstraintSystem] Use affected range (if any) to diagnose 'too complex' failures 2022-04-25 14:09:45 -07:00
Doug Gregor
0e98bf28f0 Introduce missing Sendable conformances for existential conversions
When performing conversions to an existential that involves Sendable,
introducing missing conformances as needed to allow the type-check to
succeed and then (later) they'll be diagnosed appropriately.

Fixes rdar://89992095.
2022-04-22 23:56:58 -07:00
Pavel Yaskevich
384d508200 Merge pull request #42483 from xedin/rdar-90366182
[CSApply] Rewrite types of a constructed tuple
2022-04-21 10:00:40 -07:00
Josh Soref
4c77c59269 Spelling sema (#42474)
* spelling: accessibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: accessories

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: adjustments

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: all

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ambiguous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: arguments

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: assignment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: associated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: assumes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: auxiliary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: availability

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: belongs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: checking

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clazz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compatibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: completely

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: completion

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: complicated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conformance

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constrained

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contextual

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conversion

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: convertible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: couldn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declaration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: defaultable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: depending

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: describe

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: diagnostic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: diagnostics

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: existential

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: expects

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: explicit

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: explicitly

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: expression

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: first

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: font

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: forward

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: given

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: global

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: guarantee

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: happened

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hierarchy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: identical

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: immediately

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implicit

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: indicates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inferred

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initializer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: integrity

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interpolation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: introducing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: involved

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: just

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: like

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: likewise

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mismatch

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: missing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: more

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: necessarily

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: noescape

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: nonetheless

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occurrences

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: operators

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: optional

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: otherwise

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outside

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overload

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overridden

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: override

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parameter

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parameters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: penalize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: platforms

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: precedence

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preemptively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preliminary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preserve

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: propagate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: propagated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: qualifier

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: question

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: really

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: received

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: references

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: replaceable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: replacement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: representable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: representative

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requirement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requires

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: resolved

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: retrieve

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: rewriting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: satisfied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: semantics

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: signature

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: similar

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplest

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplification

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: solver

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: struct

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: structurally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: success

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sure

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: symmetric

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: syntactically

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: target

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: that

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: themselves

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: these

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: this

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transform

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transparent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: tread

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: truncation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: type

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unconstructable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: universally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unwrapped

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: versioned

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: visible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: where

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-20 15:12:46 -07:00
Pavel Yaskevich
879bd6578d [CSApply] Rewrite types of a constructed tuple
When construction call is rewritten into a tuple conversion,
rewriter has to make sure that AST types are reset otherwise
it would end up with types set by `packIntoImplicitTupleOrParen`
which could contain l-values.

Resolves: rdar://90366182
2022-04-20 10:35:06 -07:00
Luciano Almeida
a97879d46d Merge pull request #42254 from LucianoPAlmeida/refactor-diag-checked-cast
[Sema] Improvements on typeCheckCheckedCast and checked cast diagnostics
2022-04-15 16:39:36 -03:00
Pavel Yaskevich
018cd080c7 Merge pull request #42329 from xedin/builder-var
[BuilderTransform] Replace use of `TypeExpr` with a special $builderSelf variable
2022-04-15 09:36:05 -07:00
Pavel Yaskevich
fb4720d355 [BuilderTransform] Replace use of TypeExpr with a special $builderSelf variable
For all of the `build*` calls, let's use a special variable declaration
`$builderSelf` which refers to a type of the builder used. This allows
us to remove hacks related to use of `TypeExpr`. Reference to `$builderSelf`
is replaced with `TypeExpr` during solution application when the builder
type is completely resolved.
2022-04-14 21:16:48 -07:00
Luciano Almeida
a6ab3b613e [Sema] Refactor TypeChecker::typeCheckCheckedCast in order to remove all diagnostic emiting logic from it 2022-04-14 00:12:33 -03:00
Anthony Latsis
2d43be60f6 Merge pull request #41978 from AnthonyLatsis/dyn-unbound-ref
CSApply: Handle unbound references to methods found via dynamic lookup
2022-04-13 04:58:41 +03:00
John McCall
5519749ade [NFC] Collect protocol decls, not type, in ExistentialLayout
Another thing that will be necessary for correctness with
compositions of parameterized protocols.
2022-04-11 22:15:16 -04:00
Anthony Latsis
c9c5fe2345 CSApply: Handle unbound references to methods found via dynamic lookup 2022-04-12 05:12:28 +03:00
Anthony Latsis
3593f1b987 [NFC] CSApply: 'isPartialApplication' → 'needsCurryThunk' which is more accurate 2022-04-12 05:12:23 +03:00
Anthony Latsis
4c4e2b4f84 CSApply: Fix unbound ref to class method on protocol composition metatype 2022-04-12 05:10:58 +03:00
Doug Gregor
4c77d71f60 Reseat the "is distributed thunk" check onto actor reference checking.
Rather than write an appoximation of the "is distributed thunk" check
within the type checker, use the new actor reference checking logic with
a referenced actor that is synthesized from the information in the
constraint system.
2022-04-07 10:46:52 -07:00
Doug Gregor
eef2704c86 Reimplement actor isolation checking for referencing a declaration.
Start collapsing the several implementations of actor isolation checking
into a single place that determines what it means to reference a declaration
from a given context, potentially supplying an instance for an actor. This
is partly cleanup, and partly staging for the implementation of the
Sendable restrictions introduced in SE-0338. The result of this check
falls into one of three categories:

* Reference occurs within the same concurrency domain (actor/task)
* Reference leaves an actor context to a nonisolated context (SE-0338)
* Reference enters the context of the actor, which might require a
combination of implicit async, implicit throws, and a "distributed" check.

Throughout this change I've sought to maintain the existing semantics,
even where I believe they are incorrect. The changes to the test cases
are not semantic changes, but reflect the unification of some
diagnostic paths that changed the diagnostic text but not when or how
those diagnostics are produced. Additionally, SE-0338 has not yet been
implemented, although this refactoring makes it easier to implement
SE-0338.

Use this new actor isolation checking scheme to implement the most
common actor-isolation check, which occurs when accessing a member of
an instance.
2022-04-07 09:07:36 -07:00
Pavel Yaskevich
8b8ccb488a [ConstraintSystem] Cache types of ~= components
While synthesizing `~=` application for multi-statement closures or
result builder, solver shouldn't set types directly to newly
created AST nodes because they might not be fully resolved, instead
such types have to be recorded in the constraint system and then
set during solution application.

Resolves: rdar://91145060.
2022-04-01 14:00:43 -07:00
Anthony Latsis
4c2e88b207 Merge pull request #41849 from AnthonyLatsis/dyn_unbound_ref
CS: Handle unbound references to @objc optional methods
2022-03-31 04:01:20 +03:00
Anthony Latsis
324913055d CS: Handle unbound references to @objc optional methods 2022-03-30 19:11:29 +03:00
Pavel Yaskevich
a5a50a3658 [AST] NFC: Rename underlying type accessors of OpaqueTypeDecl
Adds a `Unique` component to the accessor names to draw the
distinction between unique and conditionally available substitutions.
2022-03-28 16:22:08 -07:00
Pavel Yaskevich
0c2b8419f6 [CSApply] NFC: Remove unused cs variable
After switching to use a declaration context of rewriter,
variable `cs` became obsolete.
2022-03-28 09:47:14 -07:00
Anthony Latsis
d877ff9e0d [NFC] CSApply: Delete the now dead 'buildCurryThunk' 2022-03-26 18:28:24 +03:00