mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
No more lowercase for opaques
This commit is contained in:
parent
5e47e4767e
commit
ca7c9ec5e6
6 changed files with 31 additions and 20 deletions
|
@ -1045,26 +1045,35 @@ pub fn instantiate_and_freshen_alias_type(
|
|||
pub fn freshen_opaque_def(
|
||||
var_store: &mut VarStore,
|
||||
opaque: &Alias,
|
||||
) -> (Vec<(Lowercase, Type)>, Vec<LambdaSet>, Type) {
|
||||
) -> (Vec<Variable>, Vec<LambdaSet>, Type) {
|
||||
debug_assert!(opaque.kind == AliasKind::Opaque);
|
||||
|
||||
let fresh_arguments = opaque
|
||||
let fresh_variables: Vec<Variable> = opaque
|
||||
.type_variables
|
||||
.iter()
|
||||
.map(|_| Type::Variable(var_store.fresh()))
|
||||
.map(|_| var_store.fresh())
|
||||
.collect();
|
||||
|
||||
// TODO this gets ignored; is that a problem
|
||||
let fresh_type_arguments = fresh_variables
|
||||
.iter()
|
||||
.copied()
|
||||
.map(Type::Variable)
|
||||
.collect();
|
||||
|
||||
// NB: We don't introduce the fresh variables here, we introduce them during constraint gen.
|
||||
// NB: If there are bugs, check whether this is a problem!
|
||||
let mut introduced_variables = IntroducedVariables::default();
|
||||
|
||||
instantiate_and_freshen_alias_type(
|
||||
let (_fresh_type_arguments, fresh_lambda_set, fresh_type) = instantiate_and_freshen_alias_type(
|
||||
var_store,
|
||||
&mut introduced_variables,
|
||||
&opaque.type_variables,
|
||||
fresh_arguments,
|
||||
fresh_type_arguments,
|
||||
&opaque.lambda_set_variables,
|
||||
opaque.typ.clone(),
|
||||
)
|
||||
);
|
||||
|
||||
(fresh_variables, fresh_lambda_set, fresh_type)
|
||||
}
|
||||
|
||||
fn insertion_sort_by<T, F>(arr: &mut [T], mut compare: F)
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::pattern::Pattern;
|
|||
use crate::scope::Scope;
|
||||
use roc_collections::{SendMap, VecSet};
|
||||
use roc_module::called_via::CalledVia;
|
||||
use roc_module::ident::{Lowercase, TagName};
|
||||
use roc_module::ident::TagName;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_region::all::{Loc, Region};
|
||||
use roc_types::subs::{ExhaustiveMark, RedundantMark, VarStore, Variable};
|
||||
|
@ -1466,7 +1466,7 @@ fn build_effect_opaque(
|
|||
|
||||
fn build_fresh_opaque_variables(
|
||||
var_store: &mut VarStore,
|
||||
) -> (Box<Type>, Vec<(Lowercase, Type)>, Vec<LambdaSet>) {
|
||||
) -> (Box<Type>, Vec<Variable>, Vec<LambdaSet>) {
|
||||
let closure_var = var_store.fresh();
|
||||
|
||||
// NB: if there are bugs, check whether not introducing variables is a problem!
|
||||
|
@ -1478,7 +1478,7 @@ fn build_fresh_opaque_variables(
|
|||
Box::new(Type::Variable(closure_var)),
|
||||
Box::new(Type::Variable(a_var)),
|
||||
);
|
||||
let type_arguments = vec![("a".into(), Type::Variable(a_var))];
|
||||
let type_arguments = vec![a_var];
|
||||
let lambda_set_variables = vec![roc_types::types::LambdaSet(Type::Variable(closure_var))];
|
||||
|
||||
(Box::new(actual), type_arguments, lambda_set_variables)
|
||||
|
|
|
@ -190,7 +190,7 @@ pub enum Expr {
|
|||
// for the expression from the opaque definition. `type_arguments` is something like
|
||||
// [(n, fresh1)], and `specialized_def_type` becomes "[ Id U64 fresh1 ]".
|
||||
specialized_def_type: Box<Type>,
|
||||
type_arguments: Vec<(Lowercase, Type)>,
|
||||
type_arguments: Vec<Variable>,
|
||||
lambda_set_variables: Vec<LambdaSet>,
|
||||
},
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ pub enum Pattern {
|
|||
// for the expression from the opaque definition. `type_arguments` is something like
|
||||
// [(n, fresh1)], and `specialized_def_type` becomes "[ Id U64 fresh1 ]".
|
||||
specialized_def_type: Box<Type>,
|
||||
type_arguments: Vec<(Lowercase, Type)>,
|
||||
type_arguments: Vec<Variable>,
|
||||
lambda_set_variables: Vec<LambdaSet>,
|
||||
},
|
||||
RecordDestructure {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue