@@ -108,10 +108,8 @@ pub enum ParseErrorKind {
108
108
#[ error( "Expected identifier" ) ]
109
109
ExpectedIdentifier ,
110
110
111
- #[ error(
112
- "Expected identifier or function call after postfix apply (`//`) but instead got: `{0}`"
113
- ) ]
114
- ExpectedIdentifierOrCallAfterPostfixApply ( String ) ,
111
+ #[ error( "Expected identifier or function call after postfix apply (`//`)" ) ]
112
+ ExpectedIdentifierOrCallAfterPostfixApply ,
115
113
116
114
#[ error( "Expected dimension identifier, '1', or opening parenthesis" ) ]
117
115
ExpectedDimensionPrimary ,
@@ -902,11 +900,9 @@ impl<'a> Parser<'a> {
902
900
params. push ( expr) ;
903
901
expr = Expression :: FunctionCall ( call_span, full_span, call, params) ;
904
902
}
905
- other => {
903
+ _other => {
906
904
return Err ( ParseError :: new (
907
- ParseErrorKind :: ExpectedIdentifierOrCallAfterPostfixApply ( format ! (
908
- "{other:?}"
909
- ) ) ,
905
+ ParseErrorKind :: ExpectedIdentifierOrCallAfterPostfixApply ,
910
906
full_span,
911
907
) )
912
908
}
@@ -1878,7 +1874,7 @@ mod tests {
1878
1874
for input in inputs {
1879
1875
match parse ( input, 0 ) {
1880
1876
Err ( ( _, errors) ) => {
1881
- assert_eq ! ( errors[ 0 ] . kind, error_kind) ;
1877
+ assert_eq ! ( errors[ 0 ] . kind, error_kind, "Failed on {}" , input ) ;
1882
1878
}
1883
1879
_ => {
1884
1880
panic ! ( ) ;
@@ -2755,6 +2751,24 @@ mod tests {
2755
2751
vec ! [ binop!( scalar!( 1.0 ) , Add , scalar!( 1.0 ) ) ] ,
2756
2752
) ,
2757
2753
) ;
2754
+ parse_as_expression (
2755
+ & [ "1 + 1 // kefir(2)" ] ,
2756
+ Expression :: FunctionCall (
2757
+ Span :: dummy ( ) ,
2758
+ Span :: dummy ( ) ,
2759
+ Box :: new ( identifier ! ( "kefir" ) ) ,
2760
+ vec ! [ scalar!( 2.0 ) , binop!( scalar!( 1.0 ) , Add , scalar!( 1.0 ) ) ] ,
2761
+ ) ,
2762
+ ) ;
2763
+
2764
+ should_fail_with ( & [ "1 // print()" ] , ParseErrorKind :: InlineProcedureUsage ) ;
2765
+
2766
+ should_fail_with ( & [ "1 // +" ] , ParseErrorKind :: ExpectedPrimary ) ;
2767
+
2768
+ should_fail_with (
2769
+ & [ "1 // 2" , "1 // 1 +" ] ,
2770
+ ParseErrorKind :: ExpectedIdentifierOrCallAfterPostfixApply ,
2771
+ ) ;
2758
2772
}
2759
2773
2760
2774
#[ test]
0 commit comments