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
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
3 changed files with 11 additions and 10 deletions

View File

@ -5,15 +5,16 @@
### Added ### Added
- **aiken-lang**: added optimization to help prevent unnecessary data wraps or unwraps - **aiken-lang**: added optimization to help prevent unnecessary data wraps or unwraps
- **aiken-lang**: optimization to strip unnecessary lambdas
- **aiken-lang**: implement Clone for ParseError and tipo::Error for the playground
- **aiken-project**: added end to end tests on conversion from aiken lang to uplc - **aiken-project**: added end to end tests on conversion from aiken lang to uplc
### Fixed ### Fixed
- **aiken-lang**: Add name of var to the unused var warning
### Fixed
- **aiken**: fixed 'new' instructions to properly show project name and folder - **aiken**: fixed 'new' instructions to properly show project name and folder
- **aiken-lang**: Add name of var to the unused var warning
- **aiken-lang**: fix expect on an empty list
- **aiken-lang**: pattern match on boolean with simple clause bodies
## v1.0.2.alpha - 2023-04-17 ## v1.0.2.alpha - 2023-04-17

View File

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

View File

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