diff --git a/compiler/constrain/src/expr.rs b/compiler/constrain/src/expr.rs index 0277b6b5e3..b4148ac1d9 100644 --- a/compiler/constrain/src/expr.rs +++ b/compiler/constrain/src/expr.rs @@ -758,7 +758,10 @@ pub fn constrain_expr( Box::new(Type::Variable(*ext_var)), ), expected.clone(), - Category::TagApply(name.clone()), + Category::TagApply { + tag_name: name.clone(), + args_count: arguments.len(), + }, region, ); let ast_con = Eq( diff --git a/compiler/constrain/src/uniq.rs b/compiler/constrain/src/uniq.rs index 87fdf3762c..c53a28498c 100644 --- a/compiler/constrain/src/uniq.rs +++ b/compiler/constrain/src/uniq.rs @@ -620,13 +620,19 @@ pub fn constrain_expr( let union_con = Eq( union_type, expected.clone(), - Category::TagApply(name.clone()), + Category::TagApply { + tag_name: name.clone(), + args_count: arguments.len(), + }, region, ); let ast_con = Eq( Type::Variable(*variant_var), expected, - Category::TagApply(name.clone()), + Category::TagApply { + tag_name: name.clone(), + args_count: arguments.len(), + }, region, ); diff --git a/compiler/reporting/src/error/type.rs b/compiler/reporting/src/error/type.rs index 45fd11347d..9f6eee3184 100644 --- a/compiler/reporting/src/error/type.rs +++ b/compiler/reporting/src/error/type.rs @@ -882,12 +882,39 @@ fn add_category<'b>( Lambda => alloc.concat(vec![this_is, alloc.text(" an anonymous function of type:")]), - TagApply(TagName::Global(name)) => alloc.concat(vec![ + TagApply { + tag_name: TagName::Global(name), + args_count: 0, + } => alloc.concat(vec![ + alloc.text("This "), + alloc.global_tag_name(name.to_owned()), + if name.as_str() == "True" || name.as_str() == "False" { + alloc.text(" boolean has the type:") + } else { + alloc.text(" global tag has the type:") + }, + ]), + TagApply { + tag_name: TagName::Private(name), + args_count: 0, + } => alloc.concat(vec![ + alloc.text("This "), + alloc.private_tag_name(*name), + alloc.text(" private tag has the type:"), + ]), + + TagApply { + tag_name: TagName::Global(name), + args_count: _, + } => alloc.concat(vec![ alloc.text("This "), alloc.global_tag_name(name.to_owned()), alloc.text(" global tag application has the type:"), ]), - TagApply(TagName::Private(name)) => alloc.concat(vec![ + TagApply { + tag_name: TagName::Private(name), + args_count: _, + } => alloc.concat(vec![ alloc.text("This "), alloc.private_tag_name(*name), alloc.text(" private tag application has the type:"), diff --git a/compiler/types/src/types.rs b/compiler/types/src/types.rs index bf65d8a6e6..5ca267f31c 100644 --- a/compiler/types/src/types.rs +++ b/compiler/types/src/types.rs @@ -927,7 +927,10 @@ pub enum Category { Lookup(Symbol), CallResult(Option), LowLevelOpResult(LowLevel), - TagApply(TagName), + TagApply { + tag_name: TagName, + args_count: usize, + }, Lambda, Uniqueness, StrInterpolation,