Add Obj! type definition

This commit is contained in:
Shunsuke Shibayama 2022-11-15 18:48:55 +09:00
parent 62f4622135
commit fe0153d98a
4 changed files with 57 additions and 12 deletions

View file

@ -1351,6 +1351,39 @@ impl LowerError {
)
}
pub fn type_not_found(
input: Input,
errno: usize,
loc: Location,
caused_by: AtomicStr,
typ: &Type,
) -> Self {
let typ = StyledString::new(&typ.to_string(), Some(ERR), Some(Attribute::Bold));
Self::new(
ErrorCore::new(
errno,
NameError,
loc,
switch_lang!(
"japanese" => format!("{typ}という型は定義されていません"),
"simplified_chinese" => format!("{typ}未定义"),
"traditional_chinese" => format!("{typ}未定義"),
"english" => format!("Type {typ} is not defined"),
),
Some(
switch_lang!(
"japanese" => format!("恐らくこれはErgコンパイラのバグです、{URL}へ報告してください"),
"simplified_chinese" => format!("这可能是Erg编译器的错误请报告给{URL}"),
"traditional_chinese" => format!("這可能是Erg編譯器的錯誤請報告給{URL}"),
"english" => format!("This may be a bug of Erg compiler, please report to {URL}"),
).into(),
),
),
input,
caused_by,
)
}
pub fn no_attr_error(
input: Input,
errno: usize,