Skip to content

Commit 50b05f5

Browse files
committed
pattern: don't panic on unsupported comparisons
Users can write nonsensical patterns that parse fine, but lead to impossible comparisons during matching. Instead of panicing, which was a useful debug aid, correctly return false.
1 parent ed710f4 commit 50b05f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pattern/match.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func match(m *Matcher, l, r interface{}) (interface{}, bool) {
317317
}
318318
}
319319

320-
panic(fmt.Sprintf("unsupported comparison: %T and %T", l, r))
320+
return nil, false
321321
}
322322

323323
// Match a Node with an AST node

0 commit comments

Comments
 (0)