aboutsummaryrefslogtreecommitdiff
path: root/gopls/internal/lsp/testdata/typeassert/type_assert.go
diff options
context:
space:
mode:
Diffstat (limited to 'gopls/internal/lsp/testdata/typeassert/type_assert.go')
-rw-r--r--gopls/internal/lsp/testdata/typeassert/type_assert.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/gopls/internal/lsp/testdata/typeassert/type_assert.go b/gopls/internal/lsp/testdata/typeassert/type_assert.go
new file mode 100644
index 000000000..e24b68a07
--- /dev/null
+++ b/gopls/internal/lsp/testdata/typeassert/type_assert.go
@@ -0,0 +1,24 @@
+package typeassert
+
+type abc interface { //@item(abcIntf, "abc", "interface{...}", "interface")
+ abc()
+}
+
+type abcImpl struct{} //@item(abcImpl, "abcImpl", "struct{...}", "struct")
+func (abcImpl) abc()
+
+type abcPtrImpl struct{} //@item(abcPtrImpl, "abcPtrImpl", "struct{...}", "struct")
+func (*abcPtrImpl) abc()
+
+type abcNotImpl struct{} //@item(abcNotImpl, "abcNotImpl", "struct{...}", "struct")
+
+func _() {
+ var a abc
+ switch a.(type) {
+ case ab: //@complete(":", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+ case *ab: //@complete(":", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+ }
+
+ a.(ab) //@complete(")", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+ a.(*ab) //@complete(")", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+}