mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
fix formatting issue
This commit is contained in:
parent
02e161f839
commit
c4e606bcc6
2 changed files with 36 additions and 2 deletions
|
@ -1620,8 +1620,8 @@ fn to_diff<'b>(
|
|||
|
||||
pair => {
|
||||
// We hit none of the specific cases where we give more detailed information
|
||||
let left = to_doc(alloc, Parens::Unnecessary, type1);
|
||||
let right = to_doc(alloc, Parens::Unnecessary, type2);
|
||||
let left = to_doc(alloc, parens, type1);
|
||||
let right = to_doc(alloc, parens, type2);
|
||||
|
||||
let is_int = |t: &ErrorType| match t {
|
||||
ErrorType::Type(Symbol::NUM_INT, _) => true,
|
||||
|
|
|
@ -4703,4 +4703,38 @@ mod test_reporting {
|
|||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dict_type_formatting() {
|
||||
// TODO could do better by pointing out we're parsing a function type
|
||||
report_problem_as(
|
||||
indoc!(
|
||||
r#"
|
||||
myDict : Dict I64 Str
|
||||
myDict = Dict.insert Dict.empty "foo" 42
|
||||
|
||||
myDict
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── TYPE MISMATCH ───────────────────────────────────────────────────────────────
|
||||
|
||||
Something is off with the body of the `myDict` definition:
|
||||
|
||||
1│ myDict : Dict I64 Str
|
||||
2│ myDict = Dict.insert Dict.empty "foo" 42
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This `insert` call produces:
|
||||
|
||||
Dict Str (Num a)
|
||||
|
||||
But the type annotation on `myDict` says it should be:
|
||||
|
||||
Dict I64 Str
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue