File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -407,14 +407,14 @@ function foo(foo : natural) return lib.foo.natural;
407407 pub fn parses_function_signature_many_return_error ( ) {
408408 let code = Code :: new ( "[return bar.type_mark return" ) ;
409409 assert_eq ! (
410- code. with_stream_err ( parse_signature) ,
411- Diagnostic :: error( code. s( "return" , 2 ) , "Expected ']'" )
410+ code. with_partial_stream ( parse_signature) ,
411+ Err ( Diagnostic :: error( code. s( "return" , 2 ) , "Expected ']'" ) )
412412 ) ;
413413
414414 let code = Code :: new ( "[foo return bar.type_mark return" ) ;
415415 assert_eq ! (
416- code. with_stream_err ( parse_signature) ,
417- Diagnostic :: error( code. s( "return" , 2 ) , "Expected ']'" )
416+ code. with_partial_stream ( parse_signature) ,
417+ Err ( Diagnostic :: error( code. s( "return" , 2 ) , "Expected ']'" ) )
418418 ) ;
419419 }
420420
Original file line number Diff line number Diff line change @@ -50,8 +50,13 @@ impl<'a> TokenStream<'a> {
5050 }
5151
5252 pub fn expect_kind ( & mut self , kind : Kind ) -> DiagnosticResult < Token > {
53- if let Some ( token) = self . pop ( ) ? {
54- token. expect_kind ( kind)
53+ if let Some ( token) = self . peek ( ) ? {
54+ if token. kind == kind {
55+ self . move_after ( & token) ;
56+ Ok ( token)
57+ } else {
58+ Err ( token. kinds_error_before ( & [ kind] ) )
59+ }
5560 } else {
5661 Err ( self
5762 . tokenizer
You can’t perform that action at this time.
0 commit comments