Rename Located -> Loc

This commit is contained in:
Joshua Warner 2021-12-22 19:18:22 -08:00
parent c66c845cd2
commit f19220473a
55 changed files with 680 additions and 683 deletions

View file

@ -12,7 +12,7 @@ use roc_can::pattern::Pattern;
use roc_collections::all::{ImMap, Index, MutSet, SendMap};
use roc_module::ident::{Lowercase, TagName};
use roc_module::symbol::{ModuleId, Symbol};
use roc_region::all::{Located, Region};
use roc_region::all::{Loc, Region};
use roc_types::subs::Variable;
use roc_types::types::Type::{self, *};
use roc_types::types::{AnnotationSource, Category, PReason, Reason, RecordField};
@ -22,7 +22,7 @@ use roc_types::types::{AnnotationSource, Category, PReason, Reason, RecordField}
pub struct Info {
pub vars: Vec<Variable>,
pub constraints: Vec<Constraint>,
pub def_types: SendMap<Symbol, Located<Type>>,
pub def_types: SendMap<Symbol, Loc<Type>>,
}
impl Info {
@ -56,7 +56,7 @@ pub struct Env {
fn constrain_untyped_args(
env: &Env,
arguments: &[(Variable, Located<Pattern>)],
arguments: &[(Variable, Loc<Pattern>)],
closure_type: Type,
return_type: Type,
) -> (Vec<Variable>, PatternState, Type) {
@ -1079,7 +1079,7 @@ fn constrain_when_branch(
}
}
fn constrain_field(env: &Env, field_var: Variable, loc_expr: &Located<Expr>) -> (Type, Constraint) {
fn constrain_field(env: &Env, field_var: Variable, loc_expr: &Loc<Expr>) -> (Type, Constraint) {
let field_type = Variable(field_var);
let field_expected = NoExpectation(field_type.clone());
let constraint = constrain_expr(env, loc_expr.region, &loc_expr.value, field_expected);
@ -1129,7 +1129,7 @@ pub fn constrain_decls(home: ModuleId, decls: &[Declaration]) -> Constraint {
fn constrain_def_pattern(
env: &Env,
loc_pattern: &Located<Pattern>,
loc_pattern: &Loc<Pattern>,
expr_type: Type,
) -> PatternState {
let pattern_expected = PExpected::NoExpectation(expr_type);
@ -1448,8 +1448,8 @@ fn instantiate_rigids(
introduced_vars: &IntroducedVariables,
new_rigids: &mut Vec<Variable>,
ftv: &mut ImMap<Lowercase, Variable>, // rigids defined before the current annotation
loc_pattern: &Located<Pattern>,
headers: &mut SendMap<Symbol, Located<Type>>,
loc_pattern: &Loc<Pattern>,
headers: &mut SendMap<Symbol, Loc<Type>>,
) -> Type {
let mut annotation = annotation.clone();
let mut rigid_substitution: ImMap<Variable, Type> = ImMap::default();
@ -1472,7 +1472,7 @@ fn instantiate_rigids(
if let Some(new_headers) = crate::pattern::headers_from_annotation(
&loc_pattern.value,
&Located::at(loc_pattern.region, annotation.clone()),
&Loc::at(loc_pattern.region, annotation.clone()),
) {
for (symbol, loc_type) in new_headers {
for var in loc_type.value.variables() {
@ -1769,7 +1769,7 @@ fn constrain_field_update(
var: Variable,
region: Region,
field: Lowercase,
loc_expr: &Located<Expr>,
loc_expr: &Loc<Expr>,
) -> (Variable, Type, Constraint) {
let field_type = Type::Variable(var);
let reason = Reason::RecordUpdateValue(field);