Move solve problems to their own crate

This commit is contained in:
Ayaz Hafiz 2022-07-25 17:13:03 -04:00
parent ae4916ceb7
commit 0989b2cb82
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
17 changed files with 125 additions and 85 deletions

View file

@ -4,13 +4,14 @@ use roc_collections::{VecMap, VecSet};
use roc_error_macros::internal_error;
use roc_module::symbol::Symbol;
use roc_region::all::{Loc, Region};
use roc_solve_problem::{TypeError, UnderivableReason, Unfulfilled};
use roc_types::subs::{instantiate_rigids, Content, FlatType, GetSubsSlice, Rank, Subs, Variable};
use roc_types::types::{AliasKind, Category, ErrorType, PatternCategory};
use roc_types::types::{AliasKind, Category, PatternCategory};
use roc_unify::unify::MustImplementConstraints;
use roc_unify::unify::{MustImplementAbility, Obligated};
use crate::solve::type_to_var;
use crate::solve::{Aliases, Pools, TypeError};
use crate::solve::{Aliases, Pools};
#[derive(Debug, Clone)]
pub enum AbilityImplError {
@ -22,35 +23,6 @@ pub enum AbilityImplError {
BadPattern(Region, PatternCategory, Variable),
}
#[derive(PartialEq, Debug, Clone)]
pub enum UnderivableReason {
NotABuiltin,
/// The surface type is not derivable
SurfaceNotDerivable,
/// A nested type is not derivable
NestedNotDerivable(ErrorType),
}
#[derive(PartialEq, Debug, Clone)]
pub enum Unfulfilled {
/// No claimed implementation of an ability for an opaque type.
OpaqueDoesNotImplement { typ: Symbol, ability: Symbol },
/// Cannot derive implementation of an ability for a structural type.
AdhocUnderivable {
typ: ErrorType,
ability: Symbol,
reason: UnderivableReason,
},
/// Cannot derive implementation of an ability for an opaque type.
OpaqueUnderivable {
typ: ErrorType,
ability: Symbol,
opaque: Symbol,
derive_region: Region,
reason: UnderivableReason,
},
}
/// Indexes a requested deriving of an ability for an opaque type.
#[derive(Debug, PartialEq, Clone, Copy)]
pub struct RequestedDeriveKey {