@@ -950,10 +950,9 @@ impl<'a> LatePeepholeOptimizations {
950
950
951
951
let Expression :: ArrayExpression ( array) = expr else { unreachable ! ( ) } ;
952
952
953
- let is_all_string = array
954
- . elements
955
- . iter ( )
956
- . all ( |element| element. as_expression ( ) . is_some_and ( Expression :: is_string_literal) ) ;
953
+ let is_all_string = array. elements . iter ( ) . all ( |element| {
954
+ element. as_expression ( ) . is_some_and ( |expr| matches ! ( expr, Expression :: StringLiteral ( _) ) )
955
+ } ) ;
957
956
if !is_all_string {
958
957
return None ;
959
958
}
@@ -1323,13 +1322,15 @@ mod test {
1323
1322
1324
1323
test_same_with_longer_args ( "'1','2','3','4'" ) ;
1325
1324
test_same_with_longer_args ( "'1','2','3','4','5'" ) ;
1325
+ test_same_with_longer_args ( "`1${a}`,'2','3','4','5','6'" ) ;
1326
1326
test_with_longer_args ( "'1','2','3','4','5','6'" , "123456" , "" ) ;
1327
1327
test_with_longer_args ( "'1','2','3','4','5','00'" , "1.2.3.4.5.00" , "." ) ;
1328
1328
test_with_longer_args ( "'1','2','3','4','5','6','7'" , "1234567" , "" ) ;
1329
1329
test_with_longer_args ( "'1','2','3','4','5','6','00'" , "1.2.3.4.5.6.00" , "." ) ;
1330
1330
test_with_longer_args ( "'.,',',',',',',',',',','" , ".,(,(,(,(,(," , "(" ) ;
1331
1331
test_with_longer_args ( "',,','.',',',',',',',','" , ",,(.(,(,(,(," , "(" ) ;
1332
1332
test_with_longer_args ( "'a,','.',',',',',',',','" , "a,(.(,(,(,(," , "(" ) ;
1333
+ test_with_longer_args ( "`1`,'2','3','4','5','6'" , "123456" , "" ) ;
1333
1334
1334
1335
// all possible delimiters used, leave it alone
1335
1336
test_same_with_longer_args ( "'.', ',', '(', ')', ' '" ) ;
0 commit comments