# XO0603: name declared twice in one scope, or a predeclared name redefined

A name may be declared once per scope: top level declarations, fields, variants, methods, parameters, imports, and bindings in one block. Shadowing is allowed only in a nested block. Predeclared names (`Option`, `Result`, `true`, `dbg`, builtin types, ...) cannot be redefined at top level, and a type cannot have a field and a method with the same name. See core 1.4 and 3.1.

## Example

```xo
fn f() -> Int {
  let x = 1
  let x = 2
  x
}
```

## Fix

```xo
fn f() -> Int {
  let x = 1
  let y = 2
  x + y
}
```

Run `xo explain XO0603` for this text in a terminal, or see
[section 10.6 of the specification](../../spec/core/#106-diagnostic-codes).

