## Symbol Resolution (High)

### Trigger Signals

- Imported symbol not used in current file (`import X` but no `X` reference in the file)
- Variable declared but not used (`const x = 1` with no subsequent reference)
- Inner variable shadows outer variable with same name (`let x = 1; { let x = 2 }`)
- Variable/function/class used before definition
- `this`/`self`/`ctx` points to incorrect object in callbacks

### Judgment Process

1. **Check unused imports**: `Read` extracts all `import`/`require` statements, `Grep` searches for whether each imported symbol is referenced in the current file
2. **Check unused variables**: `Read` extracts all `const`/`let`/`var` declarations, `Grep` searches for whether the variable name is referenced within the current function/block scope
3. **Check variable shadowing**: `Read` identifies same-name variable declarations in nested scopes, determining whether the inner declaration shadows the outer one:
   - Function parameters shadowed by inner variables
   - Outer `const` shadowed by inner `let/const`
   - `Read` confirms whether the shadowing is intentional (e.g., renaming in callbacks) or accidental
4. **Check symbol definitions**: `find_definition` looks up the symbol definition at the point of use:
   - Definition does not exist → report undefined symbol
   - Definition exists but is not in scope → report scope error
5. **Check this binding**: `Read` confirms whether `this` is correctly bound in callback functions (arrow functions vs `.bind(this)` vs `self = this`)

### Evidence Construction

After confirming a defect, the output must include:
- Defect location (unused/undefined/shadowed location, with file:line number)
- Defect type (unused import/unused variable/variable shadowing/undefined symbol)
- Impact (code redundancy, potential bug, reduced readability)

### Exclusions

- TypeScript `import type` (type imports do not affect runtime, but redundancy can be reported)
- `_` prefix variables (`_unused` convention indicates intentional disregard)
- Destructuring with only partial field usage (`b` unused in `const { a, b } = obj`)
- Global declarations provided by libraries (non-imported symbols)
- Symbols imported from third-party packages (third-party dependencies are not visible, cannot confirm symbol origin)
