You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uses of a privately imported name are reported a second time #291
After #278, an import that names a private item reports PrivateSymbol/PrivateType at the import, but doesn't import the item (importing it would be order-dependent; see #289). So each use of the name gets a second error:
import inner::secret;
mod inner {
fn secret() -> Int { 42 }
}
fn main() -> Int {
secret()
}
Error: Cannot reference private symbol `secret` in module `inner`
Error: Undeclared symbol `secret`
The second error adds nothing, and there's one for every use. main before #278 also reported the uses (with UnresolvedImport at the import).
One fix: when a named import finds only private items, record the name in the import's scope as blocked, so that resolving it at a use reports nothing more (the way an unresolved name is handled once it's been reported). It must not bind the private item, or #289 comes back. Note that this is only safe once the binding can't change in a later pass, so the blocked name must give way if a public item with that name appears later.
Low priority: the first error is correct and points at the cause.
Activity