Skip to content

Enable lazy ClangImporter diagnostics by default #40903

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
Feb 4, 2022

Conversation

NuriAmari
Copy link
Contributor

Replace the existing -enable-experimental-clang-importer-diagnostics
flag with an opt-out version entitled -disable-experimentalc-clang-importer-diagnostics.
Enable the beviour previously hidden behind the old flag by default.

Implements the changes described in this forum post.

Copy link
Contributor

@zoecarver zoecarver left a comment

Choose a reason for hiding this comment

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

This looks good to me.

However, before this lands, I want to make sure there is at least one test where there are multiple un-importable APIs and we only use one of them. We should only get one error.

@NuriAmari NuriAmari force-pushed the default-diagnostics branch 5 times, most recently from 2a6aa15 to 6726b13 Compare January 20, 2022 20:16
@zoecarver
Copy link
Contributor

@swift-ci please smoke test.

@zoecarver
Copy link
Contributor

As discussed offline, I just realized because these tests require objc-interop they are only getting run on macOS. Please add a test that uses C++ interop so they get run on all platforms. You can do something like this:

// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-cxx-interop

@NuriAmari NuriAmari force-pushed the default-diagnostics branch from 6726b13 to 44fd9c8 Compare January 22, 2022 00:01
@zoecarver
Copy link
Contributor

@swift-ci please smoke test

@NuriAmari NuriAmari force-pushed the default-diagnostics branch from 44fd9c8 to c236160 Compare January 22, 2022 15:39
@zoecarver
Copy link
Contributor

@swift-ci please smoke test

@zoecarver
Copy link
Contributor

@swift-ci please test Windows

@@ -1,5 +1,5 @@
// RUN: %empty-directory(%t.mcp)
// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -Xcc -w -typecheck %s -module-cache-path %t.mcp -disable-named-lazy-member-loading 2>&1 | %FileCheck %s
// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk) -disable-experimental-clang-importer-diagnostics -I %S/Inputs/custom-modules -Xcc -w -typecheck %s -module-cache-path %t.mcp -disable-named-lazy-member-loading 2>&1 | %FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this test need to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't need updating anymore, but at the time it was because the new diagnostics were tripping a CHECK-NOT. The diagnostic was accurate, and is still there, but now it's emmitted later in a position that does not trip a CHECK-NOT.

The new diagnostic informs about a circularFriends method that can't be imported because parameter type CircularName is unimportable. Not exactly sure of the details, but looks intentional, I can dig deeper if need be.

@zoecarver
Copy link
Contributor

Don't merge this until we resolve the updated test. I also want to understand why these can't be errors anymore.

Replace the existing `-enable-experimental-clang-importer-diagnostics`
flag with an opt-out version entitled `-disable-experimentalc-clang-importer-diagnostics`.
Enable the beviour previously hidden behind the old flag by default.
@NuriAmari NuriAmari force-pushed the default-diagnostics branch from c236160 to 7ec861f Compare February 1, 2022 23:44
@NuriAmari
Copy link
Contributor Author

@swift-ci please smoke test

// CHECK-NOT: error
// CHECK-NOT: note

// CHECK-NOT: warning
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Remove unnecessary CHECK-NOTs

@zoecarver
Copy link
Contributor

@swift-ci please smoke test.

@NuriAmari
Copy link
Contributor Author

MacOS failure looks unrelated to me. I will complete the TODO comment I have left over above, and will test with errors instead of notes here: #41162. If that goes well, should be ready for merge.

@zoecarver
Copy link
Contributor

@swift-ci please smoke test macOS

@NuriAmari NuriAmari merged commit fda0b80 into swiftlang:main Feb 4, 2022
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.

2 participants