Skip to content

Commit 44ad36b

Browse files
committed
Add type assertions for all searchable contexts
We want to add an additional method to ISearchableContext later in this branch, and this will make sure that we don't forget to implement it in any concrete context.
1 parent 08a8b06 commit 44ad36b

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

pkg/gui/context/commit_files_context.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ type CommitFilesContext struct {
1818
}
1919

2020
var (
21-
_ types.IListContext = (*CommitFilesContext)(nil)
22-
_ types.DiffableContext = (*CommitFilesContext)(nil)
21+
_ types.IListContext = (*CommitFilesContext)(nil)
22+
_ types.DiffableContext = (*CommitFilesContext)(nil)
23+
_ types.ISearchableContext = (*CommitFilesContext)(nil)
2324
)
2425

2526
func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext {

pkg/gui/context/local_commits_context.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ type LocalCommitsContext struct {
1818
}
1919

2020
var (
21-
_ types.IListContext = (*LocalCommitsContext)(nil)
22-
_ types.DiffableContext = (*LocalCommitsContext)(nil)
21+
_ types.IListContext = (*LocalCommitsContext)(nil)
22+
_ types.DiffableContext = (*LocalCommitsContext)(nil)
23+
_ types.ISearchableContext = (*LocalCommitsContext)(nil)
2324
)
2425

2526
func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext {

pkg/gui/context/patch_explorer_context.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ type PatchExplorerContext struct {
1818
mutex *deadlock.Mutex
1919
}
2020

21-
var _ types.IPatchExplorerContext = (*PatchExplorerContext)(nil)
21+
var (
22+
_ types.IPatchExplorerContext = (*PatchExplorerContext)(nil)
23+
_ types.ISearchableContext = (*PatchExplorerContext)(nil)
24+
)
2225

2326
func NewPatchExplorerContext(
2427
view *gocui.View,

pkg/gui/context/sub_commits_context.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ type SubCommitsContext struct {
2121
}
2222

2323
var (
24-
_ types.IListContext = (*SubCommitsContext)(nil)
25-
_ types.DiffableContext = (*SubCommitsContext)(nil)
24+
_ types.IListContext = (*SubCommitsContext)(nil)
25+
_ types.DiffableContext = (*SubCommitsContext)(nil)
26+
_ types.ISearchableContext = (*SubCommitsContext)(nil)
2627
)
2728

2829
func NewSubCommitsContext(

pkg/gui/context/working_tree_context.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ type WorkingTreeContext struct {
1515
*SearchTrait
1616
}
1717

18-
var _ types.IListContext = (*WorkingTreeContext)(nil)
18+
var (
19+
_ types.IListContext = (*WorkingTreeContext)(nil)
20+
_ types.ISearchableContext = (*WorkingTreeContext)(nil)
21+
)
1922

2023
func NewWorkingTreeContext(c *ContextCommon) *WorkingTreeContext {
2124
viewModel := filetree.NewFileTreeViewModel(

0 commit comments

Comments
 (0)