Skip to content

Commit ec95b99

Browse files
committed
mono: Take substitutions::Output as input
1 parent 4000f93 commit ec95b99

File tree

1 file changed

+15
-34
lines changed

1 file changed

+15
-34
lines changed

typecheck/src/generics/mono.rs

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@
9595
// how does that affect our generator? something like multimapper where we take in Foo[T], a Map { Foo[T]: Foo[int], Foo[string] } and return vec![foo[int], foo[string]]?
9696
// do we return the generic version? no, right?
9797

98-
use fir::{Kind, MultiMapper, Node, OriginIdx, RefIdx};
98+
use fir::{Fir, Incomplete, Kind, MultiMapper, Node, OriginIdx, RefIdx};
9999
use flatten::FlattenData;
100100

101+
use super::substitutions;
102+
101103
pub struct Monomorphize {
102-
to_mono: (),
104+
input: substitutions::Output,
103105
}
104106

105107
#[derive(Debug)]
@@ -108,36 +110,15 @@ pub struct Error;
108110
// FIXME: This can probably benefit from using a different `U` here - something like T -> U becomes FlattenData -> (MonodIdx, FlattenData)
109111
// Also the `From: T` in Mapper should probably be a `From: (&Node, T)` - so that we get all the info possible
110112
impl<'ast> MultiMapper<FlattenData<'ast>, FlattenData<'ast>, Error> for Monomorphize {
111-
fn map_instantiation(
112-
&mut self,
113-
_data: FlattenData<'ast>,
114-
origin: OriginIdx,
115-
to: RefIdx,
116-
generics: Vec<RefIdx>,
117-
fields: Vec<RefIdx>,
118-
) -> Result<Vec<Node<FlattenData<'ast>>>, Error> {
119-
Ok(vec![
120-
Node {
121-
data: _data.clone(),
122-
origin,
123-
kind: Kind::Instantiation {
124-
to,
125-
generics,
126-
fields: fields.clone(),
127-
},
128-
},
129-
// mono'd version
130-
Node {
131-
data: _data,
132-
origin,
133-
kind: Kind::Instantiation {
134-
to,
135-
generics: vec![],
136-
// Cloning here allows us to easily replace fields with their mono'd version
137-
// does it??
138-
fields,
139-
},
140-
},
141-
])
142-
}
113+
// fn map_record_type(
114+
// &mut self,
115+
// _data: FlattenData<'ast>,
116+
// origin: OriginIdx,
117+
// generics: Vec<RefIdx>,
118+
// fields: Vec<RefIdx>,
119+
// ) -> Result<Vec<Node<FlattenData<'ast>>>, Error> {
120+
// self.input.to_mono.get(&origin).map(|request| {
121+
// request
122+
// })
123+
// }
143124
}

0 commit comments

Comments
 (0)