Move Solved to roc_solve

This commit is contained in:
ayazhafiz 2022-07-10 19:42:41 -04:00
parent c9914af5ab
commit 699c4d7fff
No known key found for this signature in database
GPG Key ID: B443F7A3030C9AED
9 changed files with 27 additions and 27 deletions

1
Cargo.lock generated
View File

@ -3339,6 +3339,7 @@ dependencies = [
"roc_problem",
"roc_region",
"roc_reporting",
"roc_solve",
"roc_target",
"roc_types",
"roc_unify",

View File

@ -16,6 +16,7 @@ roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_types = { path = "../compiler/types" }
roc_unify = { path = "../compiler/unify"}
roc_solve = { path = "../compiler/solve"}
roc_load = { path = "../compiler/load" }
roc_target = { path = "../compiler/roc_target" }
roc_error_macros = { path = "../error_macros" }

View File

@ -1937,9 +1937,9 @@ pub mod test_constrain {
};
use roc_parse::parser::{SourceError, SyntaxError};
use roc_region::all::Region;
use roc_solve::module::Solved;
use roc_types::{
pretty_print::{name_and_print_var, DebugPrint},
solved_types::Solved,
subs::{Subs, VarStore, Variable},
};

View File

@ -7,7 +7,7 @@ use roc_error_macros::internal_error;
use roc_module::ident::TagName;
use roc_module::symbol::Symbol;
use roc_region::all::{Loc, Region};
use roc_types::solved_types::Solved;
use roc_solve::module::Solved;
use roc_types::subs::{
self, AliasVariables, Content, Descriptor, FlatType, Mark, OptVariable, Rank, RecordFields,
Subs, SubsSlice, UnionLambdas, UnionTags, Variable, VariableSubsSlice,

View File

@ -41,10 +41,9 @@ use roc_parse::module::module_defs;
use roc_parse::parser::{FileError, Parser, SyntaxError};
use roc_region::all::{LineInfo, Loc, Region};
use roc_reporting::report::RenderTarget;
use roc_solve::module::SolvedModule;
use roc_solve::module::{Solved, SolvedModule};
use roc_solve::solve;
use roc_target::TargetInfo;
use roc_types::solved_types::Solved;
use roc_types::subs::{ExposedTypesStorageSubs, Subs, VarStore, Variable};
use roc_types::types::{Alias, AliasKind};
use std::collections::hash_map::Entry::{Occupied, Vacant};
@ -4875,7 +4874,7 @@ fn build_pending_specializations<'a>(
Msg::FoundSpecializations {
module_id: home,
solved_subs: roc_types::solved_types::Solved(subs),
solved_subs: Solved(subs),
ident_ids,
layout_cache,
procs_base,

View File

@ -8,10 +8,28 @@ use roc_collections::VecMap;
use roc_derive_key::GlobalDerivedSymbols;
use roc_error_macros::internal_error;
use roc_module::symbol::Symbol;
use roc_types::solved_types::Solved;
use roc_types::subs::{Content, ExposedTypesStorageSubs, FlatType, StorageSubs, Subs, Variable};
use roc_types::types::Alias;
/// A marker that a given Subs has been solved.
/// The only way to obtain a Solved<Subs> is by running the solver on it.
#[derive(Clone, Debug)]
pub struct Solved<T>(pub T);
impl<T> Solved<T> {
pub fn inner(&self) -> &'_ T {
&self.0
}
pub fn inner_mut(&mut self) -> &'_ mut T {
&mut self.0
}
pub fn into_inner(self) -> T {
self.0
}
}
#[derive(Debug)]
pub struct SolvedModule {
pub problems: Vec<solve::TypeError>,

View File

@ -2,6 +2,7 @@ use crate::ability::{
resolve_ability_specialization, type_implementing_specialization, AbilityImplError,
DeferredObligations, PendingDerivesTable, RequestedDeriveKey, Resolved, Unfulfilled,
};
use crate::module::Solved;
use bumpalo::Bump;
use roc_can::abilities::{AbilitiesStore, MemberSpecialization};
use roc_can::constraint::Constraint::{self, *};
@ -18,7 +19,6 @@ use roc_module::ident::TagName;
use roc_module::symbol::{ModuleId, Symbol};
use roc_problem::can::CycleEntry;
use roc_region::all::{Loc, Region};
use roc_types::solved_types::Solved;
use roc_types::subs::{
self, AliasVariables, Content, Descriptor, FlatType, GetSubsSlice, LambdaSet, Mark,
OptVariable, Rank, RecordFields, Subs, SubsIndex, SubsSlice, UlsOfVar, UnionLabels,

View File

@ -5,25 +5,6 @@ use roc_module::ident::{Lowercase, TagName};
use roc_module::symbol::Symbol;
use roc_region::all::{Loc, Region};
/// A marker that a given Subs has been solved.
/// The only way to obtain a Solved<Subs> is by running the solver on it.
#[derive(Clone, Debug)]
pub struct Solved<T>(pub T);
impl<T> Solved<T> {
pub fn inner(&self) -> &'_ T {
&self.0
}
pub fn inner_mut(&mut self) -> &'_ mut T {
&mut self.0
}
pub fn into_inner(self) -> T {
self.0
}
}
#[derive(Debug, Clone)]
pub struct SolvedLambdaSet(pub SolvedType);

View File

@ -59,9 +59,9 @@ use roc_collections::all::MutMap;
use roc_module::ident::Lowercase;
use roc_module::symbol::Symbol;
use roc_region::all::Region;
use roc_solve::module::Solved;
use roc_types::pretty_print::name_and_print_var;
use roc_types::pretty_print::DebugPrint;
use roc_types::solved_types::Solved;
use roc_types::subs::{Subs, VarStore, Variable};
use snafu::OptionExt;
use threadpool::ThreadPool;