File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,8 @@ func (v *checker) visit(node ast.Node) Nature {
178
178
nt = v .PointerNode (n )
179
179
case * ast.VariableDeclaratorNode :
180
180
nt = v .VariableDeclaratorNode (n )
181
+ case * ast.SequenceNode :
182
+ nt = v .SequenceNode (n )
181
183
case * ast.ConditionalNode :
182
184
nt = v .ConditionalNode (n )
183
185
case * ast.ArrayNode :
@@ -1181,6 +1183,17 @@ func (v *checker) VariableDeclaratorNode(node *ast.VariableDeclaratorNode) Natur
1181
1183
return exprNature
1182
1184
}
1183
1185
1186
+ func (v * checker ) SequenceNode (node * ast.SequenceNode ) Nature {
1187
+ if len (node .Nodes ) == 0 {
1188
+ return v .error (node , "empty sequence expression" )
1189
+ }
1190
+ var last Nature
1191
+ for _ , node := range node .Nodes {
1192
+ last = v .visit (node )
1193
+ }
1194
+ return last
1195
+ }
1196
+
1184
1197
func (v * checker ) lookupVariable (name string ) (varScope , bool ) {
1185
1198
for i := len (v .varScopes ) - 1 ; i >= 0 ; i -- {
1186
1199
if v .varScopes [i ].name == name {
Original file line number Diff line number Diff line change @@ -669,6 +669,14 @@ invalid operation: == (mismatched types int and string) (1:33)
669
669
invalid operation: > (mismatched types string and int) (1:30)
670
670
| 1..3 | map("str") | filter(# > 1)
671
671
| .............................^
672
+ ` ,
673
+ },
674
+ {
675
+ `1; 2 + true; 3` ,
676
+ `
677
+ invalid operation: + (mismatched types int and bool) (1:6)
678
+ | 1; 2 + true; 3
679
+ | .....^
672
680
` ,
673
681
},
674
682
}
You can’t perform that action at this time.
0 commit comments