Commit Graph

152 Commits

Author SHA1 Message Date
Guillaume Lessard 464cb164dc Document UnnecessaryEffectMarker warning group. 2026-05-15 02:52:34 -07:00
Michael Gottesman 7f93e1b440 Merge pull request #88662 from gottesmm/pr-af62376cd868f93226ec5353dbf9a0cbd2611b7a
[rbi] Add diagnostic groups and documentation for cross-isolation data race and unknown pattern errors
2026-04-28 16:34:11 -07:00
Michael Gottesman 43bf55cb19 [rbi] Add diagnostic groups and documentation for cross-isolation data race and unknown pattern errors
Introduce two new diagnostic groups: RegionIsolationCrossIsolationDataRace
and RegionIsolationUnknownPattern, both linked as children of the existing
RegionIsolation group. This converts the merge-region-failure errors and the
unknown-pattern error from plain ERROR to GROUPED_ERROR, which allows users
to selectively downgrade these diagnostics (e.g. the unknown pattern error
can be downgraded since it represents a compiler limitation rather than a
definite user error).

Add user-facing documentation for both groups explaining what triggers the
diagnostics and how to resolve them.

rdar://175771878
2026-04-28 10:34:22 -07:00
Allan Shortlidge c0b5e6c7b8 AST: Add a NoUsage diagnostic group.
Adds every diagnostic in the legacy `no-usage` diagnostic category to a new
diagnostic group called NoUsage so that the diagnostics can participate in
diagnostic control mechanisms like `-Werror`.

Resolves rdar://160488389.
2026-04-24 16:56:48 -07:00
Allan Shortlidge e917a21777 AST: Add the AddPreconcurrencyImport diagnostic group. 2026-04-23 15:29:47 -07:00
Allan Shortlidge de35fbd4ff AST: Add the UnsupportedScopedImport diagnostic group. 2026-04-23 15:28:09 -07:00
Allan Shortlidge 04f1bab204 AST: Add the SPIImportIgnored diagnostic group. 2026-04-23 13:20:21 -07:00
Allan Shortlidge 440120557e AST: Introduce the ModuleSelfImport diagnostic group. 2026-04-23 13:06:36 -07:00
Allan Shortlidge 622a68601b AST: Add the InconsistentImportAccess diagnostic group. 2026-04-23 13:06:19 -07:00
Allan Shortlidge f9cbe0293c AST: Add the UnusedImportAccess diagnostic group.
Resolves rdar://147656067.
2026-04-23 13:05:57 -07:00
Pavel Yaskevich f725f50d93 Merge pull request #87439 from ktoso/wip-task-discarding
[Concurrency] Warn about un-used throwing unstructured tasks
2026-04-22 10:52:41 -07:00
Aviva f2c5bbc0af Merge pull request #88194 from a-viv-a/unavailable-conformance
[Sema] Diagnose retroactive conformance for unavailable conformance
2026-04-21 15:36:41 -07:00
Konrad Malawski bfe8dbca59 [Concurrency] Warn about un-used throwing unstructured tasks
Pending swift evolution discussion: https://github.com/swiftlang/swift-evolution/pull/3133

replaces #87171

update new error message according to proposal

also handle untyped throws in _nonDiscardableWhenThrowing attr

Rename the internal attr _nonDiscardableWhenThrowingOperation
2026-04-21 23:53:56 +09:00
Allan Shortlidge 902f13a132 AST: Add group IDs to diags for module interface option obsoletion..
Makes it possible for users of `-warnings-as-errors` to control the behavior of
warnings about the obsoletion of module interface emission options.

Resolves rdar://174787052.
2026-04-15 13:08:31 -07:00
Aviva Ruben 404d1f4b2f [Sema] Diagnose retroactive conformance for unavailable conformance
This commit fixes rdar://166895453 by recognizing unavailable
conformances even for `@unchecked @retroactive` extensions. It also adds
a userdoc to explain unavailable conformances.
2026-04-08 11:41:27 -07:00
Kavon Farvardin 0cfef22ec5 Merge pull request #88329 from kavon/supp-assoc-types-polish
SuppAssocTypesWithDefaults: extra tests + migration guide
2026-04-08 09:22:47 -07:00
Kavon Farvardin e9acbe61ca Docs: fix diagnostic-groups.md 2026-04-06 16:46:34 -07:00
Aviva Ruben 9b9079f75a [Userdocs] Link to swift book on inout, highlight inout exclusivity 2026-04-06 14:21:58 -07:00
Kavon Farvardin 135eb8b0cd Docs: fix URL for SE-503 2026-04-06 13:50:43 -07:00
Kavon Farvardin 67b099aeb8 Diags: add userdocs for feature deprecation warning
There are in fact ABI changes for all suppressed associatedtypes.
Only source changes are expected for suppressed primary associatedtypes.
2026-04-06 13:37:29 -07:00
Aviva aa649de3ca Merge pull request #87939 from a-viv-a/suggest-immutable-witness
Suggest immutable witness
2026-03-30 10:04:33 -07:00
Aviva Ruben 69b6c8cc9e [Sema] Suggest let, nonisolated for properties and computed properties
Fixes rdar://89864078, by checking if all the required vars are
immutable, and suggesting mutable variables be converted to immutable to
become nonisolated and presumably fix the isolation issue. Also suggests
'nonisolated' on var decls without storage or wrapper. Additionally,
converts existing 'nonisolated' for method suggestion to emit per-method
instead of a top level 'all', for consistency with the new diagnostic,
based on PR feedback.
2026-03-23 15:42:18 -07:00
Allan Shortlidge 4276eaac10 userdocs: Re-run ./utils/generate-doc-index.swift. 2026-03-21 05:25:52 -07:00
Allan Shortlidge 1f26971a88 Sema: Introduce an opt-in UseAnyAppleOSAvailability diagnostic group.
Enabling `UseAnyAppleOSAvailability` diagnostics will cause the compiler to
diagnose declarations where `anyAppleOS` availability can be used a concise
replacement for platform-specific availability annotations.

Resolves rdar://163819878.
2026-03-20 16:01:55 -07:00
Artem Chikin 216a4f232e Add diagnostic warning group documentation for the 'ReturnTypeImplicitCopy' group 2026-03-20 09:23:07 +00:00
Artem Chikin b954e4ac73 Add diagnostic warning group documentation for the 'PerformanceHints' group 2026-03-19 16:24:33 +00:00
Aviral Goel d06e05fc6d Add diagnostic warning group documentation for the 'ExistentialType' performance hints sub-group 2026-03-19 11:33:32 +00:00
Aviva 157709a41c Merge pull request #87755 from a-viv-a/clarify-mutating-async-actor-iso-diag
Add diagnostic group and note to explain mutating async function issues
2026-03-18 11:10:18 -07:00
Aviva Ruben 96a58d748a Add diagnostic group, note to explain mutating async function issues
Fixes rdar://145127274 by adding a note that hints at why this cannot be
accepted, and a diagnostic group that spells out the correctness problem
created by the implicit inout self from mutating async methods.
2026-03-17 12:48:42 -07:00
Doug Gregor 0e9bb10bf5 Merge pull request #87833 from DougGregor/untyped-throws-performance-hint
Introduce performance hints for untyped throws
2026-03-13 20:37:34 -07:00
Artem Chikin c0dee449c2 Merge pull request #87749 from artemcm/LocalDiagsForDiagGroup
[Diagnostics] Support diagnostic groups with toolchain-local-only documentation
2026-03-13 14:19:12 +00:00
Doug Gregor c72eab6be5 Introduce performance hints for untyped throws
Untyped throws requires a heap allocation and reference counting for
thrown errors, which can be unacceptable in very
performancce-constrained environments. Introduce a new subgroup of
performance hints, UntypedThrows, to report uses of untyped throws.

This resurrects the code we were using for diagnosing untyped throws
in Embedded Swift, repurposing it as a performance hint, which is more
appropriate.
2026-03-12 13:07:00 -07:00
Doug Gregor 38c6ffbf0d [Embedded] Stop diagnosing untyped throws in embedded mode
It is plausible that we will introduce support for untyped throws in
Embedded Swift at some point, so don't diagnose its presence so
eagerly now. Instead, leave it until later in the pipeline when it's
actually used.

Fixes rdar://162071067, where we were getting entirely too many
warnings about this.
2026-03-11 10:52:20 -07:00
Artem Chikin 2a6ab76bb3 Add option to have a diagnostic group have toolchain-local-only documentation 2026-03-10 15:11:33 +00:00
Doug Gregor 8f469198f1 Regenerate diagnostic groups index 2026-03-09 14:33:06 -07:00
Doug Gregor 454237a083 Allow the OSLog module to specify the log string section name
When building the `OSLog` module, look for a variable named
`osLogStringSectionName`. It must have a string literal as its
initializer, which provides the section name where the log strings
should be emitted. The `OSLog` module should contain something like
this:

    let osLogStringSectionName = "__TEXT,__logit"

When not present, the compiler will default to
`__TEXT,__oslogstring,cstring_literals`, which was previously the
hardcoded section name. Now, OSLog can customize the name.

Implements rdar://171571056
2026-03-09 10:27:54 -07:00
Jamie a2d1591810 [docs]: add docs for ImplicitStrongCapture diagnostic 2026-02-18 05:30:15 -06:00
Ben Barham b29a0a9b3d Fix up the userdocs index
A few docs weren't added to the index, re-run the generation and fix the
test to actually run in order to catch future issues.
2025-12-06 10:18:19 +10:00
Pavel Yaskevich 22ec081377 [AST/Sema] Add a diagnostic group ExplicitSendable to replace -require-explicit-sendable
Always run explicit `Sendable` checks on public types and suppress
warning printing by default instead of using a special compiler argument.

Resolves: rdar://162394810
2025-11-04 17:53:20 -08:00
Kavon Farvardin 6b858b411c ManualOwnership: introduce 'DynamicExclusivity'
We can add warnings about dynamic exclusivity
checks that may happen on an access, with
explainers about why they happen for safety.
2025-10-24 16:59:44 -07:00
Kavon Farvardin 95a6719117 ManualOwnership: introduce 'SemanticCopies' diagnostic group
This includes documentation to explain how to understand
these diagnostics.
2025-10-24 16:59:41 -07:00
John Hui 781489f067 Merge pull request #85021 from j-hui/return-frt-diagnostics
[cxx-interop] Put RETURNS_RETAINED warnings in a diagnostic group

rdar://161932849
rdar://144976203
2025-10-24 12:05:48 -04:00
John Hui 1e5194c9a4 [cxx-interop] Re-word message and documentation for FRT diagnostics
Several changes:

- shorten the warning at the call-site of unannotated functions that
  return FRTS
- place the call to action ("annotate 'X' with 'Y'") at the diagnostic
  note attached to the unannotated callee, where the annotation should
  be made
- re-word the foreign-reference-type.md documentation to (1) reflect the
  diagnostic wording change, (2) give a little bit more background about
  why the annotations are needed, and (3) not be specific to C++ (since
  we can import FRTs from C as well)
2025-10-22 14:53:06 -07:00
Ben Barham 55f61a84ca Re-generate diagnostics index and cleanup old notes
This is mostly just cleanup:
1. Removes `diagnostic-descriptions.md` since it isn't used any more
2. Adds the group name to all the old notes files
3. Removes trailing whitespace
4. Adds "See Also" sections for notes that have links
2025-10-20 19:19:36 -07:00
John Hui d47a2626e2 [cxx-interop] Clean up diagnostics for functions returning FRTs
- Delete baseline language feature WarnUnannotatedReturnOfCxxFrt,
  which won't really be useful to users
- Remove some references to "cxx", since FRTs are not exclusively
  imported from C++
- Clean up lit test RUN lines to use %{fs-sep}
2025-10-19 22:22:15 -07:00
Fahad Nayyar facef0e034 [cxx-interop] Enabling WarnUnannotatedReturnOfCxxFrt on by default and add it to a diagnostic group
This change makes the warning for unannotated C++ functions returning foreign
reference types (FRT) enabled by default, improving memory safety for Swift/C++
interop users. Also added CxxForeignReferenceType diagnostic group for better control
2025-10-17 17:06:44 -07:00
Artem Chikin 7c74890bd8 [Performance Hints] Add simple check for returning of values of array and dictionary type
This check will run on each type-checked primary input of the current compilation and emit a warning diagnostic for all discovered occurences of this code pattern when the performance hint diagnostic is enabled
2025-10-02 10:31:13 -07:00
Doug Gregor f1866d85d0 Fix indentation for the EmbeddedRestrictions diagnostic group 2025-09-23 13:16:17 -07:00
Allan Shortlidge 8a1338dfb2 AST/Sema: Diagnose references to permanently enabled availability domains
A "permanently enabled" availability domain is one that has been declared
always available and is also simultaneously has either an attribute that
makes it deprecated or universally unavailable.

Emit fix-its that remove (or update) `@available` attributes that restrict
availability in a permanently enabled domain. Also, emit warnings about
`if #available` queries that always return true because they check a
permanently enabled domain.

Resolves rdar://157601761.
2025-09-22 17:48:55 -07:00
Doug Gregor 11976c51c8 [Embedded] Document untyped throws restriction 2025-09-18 10:05:35 -07:00