test case for alias diff reporting

This commit is contained in:
Folkert 2021-02-16 17:22:06 +01:00
parent 2a22f6254f
commit 22a9779fe4
2 changed files with 156 additions and 119 deletions

View file

@ -17,7 +17,7 @@ use roc_types::subs::{Content, FlatType, Subs, Variable};
use std::collections::HashMap;
use ven_pretty::{BoxAllocator, DocAllocator, DocBuilder};
pub const PRETTY_PRINT_IR_SYMBOLS: bool = true;
pub const PRETTY_PRINT_IR_SYMBOLS: bool = false;
macro_rules! return_on_layout_error {
($env:expr, $layout_result:expr) => {

View file

@ -1132,7 +1132,7 @@ mod test_reporting {
But the type annotation on `x` says it should be:
Int b
Int a
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -1171,7 +1171,7 @@ mod test_reporting {
But the type annotation on `x` says it should be:
Int b
Int a
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -1207,7 +1207,7 @@ mod test_reporting {
But the type annotation on `x` says it should be:
Int b
Int a
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -1541,7 +1541,7 @@ mod test_reporting {
But the type annotation says it should be:
{ x : Int b }
{ x : Int a }
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -4737,4 +4737,41 @@ mod test_reporting {
),
)
}
#[test]
fn alias_type_diff() {
report_problem_as(
indoc!(
r#"
HSet a : Set a
foo : Str -> HSet {}
myDict : HSet Str
myDict = foo "bar"
myDict
"#
),
indoc!(
r#"
TYPE MISMATCH
Something is off with the body of the `myDict` definition:
5 myDict : HSet Str
6 myDict = foo "bar"
^^^^^^^^^
This `foo` call produces:
HSet {}
But the type annotation on `myDict` says it should be:
HSet Str
"#
),
)
}
}