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
fc1ed430b9
[CSFix] Implement missing existential coercion fix
2022-05-25 16:07:05 -07:00
Pavel Yaskevich
8306724d81
[CSFix] Add a skeleton fix to require explicit existential coercion
2022-05-25 16:07:05 -07:00
Pavel Yaskevich
f3ff87b6f4
[Diagnostics] Diagnose re-labeling failures in ambiguity conditions
...
If all solutions point to the same overload choice that needs
re-labeling it's safe to diagnose it as if there was no ambiguity
because the call site is static.
2022-05-13 14:25:14 -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
Luciano Almeida
99f1704873
[CSFix] Create a fix for checked cast that always fail and existential to CFType
2022-04-13 22:13:48 -03:00
Pavel Yaskevich
82b955b93c
[CSDiagnostics] Detect and diagnose contextual mismatches with default value
2022-02-21 09:59:54 -08:00
Pavel Yaskevich
94188b87f6
[CSDiagnostics] Diagnose ambiguous empty closures
...
- Allow `SpecifyClosureReturnType` to be diagnosed in ambiguous context
- Add a tailoed diagnostic for when it's impossible to infer a type of
an empty closure
Resolves: rdar://88256059
2022-02-04 20:33:12 -08:00
Pavel Yaskevich
d5b11a6136
[CSFix] Make it possible to diagnose calls to non-functions in ambiguity contexts
...
Resolves: rdar://86611718
2021-12-20 18:12:45 -08:00
Pavel Yaskevich
2bf05b96e5
[CSFix] Make it possible to diagnose keypath inference failure in ambiguous contexts
...
Resolves: rdar://85458997
2021-12-20 15:03:28 -08:00
Pavel Yaskevich
a6755f1754
[CSFix] Diagnose multiple solutions with missing closure param as un-ambiguous
...
If there are multiple overloads and all of them require closure
to have a parameter, let's diagnose that as such instead of
ambiguity.
2021-12-03 10:53:28 -08:00
Doug Gregor
365f0afa9f
Downgrade concurrency-related function type errors in existing code
...
When in "existing" Swift code that is Swift 5.x and has not adopted
concurrency, allow mismatches in function types that only involve
ABI-neutral concurrency changes (e.g., adding `@Sendable` or removing
a global actor) by downgrading the diagnostic to a warning. This
improves the story for incremental adoption of concurrency in an
existing code base.
As part of this, generalize the facility for downgrading an error to a
warning when performing diagnostics in the constraint solver, using the
new diagnostic behavior limits rather than duplicating diagnostics.
2021-12-02 10:33:01 -08:00
Pavel Yaskevich
bc54bc6bb7
Revert "[TypeChecker] SE-0326: Enable multi-statement closure inference by default"
2021-11-29 17:26:08 -08:00
Xi Ge
03c76bd32d
sema: diagnose passing a non-constant value into a constant parameter
2021-11-22 11:52:57 -08:00
Hamish Knight
237338b504
Merge pull request #40224 from hamishknight/super-tuple-shuffle
2021-11-18 09:50:09 +00:00
Hamish Knight
4aaec65780
[CS] Warn on mismatched tuple labels for subtyping
...
This is something that we'd like to fix to bring
in line with tuple conversion, so start warning on
cases where it occurs.
2021-11-17 17:06:21 +00:00
Pavel Yaskevich
3f78f4d238
[CSFix] Diagnose multiple solutions with missing closure param as un-ambiguous
...
If there are multiple overloads and all of them require closure
to have a parameter, let's diagnose that as such instead of
ambiguity.
2021-11-15 16:42:04 -08:00
Pavel Yaskevich
4343227d19
[Diagnostics] Determine affected elements early in collection element mismatches
...
Diagnostics cannot assume that solution would always be applied
to the constraint system, so all of the elements affected by the
mismatch have to be determined by the fix.
Resolves: rdar://85021348
2021-11-12 10:10:44 -08:00
Pavel Yaskevich
f53bcea60c
[CSFix] Add a tailored fix for invalid Swift -> C pointer conversions
...
This is a skeleton of a fix that would be used to diagnose situations
when Swift -> C pointer conversion was attempted on a Swift function.
2021-09-20 17:22:26 -07:00
Pavel Yaskevich
06a762b64a
[CSFix] Add a specific kind for IgnoreResultBuilderWithReturnStmts
2021-09-10 15:46:27 -07:00
Pavel Yaskevich
0a425480d0
[CSFix] NFC: Rename fix/diagnostic for checked casts that always succeed
2021-09-10 13:55:15 -07:00
Pavel Yaskevich
4c845972b4
[CSFix] Require all sub-classes of ContextualMismatch to supply a kind
2021-09-10 13:18:37 -07:00
Pavel Yaskevich
0f2ee14cad
[CSFix] Add a specific kind for CollectionElementContextualMismatch
2021-09-10 13:07:22 -07:00
Pavel Yaskevich
152cf0b66c
[CSFix] Add a specific kind for IgnoreKeyPathContextualMismatch
2021-09-10 13:01:26 -07:00
Pavel Yaskevich
48cdb58a91
[CSFix] Add a specific kind for AllowInOutConversion
2021-09-10 12:55:26 -07:00
Pavel Yaskevich
4f5b33b4dd
[CSFix] Add a specific kind for IgnoreAssignmentDestinationType
2021-09-10 12:48:14 -07:00
Pavel Yaskevich
2e5ab93f0f
[CSFix] Add a specific kind for IgnoreContextualType
2021-09-10 12:42:34 -07:00
Pavel Yaskevich
04b35e4c26
[CSFix] Add a specific kind for AllowAutoClosurePointerConversion
2021-09-10 12:37:08 -07:00
Pavel Yaskevich
934e875e7f
[CSFix] Add a specific kind for DropAsyncAttribute
2021-09-10 12:30:02 -07:00
Pavel Yaskevich
d1d2846baa
[CSFix] Add a specific kind for DropThrowsAttribute
2021-09-10 12:21:26 -07:00
Pavel Yaskevich
057563e783
[CSFix] Add a specific kind for AddSendableAttribute
2021-09-10 12:15:10 -07:00
Pavel Yaskevich
1039b76671
[CSFix] NFC: Fix code formatting for SpecifyKeyPathRootType fix
2021-09-10 10:02:47 -07:00
Pavel Yaskevich
3265042eff
[CSFix] NFC: Add classof implementation to most of the fixes
2021-09-10 10:00:45 -07:00
Pavel Yaskevich
3fac0fefc9
[CSFix] Add a skeleton of weak pattern with non-optional type fix
2021-09-07 17:36:56 -07:00
Frederick Kellison-Linn
5f07747cb3
[Sema] Diagnose user-specified placeholders which couldn’t be resolved
2021-08-19 14:53:33 -04:00
Pavel Yaskevich
4b0d9a2509
[ResultBuilders] Diagnose pre-check errors inline
...
Not all of the pre-check errors could be diagnosed by re-running
`PreCheckExpression` e.g. key path expressions are mutated to
a particular form after an error has been produced.
To make the behavior consistent, let's allow pre-check to emit
diagnostics and unify pre-check and constraint generation fixes.
Resolves: rdar://77466241
2021-05-10 11:06:58 -07:00
Strieker
4e2b67cbae
[NFC] Resolved merge conflict in CSSimplify.cpp after making changes to improve error handling for composed wrapped value mismatches
2021-04-22 11:49:21 -07:00
Strieker
c9b53ec66f
[ConstraintSystem] Created a locator in CSGen to store the location where the wrappedValue type of a property wrapper was determined and added necessary logic so that a constraint locator can recognize a composed property wrapper’s wrapped value type in CSFix.cpp, CSFix.h, and CSSimplify.cpp.
2021-04-22 11:31:41 -07:00
Holly Borla
76c4c3dc3f
[Diagnostics] Add back a dedicated fix/diagnostic for using an invalid
...
type as a property wrapper.
2021-03-24 11:24:21 -07:00
Holly Borla
f05589f6c4
[Diagnostics] Improve diagnostics for passing an invalid projected
...
value argument.
2021-03-24 11:24:21 -07:00
Doug Gregor
52096a640e
SE-0302: Rename ConcurrentValue/@concurrent to Sendable/@Sendable.
2021-03-18 23:48:21 -07:00
Doug Gregor
d6fc1fd60f
Implement conversions for global-actor-qualified functions.
...
One can convert from a function value without a global actor to a
similar function type that does have a global actor, but one cannot
remove or change a global actor on a function type.
2021-03-17 00:51:26 -07:00
Holly Borla
133dec0e05
[ConstraintSystem] Implement implicit property wrapper attribute
...
inference for closure parameters.
2021-02-25 18:35:14 -08:00
Holly Borla
ea3fe03c98
[Property Wrappers] Add a constraint fix and diagnostic for the case
...
where the programmer tries to pass a projection argument to a wrapped
parameter without 'var projectedValue'.
2021-02-25 18:35:14 -08:00
Pavel Yaskevich
e8f7a71870
[CSBindings] Update static member lookup to utilize new isDelayed API
2021-02-23 11:33:11 -08:00
Pavel Yaskevich
618f5633c0
[CSFix] NFC: Fix a bad rebase of invalid static member lookup fix
2021-02-23 11:33:11 -08:00
Pavel Yaskevich
03d869ad8b
[Diagnostics] Extract invalid result type from overload choice
...
Instead of threading it through the constraint system all the way
to a diagnostic, let's extract it from overload choice instead.
2021-02-23 11:33:10 -08:00
Pavel Yaskevich
9231acf202
[Diagnostics] Implement a tailored diagnostic for invalid static member refs on protocol metatypes
2021-02-23 11:32:24 -08:00
Pavel Yaskevich
eaabd24746
[CSFix] Add a new fix to diagnose invalid static member refs on protocol metatype
2021-02-23 11:32:24 -08:00
Pavel Yaskevich
2274e17843
[CSFix] Allow diagnosing the same out-of-order argument in ambiguity cases
...
Is the same argument is out-of-order in multiple solutions, let's
diagnose it as if there was no ambiguity.
Resolves: SR-14093
Resolves: rdar://73600328
2021-02-18 17:21:49 -08:00