Commit Graph

4105 Commits

Author SHA1 Message Date
Meghana Gupta
ea420e0780 Add a test for @lifetime(immortal) 2024-10-08 15:10:59 -07:00
Meghana Gupta
4ac90a3e11 Diagnose multiple @lifetime attributes with same target 2024-10-08 15:10:59 -07:00
Meghana Gupta
31c1dc7eb5 Add support for specifying target in @lifetime
@lifetime(target: source1, source2...) where target can be any
parameter or 'self'. We cannot have @lifetime attributes with duplicate targets.

Also, update the internal data structures. Previously LifetimeEntry stored
pairwise (target, source) dependencies. Now, LifetimeEntry will store an optional
target descriptor and an array of source descriptors.
2024-10-08 15:10:48 -07:00
Konrad `ktoso` Malawski
dea3b59331 Merge pull request #76250 from ktoso/wip-experimental-isolated-deinit 2024-10-03 17:19:10 +09:00
Meghana Gupta
148155710f Merge pull request #76624 from meg-gupta/lifetimedepscoped
Add support for borrow lifetime dependence
2024-10-02 13:58:14 -07:00
Doug Gregor
cd6864a5f3 Merge pull request #76454 from DmT021/wp/deprecated-diagnostic-groups
[Diagnostics] Add new groups to the 'deprecated' diagnostic group
2024-09-30 09:05:16 -07:00
Konrad `ktoso` Malawski
45b97f146b Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-30 13:47:39 +09:00
Nate Chandler
d5e000fe22 [Sema] Fix inconsistent mutatingness diagnostic.
Refer to the correct problematic accessor or accessors.
2024-09-26 18:10:38 -07:00
Nate Chandler
d06e6a3c51 [Sema] Improved dynamic replacement diagnostic.
Make use of swift::getAccessorNameForDiagnostic instead of having a
parallel list of accessor names in DiagnosticsSema.def.
2024-09-26 08:27:21 -07:00
Becca Royal-Gordon
f558d010cd Merge pull request #76462 from beccadax/objcimpl-the-legacy-i-leave-you
Mimic old objcImpl behavior for early adopters
2024-09-25 17:07:03 -07:00
Dmitrii Galimzianov
aa5e10f8d2 [Diagnostics] DeprecatedDeclaration group 2024-09-25 23:18:25 +02:00
Pavel Yaskevich
762fd4aed8 Merge pull request #76644 from jameesbrown/issue-44631
[CS] Diagnose misuse of CheckedCastExpr with ~=
2024-09-25 09:54:16 -07:00
James Brown
f0eef0f583 [CS] Diagnose misuse of CheckedCastExpr with ~=
Using an unwrap operator with 'as' or the wrong keyword (i.e. `is`)
when already checking a cast via ~= results in error:
'pattern variable binding cannot appear in an expression'.
Add a diagnostic that provides more guidance and a fix-it
for the removal of ?/! or replacement of 'is' with 'as'.
2024-09-24 01:45:51 -04:00
Meghana Gupta
f8f043f585 Change @lifetime to always mean inherit lifetime dependence 2024-09-20 22:05:23 -07:00
Becca Royal-Gordon
d0a2564581 Make behavior change detection generic
Automatically detect when shouldMarkAsObjC() will behave differently based on the objcImpl early adopter flag and diagnose it. This works in either direction, although there isn’t anything yet that will emit diag:: objc_implementation_will_become_nonobjc.

NFC except for some minor changes to the wording of notes.
2024-09-20 13:39:44 -07:00
Konrad `ktoso` Malawski
d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
Pavel Yaskevich
43e19358d7 Merge pull request #76458 from xedin/rdar-131347583
[Concurrency] Allow global actor mismatches while overriding `@precon…
2024-09-18 09:16:57 -07:00
Konrad `ktoso` Malawski
a6bc0e6759 temporary -experimental flag for IsolatedDeinit 2024-09-18 12:52:37 +09:00
Slava Pestov
ad68d22041 Merge pull request #76518 from slavapestov/fix-issue-76513
Concurrency: Reject nonisolated lazy properties
2024-09-17 15:11:39 -04:00
Slava Pestov
46b4983baf Concurrency: Reject nonisolated lazy properties
We already banned nonisolated property wrappers, and 'lazy' is
conceptually similar, so it makes sense to disallow it also.

Fixes https://github.com/swiftlang/swift/issues/76513.
2024-09-17 11:30:44 -04:00
Saehej Kang
6c92f3fe1c [Diag]: Result builder misplacement error message mentions subscript 2024-09-17 02:45:07 -07:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Becca Royal-Gordon
cd8d3adab0 Mimic old objcImpl behavior for early adopters
Before the update to support the new syntax, the decl checker treated private and fileprivate members of objcImpl extensions as non-@objc by default. But SE-0436 specified that private and fileprivate members should be implicitly @objc unless opted out, so when support for the final syntax was added, this behavior was changed retroactively.

Unfortunately, we’ve found that some early adopters depended on the old behavior. Restore some logic deleted by #73309 for early adopter syntax *only*, with a warning telling the developer to put `final` or `@nonobjc` on the declaration if they want to preserve the behavior after updating it.

Also tweaks the ObjCImplementationChecker to ensure this logic will actually be run in time for it to suppress the “upgrade to @objc @implementation” warning, and corrects a couple of regressions arising from that change.

Fixes rdar://135747897.
2024-09-13 14:55:16 -07:00
Pavel Yaskevich
22b9dd7f7b [Concurrency] Allow global actor mismatches while overriding @preconcurrency members in Swift 5 mode
Downgrade a mismatch on global actor attributes to a warning until
Swift 6 to enable class authors to introduce concurrency annotations
to overridable members.

Resolves: rdar://131347583
2024-09-13 11:28:47 -07:00
Allan Shortlidge
07357b9c1f Merge pull request #76431 from rjmansfield/remove-more-unused-diags
Remove additional unused diagnostics.
2024-09-12 20:16:50 -07:00
Alejandro Alonso
718bba486a Merge pull request #76404 from Azoy/integer-type-parsing-fixes
[Parse] Fix type parsing when preceded by '-'
2024-09-12 09:26:57 -07:00
Ryan Mansfield
a097f9f660 Remove additonal unused diagnostics.
Also fix typo in diagnostics verifier error message.
2024-09-12 12:04:54 -04:00
Allan Shortlidge
23e9719b2b Sema: Refactor "cannot be marked unavailable" diagnostics.
Make it possible to share the diagnostics string for common case.
2024-09-11 16:42:47 -07:00
Alejandro Alonso
6f83e3c28f Fix type parsing when preceeded by '-' 2024-09-11 10:28:44 -07:00
Meghana Gupta
0dde044e89 Merge pull request #76256 from meg-gupta/lifetimeattrsyntax
Introduce @lifetime attribute to specify lifetime dependence on function declarations
2024-09-10 19:49:32 -07:00
Meghana Gupta
b610036e6a [NFC] Refactor out common utilities to be used by lifetime attribute 2024-09-09 22:02:44 -07:00
Alexis Laferrière
9751be9e75 Diagnostics: Ignore public-module-name for warnings about unused imports 2024-09-09 16:57:46 -07:00
Doug Gregor
08e339b7b4 Merge pull request #74466 from DmT021/wp/no-warning-as-error
[Diagnostics] Add -no-warning-as-error to except a specific warning from being treated as an error
2024-09-09 09:35:05 -07:00
Hamish Knight
72fe29f7f4 [CS] Add custom diagnostic for missing result builder element
If we have a single missing argument for an empty
`buildBlock` call, emit a custom diagnostic.
2024-09-08 16:17:11 +01:00
Dmitrii Galimzianov
28883b6654 [Diagnostics] Add -[no-]warning-as-error flags for precise control over warning behavior
This commit adds new compiler options -no-warning-as-error/-warning-as-error which allows users to specify behavior for exact warnings and warning groups.
2024-09-07 01:14:43 +02:00
Alejandro Alonso
9faf615c88 Add runtime availability checking for value generics 2024-09-04 15:13:51 -07:00
Alejandro Alonso
451e7259a1 Add ValueGenerics experimental feature 2024-09-04 15:13:49 -07:00
Alejandro Alonso
e0f2b812e8 Add serialization and parser tests for SIL 2024-09-04 15:13:47 -07:00
Alejandro Alonso
71fee06c9a Requestify GTPD::getValueType 2024-09-04 15:13:46 -07:00
Alejandro Alonso
a434126554 Disallow referencing a value generic outside of certain contexts 2024-09-04 15:13:45 -07:00
Alejandro Alonso
f4f60f4344 Remove Value requirement Add GenericTypeParamKind 2024-09-04 15:13:43 -07:00
Alejandro Alonso
3e9c4633ca Add some new diagnostics and tests 2024-09-04 15:13:27 -07:00
Alejandro Alonso
75c2cbf593 Implement value generics
Some requirement machine work

Rename requirement to Value

Rename more things to Value

Fix integer checking for requirement

some docs and parser changes

Minor fixes
2024-09-04 15:13:25 -07:00
Alex Hoppen
c5aa49ba64 Revert "Isolated synchronous deinit" 2024-09-03 18:11:26 -07:00
Konrad `ktoso` Malawski
c55ad6fa88 Merge branch 'main' into mpokhylets/isolated-deinit 2024-09-02 23:16:17 +09:00
Allan Shortlidge
2d4b21102c Sema: Fix @retroactive does not apply diags for same package conformance.
SE-0364 was amended to allow same-package conformances to be considered
non-retroactive. The logic for that ammendment was implemented in Swift 6.0,
but the diagnostics were not updated.

Resolves rdar://133423931.
2024-08-30 21:26:44 -07:00
Mykola Pokhylets
e0ad7bde82 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/AST/ASTPrinter.cpp
#	lib/AST/FeatureSet.cpp
2024-08-29 11:28:43 +02:00
Pavel Yaskevich
b6fd5fe1ba [CSDiangostics] Adjust phrasing of invalid specialization diagnostic
Instead of "a generic function" which is too abstract and not always
correct, let's actually point to a kind of the declaration being referenced.
2024-08-29 00:15:57 -07:00
Pavel Yaskevich
2a6cc12a63 [ConstraintSystem] Downgrade some invalid specialization uses to a warning until Swift 6 language mode
Some invalid specializations were previously allowed by the compiler
and we found some existing code that used that (albeit invalid) syntax,
so we need to stage that error as a warning until Swift 6 language mode
to avoid source compatibility break.

Resolves: rdar://134740240
2024-08-29 00:15:08 -07:00
Allan Shortlidge
11304b7804 AST: Take decls instead of identifiers in some conformance diagnostics.
NFC.
2024-08-22 13:57:32 -07:00