diff --git a/examples/expressions.fs b/examples/expressions.fs index 14a1be1bf..c85948d1d 100644 --- a/examples/expressions.fs +++ b/examples/expressions.fs @@ -1,5 +1,5 @@ -do - match x with - | x -> () - | _ -> () - if x then () else () +let x = + ( + 1 + 2 + ) diff --git a/src/scanner.c b/src/scanner.c index 514352458..78567a997 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -209,9 +209,8 @@ bool tree_sitter_fsharp_external_scanner_scan(void *payload, TSLexer *lexer, return true; } - if (valid_symbols[INDENT] && indent_length > current_indent_length && - !found_start_of_infix_op && !found_bracket_end && - !error_recovery_mode) { + if (valid_symbols[INDENT] && !found_start_of_infix_op && + !found_bracket_end && !error_recovery_mode) { array_push(&scanner->indents, indent_length); lexer->result_symbol = INDENT; return true; diff --git a/test/corpus/expr.txt b/test/corpus/expr.txt index de6615a1c..2c0993e91 100644 --- a/test/corpus/expr.txt +++ b/test/corpus/expr.txt @@ -173,6 +173,24 @@ do (4) (paren_expression (const (int)))))) +================================================================================ +sequential expression in paren expression +================================================================================ + +do + (4 + 3) + +-------------------------------------------------------------------------------- + +(file + (value_declaration + (do + (paren_expression + (sequential_expression + (const (int)) + (const (int))))))) + ================================================================================ let decl in paren expression ================================================================================ @@ -1912,3 +1930,57 @@ do (unit)) (const (unit))))))) + +================================================================================ +multi-line Array.map +================================================================================ + +let f xs = + xs + |> Array.map (fun x -> + let y = x + 1 + x) + +-------------------------------------------------------------------------------- + +(file + (value_declaration + (function_or_value_defn + (function_declaration_left + (identifier) + (argument_patterns + (long_identifier + (identifier)))) + (application_expression + (infix_expression + (long_identifier_or_op + (long_identifier + (identifier))) + (infix_op + (symbolic_op)) + (long_identifier_or_op + (long_identifier + (identifier) + (identifier)))) + (paren_expression + (fun_expression + (argument_patterns + (long_identifier + (identifier))) + (declaration_expression + (function_or_value_defn + (value_declaration_left + (identifier_pattern + (long_identifier + (identifier)))) + (infix_expression + (long_identifier_or_op + (long_identifier + (identifier))) + (infix_op) + (const + (int)))) + (long_identifier_or_op + (long_identifier + (identifier)))))))))) +