Display warning help + minor error improvements.
This commit is contained in:
parent
83fd910604
commit
91bd0d1d77
|
@ -638,7 +638,10 @@ The best thing to do from here is to remove it."#))]
|
|||
#[diagnostic(code("type_mismatch"))]
|
||||
#[diagnostic(help("{}", suggest_unify(expected, given, situation, rigid_type_names)))]
|
||||
CouldNotUnify {
|
||||
#[label]
|
||||
#[label(
|
||||
"expected type '{}'",
|
||||
expected.to_pretty_with_names(rigid_type_names.clone(), 0),
|
||||
)]
|
||||
location: Span,
|
||||
expected: Arc<Type>,
|
||||
given: Arc<Type>,
|
||||
|
@ -1152,13 +1155,13 @@ pub enum Warning {
|
|||
name: String,
|
||||
},
|
||||
|
||||
#[error("I came across an unused variable: '{}'.\n", name.purple())]
|
||||
#[error("I came across an unused variable.\n")]
|
||||
#[diagnostic(help(
|
||||
"No big deal, but you might want to remove it to get rid of that warning."
|
||||
))]
|
||||
#[diagnostic(code("unused::variable"))]
|
||||
UnusedVariable {
|
||||
#[label]
|
||||
#[label("unused")]
|
||||
location: Span,
|
||||
name: String,
|
||||
},
|
||||
|
|
|
@ -480,7 +480,7 @@ impl Diagnostic for Warning {
|
|||
|
||||
fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>> {
|
||||
match self {
|
||||
Warning::Type { .. } => None,
|
||||
Warning::Type { warning, .. } => warning.help(),
|
||||
Warning::NoValidators => None,
|
||||
Warning::DependencyAlreadyExists { .. } => Some(Box::new(
|
||||
"If you need to change the version, try 'aiken packages upgrade' instead.",
|
||||
|
|
Loading…
Reference in New Issue