Skip to content

Lower Backtrace and SourceContext to SPI. #539

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 1 commit into from
Jul 16, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jul 16, 2024

Backtrace is our implementation of a stack trace type. Xcode 16 uses it to provide richer information about test failures than can be provided by just an instance of SourceLocation.

The standard library has its own type, _Backtracing.Backtrace, but due to our deployment requirements on Apple platforms, we can't use it yet. It would make sense for us to adopt the Backtrace type in the standard library as soon as possible. To avoid staging issues in the future, and because our type has not undergone any sort of formal review, I'm lowering it to tools-only SPI.

I'm also lowering SourceContext because it consists of an instance of Backtrace and an instance of SourceLocation—but if Backtrace is SPI, then the public interface of SourceContext is simply a wrapper around SourceLocation. This does not eliminate the internal need for the type, but it does make it redundant from an API perspective. If and when we regain Backtrace as a public interface, we can look at raising SourceContext too.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan added bug 🪲 Something isn't working public-api Affects public API labels Jul 16, 2024
@grynspan grynspan self-assigned this Jul 16, 2024
@grynspan
Copy link
Contributor Author

@swift-ci please test

@@ -22,9 +22,13 @@ extension ABIv0 {
/// The location in source where this issue occurred, if available.
var sourceLocation: SourceLocation?

/// The backtrace where this issue occurred, if available.
var _backtrace: [Backtrace.Address]?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not formally part of the JSON schema (hence the underscore) but I realized it was missing and should be present here.

`Backtrace` is our implementation of a stack trace type. Xcode 16 uses it to
provide richer information about test failures than can be provided by _just_ an
instance of `SourceLocation`.

The standard library has its own type, `_Backtracing.Backtrace`, but due to our
deployment requirements on Apple platforms, we can't use it yet. It would make
sense for us to adopt the `Backtrace` type in the standard library as soon as
possible. To avoid staging issues in the future, and because our type has not
undergone any sort of formal review, I'm lowering it to tools-only SPI.

I'm also lowering `SourceContext` because it consists of an instance of
`Backtrace` and an instance of `SourceLocation`—but if `Backtrace` is SPI, then
the public interface of `SourceContext` is simply a wrapper around
`SourceLocation`. This does not eliminate the internal need for the type, but it
does make it redundant from an API perspective. If and when we regain
`Backtrace` as a public interface, we can look at raising `SourceContext` too.
@grynspan grynspan force-pushed the jgrynspan/lower-backtrace-to-spi branch from d5c52a6 to c40ee60 Compare July 16, 2024 21:57
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan merged commit db6e08e into main Jul 16, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/lower-backtrace-to-spi branch July 16, 2024 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working public-api Affects public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants