# Exercise literal inlining through the public CLI and refuse unsafe values and conversion-name bindings. mkdir .scratch cp calc.go .scratch/calc_before.go ! exec semedit refactor-inline-value --file calc.go --symbol value --in-function LocalAlias stderr 'cannot inline "value": default type name int is shadowed by a local or package binding or import' cmp calc.go .scratch/calc_before.go exec semedit refactor-inline-value --file calc.go --symbol value --in-function Compute cmp calc.go want/calc.go ! exec semedit refactor-inline-value --file calc.go --symbol result --in-function Compute stderr 'computed initializer must contain only scalar literals' cmp calc.go want/calc.go ! exec semedit refactor-inline-value --file calc.go --symbol typed --in-function Compute stderr 'explicitly typed declarations require preserving their declared type' cmp calc.go want/calc.go ! exec semedit refactor-inline-value --file calc.go --symbol shadowed --in-function Shadow stderr 'default type name int is shadowed' cmp calc.go want/calc.go ! exec semedit refactor-inline-value --file sibling/calc.go --symbol value --in-function Compute stderr 'default type name int is shadowed' cmp sibling/calc.go expected/sibling.go exec go test ./... -- go.mod -- module example.com/inline go 1.23 -- calc.go -- package calc func Compute() int { value := 42 println(value) result := compute() println(result) var typed int64 = 9 println(typed) return 0 } func Shadow() { int := 7 _ = int shadowed := 42 println(shadowed) } func LocalAlias() { type int = string value := 42 println(value) } func compute() int { return 1 } -- want/calc.go -- package calc func Compute() int { println(int(42)) result := compute() println(result) var typed int64 = 9 println(typed) return 0 } func Shadow() { int := 7 _ = int shadowed := 42 println(shadowed) } func LocalAlias() { type int = string value := 42 println(value) } func compute() int { return 1 } -- sibling/calc.go -- package sibling func Compute() { value := 42 println(value) } -- sibling/peer.go -- package sibling type int = byte -- expected/sibling.go -- package sibling func Compute() { value := 42 println(value) }