mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
un-ignore some tests
This commit is contained in:
parent
b9069716f9
commit
e7099a1525
4 changed files with 73 additions and 104 deletions
|
@ -433,8 +433,6 @@ fn parse_concrete_type<'a>(
|
|||
TApply::Space(crate::parser::BadInputError::LineTooLong, r, c)
|
||||
})?;
|
||||
|
||||
dbg!(&state);
|
||||
|
||||
Ok((MadeProgress, TypeAnnotation::Malformed(parsed_str), state))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -480,6 +480,8 @@ fn to_expr_report<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
EExpr::Space(error, row, col) => to_space_report(alloc, filename, &error, *row, *col),
|
||||
|
||||
_ => todo!("unhandled parse error: {:?}", parse_problem),
|
||||
}
|
||||
}
|
||||
|
@ -1821,6 +1823,22 @@ fn to_type_report<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
Type::TBadTypeVariable(row, col) => {
|
||||
let surroundings = Region::from_rows_cols(start_row, start_col, *row, *col);
|
||||
let region = Region::from_row_col(*row, *col);
|
||||
|
||||
let doc = alloc.stack(vec![
|
||||
alloc.reflow(r"I am expecting a type variable, but I got stuck here:"),
|
||||
alloc.region_with_subregion(surroundings, region),
|
||||
]);
|
||||
|
||||
Report {
|
||||
filename,
|
||||
doc,
|
||||
title: "BAD TYPE VARIABLE".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
_ => todo!("unhandled type parse error: {:?}", &parse_problem),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2330,23 +2330,6 @@ mod test_reporting {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn open_tag_union_can_grow() {
|
||||
report_problem_as(
|
||||
indoc!(
|
||||
r#"
|
||||
f : [ A ]* -> [ A, B, C ]
|
||||
f = \a -> a
|
||||
|
||||
f
|
||||
"#
|
||||
),
|
||||
// should not give errors
|
||||
indoc!(""),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn patterns_fn_not_exhaustive() {
|
||||
report_problem_as(
|
||||
|
@ -3264,7 +3247,6 @@ mod test_reporting {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn mutually_recursive_types_with_type_error() {
|
||||
report_problem_as(
|
||||
indoc!(
|
||||
|
@ -3293,13 +3275,12 @@ mod test_reporting {
|
|||
|
||||
This `ACons` global tag application has the type:
|
||||
|
||||
[ ACons (Num Integer) [ BCons (Num Integer) [ ACons Str [
|
||||
BCons I64 [ ACons I64 (BList I64 I64), ANil ] as a, BNil ], ANil
|
||||
], BNil ], ANil ]
|
||||
[ ACons Num (Integer Signed64) [ BCons (Num a) [ ACons Str [ BNil
|
||||
]b ]c ]d, ANil ]
|
||||
|
||||
But the type annotation on `x` says it should be:
|
||||
|
||||
[ ACons I64 (BList I64 I64), ANil ] as a
|
||||
[ ACons I64 BList I64 I64, ANil ]
|
||||
"#
|
||||
),
|
||||
)
|
||||
|
@ -4162,7 +4143,6 @@ mod test_reporting {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn type_annotation_double_colon() {
|
||||
report_problem_as(
|
||||
indoc!(
|
||||
|
@ -4175,12 +4155,15 @@ mod test_reporting {
|
|||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── PARSE PROBLEM ───────────────────────────────────────────────────────────────
|
||||
── UNKNOWN OPERATOR ────────────────────────────────────────────────────────────
|
||||
|
||||
Unexpected token :
|
||||
This looks like an operator, but it's not one I recognize!
|
||||
|
||||
1│ f :: I64
|
||||
^
|
||||
^^
|
||||
|
||||
I have no specific suggestion for this operator, see TODO for the full
|
||||
list of operators in Roc.
|
||||
"#
|
||||
),
|
||||
)
|
||||
|
@ -4488,7 +4471,6 @@ mod test_reporting {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn comment_with_tab() {
|
||||
report_problem_as(
|
||||
"# comment with a \t\n4",
|
||||
|
@ -4498,7 +4480,7 @@ mod test_reporting {
|
|||
|
||||
I encountered a tab character
|
||||
|
||||
1│ f : { foo }
|
||||
1│ # comment with a
|
||||
^
|
||||
|
||||
Tab characters are not allowed.
|
||||
|
@ -4508,8 +4490,8 @@ mod test_reporting {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn type_in_parens_start() {
|
||||
// TODO bad error message
|
||||
report_problem_as(
|
||||
indoc!(
|
||||
r#"
|
||||
|
@ -4518,15 +4500,12 @@ mod test_reporting {
|
|||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── UNFINISHED RECORD TYPE ──────────────────────────────────────────────────────
|
||||
── BAD TYPE VARIABLE ───────────────────────────────────────────────────────────
|
||||
|
||||
I am partway through parsing a record type, but I got stuck here:
|
||||
I am expecting a type variable, but I got stuck here:
|
||||
|
||||
1│ f : { a: Int,
|
||||
1│ f : (
|
||||
^
|
||||
|
||||
I was expecting to see a closing curly brace before this, so try
|
||||
adding a } and see if that helps?
|
||||
"#
|
||||
),
|
||||
)
|
||||
|
@ -4979,9 +4958,8 @@ mod test_reporting {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn pattern_binds_keyword() {
|
||||
// this should get better with time
|
||||
// TODO check if "what_is_next" is a keyword
|
||||
report_problem_as(
|
||||
indoc!(
|
||||
r#"
|
||||
|
@ -4995,12 +4973,15 @@ mod test_reporting {
|
|||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── PARSE PROBLEM ───────────────────────────────────────────────────────────────
|
||||
── MISSING EXPRESSION ──────────────────────────────────────────────────────────
|
||||
|
||||
Unexpected token :
|
||||
I am partway through parsing a definition, but I got stuck here:
|
||||
|
||||
2│ Just if ->
|
||||
1│ when Just 4 is
|
||||
2│ Just when ->
|
||||
^
|
||||
|
||||
I was expecting to see an expression like 42 or "hello".
|
||||
"#
|
||||
),
|
||||
)
|
||||
|
@ -5956,48 +5937,4 @@ mod test_reporting {
|
|||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn foobar() {
|
||||
report_problem_as(
|
||||
indoc!(
|
||||
r#"
|
||||
g = \x ->
|
||||
when x is
|
||||
0 -> 0
|
||||
_ -> g (x - 1)
|
||||
|
||||
# use parens to force the ordering!
|
||||
(h = \x ->
|
||||
when x is
|
||||
0 -> 0
|
||||
_ -> g (x - 1)
|
||||
|
||||
(p = \x ->
|
||||
when x is
|
||||
0 -> 0
|
||||
1 -> g (x - 1)
|
||||
_ -> p (x - 1)
|
||||
|
||||
|
||||
# variables must be (indirectly) referenced in the body for analysis to work
|
||||
{ x: p, y: h }
|
||||
))
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── TOO MANY ARGS ───────────────────────────────────────────────────────────────
|
||||
|
||||
This value is not a function, but it was given 2 arguments:
|
||||
|
||||
3│ !foo 1 2
|
||||
^^^^
|
||||
|
||||
Are there any missing commas? Or missing parentheses?
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -974,3 +974,19 @@ fn newtype_wrapper() {
|
|||
|x: &i64| *x
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_tag_union_cannot_grow() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
f : [ A ]* -> [ A, B, C ]
|
||||
f = \a -> a
|
||||
|
||||
f
|
||||
"#
|
||||
),
|
||||
4,
|
||||
i64
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue