Commit Graph

26323 Commits

Author SHA1 Message Date
Holly Borla
ed1b11d783 [Attr] Add a missing return statement at the end of allowSymbolLinkageMarkers. 2024-07-18 08:03:22 -07:00
Holly Borla
3eb9ad45eb Merge pull request #75323 from hborla/disable-symbol-linkage 2024-07-18 06:34:50 -07:00
Pavel Yaskevich
f0404daf8a Merge pull request #75319 from xedin/rdar-131855678
[Concurrency] Downgrade mutable captures of `inout` parameters into a…
2024-07-18 00:09:03 -07:00
Holly Borla
5e4277a08d [Macros] Narrow the carve-out for DebugDescription’s use of symbol
linkage markers.
2024-07-17 22:19:18 -07:00
Timur Guliamov
dd221a8e01 Added fix-it to add the @unchecked Sendable conformance if it is not re-stated (#75233)
Co-authored-by: Timur Guliamov <tplaymeow@MacBook-Pro-Timur-2.local>
2024-07-18 14:14:12 +09:00
Pavel Yaskevich
f6b33c1dc2 [Concurrency] Downgrade mutable captures of inout parameters into a warning in Swift 5 mode
This matches the behavior of local captures.

Resolves: rdar://131855678
2024-07-17 16:54:57 -07:00
Pavel Yaskevich
c4f0d6896d Merge pull request #75265 from xedin/issue-75244
[CSApply] Allow `@dynamicMemberLookup` subscripts to take sendable ke…
2024-07-17 09:08:36 -07:00
Kavon Farvardin
7ca4041624 Merge pull request #75267 from kavon/revert-backcompat-removal
Revert "NCGenerics: remove the reverse-condfail workaround"
2024-07-16 11:28:12 -07:00
Dave Lee
ad8b0f3397 [Sema] Allow @_section/@_used in concrete generic context (#75222)
Allow `@_section` and `@_used` to be used in fully constrained extensions.

This aligns with the existing behavior of static properties of generic types. The following is valid:

```swift
extension Array where Element == Int {
  static let specificConstant = 41
}
```

However, adding `@_section` or `@_used` to the above property, will result in an error diagnostic.

This change updates the logic of `@_section`/`@_used` to allow their use when the generic context is fully concrete.
2024-07-16 10:05:15 -07:00
Kavon Farvardin
1fa02fb0fe Revert "NCGenerics: remove the reverse-condfail workaround"
This reverts commit 5b2f2cbfcf.
2024-07-16 08:10:00 -07:00
Pavel Yaskevich
59ec789768 [CSApply] Allow @dynamicMemberLookup subscripts to take sendable key path
The changes to support `& Sendable` composition with key path
types adjusted `buildKeyPathDynamicMemberArgExpr` to support
that but the use-site erroneously still cast index type or
`BoundGenericType` as before.

Resolves: https://github.com/swiftlang/swift/issues/75244
Resolves: rdar://131768785
2024-07-16 00:20:38 -07:00
Doug Gregor
a3bf1fc4c2 Merge pull request #75248 from DougGregor/unsafe-inherit-executor-the-rest
Extend _unsafeInheritExecutor_ to remaining @_unsafeInheritExecutor APIs
2024-07-15 18:46:38 -07:00
Holly Borla
cc5549577c Merge pull request #75251 from hborla/gate-isolation-inference-change
[Concurrency] Gate an isolation inference change behind an upcoming feature flag.
2024-07-15 18:01:45 -07:00
Doug Gregor
4c605a2f7a Suppress warnings about @_unsafeInheritExecutor on _unsafeInheritExecutor_ functions
When inside the concurrency library, suppress the diagnostics about use
of the (deprecated) `@_unsafeInheritExecutor` for functions whose names
start with the "_unsafeInheritExecutor_" prefix that's used for
compatibility. This focuses the diagnostic on those places in the
concurrency library that might still need to introduce this hack.
2024-07-15 14:12:39 -07:00
Doug Gregor
5ce166819e Only replace async functions with _unsafeInheritExecutor_ versions 2024-07-15 14:12:38 -07:00
Holly Borla
0234bd8124 [Concurrency] Gate an isolation inference change behind an upcoming feature
flag.

This is just a proactive source compatibility measure, because isolation
inference changes like this can break source compatibility in language
modes < 6.
2024-07-15 12:16:07 -07:00
Hamish Knight
9d2af57a34 Merge pull request #75239 from hamishknight/patte-diag
[CS] A couple of minor diagnostic improvements
2024-07-15 19:16:41 +01:00
Pavel Yaskevich
cfb50a0aef Merge pull request #75191 from xedin/inlinable-init-accessors
[AST/Sema] Make it possible to use init accessors in inlinable initializers
2024-07-15 09:16:30 -07:00
Hamish Knight
d6d8d08608 [CS] Better diagnose conformance failures for EnumElementPatterns
Previously we could end up with a
ContextualMismatch fix and a MissingConformance fix
for different elements of the `matchTypes` disjunction,
leading to an ambiguity. Instead, avoid recording
the ContextualMismatch if we're matching an
existential, and tweak the MissingConformance
failure to have a custom diagnostic for
EnumElementPattern matching.
2024-07-15 12:47:50 +01:00
Hamish Knight
cd1b6eddc2 [CS] Fix logic determining parens for non-optional weak diagnostic
We were previously checking the optional type,
which would never say that parens were needed.
Unwrap the type before checking, ensuring we
correctly handle e.g protocol compositions.
2024-07-15 12:47:50 +01:00
Hamish Knight
61156e1e6b [Sema] Avoid diagnosing overrides for invalid decls
Invalid decls won't match any overrides in the
base class, so avoid diagnosing that they don't
override anything.
2024-07-15 12:47:50 +01:00
Holly Borla
73ba98cb2b Merge pull request #75224 from hborla/self-capture-deinit-task
[Concurrency] Diagnose captures of `self` in a task created in `deinit`.
2024-07-13 13:32:28 -07:00
Holly Borla
e08bd9565d Merge pull request #75135 from hborla/unavailable-superclass-conformance
[ConformanceLookup] Don't allow skipping inherited unavailable conformances in favor of explicit available ones.
2024-07-13 10:15:49 -07:00
Holly Borla
18b747c181 [Concurrency] Diagnose captures of self in a task created in deinit.
This is done by diagnosing captures of `self` in escaping `sending` or
`@Sendable` closures inside a deinit, which almost certainly means `self`
will outlive deinit at runtime, which is a fatal error. This is a common
mistake to make when creating isolated tasks inside nonisolated deinits
to workaround the lack of synchrnous isolated deinits in Swift 6.
2024-07-12 21:49:35 -07:00
Holly Borla
e2ddc6c6c2 [ProtocolConformance] Compute the correct un-availability for inherited
conformances.
2024-07-12 14:58:49 -07:00
Pavel Yaskevich
123068c64e [Sema] Resilience: Diagnose uses of init accessors in inlinable contexts if they are not marked as @usableFromInline 2024-07-12 09:54:00 -07:00
Kavon Farvardin
4529f3b295 Merge pull request #75183 from kavon/remove-reverse-condfail-workaround
NCGenerics: remove the reverse-condfail workaround
2024-07-12 09:39:12 -07:00
Allan Shortlidge
373a3fe7de Merge pull request #75185 from tshortli/revert-aeic-diagnose-unavailable-code-reached
SILGen/stdlib: Remove `_diagnoseUnavailableCodeReached_aeic()`
2024-07-12 09:22:11 -07:00
Allan Shortlidge
a8a1eb2666 Merge pull request #75182 from tshortli/warn-soft-deprecated
Introduce `-warn-soft-deprecated` option
2024-07-11 21:06:30 -07:00
Holly Borla
85b66d1dc2 [ConformanceLookup] Always prefer unavailable Sendable conformances from the
defining module, and diagnose redundant Sendable conformances.

We still allow re-stating inherited unchecked Sendable conformances in
subclasses because inherited Sendable conformances are surprising when
they opt out of static checking. Otherwise, warning on redundant Sendable
conformances nudges programmers toward cleaning up unnecessary retroactive
Sendable conformances over time as libraries incrementally add the
conformances directly.
2024-07-11 20:33:24 -07:00
Pavel Yaskevich
6925940b37 [Sema] Improve diagnostic when @usableFromInline is applied to a declaration without a name (i.e. accessor/init) 2024-07-11 17:12:57 -07:00
Allan Shortlidge
14200e412c SILGen/stdlib: Remove _diagnoseUnavailableCodeReached_aeic().
It should no longer be necessary to provide an `@_alwaysEmitIntoClient` version
of `_diagnoseUnavailableCodeReached()`. This workaround was originally added to
provide compatibility with projects that were misconfigured to compile against
a newer stdlib but link against an older one.

Resolves rdar://119892482.
2024-07-11 14:53:03 -07:00
Kavon Farvardin
5b2f2cbfcf NCGenerics: remove the reverse-condfail workaround
This should no longer be needed, after having staged the first set of
changes in, as it was a temporary workaround.

resolves rdar://131560183
2024-07-11 14:30:27 -07:00
Allan Shortlidge
1d715e2474 Sema: Diagnose references to soft-deprecated declarations.
When `-warn-soft-deprecated` is specified, diagnose references to declarations
that are deprecated in future OS versions.

Resolves rdar://130424183.
2024-07-11 14:04:38 -07:00
Pavel Yaskevich
e4cd1d7acd Merge pull request #75062 from xedin/rdar-122193606
[Concurrency] Allow sendability mismatches while overriding `@preconcurrency` properties in Swift 5 mode
2024-07-11 11:18:53 -07:00
Allan Shortlidge
5d6f6947ed Merge pull request #75158 from tshortli/member-import-visibility-package
AST: Add a `IgnoreMissingImports` option to name lookup
2024-07-11 11:07:39 -07:00
Allan Shortlidge
d002da0ef2 AST: Add a IgnoreMissingImports option to name lookup.
Control enforcement of member import visibility requirements via a new option,
instead of piggy-backing on the existing IgnoreAccessControl option. Adopt the
option when doing fallback lookups for unviable members so that the compiler
can diagnose the reason that a member is inaccessible more reliably.
Previously, with MemberImportVisibility enabled decls with the package access
level could be mis-diagnosed as inaccessible due to their access level when
really they were inaccessible due to a missing import.

Resolves rdar://131501862.
2024-07-10 22:57:15 -07:00
Andrew Trick
12acde2215 Merge pull request #75096 from meg-gupta/lifetimedeparg
Add support for lifetime dependence in parameter position
2024-07-10 22:56:23 -07:00
Kavon Farvardin
bbc02a5544 Merge pull request #75141 from kavon/invertible-conformance-same-sourcefile
NCGenerics: enforce same-source conformance rule
2024-07-10 17:50:13 -07:00
Slava Pestov
d1847ffde7 Merge pull request #75068 from slavapestov/simplify-sub-map
Simplify and optimize SubstitutionMap
2024-07-10 20:45:56 -04:00
Meghana Gupta
422ed2b0bb [NFC] LifetimeDependentReturnTypeRepr -> LifetimeDependentTypeRepr 2024-07-10 14:48:34 -07:00
Meghana Gupta
076d70acbb Update getLifetimeDependenceInfo to getLifetimeDependencies in CSSimplify 2024-07-10 14:48:34 -07:00
Meghana Gupta
154989463b Add support for lifetime dependence in parameter position 2024-07-10 14:20:03 -07:00
Meghana Gupta
8137aed238 Rename LifetimeDependentReturnTypeRepr -> LifetimeDependentTypeRepr 2024-07-10 14:20:03 -07:00
Meghana Gupta
4993f4bf22 Merge pull request #74956 from meg-gupta/lifetimedepfunctiontype
Add some diagnostics related to lifetime dependence and function types
2024-07-10 14:19:05 -07:00
Kavon Farvardin
233742a565 NCGenerics: enforce same-source conformance rule
SE-427 says the conformance to Copyable must appear in the same source
file as the nominal type.

resolves rdar://131486561
2024-07-10 14:02:10 -07:00
Holly Borla
5bddd984c4 Merge pull request #75122 from hborla/isolation-inference-inherited-conformance
[Concurrency] Don't infer actor isolation from inherited conformances.
2024-07-10 12:01:44 -07:00
Doug Gregor
2a8b3fcf95 Merge pull request #75093 from DougGregor/unsafe-inherit-executor-vs-pound-isolation
Ensure that a `@_unsafeInheritExecutor` function does not depend on `#isolation`
2024-07-10 11:05:37 -07:00
Slava Pestov
977b444eb3 AST: Add a new overload of getContextSubstitutionMap() 2024-07-10 13:28:26 -04:00
Slava Pestov
4954278342 IDE: Don't call getContextSubstitutionMap() on an existential type 2024-07-10 13:28:23 -04:00