Skip to main content

shadowed_imports

Function shadowed_imports 

Source
pub fn shadowed_imports(
    name: &str,
    unit_info: &BTreeMap<String, UnitInfo>,
) -> HashMap<String, ShadowedImport>
Expand description

#1925: the uses-imported functions and assets that unit name’s own declarations of another kind shadow, by name. A local declaration wins, as in the emitted module, so both compositions leave these out (compose_unit_symbols, crate::assets::compose_unit_assets); the resolver and checker report a reference the local declaration cannot answer as bynk.uses.name_conflict (ResolvedCommons::shadowed_import_error). A same-kind shadow (a local function over an imported one) is ordinary shadowing and is not listed. The first uses target to declare a name decides, as in the compositions.

#1927: an imported type a local value hides is listed too, but stays in the composed table: an imported declaration that uses it must still check, and a value of it may flow through the unit’s code. Writing its name is the conflict instead (crate::resolver::check_shadowed_type_names). A local type or event over an imported type is #1824’s type shadowing, not listed.