File tree 2 files changed +5
-1
lines changed 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -484,7 +484,7 @@ func matchConstantFormatStringWithListLiteralArgs(a *ast.AST) ast.ExprMatcher {
484
484
}
485
485
}
486
486
formatString := call .Target ()
487
- if formatString .Kind () != ast .LiteralKind && formatString .AsLiteral ().Type () != cel .StringType {
487
+ if formatString .Kind () != ast .LiteralKind || formatString .AsLiteral ().Type () != cel .StringType {
488
488
return false
489
489
}
490
490
args := call .Args ()
Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ var stringTests = []struct {
141
141
{expr : `strings.quote("\U0001F431\U0001F600\U0001F61B") == "\"\U0001F431\U0001F600\U0001F61B\""` },
142
142
{expr : `strings.quote("ta©o©αT") == "\"ta©o©αT\""` },
143
143
{expr : `strings.quote("") == "\"\""` },
144
+ // Format tests with a non-literal as the format string
145
+ {
146
+ expr : `strings.quote('%s %s').format(['hello', 'world']) == "\"hello world\""` ,
147
+ },
144
148
// Error test cases based on checked expression usage.
145
149
{
146
150
expr : `'tacocat'.charAt(30) == ''` ,
You can’t perform that action at this time.
0 commit comments