mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +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
|
@ -293,7 +293,8 @@ impl<'a> Formattable for TypedIdent<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmt_package_name<'buf>(buf: &mut Buf<'buf>, name: PackageName, _indent: u16) {
|
fn fmt_package_name<'buf>(buf: &mut Buf<'buf>, name: PackageName, indent: u16) {
|
||||||
|
buf.indent(indent);
|
||||||
buf.push('"');
|
buf.push('"');
|
||||||
buf.push_str_allow_spaces(name.to_str());
|
buf.push_str_allow_spaces(name.to_str());
|
||||||
buf.push('"');
|
buf.push('"');
|
||||||
|
|
|
@ -592,16 +592,19 @@ fn parse_problem() {
|
||||||
"
|
"
|
||||||
── UNFINISHED LIST ──────────────────────────────────── tmp/parse_problem/Main ─
|
── UNFINISHED LIST ──────────────────────────────────── tmp/parse_problem/Main ─
|
||||||
|
|
||||||
I cannot find the end of this list:
|
I am partway through started parsing a list, but I got stuck here:
|
||||||
|
|
||||||
3│ main = [
|
3│ main = [
|
||||||
^
|
4│
|
||||||
|
5│
|
||||||
|
^
|
||||||
|
|
||||||
You could change it to something like [1, 2, 3] or even just [].
|
I was expecting to see a closing square bracket before this, so try
|
||||||
Anything where there is an open and a close square bracket, and where
|
adding a ] and see if that helps?
|
||||||
the elements of the list are separated by commas.
|
|
||||||
|
|
||||||
Note: I may be confused by indentation"
|
Note: When I get stuck like this, it usually means that there is a
|
||||||
|
missing parenthesis or bracket somewhere earlier. It could also be a
|
||||||
|
stray keyword or operator."
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Ok(_) => unreachable!("we expect failure here"),
|
Ok(_) => unreachable!("we expect failure here"),
|
||||||
|
|
|
@ -67,6 +67,24 @@ where
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn spaces_before_optional_after<'a, P, S, E>(parser: P) -> impl Parser<'a, Loc<S>, E>
|
||||||
|
where
|
||||||
|
S: 'a + Spaceable<'a>,
|
||||||
|
P: 'a + Parser<'a, Loc<S>, E>,
|
||||||
|
E: 'a + SpaceProblem,
|
||||||
|
{
|
||||||
|
parser::map_with_arena(
|
||||||
|
and(
|
||||||
|
spaces(),
|
||||||
|
and(
|
||||||
|
parser,
|
||||||
|
one_of![backtrackable(spaces()), succeed!(&[] as &[_]),],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
spaces_around_help,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn spaces_around_help<'a, S>(
|
fn spaces_around_help<'a, S>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
tuples: (
|
tuples: (
|
||||||
|
@ -102,6 +120,26 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn spaces_before<'a, P, S, E>(parser: P) -> impl Parser<'a, Loc<S>, E>
|
||||||
|
where
|
||||||
|
S: 'a + Spaceable<'a>,
|
||||||
|
P: 'a + Parser<'a, Loc<S>, E>,
|
||||||
|
E: 'a + SpaceProblem,
|
||||||
|
{
|
||||||
|
parser::map_with_arena(
|
||||||
|
and!(spaces(), parser),
|
||||||
|
|arena: &'a Bump, (space_list, loc_expr): (&'a [CommentOrNewline<'a>], Loc<S>)| {
|
||||||
|
if space_list.is_empty() {
|
||||||
|
loc_expr
|
||||||
|
} else {
|
||||||
|
arena
|
||||||
|
.alloc(loc_expr.value)
|
||||||
|
.with_spaces_before(space_list, loc_expr.region)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn space0_before_e<'a, P, S, E>(
|
pub fn space0_before_e<'a, P, S, E>(
|
||||||
parser: P,
|
parser: P,
|
||||||
indent_problem: fn(Position) -> E,
|
indent_problem: fn(Position) -> E,
|
||||||
|
@ -331,7 +369,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn spaces<'a, E>() -> impl Parser<'a, &'a [CommentOrNewline<'a>], E>
|
pub fn spaces<'a, E>() -> impl Parser<'a, &'a [CommentOrNewline<'a>], E>
|
||||||
where
|
where
|
||||||
E: 'a + SpaceProblem,
|
E: 'a + SpaceProblem,
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,6 @@ fn loc_expr_in_parens_help<'a>() -> impl Parser<'a, Loc<Expr<'a>>, EInParens<'a>
|
||||||
specialize_ref(EInParens::Expr, loc_expr(false)),
|
specialize_ref(EInParens::Expr, loc_expr(false)),
|
||||||
word1(b',', EInParens::End),
|
word1(b',', EInParens::End),
|
||||||
word1(b')', EInParens::End),
|
word1(b')', EInParens::End),
|
||||||
EInParens::IndentEnd,
|
|
||||||
Expr::SpaceBefore
|
Expr::SpaceBefore
|
||||||
)),
|
)),
|
||||||
move |arena, state, _, loc_elements| {
|
move |arena, state, _, loc_elements| {
|
||||||
|
@ -2459,7 +2458,6 @@ fn list_literal_help<'a>() -> impl Parser<'a, Expr<'a>, EList<'a>> {
|
||||||
specialize_ref(EList::Expr, loc_expr(false)),
|
specialize_ref(EList::Expr, loc_expr(false)),
|
||||||
word1(b',', EList::End),
|
word1(b',', EList::End),
|
||||||
word1(b']', EList::End),
|
word1(b']', EList::End),
|
||||||
EList::IndentEnd,
|
|
||||||
Expr::SpaceBefore
|
Expr::SpaceBefore
|
||||||
),
|
),
|
||||||
|arena, elements: Collection<'a, _>| {
|
|arena, elements: Collection<'a, _>| {
|
||||||
|
|
|
@ -239,7 +239,6 @@ fn provides_to<'a>() -> impl Parser<'a, ProvidesTo<'a>, EProvides<'a>> {
|
||||||
exposes_entry(EProvides::Identifier),
|
exposes_entry(EProvides::Identifier),
|
||||||
word1(b',', EProvides::ListEnd),
|
word1(b',', EProvides::ListEnd),
|
||||||
word1(b']', EProvides::ListEnd),
|
word1(b']', EProvides::ListEnd),
|
||||||
EProvides::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
),
|
),
|
||||||
types: optional(backtrackable(provides_types())),
|
types: optional(backtrackable(provides_types())),
|
||||||
|
@ -271,7 +270,6 @@ fn provides_exposed<'a>() -> impl Parser<
|
||||||
exposes_entry(EProvides::Identifier),
|
exposes_entry(EProvides::Identifier),
|
||||||
word1(b',', EProvides::ListEnd),
|
word1(b',', EProvides::ListEnd),
|
||||||
word1(b']', EProvides::ListEnd),
|
word1(b']', EProvides::ListEnd),
|
||||||
EProvides::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
@ -297,7 +295,6 @@ fn provides_types<'a>(
|
||||||
provides_type_entry(EProvides::Identifier),
|
provides_type_entry(EProvides::Identifier),
|
||||||
word1(b',', EProvides::ListEnd),
|
word1(b',', EProvides::ListEnd),
|
||||||
word1(b'}', EProvides::ListEnd),
|
word1(b'}', EProvides::ListEnd),
|
||||||
EProvides::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -364,7 +361,6 @@ fn requires_rigids<'a>(
|
||||||
),
|
),
|
||||||
word1(b',', ERequires::ListEnd),
|
word1(b',', ERequires::ListEnd),
|
||||||
word1(b'}', ERequires::ListEnd),
|
word1(b'}', ERequires::ListEnd),
|
||||||
ERequires::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -402,7 +398,6 @@ fn exposes_values<'a>() -> impl Parser<
|
||||||
exposes_entry(EExposes::Identifier),
|
exposes_entry(EExposes::Identifier),
|
||||||
word1(b',', EExposes::ListEnd),
|
word1(b',', EExposes::ListEnd),
|
||||||
word1(b']', EExposes::ListEnd),
|
word1(b']', EExposes::ListEnd),
|
||||||
EExposes::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -453,7 +448,6 @@ fn exposes_modules<'a>() -> impl Parser<
|
||||||
exposes_module(EExposes::Identifier),
|
exposes_module(EExposes::Identifier),
|
||||||
word1(b',', EExposes::ListEnd),
|
word1(b',', EExposes::ListEnd),
|
||||||
word1(b']', EExposes::ListEnd),
|
word1(b']', EExposes::ListEnd),
|
||||||
EExposes::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
@ -491,7 +485,6 @@ fn packages<'a>() -> impl Parser<
|
||||||
specialize(EPackages::PackageEntry, loc!(package_entry())),
|
specialize(EPackages::PackageEntry, loc!(package_entry())),
|
||||||
word1(b',', EPackages::ListEnd),
|
word1(b',', EPackages::ListEnd),
|
||||||
word1(b'}', EPackages::ListEnd),
|
word1(b'}', EPackages::ListEnd),
|
||||||
EPackages::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -529,7 +522,6 @@ fn generates_with<'a>() -> impl Parser<
|
||||||
exposes_entry(EGeneratesWith::Identifier),
|
exposes_entry(EGeneratesWith::Identifier),
|
||||||
word1(b',', EGeneratesWith::ListEnd),
|
word1(b',', EGeneratesWith::ListEnd),
|
||||||
word1(b']', EGeneratesWith::ListEnd),
|
word1(b']', EGeneratesWith::ListEnd),
|
||||||
EGeneratesWith::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -553,7 +545,6 @@ fn imports<'a>() -> impl Parser<
|
||||||
loc!(imports_entry()),
|
loc!(imports_entry()),
|
||||||
word1(b',', EImports::ListEnd),
|
word1(b',', EImports::ListEnd),
|
||||||
word1(b']', EImports::ListEnd),
|
word1(b']', EImports::ListEnd),
|
||||||
EImports::IndentListEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -634,7 +625,6 @@ fn imports_entry<'a>() -> impl Parser<'a, Spaced<'a, ImportsEntry<'a>>, EImports
|
||||||
exposes_entry(EImports::Identifier),
|
exposes_entry(EImports::Identifier),
|
||||||
word1(b',', EImports::SetEnd),
|
word1(b',', EImports::SetEnd),
|
||||||
word1(b'}', EImports::SetEnd),
|
word1(b'}', EImports::SetEnd),
|
||||||
EImports::IndentSetEnd,
|
|
||||||
Spaced::SpaceBefore
|
Spaced::SpaceBefore
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|
|
@ -142,7 +142,6 @@ pub enum EProvides<'a> {
|
||||||
IndentProvides(Position),
|
IndentProvides(Position),
|
||||||
IndentTo(Position),
|
IndentTo(Position),
|
||||||
IndentListStart(Position),
|
IndentListStart(Position),
|
||||||
IndentListEnd(Position),
|
|
||||||
IndentPackage(Position),
|
IndentPackage(Position),
|
||||||
ListStart(Position),
|
ListStart(Position),
|
||||||
ListEnd(Position),
|
ListEnd(Position),
|
||||||
|
@ -157,7 +156,6 @@ pub enum EExposes {
|
||||||
Open(Position),
|
Open(Position),
|
||||||
IndentExposes(Position),
|
IndentExposes(Position),
|
||||||
IndentListStart(Position),
|
IndentListStart(Position),
|
||||||
IndentListEnd(Position),
|
|
||||||
ListStart(Position),
|
ListStart(Position),
|
||||||
ListEnd(Position),
|
ListEnd(Position),
|
||||||
Identifier(Position),
|
Identifier(Position),
|
||||||
|
@ -170,7 +168,6 @@ pub enum ERequires<'a> {
|
||||||
Open(Position),
|
Open(Position),
|
||||||
IndentRequires(Position),
|
IndentRequires(Position),
|
||||||
IndentListStart(Position),
|
IndentListStart(Position),
|
||||||
IndentListEnd(Position),
|
|
||||||
ListStart(Position),
|
ListStart(Position),
|
||||||
ListEnd(Position),
|
ListEnd(Position),
|
||||||
TypedIdent(ETypedIdent<'a>, Position),
|
TypedIdent(ETypedIdent<'a>, Position),
|
||||||
|
@ -234,7 +231,6 @@ pub enum EImports {
|
||||||
ModuleName(Position),
|
ModuleName(Position),
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
IndentSetStart(Position),
|
IndentSetStart(Position),
|
||||||
IndentSetEnd(Position),
|
|
||||||
SetStart(Position),
|
SetStart(Position),
|
||||||
SetEnd(Position),
|
SetEnd(Position),
|
||||||
}
|
}
|
||||||
|
@ -457,9 +453,6 @@ pub enum EInParens<'a> {
|
||||||
|
|
||||||
///
|
///
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
///
|
|
||||||
IndentOpen(Position),
|
|
||||||
IndentEnd(Position),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -484,9 +477,6 @@ pub enum EList<'a> {
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
|
|
||||||
Expr(&'a EExpr<'a>, Position),
|
Expr(&'a EExpr<'a>, Position),
|
||||||
|
|
||||||
IndentOpen(Position),
|
|
||||||
IndentEnd(Position),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -585,11 +575,6 @@ pub enum PRecord<'a> {
|
||||||
Expr(&'a EExpr<'a>, Position),
|
Expr(&'a EExpr<'a>, Position),
|
||||||
|
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
|
|
||||||
IndentOpen(Position),
|
|
||||||
IndentColon(Position),
|
|
||||||
IndentOptional(Position),
|
|
||||||
IndentEnd(Position),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -601,9 +586,6 @@ pub enum PList<'a> {
|
||||||
Pattern(&'a EPattern<'a>, Position),
|
Pattern(&'a EPattern<'a>, Position),
|
||||||
|
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
|
|
||||||
IndentOpen(Position),
|
|
||||||
IndentEnd(Position),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -614,8 +596,6 @@ pub enum PInParens<'a> {
|
||||||
Pattern(&'a EPattern<'a>, Position),
|
Pattern(&'a EPattern<'a>, Position),
|
||||||
|
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
IndentOpen(Position),
|
|
||||||
IndentEnd(Position),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -670,9 +650,6 @@ pub enum ETypeTagUnion<'a> {
|
||||||
Type(&'a EType<'a>, Position),
|
Type(&'a EType<'a>, Position),
|
||||||
|
|
||||||
Space(BadInputError, Position),
|
Space(BadInputError, Position),
|
||||||
|
|
||||||
IndentOpen(Position),
|
|
||||||
IndentEnd(Position),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
@ -1318,29 +1295,20 @@ macro_rules! collection {
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! collection_trailing_sep_e {
|
macro_rules! collection_trailing_sep_e {
|
||||||
($opening_brace:expr, $elem:expr, $delimiter:expr, $closing_brace:expr, $indent_problem:expr, $space_before:expr) => {
|
($opening_brace:expr, $elem:expr, $delimiter:expr, $closing_brace:expr, $space_before:expr) => {
|
||||||
map_with_arena!(
|
map_with_arena!(
|
||||||
skip_first!(
|
skip_first!(
|
||||||
$opening_brace,
|
$opening_brace,
|
||||||
and!(
|
$crate::parser::reset_min_indent(and!(
|
||||||
and!(
|
and!(
|
||||||
space0_e($indent_problem),
|
$crate::blankspace::spaces(),
|
||||||
$crate::parser::trailing_sep_by0(
|
$crate::parser::trailing_sep_by0(
|
||||||
$delimiter,
|
$delimiter,
|
||||||
$crate::blankspace::space0_before_optional_after(
|
$crate::blankspace::spaces_before_optional_after($elem,)
|
||||||
$elem,
|
|
||||||
$indent_problem,
|
|
||||||
$indent_problem
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
skip_second!(
|
skip_second!($crate::blankspace::spaces(), $closing_brace)
|
||||||
$crate::parser::reset_min_indent($crate::blankspace::space0_e(
|
))
|
||||||
$indent_problem
|
|
||||||
)),
|
|
||||||
$closing_brace
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
|arena: &'a bumpalo::Bump,
|
|arena: &'a bumpalo::Bump,
|
||||||
((spaces, mut parsed_elems), mut final_comments): (
|
((spaces, mut parsed_elems), mut final_comments): (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::ast::{Has, Pattern, PatternAs, Spaceable};
|
use crate::ast::{Has, Pattern, PatternAs, Spaceable};
|
||||||
use crate::blankspace::{space0_before_e, space0_e};
|
use crate::blankspace::{space0_e, spaces, spaces_before};
|
||||||
use crate::ident::{lowercase_ident, parse_ident, Ident};
|
use crate::ident::{lowercase_ident, parse_ident, Ident};
|
||||||
use crate::keyword;
|
use crate::keyword;
|
||||||
use crate::parser::Progress::{self, *};
|
use crate::parser::Progress::{self, *};
|
||||||
|
@ -190,7 +190,6 @@ fn loc_pattern_in_parens_help<'a>() -> impl Parser<'a, Loc<Pattern<'a>>, PInPare
|
||||||
specialize_ref(PInParens::Pattern, loc_pattern_help()),
|
specialize_ref(PInParens::Pattern, loc_pattern_help()),
|
||||||
word1(b',', PInParens::End),
|
word1(b',', PInParens::End),
|
||||||
word1(b')', PInParens::End),
|
word1(b')', PInParens::End),
|
||||||
PInParens::IndentOpen,
|
|
||||||
Pattern::SpaceBefore
|
Pattern::SpaceBefore
|
||||||
)),
|
)),
|
||||||
move |_arena, state, _, loc_elements| {
|
move |_arena, state, _, loc_elements| {
|
||||||
|
@ -263,7 +262,6 @@ fn list_pattern_help<'a>() -> impl Parser<'a, Pattern<'a>, PList<'a>> {
|
||||||
list_element_pattern(),
|
list_element_pattern(),
|
||||||
word1(b',', PList::End),
|
word1(b',', PList::End),
|
||||||
word1(b']', PList::End),
|
word1(b']', PList::End),
|
||||||
PList::IndentEnd,
|
|
||||||
Pattern::SpaceBefore
|
Pattern::SpaceBefore
|
||||||
),
|
),
|
||||||
Pattern::List
|
Pattern::List
|
||||||
|
@ -459,7 +457,6 @@ fn record_pattern_help<'a>() -> impl Parser<'a, Pattern<'a>, PRecord<'a>> {
|
||||||
record_pattern_field(),
|
record_pattern_field(),
|
||||||
word1(b',', PRecord::End),
|
word1(b',', PRecord::End),
|
||||||
word1(b'}', PRecord::End),
|
word1(b'}', PRecord::End),
|
||||||
PRecord::IndentEnd,
|
|
||||||
Pattern::SpaceBefore
|
Pattern::SpaceBefore
|
||||||
),
|
),
|
||||||
Pattern::RecordDestructure
|
Pattern::RecordDestructure
|
||||||
|
@ -480,7 +477,7 @@ fn record_pattern_field<'a>() -> impl Parser<'a, Loc<Pattern<'a>>, PRecord<'a>>
|
||||||
.parse(arena, state, min_indent)?;
|
.parse(arena, state, min_indent)?;
|
||||||
debug_assert_eq!(progress, MadeProgress);
|
debug_assert_eq!(progress, MadeProgress);
|
||||||
|
|
||||||
let (_, spaces, state) = space0_e(PRecord::IndentEnd).parse(arena, state, min_indent)?;
|
let (_, spaces, state) = spaces().parse(arena, state, min_indent)?;
|
||||||
|
|
||||||
// Having a value is optional; both `{ email }` and `{ email: blah }` work.
|
// Having a value is optional; both `{ email }` and `{ email: blah }` work.
|
||||||
// (This is true in both literals and types.)
|
// (This is true in both literals and types.)
|
||||||
|
@ -493,8 +490,8 @@ fn record_pattern_field<'a>() -> impl Parser<'a, Loc<Pattern<'a>>, PRecord<'a>>
|
||||||
match opt_loc_val {
|
match opt_loc_val {
|
||||||
Some(First(_)) => {
|
Some(First(_)) => {
|
||||||
let val_parser = specialize_ref(PRecord::Pattern, loc_pattern_help());
|
let val_parser = specialize_ref(PRecord::Pattern, loc_pattern_help());
|
||||||
let (_, loc_val, state) = space0_before_e(val_parser, PRecord::IndentColon)
|
let (_, loc_val, state) =
|
||||||
.parse(arena, state, min_indent)?;
|
spaces_before(val_parser).parse(arena, state, min_indent)?;
|
||||||
|
|
||||||
let Loc {
|
let Loc {
|
||||||
value: label,
|
value: label,
|
||||||
|
@ -520,8 +517,8 @@ fn record_pattern_field<'a>() -> impl Parser<'a, Loc<Pattern<'a>>, PRecord<'a>>
|
||||||
Some(Second(_)) => {
|
Some(Second(_)) => {
|
||||||
let val_parser = specialize_ref(PRecord::Expr, crate::expr::loc_expr(false));
|
let val_parser = specialize_ref(PRecord::Expr, crate::expr::loc_expr(false));
|
||||||
|
|
||||||
let (_, loc_val, state) = space0_before_e(val_parser, PRecord::IndentColon)
|
let (_, loc_val, state) =
|
||||||
.parse(arena, state, min_indent)?;
|
spaces_before(val_parser).parse(arena, state, min_indent)?;
|
||||||
|
|
||||||
let Loc {
|
let Loc {
|
||||||
value: label,
|
value: label,
|
||||||
|
|
|
@ -43,7 +43,6 @@ fn tag_union_type<'a>(
|
||||||
loc!(tag_type(false)),
|
loc!(tag_type(false)),
|
||||||
word1(b',', ETypeTagUnion::End),
|
word1(b',', ETypeTagUnion::End),
|
||||||
word1(b']', ETypeTagUnion::End),
|
word1(b']', ETypeTagUnion::End),
|
||||||
ETypeTagUnion::IndentEnd,
|
|
||||||
Tag::SpaceBefore
|
Tag::SpaceBefore
|
||||||
)
|
)
|
||||||
.parse(arena, state, min_indent)?;
|
.parse(arena, state, min_indent)?;
|
||||||
|
@ -236,7 +235,6 @@ fn loc_type_in_parens<'a>(
|
||||||
specialize_ref(ETypeInParens::Type, expression(true, false)),
|
specialize_ref(ETypeInParens::Type, expression(true, false)),
|
||||||
word1(b',', ETypeInParens::End),
|
word1(b',', ETypeInParens::End),
|
||||||
word1(b')', ETypeInParens::End),
|
word1(b')', ETypeInParens::End),
|
||||||
ETypeInParens::IndentEnd,
|
|
||||||
TypeAnnotation::SpaceBefore
|
TypeAnnotation::SpaceBefore
|
||||||
),
|
),
|
||||||
optional(allocated(specialize_ref(
|
optional(allocated(specialize_ref(
|
||||||
|
@ -376,7 +374,6 @@ fn record_type<'a>(
|
||||||
loc!(record_type_field()),
|
loc!(record_type_field()),
|
||||||
word1(b',', ETypeRecord::End),
|
word1(b',', ETypeRecord::End),
|
||||||
word1(b'}', ETypeRecord::End),
|
word1(b'}', ETypeRecord::End),
|
||||||
ETypeRecord::IndentEnd,
|
|
||||||
AssignedField::SpaceBefore
|
AssignedField::SpaceBefore
|
||||||
),
|
),
|
||||||
ext: optional(allocated(specialize_ref(
|
ext: optional(allocated(specialize_ref(
|
||||||
|
@ -522,7 +519,6 @@ pub fn has_abilities<'a>() -> impl Parser<'a, Loc<HasAbilities<'a>>, EType<'a>>
|
||||||
loc!(parse_has_ability()),
|
loc!(parse_has_ability()),
|
||||||
word1(b',', EType::TEnd),
|
word1(b',', EType::TEnd),
|
||||||
word1(b']', EType::TEnd),
|
word1(b']', EType::TEnd),
|
||||||
EType::TIndentEnd,
|
|
||||||
HasAbility::SpaceBefore
|
HasAbility::SpaceBefore
|
||||||
),
|
),
|
||||||
HasAbilities::Has
|
HasAbilities::Has
|
||||||
|
@ -544,7 +540,6 @@ fn parse_has_ability<'a>() -> impl Parser<'a, HasAbility<'a>, EType<'a>> {
|
||||||
specialize(|e: ERecord<'_>, _| e.into(), loc!(record_value_field())),
|
specialize(|e: ERecord<'_>, _| e.into(), loc!(record_value_field())),
|
||||||
word1(b',', ETypeAbilityImpl::End),
|
word1(b',', ETypeAbilityImpl::End),
|
||||||
word1(b'}', ETypeAbilityImpl::End),
|
word1(b'}', ETypeAbilityImpl::End),
|
||||||
ETypeAbilityImpl::IndentEnd,
|
|
||||||
AssignedField::SpaceBefore
|
AssignedField::SpaceBefore
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
|
@ -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",
|
"my_list",
|
||||||
),
|
),
|
||||||
@10-26 List(
|
@10-26 List(
|
||||||
Collection {
|
[
|
||||||
items: [
|
@16-17 SpaceBefore(
|
||||||
@16-17 SpaceBefore(
|
Num(
|
||||||
Num(
|
"0",
|
||||||
"0",
|
|
||||||
),
|
|
||||||
[
|
|
||||||
Newline,
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
@23-24 SpaceBefore(
|
[
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
@23-24 SpaceBefore(
|
||||||
|
SpaceAfter(
|
||||||
Num(
|
Num(
|
||||||
"1",
|
"1",
|
||||||
),
|
),
|
||||||
|
@ -38,11 +38,11 @@ Defs(
|
||||||
Newline,
|
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(
|
@13-28 Record(
|
||||||
Collection {
|
[
|
||||||
items: [
|
@17-26 SpaceBefore(
|
||||||
@17-26 SpaceBefore(
|
SpaceAfter(
|
||||||
RequiredValue(
|
RequiredValue(
|
||||||
@17-20 "bar",
|
@17-20 "bar",
|
||||||
[],
|
[],
|
||||||
|
@ -48,11 +48,11 @@ Defs(
|
||||||
Newline,
|
Newline,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
[
|
||||||
final_comments: [
|
Newline,
|
||||||
Newline,
|
],
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
Space,
|
Space,
|
||||||
|
|
|
@ -20,27 +20,27 @@ Defs(
|
||||||
"a",
|
"a",
|
||||||
),
|
),
|
||||||
@4-17 List(
|
@4-17 List(
|
||||||
Collection {
|
[
|
||||||
items: [
|
@8-9 SpaceBefore(
|
||||||
@8-9 SpaceBefore(
|
Num(
|
||||||
Num(
|
"1",
|
||||||
"1",
|
|
||||||
),
|
|
||||||
[
|
|
||||||
Newline,
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
@11-12 Num(
|
[
|
||||||
"2",
|
Newline,
|
||||||
),
|
],
|
||||||
@14-15 Num(
|
),
|
||||||
|
@11-12 Num(
|
||||||
|
"2",
|
||||||
|
),
|
||||||
|
@14-15 SpaceAfter(
|
||||||
|
Num(
|
||||||
"3",
|
"3",
|
||||||
),
|
),
|
||||||
],
|
[
|
||||||
final_comments: [
|
Newline,
|
||||||
Newline,
|
],
|
||||||
],
|
),
|
||||||
},
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -189,20 +189,19 @@ mod test_snapshots {
|
||||||
fail/lambda_missing_indent.expr,
|
fail/lambda_missing_indent.expr,
|
||||||
fail/list_double_comma.expr,
|
fail/list_double_comma.expr,
|
||||||
fail/list_pattern_not_terminated.expr,
|
fail/list_pattern_not_terminated.expr,
|
||||||
fail/list_pattern_weird_indent.expr,
|
|
||||||
fail/list_pattern_weird_rest_pattern.expr,
|
fail/list_pattern_weird_rest_pattern.expr,
|
||||||
fail/list_without_end.expr,
|
fail/list_without_end.expr,
|
||||||
fail/multi_no_end.expr,
|
fail/multi_no_end.expr,
|
||||||
fail/pattern_binds_keyword.expr,
|
fail/pattern_binds_keyword.expr,
|
||||||
fail/pattern_in_parens_end.expr,
|
|
||||||
fail/pattern_in_parens_end_comma.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_indent_open.expr,
|
||||||
fail/pattern_in_parens_open.expr,
|
fail/pattern_in_parens_open.expr,
|
||||||
fail/record_type_end.expr,
|
fail/record_type_end.expr,
|
||||||
fail/record_type_keyword_field_name.expr,
|
fail/record_type_keyword_field_name.expr,
|
||||||
fail/record_type_missing_comma.expr,
|
fail/record_type_missing_comma.expr,
|
||||||
fail/record_type_open.expr,
|
|
||||||
fail/record_type_open_indent.expr,
|
fail/record_type_open_indent.expr,
|
||||||
|
fail/record_type_open.expr,
|
||||||
fail/record_type_tab.expr,
|
fail/record_type_tab.expr,
|
||||||
fail/single_no_end.expr,
|
fail/single_no_end.expr,
|
||||||
fail/tab_crash.header,
|
fail/tab_crash.header,
|
||||||
|
@ -271,13 +270,13 @@ mod test_snapshots {
|
||||||
pass/empty_platform_header.header,
|
pass/empty_platform_header.header,
|
||||||
pass/empty_record.expr,
|
pass/empty_record.expr,
|
||||||
pass/empty_string.expr,
|
pass/empty_string.expr,
|
||||||
pass/equals.expr,
|
|
||||||
pass/equals_with_spaces.expr,
|
pass/equals_with_spaces.expr,
|
||||||
pass/expect.expr,
|
pass/equals.expr,
|
||||||
pass/expect_fx.moduledefs,
|
pass/expect_fx.moduledefs,
|
||||||
|
pass/expect.expr,
|
||||||
pass/float_with_underscores.expr,
|
pass/float_with_underscores.expr,
|
||||||
pass/full_app_header.header,
|
|
||||||
pass/full_app_header_trailing_commas.header,
|
pass/full_app_header_trailing_commas.header,
|
||||||
|
pass/full_app_header.header,
|
||||||
pass/function_effect_types.header,
|
pass/function_effect_types.header,
|
||||||
pass/function_with_tuple_ext_type.expr,
|
pass/function_with_tuple_ext_type.expr,
|
||||||
pass/function_with_tuple_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_indent_not_enough.expr,
|
||||||
pass/list_closing_same_indent_no_trailing_comma.expr,
|
pass/list_closing_same_indent_no_trailing_comma.expr,
|
||||||
pass/list_closing_same_indent_with_trailing_comma.expr,
|
pass/list_closing_same_indent_with_trailing_comma.expr,
|
||||||
|
pass/list_pattern_weird_indent.expr,
|
||||||
pass/list_patterns.expr,
|
pass/list_patterns.expr,
|
||||||
pass/lowest_float.expr,
|
pass/lowest_float.expr,
|
||||||
pass/lowest_int.expr,
|
pass/lowest_int.expr,
|
||||||
|
@ -305,8 +305,8 @@ mod test_snapshots {
|
||||||
pass/multi_char_string.expr,
|
pass/multi_char_string.expr,
|
||||||
pass/multiline_string.expr,
|
pass/multiline_string.expr,
|
||||||
pass/multiline_tuple_with_comments.expr,
|
pass/multiline_tuple_with_comments.expr,
|
||||||
pass/multiline_type_signature.expr,
|
|
||||||
pass/multiline_type_signature_with_comment.expr,
|
pass/multiline_type_signature_with_comment.expr,
|
||||||
|
pass/multiline_type_signature.expr,
|
||||||
pass/multiple_fields.expr,
|
pass/multiple_fields.expr,
|
||||||
pass/multiple_operators.expr,
|
pass/multiple_operators.expr,
|
||||||
pass/neg_inf_float.expr,
|
pass/neg_inf_float.expr,
|
||||||
|
@ -321,6 +321,7 @@ mod test_snapshots {
|
||||||
pass/newline_and_spaces_before_less_than.expr,
|
pass/newline_and_spaces_before_less_than.expr,
|
||||||
pass/newline_before_add.expr,
|
pass/newline_before_add.expr,
|
||||||
pass/newline_before_sub.expr,
|
pass/newline_before_sub.expr,
|
||||||
|
pass/newline_in_packages.full,
|
||||||
pass/newline_in_type_def.expr,
|
pass/newline_in_type_def.expr,
|
||||||
pass/newline_inside_empty_list.expr,
|
pass/newline_inside_empty_list.expr,
|
||||||
pass/newline_singleton_list.expr,
|
pass/newline_singleton_list.expr,
|
||||||
|
@ -337,10 +338,10 @@ mod test_snapshots {
|
||||||
pass/one_spaced_def.expr,
|
pass/one_spaced_def.expr,
|
||||||
pass/opaque_destructure_first_item_in_body.expr,
|
pass/opaque_destructure_first_item_in_body.expr,
|
||||||
pass/opaque_has_abilities.expr,
|
pass/opaque_has_abilities.expr,
|
||||||
pass/opaque_reference_expr.expr,
|
|
||||||
pass/opaque_reference_expr_with_arguments.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_with_arguments.expr,
|
||||||
|
pass/opaque_reference_pattern.expr,
|
||||||
pass/opaque_simple.moduledefs,
|
pass/opaque_simple.moduledefs,
|
||||||
pass/opaque_with_type_arguments.moduledefs,
|
pass/opaque_with_type_arguments.moduledefs,
|
||||||
pass/ops_with_newlines.expr,
|
pass/ops_with_newlines.expr,
|
||||||
|
@ -388,8 +389,8 @@ mod test_snapshots {
|
||||||
pass/three_arg_closure.expr,
|
pass/three_arg_closure.expr,
|
||||||
pass/tuple_access_after_record.expr,
|
pass/tuple_access_after_record.expr,
|
||||||
pass/tuple_accessor_function.expr,
|
pass/tuple_accessor_function.expr,
|
||||||
pass/tuple_type.expr,
|
|
||||||
pass/tuple_type_ext.expr,
|
pass/tuple_type_ext.expr,
|
||||||
|
pass/tuple_type.expr,
|
||||||
pass/two_arg_closure.expr,
|
pass/two_arg_closure.expr,
|
||||||
pass/two_backpassing.expr,
|
pass/two_backpassing.expr,
|
||||||
pass/two_branch_when.expr,
|
pass/two_branch_when.expr,
|
||||||
|
@ -397,12 +398,12 @@ mod test_snapshots {
|
||||||
pass/type_decl_with_underscore.expr,
|
pass/type_decl_with_underscore.expr,
|
||||||
pass/type_signature_def.expr,
|
pass/type_signature_def.expr,
|
||||||
pass/type_signature_function_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_access.expr, // Regression test for https://github.com/roc-lang/roc/issues/509
|
||||||
pass/unary_negation_arg.expr,
|
pass/unary_negation_arg.expr,
|
||||||
pass/unary_negation_with_parens.expr,
|
pass/unary_negation_with_parens.expr,
|
||||||
pass/unary_not.expr,
|
pass/unary_negation.expr,
|
||||||
pass/unary_not_with_parens.expr,
|
pass/unary_not_with_parens.expr,
|
||||||
|
pass/unary_not.expr,
|
||||||
pass/underscore_backpassing.expr,
|
pass/underscore_backpassing.expr,
|
||||||
pass/underscore_in_assignment_pattern.expr,
|
pass/underscore_in_assignment_pattern.expr,
|
||||||
pass/var_else.expr,
|
pass/var_else.expr,
|
||||||
|
@ -413,10 +414,10 @@ mod test_snapshots {
|
||||||
pass/var_when.expr,
|
pass/var_when.expr,
|
||||||
pass/when_if_guard.expr,
|
pass/when_if_guard.expr,
|
||||||
pass/when_in_assignment.expr,
|
pass/when_in_assignment.expr,
|
||||||
pass/when_in_function.expr,
|
|
||||||
pass/when_in_function_python_style_indent.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_indented.expr,
|
||||||
|
pass/when_in_parens.expr,
|
||||||
pass/when_with_alternative_patterns.expr,
|
pass/when_with_alternative_patterns.expr,
|
||||||
pass/when_with_function_application.expr,
|
pass/when_with_function_application.expr,
|
||||||
pass/when_with_negative_numbers.expr,
|
pass/when_with_negative_numbers.expr,
|
||||||
|
@ -426,8 +427,8 @@ mod test_snapshots {
|
||||||
pass/when_with_tuples.expr,
|
pass/when_with_tuples.expr,
|
||||||
pass/where_clause_function.expr,
|
pass/where_clause_function.expr,
|
||||||
pass/where_clause_multiple_bound_abilities.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_across_newlines.expr,
|
||||||
|
pass/where_clause_multiple_has.expr,
|
||||||
pass/where_clause_non_function.expr,
|
pass/where_clause_non_function.expr,
|
||||||
pass/where_clause_on_newline.expr,
|
pass/where_clause_on_newline.expr,
|
||||||
pass/zero_float.expr,
|
pass/zero_float.expr,
|
||||||
|
|
|
@ -20,14 +20,6 @@ fn note_for_record_type_indent<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuil
|
||||||
alloc.note("I may be confused by indentation")
|
alloc.note("I may be confused by indentation")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn note_for_record_pattern_indent<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
|
||||||
alloc.note("I may be confused by indentation")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn note_for_list_pattern_indent<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
|
||||||
alloc.note("I may be confused by indentation")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn note_for_tag_union_type_indent<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
fn note_for_tag_union_type_indent<'a>(alloc: &'a RocDocAllocator<'a>) -> RocDocBuilder<'a> {
|
||||||
alloc.note("I may be confused by indentation")
|
alloc.note("I may be confused by indentation")
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1076,7 @@ fn to_expr_in_parens_report<'a>(
|
||||||
severity: Severity::RuntimeError,
|
severity: Severity::RuntimeError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EInParens::End(pos) | EInParens::IndentEnd(pos) => {
|
EInParens::End(pos) => {
|
||||||
let surroundings = Region::new(start, pos);
|
let surroundings = Region::new(start, pos);
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
||||||
|
|
||||||
|
@ -1108,7 +1100,7 @@ fn to_expr_in_parens_report<'a>(
|
||||||
severity: Severity::RuntimeError,
|
severity: Severity::RuntimeError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EInParens::Open(pos) | EInParens::IndentOpen(pos) => {
|
EInParens::Open(pos) => {
|
||||||
let surroundings = Region::new(start, pos);
|
let surroundings = Region::new(start, pos);
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
||||||
|
|
||||||
|
@ -1218,32 +1210,6 @@ fn to_list_report<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EList::IndentOpen(pos) | EList::IndentEnd(pos) => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(r"I cannot find the end of this list:"),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow(r"You could change it to something like "),
|
|
||||||
alloc.parser_suggestion("[1, 2, 3]"),
|
|
||||||
alloc.reflow(" or even just "),
|
|
||||||
alloc.parser_suggestion("[]"),
|
|
||||||
alloc.reflow(". Anything where there is an open and a close square bracket, "),
|
|
||||||
alloc.reflow("and where the elements of the list are separated by commas."),
|
|
||||||
]),
|
|
||||||
note_for_tag_union_type_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED LIST".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1905,84 +1871,6 @@ fn to_precord_report<'a>(
|
||||||
pos,
|
pos,
|
||||||
),
|
),
|
||||||
|
|
||||||
PRecord::IndentOpen(pos) => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(r"I just started parsing a record pattern, but I got stuck here:"),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
record_patterns_look_like(alloc),
|
|
||||||
note_for_record_pattern_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED RECORD PATTERN".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PRecord::IndentEnd(pos) => {
|
|
||||||
match next_line_starts_with_close_curly(alloc.src_lines, lines.convert_pos(pos)) {
|
|
||||||
Some(curly_pos) => {
|
|
||||||
let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos);
|
|
||||||
let region = LineColumnRegion::from_pos(curly_pos);
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
"I am partway through parsing a record pattern, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(surroundings, region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I need this curly brace to be indented more. Try adding more spaces before it!"),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "NEED MORE INDENTATION".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
r"I am partway through parsing a record pattern, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I was expecting to see a closing curly "),
|
|
||||||
alloc.reflow("brace before this, so try adding a "),
|
|
||||||
alloc.parser_suggestion("}"),
|
|
||||||
alloc.reflow(" and see if that helps?"),
|
|
||||||
]),
|
|
||||||
note_for_record_pattern_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED RECORD PATTERN".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PRecord::IndentColon(_) => {
|
|
||||||
unreachable!("because `foo` is a valid field; the colon is not required")
|
|
||||||
}
|
|
||||||
|
|
||||||
PRecord::IndentOptional(_) => {
|
|
||||||
unreachable!("because `foo` is a valid field; the question mark is not required")
|
|
||||||
}
|
|
||||||
|
|
||||||
PRecord::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
PRecord::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2059,79 +1947,6 @@ fn to_plist_report<'a>(
|
||||||
|
|
||||||
PList::Pattern(pattern, pos) => to_pattern_report(alloc, lines, filename, pattern, pos),
|
PList::Pattern(pattern, pos) => to_pattern_report(alloc, lines, filename, pattern, pos),
|
||||||
|
|
||||||
PList::IndentOpen(pos) => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(r"I just started parsing a list pattern, but I got stuck here:"),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
record_patterns_look_like(alloc),
|
|
||||||
note_for_list_pattern_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED LIST PATTERN".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PList::IndentEnd(pos) => {
|
|
||||||
match next_line_starts_with_close_square_bracket(
|
|
||||||
alloc.src_lines,
|
|
||||||
lines.convert_pos(pos),
|
|
||||||
) {
|
|
||||||
Some(curly_pos) => {
|
|
||||||
let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos);
|
|
||||||
let region = LineColumnRegion::from_pos(curly_pos);
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
"I am partway through parsing a list pattern, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(surroundings, region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I need this square brace to be indented more. Try adding more spaces before it!"),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "NEED MORE INDENTATION".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
r"I am partway through parsing a list pattern, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I was expecting to see a closing square "),
|
|
||||||
alloc.reflow("brace before this, so try adding a "),
|
|
||||||
alloc.parser_suggestion("]"),
|
|
||||||
alloc.reflow(" and see if that helps?"),
|
|
||||||
]),
|
|
||||||
note_for_list_pattern_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED LIST PATTERN".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PList::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
PList::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2220,78 +2035,6 @@ fn to_pattern_in_parens_report<'a>(
|
||||||
|
|
||||||
PInParens::Pattern(pattern, pos) => to_pattern_report(alloc, lines, filename, pattern, pos),
|
PInParens::Pattern(pattern, pos) => to_pattern_report(alloc, lines, filename, pattern, pos),
|
||||||
|
|
||||||
PInParens::IndentOpen(pos) => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
r"I just started parsing a pattern in parentheses, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
record_patterns_look_like(alloc),
|
|
||||||
note_for_record_pattern_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED PARENTHESES".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PInParens::IndentEnd(pos) => {
|
|
||||||
match next_line_starts_with_close_parenthesis(alloc.src_lines, lines.convert_pos(pos)) {
|
|
||||||
Some(close_pos) => {
|
|
||||||
let surroundings = LineColumnRegion::new(lines.convert_pos(start), close_pos);
|
|
||||||
let region = LineColumnRegion::from_pos(close_pos);
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
"I am partway through parsing a pattern in parentheses, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(surroundings, region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I need this parenthesis to be indented more. Try adding more spaces before it!"),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "NEED MORE INDENTATION".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
r"I am partway through parsing a pattern in parentheses, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I was expecting to see a closing parenthesis "),
|
|
||||||
alloc.reflow("before this, so try adding a "),
|
|
||||||
alloc.parser_suggestion(")"),
|
|
||||||
alloc.reflow(" and see if that helps?"),
|
|
||||||
]),
|
|
||||||
note_for_record_pattern_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED PARENTHESES".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PInParens::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
PInParens::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2831,83 +2574,6 @@ fn to_ttag_union_report<'a>(
|
||||||
|
|
||||||
ETypeTagUnion::Type(tipe, pos) => to_type_report(alloc, lines, filename, tipe, pos),
|
ETypeTagUnion::Type(tipe, pos) => to_type_report(alloc, lines, filename, tipe, pos),
|
||||||
|
|
||||||
ETypeTagUnion::IndentOpen(pos) => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(r"I just started parsing a tag union type, but I got stuck here:"),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow(r"Tag unions look like "),
|
|
||||||
alloc.parser_suggestion("[Many I64, None],"),
|
|
||||||
alloc.reflow(" so I was expecting to see a tag name next."),
|
|
||||||
]),
|
|
||||||
note_for_tag_union_type_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED TAG UNION TYPE".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ETypeTagUnion::IndentEnd(pos) => {
|
|
||||||
match next_line_starts_with_close_square_bracket(
|
|
||||||
alloc.src_lines,
|
|
||||||
lines.convert_pos(pos),
|
|
||||||
) {
|
|
||||||
Some(curly_pos) => {
|
|
||||||
let surroundings = LineColumnRegion::new(lines.convert_pos(start), curly_pos);
|
|
||||||
let region = LineColumnRegion::from_pos(curly_pos);
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
"I am partway through parsing a tag union type, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(surroundings, region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I need this square bracket to be indented more. Try adding more spaces before it!"),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "NEED MORE INDENTATION".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
let surroundings = Region::new(start, pos);
|
|
||||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
|
||||||
|
|
||||||
let doc = alloc.stack([
|
|
||||||
alloc.reflow(
|
|
||||||
r"I am partway through parsing a tag union type, but I got stuck here:",
|
|
||||||
),
|
|
||||||
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
|
||||||
alloc.concat([
|
|
||||||
alloc.reflow("I was expecting to see a closing square "),
|
|
||||||
alloc.reflow("bracket before this, so try adding a "),
|
|
||||||
alloc.parser_suggestion("]"),
|
|
||||||
alloc.reflow(" and see if that helps?"),
|
|
||||||
]),
|
|
||||||
note_for_tag_union_type_indent(alloc),
|
|
||||||
]);
|
|
||||||
|
|
||||||
Report {
|
|
||||||
filename,
|
|
||||||
doc,
|
|
||||||
title: "UNFINISHED TAG UNION TYPE".to_string(),
|
|
||||||
severity: Severity::RuntimeError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ETypeTagUnion::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
ETypeTagUnion::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4186,13 +3852,6 @@ fn next_line_starts_with_close_parenthesis(
|
||||||
next_line_starts_with_char(source_lines, pos, ')')
|
next_line_starts_with_char(source_lines, pos, ')')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_line_starts_with_close_square_bracket(
|
|
||||||
source_lines: &[&str],
|
|
||||||
pos: LineColumn,
|
|
||||||
) -> Option<LineColumn> {
|
|
||||||
next_line_starts_with_char(source_lines, pos, ']')
|
|
||||||
}
|
|
||||||
|
|
||||||
fn next_line_starts_with_char(
|
fn next_line_starts_with_char(
|
||||||
source_lines: &[&str],
|
source_lines: &[&str],
|
||||||
pos: LineColumn,
|
pos: LineColumn,
|
||||||
|
|
|
@ -4226,12 +4226,12 @@ mod test_reporting {
|
||||||
I am partway through parsing a tag union type, but I got stuck here:
|
I am partway through parsing a tag union type, but I got stuck here:
|
||||||
|
|
||||||
4│ f : [
|
4│ f : [
|
||||||
^
|
5│
|
||||||
|
6│
|
||||||
|
^
|
||||||
|
|
||||||
I was expecting to see a closing square bracket before this, so try
|
I was expecting to see a closing square bracket before this, so try
|
||||||
adding a ] and see if that helps?
|
adding a ] and see if that helps?
|
||||||
|
|
||||||
Note: I may be confused by indentation
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4312,12 +4312,12 @@ mod test_reporting {
|
||||||
I am partway through parsing a record type, but I got stuck here:
|
I am partway through parsing a record type, but I got stuck here:
|
||||||
|
|
||||||
4│ f : {
|
4│ f : {
|
||||||
^
|
5│
|
||||||
|
6│
|
||||||
|
^
|
||||||
|
|
||||||
I was expecting to see a closing curly brace before this, so try
|
I was expecting to see a closing curly brace before this, so try
|
||||||
adding a } and see if that helps?
|
adding a } and see if that helps?
|
||||||
|
|
||||||
Note: I may be confused by indentation
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4335,12 +4335,13 @@ mod test_reporting {
|
||||||
I am partway through parsing a record type, but I got stuck here:
|
I am partway through parsing a record type, but I got stuck here:
|
||||||
|
|
||||||
4│ f : {
|
4│ f : {
|
||||||
^
|
5│ foo : I64,
|
||||||
|
6│
|
||||||
|
7│
|
||||||
|
^
|
||||||
|
|
||||||
I was expecting to see a closing curly brace before this, so try
|
I was expecting to see a closing curly brace before this, so try
|
||||||
adding a } and see if that helps?
|
adding a } and see if that helps?
|
||||||
|
|
||||||
Note: I may be confused by indentation
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4458,12 +4459,12 @@ Tab characters are not allowed."###,
|
||||||
here:
|
here:
|
||||||
|
|
||||||
4│ f : (
|
4│ f : (
|
||||||
^
|
5│
|
||||||
|
6│
|
||||||
|
^
|
||||||
|
|
||||||
I was expecting to see a parenthesis before this, so try adding a )
|
I was expecting to see a closing parenthesis before this, so try
|
||||||
and see if that helps?
|
adding a ) and see if that helps?
|
||||||
|
|
||||||
Note: I may be confused by indentation
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6137,15 +6138,16 @@ In roc, functions are always written as a lambda, like{}
|
||||||
@r###"
|
@r###"
|
||||||
── UNFINISHED PARENTHESES ───────── tmp/pattern_in_parens_indent_open/Test.roc ─
|
── UNFINISHED PARENTHESES ───────── tmp/pattern_in_parens_indent_open/Test.roc ─
|
||||||
|
|
||||||
I just started parsing a pattern in parentheses, but I got stuck here:
|
I am partway through parsing a pattern in parentheses, but I got stuck
|
||||||
|
here:
|
||||||
|
|
||||||
4│ \(
|
4│ \(
|
||||||
^
|
5│
|
||||||
|
6│
|
||||||
|
^
|
||||||
|
|
||||||
Record pattern look like { name, age: currentAge }, so I was expecting
|
I was expecting to see a closing parenthesis before this, so try
|
||||||
to see a field name next.
|
adding a ) and see if that helps?
|
||||||
|
|
||||||
Note: I may be confused by indentation
|
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -11783,29 +11785,6 @@ I recommend using camelCase. It's the standard style in Roc code!
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
||||||
test_report!(
|
|
||||||
list_pattern_weird_indent,
|
|
||||||
indoc!(
|
|
||||||
r#"
|
|
||||||
when [] is
|
|
||||||
[1, 2,
|
|
||||||
3] -> ""
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
@r###"
|
|
||||||
── UNFINISHED LIST PATTERN ──────────── tmp/list_pattern_weird_indent/Test.roc ─
|
|
||||||
|
|
||||||
I am partway through parsing a list pattern, but I got stuck here:
|
|
||||||
|
|
||||||
5│ [1, 2,
|
|
||||||
6│ 3] -> ""
|
|
||||||
^
|
|
||||||
|
|
||||||
I was expecting to see a closing square brace before this, so try
|
|
||||||
adding a ] and see if that helps?
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
|
|
||||||
test_report!(
|
test_report!(
|
||||||
list_pattern_weird_rest_pattern,
|
list_pattern_weird_rest_pattern,
|
||||||
indoc!(
|
indoc!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue