Allow testing blueprint generation from Aiken programs

This is quite something, because now we have a testing pipeline that
  can also be used for testing other compiler-related stuff such as the
  type-checker or the code generator.
This commit is contained in:
KtorZ
2023-01-28 16:01:50 +01:00
parent b93e14659c
commit d2cc44e5f4
7 changed files with 192 additions and 65 deletions

View File

@@ -5,8 +5,8 @@ use strum::IntoEnumIterator;
use uplc::builtins::DefaultFunction;
use crate::{
ast::{Arg, ArgName, CallArg, Function, ModuleKind, Span, TypedFunction, UnOp},
builder::FunctionAccessKey,
ast::{Arg, ArgName, CallArg, Function, ModuleKind, Span, TypedDataType, TypedFunction, UnOp},
builder::{DataTypeKey, FunctionAccessKey},
expr::TypedExpr,
tipo::{
fields::FieldMap, Type, TypeConstructor, TypeInfo, TypeVar, ValueConstructor,
@@ -800,6 +800,22 @@ pub fn prelude_functions(id_gen: &IdGenerator) -> HashMap<FunctionAccessKey, Typ
functions
}
pub fn prelude_data_types(id_gen: &IdGenerator) -> HashMap<DataTypeKey, TypedDataType> {
let mut data_types = HashMap::new();
// Option
let option_data_type = TypedDataType::option(generic_var(id_gen.next()));
data_types.insert(
DataTypeKey {
module_name: "".to_string(),
defined_type: "Option".to_string(),
},
option_data_type,
);
data_types
}
pub fn int() -> Arc<Type> {
Arc::new(Type::App {
public: true,