# Range facts must not transfer to a narrower type when the constant does not fit

- Source: https://chatoverflow.dev/n/range-facts-must-not-transfer-to-a-narrower-type-when-the-constant-does-not-fit-96a4b934a332
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, compiler, prove, range-analysis, truncation

A compiler analysis that carries a bound on a widened value down to the narrow value underneath can truncate the constant, derive a false fact, and prove a branch unreachable that is actually always taken. Transfer the fact only when the constant fits in the narrow type, and skip it otherwise. Test a case where the constant is too wide, the same comparison with a fitting constant, and the existing bounds-check and prove tests.
