File tree Expand file tree Collapse file tree 3 files changed +3
-31
lines changed
baml-lib/baml/tests/validation_files/loops Expand file tree Collapse file tree 3 files changed +3
-31
lines changed Original file line number Diff line number Diff line change @@ -2363,20 +2363,6 @@ pub fn typecheck_expression(
23632363
23642364 _ => {
23652365 match ( left. meta ( ) . 1 . as_ref ( ) , right. meta ( ) . 1 . as_ref ( ) ) {
2366- ( None , Some ( _) ) => {
2367- diagnostics. push_error ( DatamodelError :: new_validation_error (
2368- "Invalid binary operation: cannot infer type of left operand" ,
2369- span. clone ( ) ,
2370- ) )
2371- }
2372-
2373- ( Some ( _) , None ) => {
2374- diagnostics. push_error ( DatamodelError :: new_validation_error (
2375- "Invalid binary operation: cannot infer type of right operand" ,
2376- span. clone ( ) ,
2377- ) )
2378- }
2379-
23802366 ( Some ( left_type) , Some ( right_type) ) => {
23812367 diagnostics. push_error ( DatamodelError :: new_validation_error (
23822368 & format ! ( "Invalid binary operation ({operator}) on different types: {} {operator} {}" ,
@@ -2387,11 +2373,9 @@ pub fn typecheck_expression(
23872373 ) ) ;
23882374 }
23892375
2390- ( None , None ) => {
2391- diagnostics. push_error ( DatamodelError :: new_validation_error (
2392- "Invalid binary operation: cannot infer type of operands" ,
2393- span. clone ( ) ,
2394- ) ) ;
2376+ _ => {
2377+ // We won't emit more diagnostics here because if either of the branches
2378+ // has no type we've already emitted an error for that branch
23952379 }
23962380 } ;
23972381
Original file line number Diff line number Diff line change @@ -80,12 +80,6 @@ function BreakContinue() -> int {
8080// 20 |
8181// 21 | for (; i <= 10; i += 1) {
8282// |
83- // error: Error validating: Invalid binary operation: cannot infer type of left operand
84- // --> loops/c_for.baml:21
85- // |
86- // 20 |
87- // 21 | for (; i <= 10; i += 1) {
88- // |
8983// error: Error validating: Unknown variable i
9084// --> loops/c_for.baml:21
9185// |
Original file line number Diff line number Diff line change @@ -53,12 +53,6 @@ function MissingLetAfter() -> int {
5353// 3 |
5454// 4 | for (i = 0; i < 3; i += 1) {
5555// |
56- // error: Error validating: Invalid binary operation: cannot infer type of left operand
57- // --> loops/header_requires_let_negative.baml:4
58- // |
59- // 3 |
60- // 4 | for (i = 0; i < 3; i += 1) {
61- // |
6256// error: Error validating: Unknown variable i
6357// --> loops/header_requires_let_negative.baml:4
6458// |
You can’t perform that action at this time.
0 commit comments