forked from M-Labs/nac3
Fixed type error messages
This commit is contained in:
parent
bb7c0a2d79
commit
d3cb5d6e52
|
@ -371,7 +371,7 @@ impl Nac3 {
|
||||||
.extract()
|
.extract()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
exception: id_fn
|
exception: id_fn
|
||||||
.call1((builtins_mod.getattr("tuple").unwrap(),))
|
.call1((builtins_mod.getattr("Exception").unwrap(),))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.extract()
|
.extract()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
|
|
@ -155,7 +155,7 @@ impl<'a> Display for DisplayTypeError<'a> {
|
||||||
}
|
}
|
||||||
NoSuchField(name, t) => {
|
NoSuchField(name, t) => {
|
||||||
let t = self.unifier.stringify_with_notes(*t, &mut notes);
|
let t = self.unifier.stringify_with_notes(*t, &mut notes);
|
||||||
write!(f, "`{}::{}` field does not exist", t, name)
|
write!(f, "`{}::{}` field/method does not exist", t, name)
|
||||||
}
|
}
|
||||||
TupleIndexOutOfBounds { index, len } => {
|
TupleIndexOutOfBounds { index, len } => {
|
||||||
write!(
|
write!(
|
||||||
|
|
|
@ -925,7 +925,10 @@ impl<'a> Inferencer<'a> {
|
||||||
(Some((_, false)), true) => {
|
(Some((_, false)), true) => {
|
||||||
report_error(&format!("Field {} should be immutable", attr), value.location)
|
report_error(&format!("Field {} should be immutable", attr), value.location)
|
||||||
}
|
}
|
||||||
(None, _) => report_error(&format!("No such field {}", attr), value.location),
|
(None, _) => {
|
||||||
|
let t = self.unifier.stringify(ty);
|
||||||
|
report_error(&format!("`{}::{}` field/method does not exist", t, attr), value.location)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let attr_ty = self.unifier.get_dummy_var().0;
|
let attr_ty = self.unifier.get_dummy_var().0;
|
||||||
|
|
Loading…
Reference in New Issue