feat(playground): impl clone for some errors

This commit is contained in:
rvcas
2023-04-24 17:13:20 -04:00
parent ff87a4c60f
commit baa2cef6c4
3 changed files with 11 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ use miette::Diagnostic;
use owo_colors::{OwoColorize, Stream::Stdout};
use std::collections::HashSet;
#[derive(Debug, Diagnostic, thiserror::Error)]
#[derive(Debug, Clone, Diagnostic, thiserror::Error)]
#[error("{kind}\n")]
pub struct ParseError {
pub kind: ErrorKind,
@@ -98,7 +98,7 @@ impl<T: Into<Pattern>> chumsky::Error<T> for ParseError {
}
}
#[derive(Debug, PartialEq, Eq, Diagnostic, thiserror::Error)]
#[derive(Debug, Clone, PartialEq, Eq, Diagnostic, thiserror::Error)]
pub enum ErrorKind {
#[error("I arrived at the end of the file unexpectedly.")]
UnexpectedEnd,
@@ -155,7 +155,7 @@ pub enum ErrorKind {
InvalidWhenClause,
}
#[derive(Debug, PartialEq, Eq, Hash, Diagnostic, thiserror::Error)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Diagnostic, thiserror::Error)]
pub enum Pattern {
#[error("I found an unexpected char '{0:?}'.")]
#[diagnostic(help("Try removing it!"))]

View File

@@ -15,14 +15,14 @@ use owo_colors::{
};
use std::{collections::HashMap, fmt::Display, sync::Arc};
#[derive(Debug, thiserror::Error, Diagnostic)]
#[derive(Debug, thiserror::Error, Diagnostic, Clone)]
#[error("Something is possibly wrong here...")]
pub struct Snippet {
#[label]
pub location: Span,
}
#[derive(Debug, thiserror::Error)]
#[derive(Debug, Clone, thiserror::Error)]
#[error(
"I don't know some of the labels used in this expression. I've highlighted them just below."
)]
@@ -53,7 +53,7 @@ impl Diagnostic for UnknownLabels {
}
}
#[derive(Debug, thiserror::Error, Diagnostic)]
#[derive(Debug, thiserror::Error, Diagnostic, Clone)]
pub enum Error {
#[error("I discovered a type cast from Data without an annotation")]
#[diagnostic(code("illegal::type_cast"))]