Skip to content

[cxx-interop] Add source location to instantiation error #82717

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

Conversation

Xazax-hun
Copy link
Contributor

Previously, the diagnostic was emitted with an unknown location.

Previously, the diagnostic was emitted with an unknown location.
@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Jul 2, 2025
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

This is extremely useful, thanks!

@@ -25,12 +25,12 @@ public protocol A { }
public protocol B { }
public protocol C { }

// CHECK: error: unexpected error produced: could not generate C++ types from the generic Swift types provided; the following Swift type(s) provided to 'passThrough' could not be converted: any A & B
// CHECK: function-templates.h{{.*}}: error: diagnostic produced elsewhere: could not generate C++ types from the generic Swift types provided; the following Swift type(s) provided to 'passThrough' could not be converted: any A & B
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to match the line number with [[@LINE+1]]

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 location is in a header that we import, so the line reported here has no relationship to the lines in this file. Or is there a way to make that work regardless?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh year, right! It could be done by putting the CHECK line in the header, and passing the header to FileCheck instead. But that may or may not be suitable here.

@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test Windows

@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test windows

@Xazax-hun Xazax-hun merged commit 507f82c into swiftlang:main Jul 3, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants