Skip to content

Commit dd275da

Browse files
committed
Fix matches checker type
1 parent a234047 commit dd275da

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (v *visitor) MatchesNode(node *ast.MatchesNode) reflect.Type {
235235
r := v.visit(node.Right)
236236

237237
if isString(l) && isString(r) {
238-
return stringType
238+
return boolType
239239
}
240240

241241
panic(v.error(node, `invalid operation: matches (mismatched types %v and %v)`, l, r))

checker/checker_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func TestCheck(t *testing.T) {
175175
"String in Foo",
176176
"String matches 'ok'",
177177
"String matches Any",
178+
"(1 == 1) || (String matches Any)",
178179
"String not in Foo2p",
179180
"StringPtr == nil",
180181
"Sub.Method(0) + String",

0 commit comments

Comments
 (0)