todo: arbitrary ir
This commit is contained in:
@@ -5,10 +5,6 @@ use crate::{
|
||||
};
|
||||
use internment::ArcIntern;
|
||||
use pretty::{BoxAllocator, DocAllocator, Pretty};
|
||||
use proptest::{
|
||||
prelude::Arbitrary,
|
||||
strategy::{BoxedStrategy, Strategy},
|
||||
};
|
||||
use std::{fmt, str::FromStr, sync::atomic::AtomicUsize};
|
||||
|
||||
/// We're going to represent variables as interned strings.
|
||||
@@ -78,21 +74,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<Type: core::fmt::Debug> Arbitrary for Program<Type> {
|
||||
type Parameters = crate::syntax::arbitrary::GenerationEnvironment;
|
||||
type Strategy = BoxedStrategy<Self>;
|
||||
|
||||
fn arbitrary_with(args: Self::Parameters) -> Self::Strategy {
|
||||
unimplemented!()
|
||||
//crate::syntax::Program::arbitrary_with(args)
|
||||
// .prop_map(|x| {
|
||||
// x.type_infer()
|
||||
// .expect("arbitrary_with should generate type-correct programs")
|
||||
// })
|
||||
// .boxed()
|
||||
}
|
||||
}
|
||||
|
||||
/// A thing that can sit at the top level of a file.
|
||||
///
|
||||
/// For the moment, these are statements and functions. Other things
|
||||
@@ -144,7 +125,7 @@ where
|
||||
/// a primitive), any subexpressions have been bound to variables so
|
||||
/// that the referenced data will always either be a constant or a
|
||||
/// variable reference.
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Expression<Type> {
|
||||
Atomic(ValueOrRef<Type>),
|
||||
Cast(Location, Type, ValueOrRef<Type>),
|
||||
@@ -497,7 +478,7 @@ impl fmt::Display for TypeOrVar {
|
||||
Some((last_one, rest)) => {
|
||||
write!(f, "(")?;
|
||||
for arg in rest.iter() {
|
||||
write!(f, "{}, ", arg);
|
||||
write!(f, "{}, ", arg)?;
|
||||
}
|
||||
write!(f, "{})", last_one)?;
|
||||
}
|
||||
@@ -510,6 +491,12 @@ impl fmt::Display for TypeOrVar {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TypeOrVar {
|
||||
fn default() -> Self {
|
||||
TypeOrVar::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeOrVar {
|
||||
/// Generate a fresh type variable that is different from all previous type variables.
|
||||
///
|
||||
@@ -532,7 +519,7 @@ impl TypeOrVar {
|
||||
}
|
||||
}
|
||||
|
||||
trait TypeWithVoid {
|
||||
pub trait TypeWithVoid {
|
||||
fn void() -> Self;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user