mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
Merge branch 'main' of https://github.com/GreasySlug/erg into split-err-msg
This commit is contained in:
commit
ff24c62de1
31 changed files with 878 additions and 412 deletions
|
@ -1,12 +1,12 @@
|
|||
use std::fmt;
|
||||
use std::fmt::Display;
|
||||
|
||||
use erg_common::astr::AtomicStr;
|
||||
use erg_common::config::Input;
|
||||
use erg_common::error::{
|
||||
ErrorCore, ErrorDisplay, ErrorKind::*, Location, MultiErrorDisplay, SubMessage,
|
||||
};
|
||||
use erg_common::set::Set;
|
||||
use erg_common::style::{Attribute, Color, StyledStr, StyledString, StyledStrings, THEME};
|
||||
use erg_common::style::{Attribute, Color, StyledStr, StyledString, StyledStrings, Theme, THEME};
|
||||
use erg_common::traits::{Locational, Stream};
|
||||
use erg_common::vis::Visibility;
|
||||
use erg_common::{
|
||||
|
@ -113,7 +113,8 @@ pub fn readable_name(name: &str) -> &str {
|
|||
pub struct CompileError {
|
||||
pub core: Box<ErrorCore>, // ErrorCore is large, so box it
|
||||
pub input: Input,
|
||||
pub caused_by: AtomicStr,
|
||||
pub caused_by: String,
|
||||
pub theme: Theme,
|
||||
}
|
||||
|
||||
impl_display_and_error!(CompileError);
|
||||
|
@ -123,7 +124,8 @@ impl From<ParserRunnerError> for CompileError {
|
|||
Self {
|
||||
core: Box::new(err.core),
|
||||
input: err.input,
|
||||
caused_by: "".into(),
|
||||
caused_by: "".to_owned(),
|
||||
theme: THEME,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,11 +153,12 @@ const URL: StyledStr = StyledStr::new(
|
|||
);
|
||||
|
||||
impl CompileError {
|
||||
pub fn new(core: ErrorCore, input: Input, caused_by: AtomicStr) -> Self {
|
||||
pub fn new(core: ErrorCore, input: Input, caused_by: String) -> Self {
|
||||
Self {
|
||||
core: Box::new(core),
|
||||
input,
|
||||
caused_by,
|
||||
theme: THEME,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +220,7 @@ impl CompileError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn feature_error(input: Input, loc: Location, name: &str, caused_by: AtomicStr) -> Self {
|
||||
pub fn feature_error(input: Input, loc: Location, name: &str, caused_by: String) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::only_loc(loc)],
|
||||
|
@ -300,7 +303,7 @@ impl TyCheckError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
) -> Self {
|
||||
let name = readable_name(name);
|
||||
|
@ -327,7 +330,7 @@ impl TyCheckError {
|
|||
errno: usize,
|
||||
callee: &C,
|
||||
param_ts: impl Iterator<Item = &'a Type>,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let param_ts = fmt_iter(param_ts);
|
||||
Self::new(
|
||||
|
@ -357,13 +360,13 @@ impl TyCheckError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
nth_param: Option<usize>,
|
||||
expect: &Type,
|
||||
found: &Type,
|
||||
candidates: Option<Set<Type>>,
|
||||
hint: Option<AtomicStr>,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
let ord = match nth_param {
|
||||
Some(pos) => switch_lang!(
|
||||
|
@ -422,7 +425,7 @@ impl TyCheckError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
expect: &Type,
|
||||
found: &Type,
|
||||
|
@ -471,7 +474,7 @@ impl TyCheckError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
t: &Type,
|
||||
) -> Self {
|
||||
|
@ -497,7 +500,7 @@ impl TyCheckError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
expect: usize,
|
||||
found: usize,
|
||||
) -> Self {
|
||||
|
@ -541,7 +544,7 @@ impl TyCheckError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
expr_t: &Type,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
|
@ -566,7 +569,7 @@ impl TyCheckError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
expr: &str,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
|
@ -601,7 +604,7 @@ impl TyCheckError {
|
|||
errno: usize,
|
||||
loc: Location,
|
||||
callee_name: &str,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
params_len: usize,
|
||||
pos_args_len: usize,
|
||||
kw_args_len: usize,
|
||||
|
@ -667,7 +670,7 @@ passed keyword args: {kw_args_len}"
|
|||
errno: usize,
|
||||
loc: Location,
|
||||
callee_name: &str,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
missing_len: usize,
|
||||
missing_params: Vec<Str>,
|
||||
) -> Self {
|
||||
|
@ -697,7 +700,7 @@ passed keyword args: {kw_args_len}"
|
|||
errno: usize,
|
||||
loc: Location,
|
||||
callee_name: &str,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
arg_name: &str,
|
||||
) -> Self {
|
||||
let name = readable_name(callee_name);
|
||||
|
@ -725,7 +728,7 @@ passed keyword args: {kw_args_len}"
|
|||
errno: usize,
|
||||
loc: Location,
|
||||
callee_name: &str,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
param_name: &str,
|
||||
) -> Self {
|
||||
let name = readable_name(callee_name);
|
||||
|
@ -754,7 +757,7 @@ passed keyword args: {kw_args_len}"
|
|||
lhs_t: &Type,
|
||||
rhs_t: &Type,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let mut lhs_typ = StyledStrings::default();
|
||||
switch_lang!(
|
||||
|
@ -800,7 +803,7 @@ passed keyword args: {kw_args_len}"
|
|||
lhs_t: &Type,
|
||||
rhs_t: &Type,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let lhs_t = StyledString::new(&format!("{}", lhs_t), Some(WARN), Some(Attribute::Bold));
|
||||
let rhs_t = StyledString::new(&format!("{}", rhs_t), Some(WARN), Some(Attribute::Bold));
|
||||
|
@ -828,7 +831,7 @@ passed keyword args: {kw_args_len}"
|
|||
sub_t: &Type,
|
||||
sup_t: &Type,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let mut sub_type = StyledStrings::default();
|
||||
switch_lang!(
|
||||
|
@ -875,7 +878,7 @@ passed keyword args: {kw_args_len}"
|
|||
errno: usize,
|
||||
lhs: &Predicate,
|
||||
rhs: &Predicate,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let mut lhs_uni = StyledStrings::default();
|
||||
switch_lang!(
|
||||
|
@ -920,8 +923,8 @@ passed keyword args: {kw_args_len}"
|
|||
errno: usize,
|
||||
proj: &Type,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
hint: Option<AtomicStr>,
|
||||
caused_by: String,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
|
@ -947,8 +950,8 @@ passed keyword args: {kw_args_len}"
|
|||
class: &Type,
|
||||
trait_: &Type,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
hint: Option<AtomicStr>,
|
||||
caused_by: String,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
|
@ -972,9 +975,9 @@ passed keyword args: {kw_args_len}"
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
hint: Option<AtomicStr>,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
let found = StyledString::new(name, Some(ERR), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1008,12 +1011,12 @@ passed keyword args: {kw_args_len}"
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
member_name: &str,
|
||||
trait_type: &Type,
|
||||
expect: &Type,
|
||||
found: &Type,
|
||||
hint: Option<AtomicStr>,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
let mut expct = StyledStrings::default();
|
||||
expct.push_str_with_color_and_attribute(&format!("{}", trait_type), WARN, Attribute::Bold);
|
||||
|
@ -1059,11 +1062,11 @@ passed keyword args: {kw_args_len}"
|
|||
pub fn trait_member_not_defined_error(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
member_name: &str,
|
||||
trait_type: &Type,
|
||||
class_type: &Type,
|
||||
hint: Option<AtomicStr>,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
let member_name = StyledString::new(member_name, Some(WARN), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1088,11 +1091,11 @@ passed keyword args: {kw_args_len}"
|
|||
pub fn not_in_trait_error(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
member_name: &str,
|
||||
trait_type: &Type,
|
||||
class_type: &Type,
|
||||
hint: Option<AtomicStr>,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
let member_name = StyledString::new(member_name, Some(WARN), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1118,7 +1121,7 @@ passed keyword args: {kw_args_len}"
|
|||
errno: usize,
|
||||
name: &str,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let found = StyledString::new(name, Some(ERR), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1144,7 +1147,7 @@ passed keyword args: {kw_args_len}"
|
|||
errno: usize,
|
||||
expr: &(impl Locational + Display),
|
||||
candidates: &[Type],
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let hint = Some(
|
||||
switch_lang!(
|
||||
|
@ -1197,7 +1200,7 @@ pub type EvalResult<T> = TyCheckResult<T>;
|
|||
pub type SingleEvalResult<T> = SingleTyCheckResult<T>;
|
||||
|
||||
impl EvalError {
|
||||
pub fn not_const_expr(input: Input, errno: usize, loc: Location, caused_by: AtomicStr) -> Self {
|
||||
pub fn not_const_expr(input: Input, errno: usize, loc: Location, caused_by: String) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::only_loc(loc)],
|
||||
|
@ -1216,12 +1219,7 @@ impl EvalError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn invalid_literal(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
) -> Self {
|
||||
pub fn invalid_literal(input: Input, errno: usize, loc: Location, caused_by: String) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::only_loc(loc)],
|
||||
|
@ -1245,7 +1243,7 @@ pub type EffectError = TyCheckError;
|
|||
pub type EffectErrors = TyCheckErrors;
|
||||
|
||||
impl EffectError {
|
||||
pub fn has_effect<S: Into<AtomicStr>>(
|
||||
pub fn has_effect<S: Into<String>>(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
expr: &Expr,
|
||||
|
@ -1269,7 +1267,7 @@ impl EffectError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn proc_assign_error<S: Into<AtomicStr>>(
|
||||
pub fn proc_assign_error<S: Into<String>>(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
sig: &Signature,
|
||||
|
@ -1307,7 +1305,7 @@ pub type OwnershipError = TyCheckError;
|
|||
pub type OwnershipErrors = TyCheckErrors;
|
||||
|
||||
impl OwnershipError {
|
||||
pub fn move_error<S: Into<AtomicStr>>(
|
||||
pub fn move_error<S: Into<String>>(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
name: &str,
|
||||
|
@ -1355,13 +1353,13 @@ pub type LowerResult<T> = TyCheckResult<T>;
|
|||
pub type SingleLowerResult<T> = SingleTyCheckResult<T>;
|
||||
|
||||
impl LowerError {
|
||||
pub fn syntax_error<S: Into<AtomicStr>>(
|
||||
pub fn syntax_error<S: Into<String>>(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
desc: S,
|
||||
hint: Option<AtomicStr>,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
|
@ -1380,7 +1378,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
) -> Self {
|
||||
let name = readable_name(name);
|
||||
|
@ -1406,7 +1404,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
) -> Self {
|
||||
let name = readable_name(name);
|
||||
|
@ -1432,7 +1430,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
spec_t: &Type,
|
||||
found_t: &Type,
|
||||
|
@ -1462,7 +1460,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
similar_name: Option<&str>,
|
||||
) -> Self {
|
||||
|
@ -1475,7 +1473,6 @@ impl LowerError {
|
|||
"traditional_chinese" => format!("存在相同名稱變量: {n}"),
|
||||
"english" => format!("exists a similar name variable: {n}"),
|
||||
)
|
||||
.into()
|
||||
});
|
||||
let found = StyledString::new(name, Some(ERR), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1500,7 +1497,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
typ: &Type,
|
||||
) -> Self {
|
||||
let typ = StyledString::new(&typ.to_string(), Some(ERR), Some(Attribute::Bold));
|
||||
|
@ -1533,7 +1530,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
obj_t: &Type,
|
||||
name: &str,
|
||||
similar_name: Option<&str>,
|
||||
|
@ -1545,7 +1542,6 @@ impl LowerError {
|
|||
"traditional_chinese" => format!("具有相同名稱的屬性: {n}"),
|
||||
"english" => format!("has a similar name attribute: {n}"),
|
||||
)
|
||||
.into()
|
||||
});
|
||||
let found = StyledString::new(name, Some(ERR), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1571,7 +1567,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
obj_name: &str,
|
||||
obj_t: &Type,
|
||||
name: &str,
|
||||
|
@ -1585,7 +1581,6 @@ impl LowerError {
|
|||
"traditional_chinese" => format!("具有相同名稱的屬性: {n}"),
|
||||
"english" => format!("has a similar name attribute: {n}"),
|
||||
)
|
||||
.into()
|
||||
});
|
||||
let found = StyledString::new(name, Some(ERR), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1610,7 +1605,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
) -> Self {
|
||||
let name = StyledString::new(readable_name(name), Some(WARN), Some(Attribute::Bold));
|
||||
|
@ -1637,7 +1632,7 @@ impl LowerError {
|
|||
errno: usize,
|
||||
loc: Location,
|
||||
name: &str,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let name = StyledString::new(readable_name(name), Some(WARN), Some(Attribute::Bold));
|
||||
Self::new(
|
||||
|
@ -1658,7 +1653,7 @@ impl LowerError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn del_error(input: Input, errno: usize, ident: &Identifier, caused_by: AtomicStr) -> Self {
|
||||
pub fn del_error(input: Input, errno: usize, ident: &Identifier, caused_by: String) -> Self {
|
||||
let name = StyledString::new(
|
||||
readable_name(ident.inspect()),
|
||||
Some(WARN),
|
||||
|
@ -1686,7 +1681,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
vis: Visibility,
|
||||
) -> Self {
|
||||
|
@ -1725,7 +1720,7 @@ impl LowerError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn override_error<S: Into<AtomicStr>>(
|
||||
pub fn override_error<S: Into<String>>(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
name: &str,
|
||||
|
@ -1789,7 +1784,7 @@ impl LowerError {
|
|||
errno: usize,
|
||||
class: String,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
|
@ -1814,8 +1809,8 @@ impl LowerError {
|
|||
errno: usize,
|
||||
desc: String,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
hint: Option<AtomicStr>,
|
||||
caused_by: String,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
|
@ -1835,7 +1830,7 @@ impl LowerError {
|
|||
errno: usize,
|
||||
mod_name: &str,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
let desc = switch_lang!(
|
||||
"japanese" => format!("{mod_name}モジュールはお使いの環境をサポートしていません"),
|
||||
|
@ -1851,7 +1846,7 @@ impl LowerError {
|
|||
errno: usize,
|
||||
desc: String,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
similar_erg_mod: Option<Str>,
|
||||
similar_py_mod: Option<Str>,
|
||||
) -> Self {
|
||||
|
@ -1948,7 +1943,6 @@ impl LowerError {
|
|||
}
|
||||
},
|
||||
);
|
||||
let hint = hint.map(AtomicStr::from);
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::ambiguous_new(
|
||||
|
@ -1970,7 +1964,7 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
|
@ -1990,7 +1984,7 @@ impl LowerError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn declare_error(input: Input, errno: usize, loc: Location, caused_by: AtomicStr) -> Self {
|
||||
pub fn declare_error(input: Input, errno: usize, loc: Location, caused_by: String) -> Self {
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::only_loc(loc)],
|
||||
|
@ -2014,10 +2008,10 @@ impl LowerError {
|
|||
input: Input,
|
||||
errno: usize,
|
||||
loc: Location,
|
||||
caused_by: AtomicStr,
|
||||
caused_by: String,
|
||||
name: &str,
|
||||
cast_to: &Type,
|
||||
hint: Option<AtomicStr>,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
let name = StyledString::new(name, Some(WARN), Some(Attribute::Bold));
|
||||
let found = StyledString::new(&format!("{}", cast_to), Some(WARN), Some(Attribute::Bold));
|
||||
|
@ -2065,6 +2059,12 @@ impl From<CompileError> for CompileErrors {
|
|||
|
||||
impl MultiErrorDisplay<CompileError> for CompileErrors {}
|
||||
|
||||
impl fmt::Display for CompileErrors {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.fmt_all(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl CompileErrors {
|
||||
pub fn flush(&mut self) -> Self {
|
||||
Self(self.0.drain(..).collect())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue