This test checks the behavior of the 'fill switch' code action.
See fill_switch_resolve.txt for same test with resolve support.

-- capabilities.json --
{
	"textDocument": {
		"codeAction": {
			"dataSupport": false,
			"resolveSupport": {}
		}
	}
}
-- flags --
-ignore_extra_diags

-- go.mod --
module golang.org/lsptests/fillswitch

go 1.18

-- data/data.go --
package data

type TypeB int

const (
  TypeBOne TypeB = iota
  TypeBTwo
  TypeBThree
)

-- a.go --
package fillswitch

import (
	dataalias "golang.org/lsptests/fillswitch/data"
)

type typeA int

const (
	typeAOne typeA = iota
	typeATwo
	typeAThree
)

type notification interface {
	isNotification()
}

type notificationOne struct{}

func (notificationOne) isNotification() {}

type notificationTwo struct{}

func (notificationTwo) isNotification() {}

func doSwitch() {
	var b dataalias.TypeB
	switch b {
	case dataalias.TypeBOne: //@codeaction(":", "refactor.rewrite.fillSwitch", edit=a1)
	}

	var a typeA
	switch a {
	case typeAThree: //@codeaction(":", "refactor.rewrite.fillSwitch", edit=a2)
	}

	var n notification
	switch n.(type) { //@codeaction("{", "refactor.rewrite.fillSwitch", edit=a3)
	}

	switch nt := n.(type) { //@codeaction("{", "refactor.rewrite.fillSwitch", edit=a4)
	}

	var s struct {
		a typeA
	}

	switch s.a {
	case typeAThree: //@codeaction(":", "refactor.rewrite.fillSwitch", edit=a5)
	}
}
-- alias.go --
package fillswitch

import format "fmt"

var _ = format.Sprintf

func doAliasedFmtSwitch() {
	var a typeA
	switch a {
	case typeAThree: //@codeaction(":", "refactor.rewrite.fillSwitch", edit=a6)
	}
}
-- @a1/a.go --
@@ -4 +4,2 @@
+	"fmt"
+
@@ -31 +33,4 @@
+	case dataalias.TypeBThree:
+	case dataalias.TypeBTwo:
+	default:
+		panic(fmt.Sprintf("unexpected data.TypeB: %#v", b))
-- @a2/a.go --
@@ -4 +4,2 @@
+	"fmt"
+
@@ -36 +38,4 @@
+	case typeAOne:
+	case typeATwo:
+	default:
+		panic(fmt.Sprintf("unexpected fillswitch.typeA: %#v", a))
-- @a3/a.go --
@@ -4 +4,2 @@
+	"fmt"
+
@@ -40 +42,4 @@
+	case notificationOne:
+	case notificationTwo:
+	default:
+		panic(fmt.Sprintf("unexpected fillswitch.notification: %#v", n))
-- @a4/a.go --
@@ -4 +4,2 @@
+	"fmt"
+
@@ -43 +45,4 @@
+	case notificationOne:
+	case notificationTwo:
+	default:
+		panic(fmt.Sprintf("unexpected fillswitch.notification: %#v", nt))
-- @a5/a.go --
@@ -4 +4,2 @@
+	"fmt"
+
@@ -51 +53,4 @@
+	case typeAOne:
+	case typeATwo:
+	default:
+		panic(fmt.Sprintf("unexpected fillswitch.typeA: %#v", s.a))
-- @a6/alias.go --
@@ -11 +11,4 @@
+	case typeAOne:
+	case typeATwo:
+	default:
+		panic(format.Sprintf("unexpected fillswitch.typeA: %#v", a))
