tree-sitter-fsharp
tree-sitter-fsharp copied to clipboard
Multiline record pattern match errors
For example:
diff --git a/test/corpus/patterns.txt b/test/corpus/patterns.txt
index e2ae7a1..0b4177d 100644
--- a/test/corpus/patterns.txt
+++ b/test/corpus/patterns.txt
@@ -270,6 +270,24 @@ let f =
(const
(unit))))))))
+================================================================================
+multiline record patterns
+================================================================================
+
+type T() =
+ let v =
+ match immutQuery with
+ | { Field1 = 1
+ Field2 = true } -> ()
+ | { Field1 = 2
+ Field2 = false } -> ()
+
+ do ()
+
+--------------------------------------------------------------------------------
+
+
+
================================================================================
empty list pattern
================================================================================
Results in:
(ERROR
(type_name
(identifier))
(primary_constr_args)
(value_declaration_left
(identifier_pattern
(long_identifier_or_op
(identifier))))
(application_expression
(match_expression
(long_identifier_or_op
(identifier))
(rules
(rule
(record_pattern
(field_pattern
(long_identifier
(identifier))
(ERROR
(int))
(identifier_pattern
(long_identifier_or_op
(identifier))
(ERROR)
(const
(bool)))))
(const
(unit)))
(rule
(record_pattern
(field_pattern
(long_identifier
(identifier))
(ERROR
(int)
(identifier))
(const
(bool))))
(const
(unit)))))
(do_expression
(const
(unit)))))
When putting the patterns on one line each, it parses successfully:
diff --git a/test/corpus/patterns.txt b/test/corpus/patterns.txt
index e2ae7a1..c7ad4d9 100644
--- a/test/corpus/patterns.txt
+++ b/test/corpus/patterns.txt
@@ -270,6 +270,68 @@ let f =
(const
(unit))))))))
+================================================================================
+multiline record patterns
+================================================================================
+
+type T() =
+ let v =
+ match immutQuery with
+ | { Field1 = 1; Field2 = true } -> ()
+ | { Field1 = 2; Field2 = false } -> ()
+
+ do ()
+
+--------------------------------------------------------------------------------
+
+(file
+ (type_definition
+ (anon_type_defn
+ (type_name
+ (identifier))
+ (primary_constr_args)
+ (type_extension_elements
+ (function_or_value_defn
+ (value_declaration_left
+ (identifier_pattern
+ (long_identifier_or_op
+ (identifier))))
+ (match_expression
+ (long_identifier_or_op
+ (identifier))
+ (rules
+ (rule
+ (record_pattern
+ (field_pattern
+ (long_identifier
+ (identifier))
+ (const
+ (int)))
+ (field_pattern
+ (long_identifier
+ (identifier))
+ (const
+ (bool))))
+ (const
+ (unit)))
+ (rule
+ (record_pattern
+ (field_pattern
+ (long_identifier
+ (identifier))
+ (const
+ (int)))
+ (field_pattern
+ (long_identifier
+ (identifier))
+ (const
+ (bool))))
+ (const
+ (unit)))))))
+ (type_extension_elements
+ (const
+ (unit))))))
+
================================================================================
empty list pattern
================================================================================