shadowing

A name hides another name that is already in scope.

compile error, shown by synod check.

Every name has one meaning. A local, a binding, a hole or an each name must not be spelled like another of these, like a zero-hole phrase, or like a record type of the package. A node field or phrase head must not be spelled like an import qualifier of the file.

Example

Check this program to see the diagnostic.

# package p
define Total [x: number]
  set sum to x
  each x in {1, 2}
    set sum to (sum plus x)
  result sum

Diagnostic

p/p.synod:4:8: error[shadowing]: "x" hides the hole "x" at p/p.synod:2
  hint: rename it

Fix

Rename the second name.

# package p
define Total [x: number]
  set sum to x
  each y in {1, 2}
    set sum to (sum plus y)
  result sum