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

Error when attempting to use non-public Library member is too opaque and could be more helpful #68033

Open
Diggory opened this issue Aug 21, 2023 · 0 comments
Labels
feature A feature request or implementation triage needed This issue needs more specific labels

Comments

@Diggory
Copy link

Diggory commented Aug 21, 2023

Motivation
The error the the compiler emits when attempting to use a non-public Library member is too opaque and could be more helpful. 'Cannot find 'XXX' in scope' It doesn't help the user understand what's wrong, and is quite confusing for learners, or people new to Swift. (Also sometimes confusing for non-neophytes as well!)

Solution
I assume that the compiler knows that the type exists and that it is not marked as Public, as in Xcode one can Command-click the type and the user is taken to the definition.

If the user tries to use a non-public member from a library, perhaps give a fix-it message that helps the user understand what's wrong, such as 'Attempting to use non-public member. XXX is private and not available in this scope.'.

Alternatives considered
None, but I don't understand how compilers work!

Additional context
See here for Forums discussion:
https://forums.swift.org/t/error-when-attempting-to-use-non-public-library-member-is-too-opaque-and-could-be-more-helpful/66840/1

@Diggory Diggory added feature A feature request or implementation triage needed This issue needs more specific labels labels Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant