mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Merge remote-tracking branch 'origin/main' into abilities-syntax
This commit is contained in:
commit
2da41be29f
524 changed files with 47536 additions and 15089 deletions
|
@ -298,7 +298,7 @@ fn hash_tag_union(
|
|||
Expr::Int(
|
||||
discr_num_var,
|
||||
discr_precision_var,
|
||||
format!("{}", discr_n).into_boxed_str(),
|
||||
format!("{discr_n}").into_boxed_str(),
|
||||
IntValue::I128((discr_n as i128).to_ne_bytes()),
|
||||
IntBound::Exact(discr_width),
|
||||
),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use roc_can::{abilities::SpecializationLambdaSets, module::ExposedByModule};
|
||||
use roc_checkmate::with_checkmate;
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_module::symbol::{IdentIds, Symbol};
|
||||
use roc_solve_schema::UnificationMode;
|
||||
use roc_types::{
|
||||
subs::{instantiate_rigids, Subs, Variable},
|
||||
types::Polarity,
|
||||
|
@ -31,7 +33,7 @@ impl Env<'_> {
|
|||
let name = if i == 1 {
|
||||
hint.clone()
|
||||
} else {
|
||||
format!("{}{}", hint, i)
|
||||
format!("{hint}{i}")
|
||||
};
|
||||
if self.derived_ident_ids.get_id(&name).is_none() {
|
||||
break name;
|
||||
|
@ -71,13 +73,20 @@ impl Env<'_> {
|
|||
}
|
||||
|
||||
pub fn unify(&mut self, left: Variable, right: Variable) {
|
||||
use roc_unify::unify::{unify, Env, Mode, Unified};
|
||||
use roc_unify::{
|
||||
unify::{unify, Unified},
|
||||
Env,
|
||||
};
|
||||
|
||||
let unified = unify(
|
||||
&mut Env::new(self.subs),
|
||||
// TODO(checkmate): pass checkmate through
|
||||
&mut with_checkmate!({
|
||||
on => Env::new(self.subs, None),
|
||||
off => Env::new(self.subs),
|
||||
}),
|
||||
left,
|
||||
right,
|
||||
Mode::EQ,
|
||||
UnificationMode::EQ,
|
||||
Polarity::OF_PATTERN,
|
||||
);
|
||||
|
||||
|
@ -103,15 +112,22 @@ impl Env<'_> {
|
|||
specialization_type: Variable,
|
||||
ability_member: Symbol,
|
||||
) -> SpecializationLambdaSets {
|
||||
use roc_unify::unify::{unify_introduced_ability_specialization, Env, Mode, Unified};
|
||||
use roc_unify::{
|
||||
unify::{unify_introduced_ability_specialization, Unified},
|
||||
Env,
|
||||
};
|
||||
|
||||
let member_signature = self.import_builtin_symbol_var(ability_member);
|
||||
|
||||
let unified = unify_introduced_ability_specialization(
|
||||
&mut Env::new(self.subs),
|
||||
// TODO(checkmate): pass checkmate through
|
||||
&mut with_checkmate!({
|
||||
on => Env::new(self.subs, None),
|
||||
off => Env::new(self.subs),
|
||||
}),
|
||||
member_signature,
|
||||
specialization_type,
|
||||
Mode::EQ,
|
||||
UnificationMode::EQ,
|
||||
);
|
||||
|
||||
match unified {
|
||||
|
@ -151,7 +167,7 @@ impl Env<'_> {
|
|||
== self.subs.get_root_key_without_compacting(lambda_set)
|
||||
});
|
||||
debug_assert!(belongs_to_specialized_lambda_sets,
|
||||
"Did not expect derivers to need to specialize unspecialized lambda sets, but we got one: {:?} for {:?}", lambda_set, spec_var)
|
||||
"Did not expect derivers to need to specialize unspecialized lambda sets, but we got one: {lambda_set:?} for {spec_var:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue