Pavel Yaskevich
773ea6b10c
[TypeChecker] Require a coercion if result of protocol member access would loose information
...
Accessing members on the protocol could result in existential opening and subsequence
result erasure, which requires explicit coercion if there is any loss of generic requirements.
2022-05-25 16:07:06 -07:00
Pavel Yaskevich
f7c4ff6847
[ConstraintSystem] Adjust getCalleeLocator to handle implicit callAsFunction
...
A call to `.callAsFunction` could be injected after initializer if the type is
callable, `getCalleeLocator` should recognize that situation and return
appropriate locator otherwise if `callAsFunction` has e.g. a result builder
attached to one of its parameters the solver wouldn't be able to find it.
Resolves: rdar://92914226
2022-05-10 10:04:06 -07:00
Pavel Yaskevich
c05a07af05
Revert "[ConstraintSystem] Extend availability check to cover unavailable ext…"
2022-04-29 15:19:25 -07:00
Evan Wilde
8b2ccd9ed5
Merge pull request #58429 from etcwilde/ewilde/disjunction-main-resolution
...
Use Disjunction Constraint to find main function
2022-04-28 09:31:45 -07:00
Pavel Yaskevich
a240c0f637
Merge pull request #58466 from xedin/rdar-92364955
...
[ConstraintSystem] Extend availability check to cover unavailable ext…
2022-04-27 20:31:02 -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
9a32db7871
[ConstraintSystem] Extend availability check to cover unavailable extensions
...
The solver used to check availability attribute on the declaration
itself, a better approach is to go through `AvailableAttr::isUnavailable`
because that also covers unavailable extensions.
Resolves: rdar://92364955
2022-04-27 14:00:12 -07:00
Evan Wilde
5dfc6b8b72
Ignore async/sync mismatch on main
...
The main function is different from other function resolutions. It isn't
being called from a synchronous or asynchronous context, but defines
whether the program starts in a synchronous or async context. As a
result, we should not prefer one over the other, so the scoring
mechanism shouldn't involve the async/sync score when resolving the main
function.
This patch adds a constraint solver flag to ignore async/sync context
mismatches so that we do not favor one over the other, but otherwise use
the normal resolution behavior.
2022-04-26 16:29:51 -07:00
Evan Wilde
94e30a817e
Revert "Add -async-main flag to favor asynchronous main"
...
This reverts commit da0a3311a5 .
2022-04-26 16:29:45 -07:00
Pavel Yaskevich
6a65810d30
[Constraint] NFC: Rename ClosureBodyElement to SyntacticElement
...
`SyntacticElement` represents a statement, pattern, declaration,
condition, or expression and could originate from i.e. a closure,
a function or a result builder body.
2022-04-26 09:55:04 -07:00
Pavel Yaskevich
a40e8e80c1
[ConstraintSystem] Use affected range (if any) to diagnose 'too complex' failures
2022-04-25 14:09:45 -07:00
Pavel Yaskevich
ef2f24b82a
[ConstraintSystem] Save "too complex" source range if known
...
This would help to diagnose the initial point where constraint
system has been determine to be "too complex"
2022-04-25 10:31:57 -07:00
Pavel Yaskevich
7dab90cd98
[ConstraintSystem] NFC: Drop Expression from isTooComplex check
...
Solver can now handle multiple different targets e.g. multi-statement
closures, result builders etc. So it's more appropriate to say that
the constraint system is too complex.
2022-04-25 10:14:39 -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
1c426a30d1
Merge pull request #42484 from xedin/drop-se-0326-flag
...
[TypeChecker] NFC: Remove `-experimental-multi-statement-closures` flag
2022-04-20 14:39:35 -07:00
Pavel Yaskevich
6db0001863
[TypeChecker] NFC: Remove -experimental-multi-statement-closures flag
...
SE-0326 has been enabled by default, so this flag is no longer necessary.
2022-04-20 10:40:27 -07:00
Anthony Latsis
934964d49d
Use AbstractStorageDecl::isSettableInSwift to prohibit direct writes to optional requirements
...
Stop pretending that an optional requirement is immutable via the `StorageImplInfo` request.
This approach has lead astray the conformance checker and may have had a negative impact
on other code paths, and it doesn't work for imported declarations because they bypass the
request. Instead, use a forwarding `AbstractStorageDecl::isSettableInSwift` method
that special-cases optional requirements.
2022-04-20 14:27:15 +03:00
Alex Hoppen
0b9644a0d4
[CodeCompletion] Report type relations when completing inside result builders
...
This requires navigating the constraint system solution to retrieve the argument type of the `buildBlock` call. The comments in the code should describe what I’m doing well enough.
rdar://83846531
2022-04-08 11:24:31 +02:00
Alex Hoppen
ed58b689a1
[CodeCompletion] Allow references to top-level functions with error parameters
...
During normal type-checking we ignore functions that contain an error. During code completion, we want to consider them and replace all error types by placeholders so we can match up the known types.
We already do this for member types (see `getTypeOfMemberReference`). We should also do it for top-level functions.
Fixes rdar://81425383 [SR-14992]
2022-04-06 10:10:09 +02:00
Evan Wilde
4494db946c
Merge pull request #42142 from etcwilde/ewilde/async-main-resolution
...
Fixing async main resolution
2022-04-04 10:25:29 -07:00
Alex Hoppen
0ded798ceb
Merge pull request #42006 from ahoppen/pr/prepare-for-migrate-postfixexprparen
...
[CodeCompletion][Sema] Multiple improvements to prepare for migration of PostfixExprParen to solver-based
2022-04-03 16:43:36 +02:00
Evan Wilde
2eb801145e
Merge branch 'main' into ewilde/async-main-resolution
2022-04-02 16:15:10 -07:00
Evan Wilde
da0a3311a5
Add -async-main flag to favor asynchronous main
...
This flag biases the overload checker in favor of selecting an
asynchronous main function over a synchronous main. If no asynchronous
main function exists, a synchronous one will still be selected.
Likewise, if the flag is not passed and there are only asynchronous main
functions available, the most specific asynchronous main function will
still be selected.
2022-04-02 16:14:01 -07:00
Doug Gregor
b94d6eb874
Merge pull request #42121 from xedin/rdar-91110069
...
[ConstraintSystem] Fix a bug in existential Self erasure
2022-03-31 20:55:34 -07:00
Pavel Yaskevich
9e3432a833
[ConstraintSystem] Fix a bug in existential Self erasure
...
`typeEraseExistentialSelfReferences` shouldn't account for
contextual signature because that signature could have
generic parameters of it's own unrelated to the reference
which would be located before generic parameters of the
member, e.g. when the code is located in a protocol extension,
which invalidates the assumption that `Self` is located at
depth = 0, index = 0.
Resolves: rdar://91110069
2022-03-31 13:19:33 -07:00
Doug Gregor
89ab4aac30
Fix the "early" computation of a return type to respect @preconcurrency.
...
Fixes rdar://91087622.
2022-03-31 12:46:00 -07:00
Anthony Latsis
324913055d
CS: Handle unbound references to @objc optional methods
2022-03-30 19:11:29 +03:00
Alex Hoppen
237376b980
[CodeCompletion] Call into simplifyTypeImpl when simplifying a type for code completion
...
This makes sure we e.g. resolve dependent member types after we perform type variable to generic parameter substitutions for code completion
2022-03-25 09:36:05 +01:00
Doug Gregor
38c9d2e8dd
Merge pull request #41992 from DougGregor/implicit-existential-opening-erase-or-reject
2022-03-23 21:03:54 -07:00
Doug Gregor
50451d2583
Type-erase contravariant uses of opened existentials in subsequent parameters.
...
When we open an existential argument in a call to a generic function,
type-erase contravariant uses of that opened existential in subsequent
parameters. This primarily impacts closure parameters, where we want
the closure to be provided with an existential parameter type rather
than permit the parameter to have opened existential type. This
prevents the opened existential type from being directly exposed in
the type system.
Note that we do not need to perform this erasure when the argument is
a reference to a generic function, because there it is suitable to
infer that the generic arguments are the opened archetypes. This
subsumes the use case for `_openExistential`.
2022-03-23 15:22:06 -07:00
Pavel Yaskevich
3c5a6f93e9
Merge pull request #41864 from xedin/improvements-for-diagnoseAmbiguity
...
[ConstraintSystem] Augment `diagnoseAmbiguity` to handle non-expression anchors
2022-03-21 10:00:19 -07:00
Alex Hoppen
17ac201b29
Merge pull request #39373 from ahoppen/pr/solver-based-arg-completion
...
[CodeCompletion] Migrate argument position completion to the solver-based implementation
2022-03-17 22:41:59 +01:00
Pavel Yaskevich
ebdef12fe1
[ContraintSystem] Augment diagnoseAmbiguity to diagnose non-expression ambiguities
...
Since constraint solver can now handle statements, patterns, and declarations,
it's possible to that ambiguity could be detected in a non-expression context,
for example - pattern matching in switch statements. Augment `diagnoseAmbiguity`
to accept overloads with non-expression anchors and diagnose them in order of
their appearance in a solution.
2022-03-17 13:02:20 -07:00
Alex Hoppen
f538d33e5f
[CodeCompletion][Sema] Migrate CallArgurment position completion to the solver-based implementation
...
This hooks up call argument position completion to the typeCheckForCodeCompletion API to generate completions from all the solutions the constraint solver produces (even those requiring fixes), rather than relying on a single solution being applied to the AST (if any).
Co-authored-by: Nathan Hawes <nathan.john.hawes@gmail.com >
2022-03-17 15:15:54 +01:00
Pavel Yaskevich
01691d6497
[ConstraintSystem] ExpressionTimer: Simplify locators only if allotted time has been exceeded
2022-03-17 00:51:25 -07:00
Pavel Yaskevich
eb6b267848
[ConstraintSystem] Implement simplification of Witness, WrappedValue, OptionalPayload, and IUO Choice
2022-03-17 00:51:25 -07:00
Pavel Yaskevich
a9e92111fc
[ConstraintSystem] Augment condition/ternary simplication to support statements
2022-03-17 00:51:20 -07:00
Pavel Yaskevich
9bd05b7a00
[ConstraintSystem] Implement simplication of ImplicitConversion element
2022-03-16 14:29:16 -07:00
Pavel Yaskevich
8fe78d485e
[ConstraintSystem] Implement simplication of {Pack, PatternBinding}Element elements
2022-03-16 14:27:17 -07:00
Pavel Yaskevich
029b11234b
[ConstraintSystem] Implement simplication of generic requirement elements
2022-03-16 14:25:39 -07:00
Pavel Yaskevich
46ecae37e9
[ConstraintSystem] Implement simplication of Opened{Generic, OpaqueArchetype} elements
2022-03-16 14:25:05 -07:00
Pavel Yaskevich
3d8333bd71
[ConstraintSystem] Implement simplication of KeyPath{Root, Value} elements
2022-03-16 14:24:31 -07:00
Pavel Yaskevich
9dbda8573c
[ConstraintSystem] Implement simplication of GenericParameter element
2022-03-16 14:23:38 -07:00
Pavel Yaskevich
6f3203dba1
[ConstraintSystem] Implement simplication of {DynamicLookup, KeyPathComponent}Result elements
2022-03-16 14:22:58 -07:00
Pavel Yaskevich
3f47ed2365
[ConstraintSystem] Implement simplication of {Function, Generic, Synthesized}Argument elements
2022-03-16 14:22:09 -07:00
Pavel Yaskevich
3b4c637b0a
[ConstraintSystem] Implement simplication of assorted Type elements
2022-03-16 14:20:50 -07:00
Pavel Yaskevich
fed7c69112
[ConstraintSystem] Implement simplication of ClosureBodyElement element
2022-03-16 11:34:30 -07:00
Pavel Yaskevich
696c8f1d9d
[ConstraintSystem] Implement simplication of PatternMatch element
2022-03-16 11:34:20 -07:00
Slava Pestov
5bb40ae66e
Sema: Fix doesMemberHaveUnfulfillableConstraintsWithExistentialBase() for generic context
...
We don't want to pass in the outer generic signature here.
The base type's constraint type is written in terms of archetypes,
and we run generic signature queries against it with types appearing
in the protocol member. Since the protocol member has Self at
depth 0, index 0, prepending the outer generic signature to the
opened existential signature would produce incorrect results.
2022-03-09 17:27:06 -05:00
Slava Pestov
3f8e4e7442
AST: Fix mistake with generic signature in findExistentialSelfReferences()
...
We used to concatenate the DeclContext's generic signature with the
protocol requirement's signature, then look for occurrences of the
first generic parameter from the DeclContext's signature in the
requirement's type.
This almost worked, except when the first generic parameter from the
DeclContext's signature didn't conform to a protocol referenced by
an associated type. In that case, we would falsely report that there
are no 'Self' references.
Note that the CHECK lines in test/SILGen/witnesses_class.swift change
to what they were before 01d9d61cc8 .
2022-03-09 02:38:09 -05:00