Provide better errors on unknown type in cyclic definitions.
Let's consider the following case:
```
type Var =
Integer
type Vars =
List<Var>
```
This incorrectly reports an infinite cycle; due to the inability to
properly type-check `Var` which is also a dependent var of `Vars`. Yet
the real issue here being that `Integer` is an unknown type.
This commit also upgrades miette to 7.2.0, so that we can also display
a better error output when the problem is actually a cycle.
This commit is contained in:
parent
6fd9b34b92
commit
b36250d183
|
|
@ -61,7 +61,7 @@ pub enum Error {
|
||||||
TomlLoading {
|
TomlLoading {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
src: String,
|
src: String,
|
||||||
named: Box<NamedSource<String>>,
|
named: NamedSource<String>,
|
||||||
location: Option<Span>,
|
location: Option<Span>,
|
||||||
help: String,
|
help: String,
|
||||||
},
|
},
|
||||||
|
|
@ -76,7 +76,7 @@ pub enum Error {
|
||||||
Parse {
|
Parse {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
src: String,
|
src: String,
|
||||||
named: Box<NamedSource<String>>,
|
named: NamedSource<String>,
|
||||||
#[source]
|
#[source]
|
||||||
error: Box<ParseError>,
|
error: Box<ParseError>,
|
||||||
},
|
},
|
||||||
|
|
@ -454,7 +454,7 @@ impl Diagnostic for Error {
|
||||||
Error::Type { named, .. } => Some(named),
|
Error::Type { named, .. } => Some(named),
|
||||||
Error::StandardIo(_) => None,
|
Error::StandardIo(_) => None,
|
||||||
Error::MissingManifest { .. } => None,
|
Error::MissingManifest { .. } => None,
|
||||||
Error::TomlLoading { named, .. } => Some(named.as_ref()),
|
Error::TomlLoading { named, .. } => Some(named),
|
||||||
Error::Format { .. } => None,
|
Error::Format { .. } => None,
|
||||||
Error::TestFailure { .. } => None,
|
Error::TestFailure { .. } => None,
|
||||||
Error::Http(_) => None,
|
Error::Http(_) => None,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue