Skip to content

Check thrown error types of for applications/subscripts/property access #69198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 16, 2023

Conversation

DougGregor
Copy link
Member

Whenever there is a throwing operation such as a call, subscript, or
property access, check that the error type thrown from that operation
can be caught/rethrown from the current context.

To do this, introduce a new API to find the AST node that catches or rethrows an
error thrown from the given source location.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

Introduce a new API to find the AST node that catches or rethrows an
error thrown from the given source location. Use it to determine the
thrown error type to use for type checking a `throw` statement, which
begins as `any Error` within a `do..catch` and is later refined.
…s/etc.

Whenever there is a throwing operation such as a call, subscript, or
property access, check that the error type thrown from that operation
can be caught/rethrown from the current context.
While it is not yet possible for an `AsyncSequence` to specify its
thrown error type (so it always throws `any Error`), check that `any
Error` is a suitable error type to be thrown in context.
@DougGregor DougGregor force-pushed the typed-throws-rethrow-checking branch from 9cdfe56 to 7b9c079 Compare October 16, 2023 08:12
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

… interface types

The implementation of `SimpleDidSetRequest` currently depends on a
type-checked body for `didSet`, which in turn depends on the interface
type (for the thrown error type). Break that dependency in a silly way
for now.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit a0d1c35 into swiftlang:main Oct 16, 2023
@DougGregor DougGregor deleted the typed-throws-rethrow-checking branch October 16, 2023 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant