Commit Graph

490 Commits

Author SHA1 Message Date
Pavel Yaskevich
db024d973e [CSDiagnostics] InitAccessors: Implement invalid member reference diagnostics within init accessors 2023-06-13 10:58:50 -07:00
Hamish Knight
c6dd3ad839 [CS] Diagnose UnresolvedPatternExprs as part of constraint solving
Instead of diagnosing in CSApply, let's create a
fix and diagnose in the solver instead.
Additionally, make sure we assign ErrorTypes to
any VarDecls bound by the invalid pattern, which
fixes a crash.

rdar://110638279
2023-06-13 12:14:25 +01:00
Pavel Yaskevich
a987861d1c Merge pull request #65806 from xedin/rdar-108977234
[CSSimplify] Detect and diagnose conformance failures related to AnyHashable conversion
2023-05-16 09:56:41 -07:00
Pavel Yaskevich
406b7a62c7 Merge pull request #65718 from xedin/diagnose-missing-each-in-expr-context
[ConstraintSystem] Detect and diagnose missing 'each' and provide a fix-it
2023-05-15 16:18:55 -07:00
Pavel Yaskevich
c9c631109b [CSDiagnostics] NFC: Move FailureDiagnostic::resolveType out of header 2023-05-09 14:11:45 -07:00
Pavel Yaskevich
440bc39207 [Diagnostics] Don't print pack element archetypes in diagnostics 2023-05-09 14:11:45 -07:00
Pavel Yaskevich
eee7e1879f [CSDiagnostics] Add a diagnostic for missing each and provide a fix-it
Diagnose situations where value pack is referenced without an explicit 'each':

```
func compute<each T>(_: repeat each T) {}

func test<each T>(v: repeat each T) {
  repeat compute(v) // should be `repeat compute(each v)`
}
```
2023-05-08 13:30:51 -07:00
Pavel Yaskevich
ff527269ee Merge pull request #65610 from jreference/65330-unhelpful-error-contextually-required-as
[Sema] Fix issue 65330 Unhelpful error when missing contextually requ…
2023-05-06 12:00:03 -07:00
jreference
2cf01a18de [Sema] Fix issue 65330 Unhelpful error when missing contextually required as bridging conversion to AnyObject in structural position. Minor formatting change in previous test case 2023-05-06 10:47:15 +08:00
Hamish Knight
91209d4226 [CS] NFC: Factor out AllowAssociatedValueMismatch
This seems better suited as its own fix, rather
than as part of ContextualMismatch.
2023-05-04 14:53:57 +01:00
Pavel Yaskevich
cb2fdd9b54 [CSDiagnostics] Add a diagnostic for pack expansions without pack references 2023-05-02 09:32:19 -07:00
Pavel Yaskevich
c74824e1ab [CSDiagnostics] Diagnose situations when value pack expansion does expect a tuple argument
Diagnose situation when a single argument to tuple type is passed to
a value pack expansion parameter that expects distinct N elements:

```swift
struct S<each T> {
  func test(x: Int, _: repeat each T) {}
}

S<Int, String>().test(x: 42, (2, "b"))
```
2023-05-02 09:32:19 -07:00
Pavel Yaskevich
b5aae065c2 [CSDiagnostics] Unwrap some packs types for diagnostics
If diagnostic references a `Pack{repeat ...}` unwrap it to underlying
pattern.
2023-05-02 09:32:19 -07:00
Pavel Yaskevich
9365211d28 [CSDiagnostics] Teach generic parameter restoration logic about pack expansions
Just like in any other position, let's restore unresolved type variables
that represent generic parameters to their generic parameter type when
they are found in a pack expansion pattern type.
2023-05-02 09:32:19 -07:00
Holly Borla
da3079de05 [ConstraintSystem] Diagnose pack expansion expressions in non-variadic contexts. 2023-03-21 21:58:05 -07:00
Holly Borla
c60b4860ab Merge pull request #64498 from hborla/diagnose-pack-outside-expansion-expr
[ConstraintSystem] Enforce `TVO_CanBindToPack`, and diagnose pack references outside of pack expansion expressions.
2023-03-21 14:00:52 -07:00
Holly Borla
cb19fc3a71 [ConstraintSystem] Enforce TVO_CanBindToPack, and diagnose pack references outside
of pack expansion expressions.
2023-03-20 20:13:48 -07:00
Alex Hoppen
cebc084367 [CS] Fix locator simplification with 'Member' path element
Previously, a `Member` path element in a `ConstraintLocator` was simplified to the base on which the member was accessed. This is incorrect.
2023-03-20 09:19:21 -07:00
Luciano Almeida
4ebedc8333 [Sema] Adjust getCalleeLocator to look into coercion operand 2023-03-14 23:06:11 -03:00
Luciano Almeida
5fee07b73f [CSDiagnostics] Adapt diagnostics to handle new CoercionOperand elt 2023-03-11 18:47:53 -03:00
Holly Borla
8012e45109 [Diagnostics] Diagnose pack element expressions containing a non-pack subexpression. 2023-03-05 00:11:54 -08:00
Andrew Trick
185e6fabd5 Add TypeBase::isArrayType helper API.
This is also needed in SIL diagnostics, not just Sema diagnostics,
because implicit Array conversion generates special SIL patterns.
2023-02-27 21:51:17 -08:00
zoecarver
d19b587c35 [cxx-interop] Update based on review feedback. 2023-02-20 14:57:50 -08:00
zoecarver
9ce9310df5 [cxx-interop] Offer fix-it to re-write ".at(42)" as "[42]".
Only applies to random access collections. The first of many fix-its like this :)
2023-02-20 14:57:50 -08:00
Kavon Farvardin
ab130883a3 Initial ban of move-only types from being used generically
Since values of generic type are currently assumed to always
support copying, we need to prevent move-only types from
being substituted for generic type parameters.

This approach leans on a `_Copyable` marker protocol to which
all generic type parameters implicitly must conform.

A few other changes in this initial implementation:

- Now every concrete type that can conform to Copyable will do so. This fixes issues with conforming to a protocol that requires Copyable.
- Narrowly ban writing a concrete type `[T]` when `T` is move-only.
2023-02-01 23:38:28 -08:00
Holly Borla
9b5cf1d2ff [Diagnostics] Remove the MacroMissingArguments constraint fix and its
associated failure diagnostic.

This constraint fix is unused now that MacroExpansionExpr always has an
argument list, and goes through the AddMissingArguments constraint fix for
this error.
2023-01-31 17:45:31 -08:00
Luciano Almeida
e513d23c0b [Sema] Improving global actor function mismatch diagnostic 2023-01-13 20:47:23 -03:00
Doug Gregor
71ca9c86e6 [Macros] Diagnose when we forget to provide macro arguments.
Unlike functions, you can't curry macros; diagnose when one omits the
arguments in a macro expansion of a macro that has a parameter list.
2023-01-02 21:22:04 -08:00
Doug Gregor
806b5a8777 [Macros] Diagnose errors where a macro is used without the '#'. 2023-01-02 21:22:04 -08:00
Holly Borla
e966b4ef7d [CSDiagnostics] Add an error message for pack expansion expressions over
packs that don't have the same shape.
2022-12-21 08:25:10 -05:00
Slava Pestov
88d7f63d71 Sema: Fix a comment 2022-10-27 13:46:58 -04:00
Slava Pestov
bb045423b3 Sema: Add diagnostics for ShapeOf constraint 2022-10-25 13:20:38 -04:00
Hamish Knight
bca941b152 [AST] NFC: Rename IfExpr -> TernaryExpr
This matches what we call it in SwiftSyntax, and
is just generally clearer.
2022-09-28 10:33:31 +01:00
Doug Gregor
3368dd4b6b Make the error for missing existential erasure coercions configurable. 2022-07-08 12:25:09 -07:00
Doug Gregor
c564698625 [Constraint solver] Improve modeling of fix behavior.
Rather than re-using `DiagnosticBehavior` to describe how a fix should
act, introduce `FixBehavior` to cover the differences between (e.g.)
always-as-awarning and downgrade-to-warning. While here, split the
`isWarning` predicate into two different predicates:

* `canApplySolution`: Whether we can still apply a solution when it
contains this particular fix.
* `affectsSolutionScore`: Whether

These two predicates are currently tied together, because that's the
existing behavior, but we don't necessarily want them to stay that way.
2022-07-07 12:17:11 -07:00
Doug Gregor
218a3f79e0 [Constraint solver] Downgrade/ignore concurrency issues more generally.
Instead of the `warning` Boolean threaded through the solver's
diagnostics, thread `DiagnosticBehavior` to be used as the behavior
limit. Use this for concurrency checking (specifically dropped
`@Sendable` and dropped global actors) so the solver gets more control
over these diagnostics.

This change restores the diagnostics to a usable state after the prior
change, which introduced extra noise. The only change from existing
beavior is that dropping a global actor from a function type is now
always a warning in Swift < 6. This is partly intentional, because
there are some places where dropping the global actor is well-formed.
2022-07-01 11:45:44 -07:00
Hamish Knight
c56ea461b6 [Sema] Add fix-it to import RegexBuilder
For code such as the following:

```
let r = Regex {
  /abc/
}
```

If RegexBuilder has not been imported, emit a
specialized diagnostic and fix-it to add
`import RegexBuilder` to the file.

Unfortunately we're currently prevented from
emitting the specialized diagnostic in cases where
the builder contains references to RegexBuilder
types, such as:

```
let r = Regex {
  Capture {
    /abc/
  }
}
```

This is due to the fact that we bail from CSGen
due to the reference to `Capture` being turned
into an `ErrorExpr`. We ought to be able to
handle solving in the presence of such errors, but
for now I'm leaving it as future work.

rdar://93176036
2022-06-28 11:38:41 +01:00
Holly Borla
429488f6c9 [Sema] Use ExistentialType for Any and AnyObject. 2022-06-17 18:29:15 -07:00
Pavel Yaskevich
62ba74950c [Diagnostics] Diagnose conflicting pattern variables
Diagnose situations where pattern variables with the same name
have conflicting types:

```swift
enum E {
case a(Int)
case b(String)
}

func test(e: E) {
  switch e {
  case .a(let x), .b(let x): ...
  }
}
```

In this example `x` is bound to `Int` and `String` at the same
time which is incorrect.
2022-06-03 16:31:27 -07:00
Pavel Yaskevich
6edab6a9a6 [Diagnostics] Prevent fix-it for explicit existential erasure from suppressing opening at use site
If erased result is passed as an argument to a call that requires
implicit opening, the fix-it should use parens to avoid suppressing
the opening at that argument position.
2022-05-26 15:34:07 -07:00
Pavel Yaskevich
0e70841d5f [Diagnostics] Diagnose returning existential values that lose requirements
Diagnose situations where inferring existential type for result of
a call would result in loss of generic requirements.

```swift
protocol P {
  associatedtype A
}

protocol Q {
 associatedtype B: P where B.A == Int
}

func getB<T: Q>(_: T) -> T.B { ... }

func test(v: any Q) {
  let _ = getB(v) // <- produces `any P` which looses A == Int
}
```
2022-05-25 16:07:05 -07:00
Pavel Yaskevich
dfadee3731 [CSDiagnostics] Attach missing member diagnostic to a pattern/statement
If missing member is found in e.g. case statement or a pattern,
let's attach diagnostic directly to it.
2022-05-18 00:28:08 -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
Anthony Latsis
c47f99a22d Diag: Use 'Self'-rooted interface types instead of opened archetypes in requirement failure messages 2022-02-02 02:10:05 +03:00
Doug Gregor
c0f5502269 Leverage error-to-warnings downgrades for non-ephemeral conversion diagnostics
There were slight wording changes between the warning and error
diagnostics, but they don't seem to justify the duplication here.
2021-12-02 11:12:07 -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
Xi Ge
03c76bd32d sema: diagnose passing a non-constant value into a constant parameter 2021-11-22 11:52:57 -08: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