mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
Improve type mismatch messages
This commit is contained in:
parent
14bb674068
commit
d26909c317
7 changed files with 50 additions and 27 deletions
|
@ -16,9 +16,9 @@ use erg_common::{
|
|||
|
||||
use erg_parser::error::{ParserRunnerError, ParserRunnerErrors};
|
||||
|
||||
use crate::ty::{Predicate, Type};
|
||||
|
||||
use crate::context::Context;
|
||||
use crate::hir::{Expr, Identifier, Signature};
|
||||
use crate::ty::{Predicate, Type};
|
||||
|
||||
pub fn ordinal_num(n: usize) -> String {
|
||||
match n.to_string().chars().last().unwrap() {
|
||||
|
@ -972,6 +972,7 @@ passed keyword args: {kw_args_len}"
|
|||
caused_by: String,
|
||||
hint: Option<String>,
|
||||
) -> Self {
|
||||
let hint = hint.or_else(|| Context::get_type_mismatch_hint(trait_, class));
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
vec![SubMessage::ambiguous_new(loc, vec![], hint)],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue