Skip to content

Commit d409144

Browse files
authored
[Parse] Minor fix for parsing SIL BuiltinInst. (#17072)
* [Parse] Minor fix for parsing SIL BuiltinInst. The expected token in the diagnostic should be ")", not "(". * [Parse] Add test for SIL BuiltinInst parse error.
1 parent af428be commit d409144

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/ParseSIL/ParseSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2583,7 +2583,7 @@ bool SILParser::parseSILInstruction(SILBuilder &B) {
25832583
continue;
25842584
if (P.consumeIf(tok::r_paren))
25852585
break;
2586-
P.diagnose(P.Tok, diag::expected_tok_in_sil_instr, "(' or ',");
2586+
P.diagnose(P.Tok, diag::expected_tok_in_sil_instr, ")' or ',");
25872587
return true;
25882588
}
25892589

test/SIL/Parser/errors.sil

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ bb0:
2121
%2 = tuple (%199 : $()) // expected-error {{use of undefined value '%199'}}
2222
}
2323

24+
sil @local_value_errors2 : $() -> () {
25+
bb0:
26+
%0 = builtin "cmp_eq_Int1"(%0 : $() // expected-error @+1 {{expected ')' or ',' in SIL instruction}}
27+
} // expected-error {{extraneous '}' at top level}}
2428

2529
sil @global_value_errors : $() -> () {
2630
bb0:

0 commit comments

Comments
 (0)