Escaping solver-allocated types into a nested allocation arena is
problematic since we can e.g lazily compute the `ContextSubMap` for a
`NominalOrBoundGenericNominalType`, which is then destroyed when we
exit the nested arena. Ensure we don't pass any types with type
variables or placeholders to `typesSatisfyConstraint`.
rdar://152763265
Fixes a crash on invalid. The previous logic was causing a label
mismatch constraint fix to be recorded for an unlabeled trailing closure
argument matching a variadic paramater after a late recovery argument
claim in `matchCallArgumentsImpl`, because the recovery claiming skips
arguments matching defaulted parameters, but not variadic ones. We may
want to reconsider that last part, but currently it regresses the
quality of some diagnostics, and this is a targeted fix.
The previous behavior is fine because the diagnosis routine associate
with the constraint fix (`diagnoseArgumentLabelError`) skips unlabeled
trailing closures when tallying labeling issues — *unless* there are no
other issues and the tally is zero, which we assert it is not.
Fixes rdar://152313388.
(cherry picked from commit f2e1420a90)
A member and a parameter could be wrapped in an arbitrary number
of `Optional`, we need to look through all of them to get to the
underlying function type.
Resolves: rdar://151943924
(cherry picked from commit 86390ab91f)
Currently the note is going to point to the "callee" but that is
incorrect when the failure is related to an argument of a call.
Detect this situation in `RValueTreatedAsLValueFailure::diagnoseAsNote`
and produce a correct note.
Resolves: rdar://150689994
(cherry picked from commit 6bbc101a98)
This element is used purely for diagnostic purposes and locator
should behavior as if it's completely transparent.
(cherry picked from commit 622475bf15)
No warnings with minimal checking, warnings with `strict-concurrency=complete` and
if declaration is `@preconcurrency` until next major swift version.
Resolves: rdar://151911135
Resolves: https://github.com/swiftlang/swift/issues/81739
(cherry picked from commit e326cd00930ff042ba1595e7793af9aaf0208b97)
If a type gets `Sendable` conformace requirement through another
`@preconcurrency` protocol the error should be downgraded even
with strict concurrency checking to allow clients time to address
the new requirement.
Resolves: rdar://146027395
(cherry picked from commit 6d45229367)
Infer default actor isolation from `using` declaration in the
file scope and use it to override one that is set by `-default-isolation`
flag.
(cherry picked from commit 595c3b3a62)
Initially this declaration is going to be used to determine
per-file default actor isolation i.e. `using @MainActor` and
`using nonisolated` but it could be extended to support other
file-global settings in the future.
(cherry picked from commit aabfebec03)
We effectively suppress sendable diagnostics when region-based
isolation is disabled, and RBI is enabled whenever strict concurrency
checking is enabled. So, suppress this diagnostic when RBI is enabled.
Fixes rdar://152583759.
- Mismatch in tuple element position should reference whole tuple
with a note for mismatch position;
- Situations where optional object type is not a class but matched
against `AnyObject` have a tailored fix.
(cherry picked from commit 7305275dbd)
Attempting to propagate generic argument failures up is not always
reliable, `matchDeepEqualityTypes` should avoid using `TMF_ApplyingFix`
while dealing with optionals and instead let `repairFailures` decide
whether to use generic arguments mismatch fix to a more general one.
(cherry picked from commit 27c28d4d64)
If generic arguments mismatch ends up being recorded on the result
of the chain or `try` expression it means that there is a contextual
conversion mismatch.
For optional conversions the solver currently generates a disjunction
with two choices - bind and optional-to-optional conversion which is
anchored on the contextual expression. If we can get a fix recorded
there that would result in a better diagnostic. It's only possible
for optional-to-optional choice because it doesn't bind the
variable immediately, so we need to downgrade direct fixes to prevent
`bind` choice from considered better.
(cherry picked from commit 65e83a8bb1)
Since we have `repairViaOptionalUnwrap`, let's use that to fix
argument/parameter mismatches instead of doing ad-hoc matching.
(cherry picked from commit b12d844fcc)
The problem detection logic currently expects `generic argument #<N>`
location to always be associated with two generic types, but that
is not always the case, this locator element is sometimes used for
i.e. optional object types and pointer `Pointee` type when types
appear in argument positions. This needs to be handled specifically.
Resolves: rdar://82971941
(cherry picked from commit ded6158cc3)
Without contextual information it won't be possible to bind a missing
member to a concrete type later, so let's bind them eagerly and propagate
placeholders outward.
Resolves: rdar://152021264
Resolves: https://github.com/swiftlang/swift/issues/81770
(cherry picked from commit 10186d664b)
If key or value of a literal collection expression doesn't conform
to protocol(s) expected by the contextual existential type, let's
diagnose that via a tailed collection mismatch fix instead of a
generic conformance one.
Resolves: rdar://103045274
(cherry picked from commit d83ec7b3a5)
`@autoclosure` is associated with a parameter, we use argument mismatch fix
to diagnose missing explicit calls as well as any mismatches in that position.
Resolves: rdar://110527062
(cherry picked from commit b3e9cf3424)
If the argument has an extra `?` or `!`, let's not attempt to force
optional (because it's use is already invalid) and re-introduce
the constraint with unwrapped type instead. This would help to diagnose
the invalid chaining as well as any argument to parameter mismatches.
Resolves: rdar://126080504
(cherry picked from commit ef2fa4a1b6)
Inference of conformance isolation needs to check whether all of the
witnesses are nonisolated. However, witness checking looks at
conformance isolation. To break this reference cycle, split the
conformance isolation request into two requests: a "raw" request that
looks at explicitly-specified isolation, and the existing one that
also performs inference. The existing one builds on the "raw" one, as
does a separate path for the conformance checker.
Fixes rdar://152461344.
When compiling for visionOS, iOS availability attributes are remapped into the
visionOS availability domain automatically. While the version remapping was
being performed correctly, there was a regression that caused the platform name
to be printed incorrectly in many diagnostics. Whenever an iOS version is
remapped to a visionOS version, availability diagnostics will now present
those versions as visionOS versions instead of iOS versions.
Resolves rdar://146293165.
String interpolations can end up being unsafe in the call to
appendInterpolation when it's provided with unsafe types. Move the
location of the proposed "unsafe" out to the string interpolation
itself in these cases, which properly suppresses the warning.
Fixes rdar://151799777.
The migration to `MemberImportVisibility` can be performed mechanically by
adding missing import declarations, so offer automatic migration for the
feature.
Resolves rdar://151931597.
The was never invoked because inaccessibility due to SPI protection level is
always diagnosed before missing imports are diagnosed. The functionality could
therefore not be tested and should be removed.
We weren't showing the unsafe uses when we determine that a for..in
loop is unsafe. Do so, which generally means complaining about `next()`
being unsafe. Fixes rdar://151237127