Closed
Description
Gopls' extract logic does not correctly handle the case when an expression has multiple values:
Before:
func f(m map[string]int) {
if v, ok := m[""]; ok { // <-- refactor.extract.variable on m[""]
println(v)
}
}
After:
func f(m map[string]int) {
x := m[""]
if v, ok := x; ok { // error: assignment mismatch
println(v)
}
}