-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
generic_structure.rs
48 lines (42 loc) · 1.16 KB
/
generic_structure.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use crate::TypeId;
// #[derive(Clone, Debug, Default)]
// pub struct GenericStructureTypeArguments(pub(crate) Vec<GenericStructureTypeArgument>);
#[derive(Clone, Debug)]
pub enum GenericStructureArgumentValue {
Type(TypeId),
Unknown,
}
impl From<TypeId> for GenericStructureArgumentValue {
fn from(ty: TypeId) -> Self {
Self::Type(ty)
}
}
impl From<Option<TypeId>> for GenericStructureArgumentValue {
fn from(ty: Option<TypeId>) -> Self {
match ty {
Some(ty) => Self::Type(ty),
None => Self::Unknown,
}
}
}
#[allow(unused)]
#[derive(Clone, Debug)]
pub struct GenericStructureTypeArgument {
pub(crate) matching_id: TypeId,
pub(crate) ty: GenericStructureArgumentValue,
// TODO fixed type constraint id
// pub(crate) constraint: Option<Box<Type>>,
}
// impl From<GenericStructureTypeArguments> for FunctionTypeArguments {
// fn from(_instance_of_generics_arguments: GenericStructureTypeArguments) -> Self {
// todo!()
// // TypeArguments {
// // structure_arguments: todo!(),
// // local_arguments: todo!(),
// // environment: todo!(),
// // }
// // Cow::Owned(
// // instance_of_generics_arguments.into(),
// // ))
// }
// }