Skip to content
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

[AST/Sema] Introduce a new type that has associated location in source #77797

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Nov 21, 2024

This type is intended to be used to wrap compiler synthesized nodes
(i.e. variables) to make it easier for diagnostic to diagnose precise
failure locations.

Consider the situation like:

protocol P {}

extension Array: P where Element: P {}

func test<T: P>() -> T {
  $_a = ...
  $_b = ...
  return [$_a, $_b]
}

This is a common pattern with result builders.

In this case if one of the elements don't conform to P the best
user experience would be to attach diagnostic to the element otherwise
the developers would have to figure out where in result expression
the error occurred before attempting to fix it.

Resolves: rdar://139842210

This type is intended to be used to wrap compiler synthesized nodes
(i.e. variables) to make it easier for diagnostic to diagnose precise
failure locations.

Consider the situation like:

```
protocol P {}

extension Array: P where Element: P {}

func test<T: P>() -> T {
  $_a = ...
  $_b = ...
  return [$_a, $_b]
}
```

This is a common pattern with result builders.

In this case if one of the elements don't conform to `P` the best
user experience would be to attach diagnostic to the element otherwise
the developers would have to figure out where in result expression
the error occured before attempting to fix it.
…catable

This would aid `FailureDiagnostic` in anchoring conformance failures to `View`.
…catable types

If conformance failure is associated with a `LocatableType`, use
its location to anchor the failure.
@xedin
Copy link
Contributor Author

xedin commented Nov 22, 2024

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Nov 22, 2024

@swift-ci please build toolchain macOS

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