Store types on ConstrainedModule

This commit is contained in:
Ayaz Hafiz 2022-11-08 14:27:26 -06:00
parent 7ce32e75b7
commit 6f6a90320e
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 6 additions and 1 deletions

View file

@ -49,7 +49,7 @@ use roc_solve::module::{extract_module_owned_implementations, Solved, SolvedModu
use roc_solve_problem::TypeError; use roc_solve_problem::TypeError;
use roc_target::TargetInfo; use roc_target::TargetInfo;
use roc_types::subs::{ExposedTypesStorageSubs, Subs, VarStore, Variable}; use roc_types::subs::{ExposedTypesStorageSubs, Subs, VarStore, Variable};
use roc_types::types::{Alias, AliasKind}; use roc_types::types::{Alias, AliasKind, Types};
use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::HashMap; use std::collections::HashMap;
use std::env::current_dir; use std::env::current_dir;
@ -646,6 +646,7 @@ struct ConstrainedModule {
var_store: VarStore, var_store: VarStore,
dep_idents: IdentIdsByModule, dep_idents: IdentIdsByModule,
module_timing: ModuleTiming, module_timing: ModuleTiming,
types: Types,
// Rather than adding pending derives as constraints, hand them directly to solve because they // Rather than adding pending derives as constraints, hand them directly to solve because they
// must be solved at the end of a module. // must be solved at the end of a module.
pending_derives: PendingDerives, pending_derives: PendingDerives,
@ -4703,6 +4704,7 @@ fn canonicalize_and_constrain<'a>(
&symbols_from_requires, &symbols_from_requires,
&mut var_store, &mut var_store,
); );
let types = Types::new();
// _after has an underscore because it's unused in --release builds // _after has an underscore because it's unused in --release builds
let _after = roc_types::types::get_type_clone_count(); let _after = roc_types::types::get_type_clone_count();
@ -4817,6 +4819,7 @@ fn canonicalize_and_constrain<'a>(
ident_ids: module_output.scope.locals.ident_ids, ident_ids: module_output.scope.locals.ident_ids,
dep_idents, dep_idents,
module_timing, module_timing,
types,
pending_derives: module_output.pending_derives, pending_derives: module_output.pending_derives,
}; };

View file

@ -365,6 +365,7 @@ impl std::ops::Neg for Polarity {
} }
} }
#[derive(Debug)]
pub struct AliasShared { pub struct AliasShared {
pub symbol: Symbol, pub symbol: Symbol,
pub type_argument_abilities: Slice<AbilitySet>, pub type_argument_abilities: Slice<AbilitySet>,
@ -456,6 +457,7 @@ impl AsideTypeSlice {
/// the [type solving representation][crate::subs::Content] of types. /// the [type solving representation][crate::subs::Content] of types.
/// ///
/// See [TypeTag]. /// See [TypeTag].
#[derive(Debug)]
pub struct Types { pub struct Types {
// main storage. Each type is represented by a tag, which is identified by its index. // main storage. Each type is represented by a tag, which is identified by its index.
// `tags_slices` is a parallel array (so these two vectors always have the same size), that // `tags_slices` is a parallel array (so these two vectors always have the same size), that