Commit Graph

13 Commits

Author SHA1 Message Date
Alex Hoppen
66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00
Nishith Shah
8e2e625543 [Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
This commit changes fixit messages from a question/suggestion to an
imperative message for protocol conformances and switch-case. Addresses
https://github.com/apple/swift/issues/67510.
2023-08-13 22:34:26 -07:00
Slava Pestov
290701cb4d Sema: Ban shadowing generic parameters from outer scopes
Code like that is usually indicative of programmer error, and does not
round-trip through module interface files since there is no source
syntax to refer to an outer generic parameter.

For source compatibility this is a warning, but becomes an error with
-swift-version 6.

Fixes rdar://problem/108385980 and https://github.com/apple/swift/issues/62767.
2023-04-25 17:41:23 -04:00
Slava Pestov
2c19e70b2f Sema: Initial implementation of 'reasync' body checking
This also implements rethrows checking for rethrows-by-conformance
functions bodies, too.
2021-03-02 00:53:25 -05:00
Slava Pestov
bbbe082220 Sema: Fix conformance checking for 'rethrows' protocol requirements
A protocol requirement in a non-'@rethrows' protocol cannot be
witnessed by a rethrows-via-conformance witness, because there
is not enough information at a potential call site of the
protocol requirement to determine if the witness uses a
rethrows source or not.
2021-02-25 17:22:17 -05:00
Slava Pestov
af83f8814d Sema: Fix crash when enum case satisfies requirement in @rethrows protocol 2021-02-10 16:30:30 -05:00
Slava Pestov
5246fefcef Sema: Conformance witnesses that only rethrow via closure arguments don't contribute 2021-02-10 16:30:30 -05:00
Slava Pestov
e2d4eb64e0 Sema: Fix recursion into associated conformances when checking for rethrows
The logic for recursively expanding protocol requirements was broken.
Instead, let's do the recursive visitation when evaluating a
conformance to a @rethrows protocol.
2021-02-10 16:30:30 -05:00
Slava Pestov
a70ef07e17 Sema: Add more rethrows test cases 2021-02-09 00:11:01 -05:00
Slava Pestov
f3c9b00298 AST: Allow empty protocols to be @rethrows 2021-02-09 00:11:01 -05:00
Slava Pestov
8fa0dc5184 Sema: Protocol requirements taking throwing closures can still be conformance rethrows sources
We meant to reject 'rethrows' requirements here instead.
2021-02-09 00:11:01 -05:00
Slava Pestov
31f2c83140 Sema: Fix inconsistent rethrows conformance checking with 'self' parameter 2021-02-09 00:11:01 -05:00
Philippe Hausler
6e05240426 AsyncSequence and protocol conformance rethrows (#35224)
* Initial draft of async sequences

* Adjust AsyncSequence associated type requirements

* Add a draft implementation of AsyncSequence and associated functionality

* Correct merge damage and rename from GeneratorProtocol to AsyncIteratorProtocol

* Add AsyncSequence types to the cmake lists

* Add cancellation support

* [DRAFT] Implementation of protocol conformance rethrowing

* Account for ASTVerifier passes to ensure throwing and by conformance rethrowing verifies appropriately

* Remove commented out code

* OtherConstructorDeclRefExpr can also be a source of a rethrowing kind function

* Re-order the checkApply logic to account for existing throwing calculations better

* Extract rethrowing calculation into smaller functions

* Allow for closures and protocol conformances to contribute to throwing

* Add unit tests for conformance based rethrowing

* Restrict rethrowing requirements to only protocols marked with @rethrows

* Correct logic for gating of `@rethrows` and adjust the determinates to be based upon throws and not rethrows spelling

* Attempt to unify the async sequence features together

* Reorder try await to latest syntax

* revert back to the inout diagnosis

* House mutations in local scope

* Revert "House mutations in local scope"

This reverts commit d91f1b25b59fff8e4be107c808895ff3f293b394.

* Adjust for inout diagnostics and fall back to original mutation strategy

* Convert async flag to source locations and add initial try support to for await in syntax

* Fix case typo of MinMax.swift

* Adjust rethrowing tests to account for changes associated with @rethrows

* Allow parsing and diagnostics associated with try applied to for await in syntax

* Correct the code-completion for @rethrows

* Additional corrections for the code-completion for @rethrows this time for the last in the list

* Handle throwing cases of iteration of async sequences

* restore building XCTest

* First wave of feedback fixes

* Rework constraints checking for async sequence for-try-await-in checking

* Allow testing of for-await-in parsing and silgen testing and add unit tests for both

* Remove async sequence operators for now

* Back out cancellation of AsyncIteratorProtocols

* Restructure protocol conformance throws checking and cache results

* remove some stray whitespaces

* Correct some merge damage

* Ensure the throwing determinate for applying for-await-in always has a valid value and adjust the for-await-in silgen test to reflect the cancel changes

* Squelch the python linter for line length
2021-01-25 18:48:50 -08:00