This test checks the behavior of the 'extract variable/constant' code action.
See extract_variable_resolve.txt for the same test with resolve support.

-- flags --
-ignore_extra_diags

-- basic_lit.go --
package extract

func _() {
	var _ = 1 + 2 //@codeaction("1", "refactor.extract.constant", edit=basic_lit1)
	var _ = 3 + 4 //@codeaction("3 + 4", "refactor.extract.constant", edit=basic_lit2)
}

-- @basic_lit1/basic_lit.go --
@@ -4 +4,2 @@
-	var _ = 1 + 2 //@codeaction("1", "refactor.extract.constant", edit=basic_lit1)
+	const k = 1
+	var _ = k + 2 //@codeaction("1", "refactor.extract.constant", edit=basic_lit1)
-- @basic_lit2/basic_lit.go --
@@ -5 +5,2 @@
-	var _ = 3 + 4 //@codeaction("3 + 4", "refactor.extract.constant", edit=basic_lit2)
+	const k = 3 + 4
+	var _ = k //@codeaction("3 + 4", "refactor.extract.constant", edit=basic_lit2)
-- func_call.go --
package extract

import "strconv"

func _() {
	x0 := append([]int{}, 1) //@codeaction("append([]int{}, 1)", "refactor.extract.variable", edit=func_call1)
	str := "1"
	b, err := strconv.Atoi(str) //@codeaction("strconv.Atoi(str)", "refactor.extract.variable", edit=func_call2)
}

-- @func_call1/func_call.go --
@@ -6 +6,2 @@
-	x0 := append([]int{}, 1) //@codeaction("append([]int{}, 1)", "refactor.extract.variable", edit=func_call1)
+	x := append([]int{}, 1)
+	x0 := x //@codeaction("append([]int{}, 1)", "refactor.extract.variable", edit=func_call1)
-- @func_call2/func_call.go --
@@ -8 +8,2 @@
-	b, err := strconv.Atoi(str) //@codeaction("strconv.Atoi(str)", "refactor.extract.variable", edit=func_call2)
+	x, x1 := strconv.Atoi(str)
+	b, err := x, x1 //@codeaction("strconv.Atoi(str)", "refactor.extract.variable", edit=func_call2)
-- scope.go --
package extract

import "go/ast"

func _() {
	x0 := 0
	if true {
		y := ast.CompositeLit{} //@codeaction("ast.CompositeLit{}", "refactor.extract.variable", edit=scope1)
	}
	if true {
		x := !false //@codeaction("!false", "refactor.extract.constant", edit=scope2)
	}
}

-- @scope1/scope.go --
@@ -8 +8,2 @@
-		y := ast.CompositeLit{} //@codeaction("ast.CompositeLit{}", "refactor.extract.variable", edit=scope1)
+		x := ast.CompositeLit{}
+		y := x //@codeaction("ast.CompositeLit{}", "refactor.extract.variable", edit=scope1)
-- @scope2/scope.go --
@@ -11 +11,2 @@
-		x := !false //@codeaction("!false", "refactor.extract.constant", edit=scope2)
+		const k = !false
+		x := k //@codeaction("!false", "refactor.extract.constant", edit=scope2)
