From 9e331f4a60c4c82ca7abdf643fc105701a569355 Mon Sep 17 00:00:00 2001 From: Folkert Date: Sun, 5 Apr 2020 00:12:41 +0200 Subject: [PATCH] add commented tests --- compiler/reporting/src/type_error.rs | 2 +- compiler/reporting/tests/test_reporting.rs | 62 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/compiler/reporting/src/type_error.rs b/compiler/reporting/src/type_error.rs index a049a286f6..fc1e30fa87 100644 --- a/compiler/reporting/src/type_error.rs +++ b/compiler/reporting/src/type_error.rs @@ -122,7 +122,7 @@ fn to_expr_report( match expected { Expected::NoExpectation(expected_type) => todo!("hit no expectation with type {:?}", expected_type), - Expected::FromAnnotation(_name, _arity, _sub_context, _expected_type) => todo!(), + Expected::FromAnnotation(_name, _arity, _sub_context, _expected_type) => todo!("hit from annotation {:?} {:?}",_sub_context, _expected_type ), Expected::ForReason(reason, expected_type, region) => match reason { Reason::IfCondition => { let problem = Concat(vec![ diff --git a/compiler/reporting/tests/test_reporting.rs b/compiler/reporting/tests/test_reporting.rs index 354558795e..8095efaa52 100644 --- a/compiler/reporting/tests/test_reporting.rs +++ b/compiler/reporting/tests/test_reporting.rs @@ -960,6 +960,68 @@ mod test_reporting { ) } + // needs a bit more infrastructure re. diffing records + // #[test] + // fn record_update_keys() { + // report_problem_as( + // indoc!( + // r#" + // x : { foo : {} } + // x = { foo: {} } + // + // { x & baz: "bar" } + // "# + // ), + // indoc!( + // r#" + // The `x` record does not have a `baz` field + // + // 4 ┆ { x & baz: "bar" } + // ┆ ^^^ + // + // This is usually a typo. Here are the `x` fields that are most similar + // + // { foo : {} + // } + // + // So maybe `baz` should be `foo`? + // "# + // ), + // ) + // } + + // #[test] + // fn num_literal() { + // report_problem_as( + // indoc!( + // r#" + // x : Str + // x = 4 + // + // x + // "# + // ), + // indoc!( + // r#" + // Something is off with the body of the `x` definition + // + // 4 ┆ x = 4 + // ┆ ^ + // + // The body is a number of type + // + // Num a + // + // But the type annotation on `x` says that it should be + // + // Str + // + // instead. + // "# + // ), + // ) + // } + #[test] fn circular_type() { report_problem_as(