fix(build): --uplc must use Program<Name> to pretty print
This commit is contained in:
parent
1747090931
commit
8d107b1293
|
@ -1,6 +1,6 @@
|
|||
# Changelog
|
||||
|
||||
## v1.0.8-alpha - unreleased
|
||||
## next - 2023-MM-DD
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -8,7 +8,10 @@ N/A
|
|||
|
||||
### Fixed
|
||||
|
||||
- Fixed operator precedences, in particular the pipe operator (`|>`) which is now of the lowest precedence.
|
||||
- **aiken-lang**: fixed operator precedences, in particular the pipe operator (`|>`) which is now of the lowest precedence.
|
||||
- **aiken-project**: need to convert to Program<Name> before dumping to uplc
|
||||
- **aiken-lang**: fmt crashing when comment at end of file with no newline
|
||||
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ use std::{
|
|||
};
|
||||
use telemetry::EventListener;
|
||||
use uplc::{
|
||||
ast::{DeBruijn, Term},
|
||||
ast::{DeBruijn, Name, Program, Term},
|
||||
machine::cost_model::ExBudget,
|
||||
};
|
||||
|
||||
|
@ -227,8 +227,10 @@ where
|
|||
for validator in &blueprint.validators {
|
||||
let path = dir.clone().join(format!("{}.uplc", validator.title));
|
||||
|
||||
fs::write(&path, validator.program.to_pretty())
|
||||
.map_err(|error| Error::FileIo { error, path })?;
|
||||
let program = &validator.program;
|
||||
let program: Program<Name> = program.try_into().unwrap();
|
||||
|
||||
fs::write(&path, program.to_pretty()).map_err(|error| Error::FileIo { error, path })?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -537,6 +537,29 @@ impl TryFrom<Term<Name>> for Term<DeBruijn> {
|
|||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&Program<DeBruijn>> for Program<Name> {
|
||||
type Error = debruijn::Error;
|
||||
|
||||
fn try_from(value: &Program<DeBruijn>) -> Result<Self, Self::Error> {
|
||||
Ok(Program::<Name> {
|
||||
version: value.version,
|
||||
term: (&value.term).try_into()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&Term<DeBruijn>> for Term<Name> {
|
||||
type Error = debruijn::Error;
|
||||
|
||||
fn try_from(value: &Term<DeBruijn>) -> Result<Self, debruijn::Error> {
|
||||
let mut converter = Converter::new();
|
||||
|
||||
let term = converter.debruijn_to_name(value)?;
|
||||
|
||||
Ok(term)
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<Program<NamedDeBruijn>> for Program<Name> {
|
||||
type Error = debruijn::Error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue