Skip to content

Sema: consolidate diagnostics about package modifier outside of a package #68639

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 2 commits into from
Sep 20, 2023

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Sep 19, 2023

Show the same error for both decls and imports when using the package access level and no package name is set. Also brings up this check to run once on decls and avoid repeated diagnostics.

Show the same error for both decls and imports when using the package
access level and no package name is set. Also brings up this check to
run once on decls and avoid repeated diagnostics.
@xymus xymus requested a review from elsh September 19, 2023 22:04
@xymus
Copy link
Contributor Author

xymus commented Sep 19, 2023

@swift-ci Please smoke test

@xymus xymus changed the title Sema: Merge diagnostics about package modifier outside of a package Sema: consolidate diagnostics about package modifier outside of a package Sep 19, 2023
@@ -3,11 +3,11 @@
// Package name should not be empty
// RUN: not %target-swift-frontend -typecheck %s -package-name "" 2>&1 | %FileCheck %s -check-prefix CHECK-EMPTY
// CHECK-EMPTY: error: package-name is empty
// CHECK-EMPTY: error: 'log' has a package access level but no -package-name was specified: {{.*}}.swift
// CHECK-EMPTY: error: the package access level requires a package name; set it with the compiler flag -package-name
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we still pass the symbol name here? I usually find it helpful esp when there are multiple errors with the same diags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests don't show this but the diagnostics points to the attribute. Since the solution is to change a project setting I thought it would be enough. I can special case the check for a value decl if you prefer for us to keep the decl name.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a nice to have, but not a strict requirement. I'm ok with adding it in the future if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added it back for ValueDecls.

@xymus
Copy link
Contributor Author

xymus commented Sep 20, 2023

@swift-ci Please smoke test

@xymus xymus merged commit 23e6149 into swiftlang:main Sep 20, 2023
@xymus xymus deleted the package-or-no-package branch September 20, 2023 16:01
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