mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
cleanup
This commit is contained in:
parent
a6e39e66f1
commit
cb1dff1baf
5 changed files with 11 additions and 5 deletions
|
@ -14,13 +14,12 @@ impl LayoutId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct IdsByLayout<'a> {
|
struct IdsByLayout<'a> {
|
||||||
by_id: MutMap<Layout<'a>, u32>,
|
by_id: MutMap<Layout<'a>, u32>,
|
||||||
next_id: u32,
|
next_id: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default)]
|
||||||
pub struct LayoutIds<'a> {
|
pub struct LayoutIds<'a> {
|
||||||
by_symbol: MutMap<Symbol, IdsByLayout<'a>>,
|
by_symbol: MutMap<Symbol, IdsByLayout<'a>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3441,7 +3441,6 @@ fn get_foreign_symbol<'a, 'ctx, 'env>(
|
||||||
function_type: FunctionType<'ctx>,
|
function_type: FunctionType<'ctx>,
|
||||||
) -> FunctionValue<'ctx> {
|
) -> FunctionValue<'ctx> {
|
||||||
let module = env.module;
|
let module = env.module;
|
||||||
let context = env.context;
|
|
||||||
|
|
||||||
match module.get_function(foreign_symbol.as_str()) {
|
match module.get_function(foreign_symbol.as_str()) {
|
||||||
Some(gvalue) => gvalue,
|
Some(gvalue) => gvalue,
|
||||||
|
|
|
@ -1344,12 +1344,14 @@ pub fn specialize_all<'a>(
|
||||||
mut procs: Procs<'a>,
|
mut procs: Procs<'a>,
|
||||||
layout_cache: &mut LayoutCache<'a>,
|
layout_cache: &mut LayoutCache<'a>,
|
||||||
) -> Procs<'a> {
|
) -> Procs<'a> {
|
||||||
dbg!(&procs.externals_others_need);
|
|
||||||
let it = procs.externals_others_need.specs.clone();
|
let it = procs.externals_others_need.specs.clone();
|
||||||
let it = it
|
let it = it
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(symbol, solved_types)| {
|
.map(|(symbol, solved_types)| {
|
||||||
|
// for some unclear reason, the MutSet does not deduplicate according to the hash
|
||||||
|
// instance. So we do it manually here
|
||||||
let mut as_vec: std::vec::Vec<_> = solved_types.into_iter().collect();
|
let mut as_vec: std::vec::Vec<_> = solved_types.into_iter().collect();
|
||||||
|
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::collections::hash_map::DefaultHasher;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
|
@ -1365,6 +1367,7 @@ pub fn specialize_all<'a>(
|
||||||
as_vec.into_iter().map(move |s| (symbol, s))
|
as_vec.into_iter().map(move |s| (symbol, s))
|
||||||
})
|
})
|
||||||
.flatten();
|
.flatten();
|
||||||
|
|
||||||
for (name, solved_type) in it.into_iter() {
|
for (name, solved_type) in it.into_iter() {
|
||||||
let partial_proc = match procs.partial_procs.get(&name) {
|
let partial_proc = match procs.partial_procs.get(&name) {
|
||||||
Some(v) => v.clone(),
|
Some(v) => v.clone(),
|
||||||
|
|
|
@ -26,6 +26,12 @@ impl<T> Solved<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A custom hash instance, that treats flex vars specially, so that
|
||||||
|
///
|
||||||
|
/// `Foo 100 200 100` hashes to the same as `Foo 300 100 300`
|
||||||
|
///
|
||||||
|
/// i.e., we can rename the flex variables, so long as it happens consistently.
|
||||||
|
/// this is important so we don't generate the same PartialProc twice.
|
||||||
impl Hash for SolvedType {
|
impl Hash for SolvedType {
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
hash_solved_type_help(self, &mut Vec::new(), state);
|
hash_solved_type_help(self, &mut Vec::new(), state);
|
||||||
|
|
|
@ -2,7 +2,6 @@ app Main provides [ main ] imports [ Effect ]
|
||||||
|
|
||||||
main : Effect.Effect {} as Fx
|
main : Effect.Effect {} as Fx
|
||||||
main =
|
main =
|
||||||
|
|
||||||
Effect.putLine "Hello"
|
Effect.putLine "Hello"
|
||||||
|> Effect.after \{} -> Effect.putChar 87
|
|> Effect.after \{} -> Effect.putChar 87
|
||||||
# |> Effect.after \{} -> Effect.putLine "orld"
|
# |> Effect.after \{} -> Effect.putLine "orld"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue