mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-01 21:40:58 +00:00
Be more lenient with required indentation in collections
... and also remove a bunch of now-dead errors that can't be triggered.
This commit is contained in:
parent
9171799c67
commit
0da50a612d
22 changed files with 333 additions and 516 deletions
|
|
@ -1 +0,0 @@
|
|||
Expr(When(Pattern(List(End(@22), @15), @15), @0), @0)
|
||||
|
|
@ -1 +1 @@
|
|||
Expr(Type(TRecord(IndentEnd(@5), @4), @4), @0)
|
||||
Expr(Type(TRecord(End(@16), @4), @4), @0)
|
||||
|
|
@ -20,17 +20,17 @@ Defs(
|
|||
"my_list",
|
||||
),
|
||||
@10-26 List(
|
||||
Collection {
|
||||
items: [
|
||||
@16-17 SpaceBefore(
|
||||
Num(
|
||||
"0",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
[
|
||||
@16-17 SpaceBefore(
|
||||
Num(
|
||||
"0",
|
||||
),
|
||||
@23-24 SpaceBefore(
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@23-24 SpaceBefore(
|
||||
SpaceAfter(
|
||||
Num(
|
||||
"1",
|
||||
),
|
||||
|
|
@ -38,11 +38,11 @@ Defs(
|
|||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
final_comments: [
|
||||
Newline,
|
||||
],
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
when [] is
|
||||
[1, 2, 3] -> ""
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
When(
|
||||
@5-7 List(
|
||||
[],
|
||||
),
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@15-24 SpaceBefore(
|
||||
List(
|
||||
[
|
||||
@16-17 NumLiteral(
|
||||
"1",
|
||||
),
|
||||
@19-20 NumLiteral(
|
||||
"2",
|
||||
),
|
||||
@22-23 SpaceBefore(
|
||||
NumLiteral(
|
||||
"3",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
value: @28-30 Str(
|
||||
PlainLine(
|
||||
"",
|
||||
),
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
app "hello"
|
||||
packages {
|
||||
pf:
|
||||
"https://github.com/roc-lang/basic-cli/releases/download/0.1.3/5SXwdW7rH8QAOnD71IkHcFxCmBEPtFSLAIkclPEgjHQ.tar.br",
|
||||
}
|
||||
imports [pf.Stdout]
|
||||
provides [main] to pf
|
||||
|
||||
main =
|
||||
Stdout.line "I'm a Roc application!"
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
Full {
|
||||
header: Module {
|
||||
comments: [],
|
||||
header: App(
|
||||
AppHeader {
|
||||
before_name: [],
|
||||
name: @4-11 PlainLine(
|
||||
"hello",
|
||||
),
|
||||
packages: Some(
|
||||
KeywordItem {
|
||||
keyword: Spaces {
|
||||
before: [
|
||||
Newline,
|
||||
],
|
||||
item: PackagesKeyword,
|
||||
after: [],
|
||||
},
|
||||
item: [
|
||||
@27-145 SpaceAfter(
|
||||
PackageEntry {
|
||||
shorthand: "pf",
|
||||
spaces_after_shorthand: [
|
||||
Newline,
|
||||
],
|
||||
package_name: @31-145 PackageName(
|
||||
"https://github.com/roc-lang/basic-cli/releases/download/0.1.3/5SXwdW7rH8QAOnD71IkHcFxCmBEPtFSLAIkclPEgjHQ.tar.br",
|
||||
),
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
imports: Some(
|
||||
KeywordItem {
|
||||
keyword: Spaces {
|
||||
before: [
|
||||
Newline,
|
||||
],
|
||||
item: ImportsKeyword,
|
||||
after: [],
|
||||
},
|
||||
item: [
|
||||
@161-170 Package(
|
||||
"pf",
|
||||
ModuleName(
|
||||
"Stdout",
|
||||
),
|
||||
[],
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
provides: ProvidesTo {
|
||||
provides_keyword: Spaces {
|
||||
before: [
|
||||
Newline,
|
||||
],
|
||||
item: ProvidesKeyword,
|
||||
after: [],
|
||||
},
|
||||
entries: [
|
||||
@186-190 ExposedName(
|
||||
"main",
|
||||
),
|
||||
],
|
||||
types: None,
|
||||
to_keyword: Spaces {
|
||||
before: [],
|
||||
item: ToKeyword,
|
||||
after: [],
|
||||
},
|
||||
to: @195-197 ExistingPackage(
|
||||
"pf",
|
||||
),
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
module_defs: Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@199-246,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 2),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 2, length = 0),
|
||||
],
|
||||
spaces: [
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@199-203 Identifier(
|
||||
"main",
|
||||
),
|
||||
@210-246 SpaceBefore(
|
||||
Apply(
|
||||
@210-221 Var {
|
||||
module_name: "Stdout",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@222-246 Str(
|
||||
PlainLine(
|
||||
"I'm a Roc application!",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
app "hello"
|
||||
packages { pf:
|
||||
"https://github.com/roc-lang/basic-cli/releases/download/0.1.3/5SXwdW7rH8QAOnD71IkHcFxCmBEPtFSLAIkclPEgjHQ.tar.br"
|
||||
}
|
||||
imports [pf.Stdout]
|
||||
provides [main] to pf
|
||||
|
||||
main =
|
||||
Stdout.line "I'm a Roc application!"
|
||||
|
|
@ -33,9 +33,9 @@ Defs(
|
|||
},
|
||||
[
|
||||
@13-28 Record(
|
||||
Collection {
|
||||
items: [
|
||||
@17-26 SpaceBefore(
|
||||
[
|
||||
@17-26 SpaceBefore(
|
||||
SpaceAfter(
|
||||
RequiredValue(
|
||||
@17-20 "bar",
|
||||
[],
|
||||
|
|
@ -48,11 +48,11 @@ Defs(
|
|||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
final_comments: [
|
||||
Newline,
|
||||
],
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
|
|
|
|||
|
|
@ -20,27 +20,27 @@ Defs(
|
|||
"a",
|
||||
),
|
||||
@4-17 List(
|
||||
Collection {
|
||||
items: [
|
||||
@8-9 SpaceBefore(
|
||||
Num(
|
||||
"1",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
[
|
||||
@8-9 SpaceBefore(
|
||||
Num(
|
||||
"1",
|
||||
),
|
||||
@11-12 Num(
|
||||
"2",
|
||||
),
|
||||
@14-15 Num(
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@11-12 Num(
|
||||
"2",
|
||||
),
|
||||
@14-15 SpaceAfter(
|
||||
Num(
|
||||
"3",
|
||||
),
|
||||
],
|
||||
final_comments: [
|
||||
Newline,
|
||||
],
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -189,20 +189,19 @@ mod test_snapshots {
|
|||
fail/lambda_missing_indent.expr,
|
||||
fail/list_double_comma.expr,
|
||||
fail/list_pattern_not_terminated.expr,
|
||||
fail/list_pattern_weird_indent.expr,
|
||||
fail/list_pattern_weird_rest_pattern.expr,
|
||||
fail/list_without_end.expr,
|
||||
fail/multi_no_end.expr,
|
||||
fail/pattern_binds_keyword.expr,
|
||||
fail/pattern_in_parens_end.expr,
|
||||
fail/pattern_in_parens_end_comma.expr,
|
||||
fail/pattern_in_parens_end.expr,
|
||||
fail/pattern_in_parens_indent_open.expr,
|
||||
fail/pattern_in_parens_open.expr,
|
||||
fail/record_type_end.expr,
|
||||
fail/record_type_keyword_field_name.expr,
|
||||
fail/record_type_missing_comma.expr,
|
||||
fail/record_type_open.expr,
|
||||
fail/record_type_open_indent.expr,
|
||||
fail/record_type_open.expr,
|
||||
fail/record_type_tab.expr,
|
||||
fail/single_no_end.expr,
|
||||
fail/tab_crash.header,
|
||||
|
|
@ -271,13 +270,13 @@ mod test_snapshots {
|
|||
pass/empty_platform_header.header,
|
||||
pass/empty_record.expr,
|
||||
pass/empty_string.expr,
|
||||
pass/equals.expr,
|
||||
pass/equals_with_spaces.expr,
|
||||
pass/expect.expr,
|
||||
pass/equals.expr,
|
||||
pass/expect_fx.moduledefs,
|
||||
pass/expect.expr,
|
||||
pass/float_with_underscores.expr,
|
||||
pass/full_app_header.header,
|
||||
pass/full_app_header_trailing_commas.header,
|
||||
pass/full_app_header.header,
|
||||
pass/function_effect_types.header,
|
||||
pass/function_with_tuple_ext_type.expr,
|
||||
pass/function_with_tuple_type.expr,
|
||||
|
|
@ -291,6 +290,7 @@ mod test_snapshots {
|
|||
pass/list_closing_indent_not_enough.expr,
|
||||
pass/list_closing_same_indent_no_trailing_comma.expr,
|
||||
pass/list_closing_same_indent_with_trailing_comma.expr,
|
||||
pass/list_pattern_weird_indent.expr,
|
||||
pass/list_patterns.expr,
|
||||
pass/lowest_float.expr,
|
||||
pass/lowest_int.expr,
|
||||
|
|
@ -305,8 +305,8 @@ mod test_snapshots {
|
|||
pass/multi_char_string.expr,
|
||||
pass/multiline_string.expr,
|
||||
pass/multiline_tuple_with_comments.expr,
|
||||
pass/multiline_type_signature.expr,
|
||||
pass/multiline_type_signature_with_comment.expr,
|
||||
pass/multiline_type_signature.expr,
|
||||
pass/multiple_fields.expr,
|
||||
pass/multiple_operators.expr,
|
||||
pass/neg_inf_float.expr,
|
||||
|
|
@ -321,6 +321,7 @@ mod test_snapshots {
|
|||
pass/newline_and_spaces_before_less_than.expr,
|
||||
pass/newline_before_add.expr,
|
||||
pass/newline_before_sub.expr,
|
||||
pass/newline_in_packages.full,
|
||||
pass/newline_in_type_def.expr,
|
||||
pass/newline_inside_empty_list.expr,
|
||||
pass/newline_singleton_list.expr,
|
||||
|
|
@ -337,10 +338,10 @@ mod test_snapshots {
|
|||
pass/one_spaced_def.expr,
|
||||
pass/opaque_destructure_first_item_in_body.expr,
|
||||
pass/opaque_has_abilities.expr,
|
||||
pass/opaque_reference_expr.expr,
|
||||
pass/opaque_reference_expr_with_arguments.expr,
|
||||
pass/opaque_reference_pattern.expr,
|
||||
pass/opaque_reference_expr.expr,
|
||||
pass/opaque_reference_pattern_with_arguments.expr,
|
||||
pass/opaque_reference_pattern.expr,
|
||||
pass/opaque_simple.moduledefs,
|
||||
pass/opaque_with_type_arguments.moduledefs,
|
||||
pass/ops_with_newlines.expr,
|
||||
|
|
@ -388,8 +389,8 @@ mod test_snapshots {
|
|||
pass/three_arg_closure.expr,
|
||||
pass/tuple_access_after_record.expr,
|
||||
pass/tuple_accessor_function.expr,
|
||||
pass/tuple_type.expr,
|
||||
pass/tuple_type_ext.expr,
|
||||
pass/tuple_type.expr,
|
||||
pass/two_arg_closure.expr,
|
||||
pass/two_backpassing.expr,
|
||||
pass/two_branch_when.expr,
|
||||
|
|
@ -397,12 +398,12 @@ mod test_snapshots {
|
|||
pass/type_decl_with_underscore.expr,
|
||||
pass/type_signature_def.expr,
|
||||
pass/type_signature_function_def.expr,
|
||||
pass/unary_negation.expr,
|
||||
pass/unary_negation_access.expr, // Regression test for https://github.com/roc-lang/roc/issues/509
|
||||
pass/unary_negation_arg.expr,
|
||||
pass/unary_negation_with_parens.expr,
|
||||
pass/unary_not.expr,
|
||||
pass/unary_negation.expr,
|
||||
pass/unary_not_with_parens.expr,
|
||||
pass/unary_not.expr,
|
||||
pass/underscore_backpassing.expr,
|
||||
pass/underscore_in_assignment_pattern.expr,
|
||||
pass/var_else.expr,
|
||||
|
|
@ -413,10 +414,10 @@ mod test_snapshots {
|
|||
pass/var_when.expr,
|
||||
pass/when_if_guard.expr,
|
||||
pass/when_in_assignment.expr,
|
||||
pass/when_in_function.expr,
|
||||
pass/when_in_function_python_style_indent.expr,
|
||||
pass/when_in_parens.expr,
|
||||
pass/when_in_function.expr,
|
||||
pass/when_in_parens_indented.expr,
|
||||
pass/when_in_parens.expr,
|
||||
pass/when_with_alternative_patterns.expr,
|
||||
pass/when_with_function_application.expr,
|
||||
pass/when_with_negative_numbers.expr,
|
||||
|
|
@ -426,8 +427,8 @@ mod test_snapshots {
|
|||
pass/when_with_tuples.expr,
|
||||
pass/where_clause_function.expr,
|
||||
pass/where_clause_multiple_bound_abilities.expr,
|
||||
pass/where_clause_multiple_has.expr,
|
||||
pass/where_clause_multiple_has_across_newlines.expr,
|
||||
pass/where_clause_multiple_has.expr,
|
||||
pass/where_clause_non_function.expr,
|
||||
pass/where_clause_on_newline.expr,
|
||||
pass/zero_float.expr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue