add NoExpectation type error

This commit is contained in:
Folkert 2020-04-07 13:35:38 +02:00
parent ccd021a755
commit 2d1a1621c3

View file

@ -130,7 +130,23 @@ fn to_expr_report(
match expected { match expected {
Expected::NoExpectation(expected_type) => { Expected::NoExpectation(expected_type) => {
todo!("hit no expectation with type {:?}", expected_type) let comparison = type_comparison(
found,
expected_type,
add_category(plain_text("It is"), &category),
plain_text("But you are trying to use it as:"),
Concat(vec![]),
);
Report {
filename,
title: "TYPE MISMATCH".to_string(),
text: Concat(vec![
plain_text("This expression is used in an unexpected way:"),
Region(expr_region),
comparison,
]),
}
} }
Expected::FromAnnotation(name, _arity, annotation_source, expected_type) => { Expected::FromAnnotation(name, _arity, annotation_source, expected_type) => {
use roc_types::types::AnnotationSource::*; use roc_types::types::AnnotationSource::*;