1// module `package::shadow`: local declarations shadowing global declarations2// and imported items.4import constants::PI;5import package::util::dot2;7const level: f32 = 1.0;9fn uses_globals() -> f32 {10 // module-scope names, not shadowed here.11 return level + PI + dot2(vec2f(1.0), vec2f(2.0));12}14public fn shadowed_fn(dot2: f32) -> f32 {15 // the formal parameter `dot2` shadows the imported function for the16 // entire body; the import is still usable through `uses_globals`.17 let base = uses_globals() + dot2;19 // local `let` shadows the global const `level`.20 let level = base + 1.0;22 // local `var` shadows the imported virtual constant `PI`.23 var PI = 3.0;25 {26 // nested-scope shadowing of the local above (initializer sees the27 // outer PI).28 let PI = PI * 2.0;29 return level + PI;30 }31}