Add hint.rs in context

This commit is contained in:
Shunsuke Shibayama 2022-09-02 01:20:35 +09:00
parent 0844fb2f7a
commit 3550a0e4b5
7 changed files with 17 additions and 6 deletions

View file

@ -513,6 +513,7 @@ impl TyCheckError {
name: &str,
expect: &Type,
found: &Type,
hint: Option<Str>,
) -> Self {
Self::new(
ErrorCore::new(
@ -525,7 +526,7 @@ impl TyCheckError {
"traditional_chinese" => format!("{name}的類型不匹配:\n預期:{GREEN}{expect}{RESET}\n但找到:{RED}{found}{RESET}"),
"english" => format!("the type of {name} is mismatched:\nexpected: {GREEN}{expect}{RESET}\nbut found: {RED}{found}{RESET}"),
),
None,
hint,
),
caused_by,
)