mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
WIP
This commit is contained in:
parent
fd8dfd284d
commit
ec099bbdec
12 changed files with 103 additions and 118 deletions
|
@ -1,7 +1,7 @@
|
|||
use bumpalo::{collections::Vec as BumpVec, Bump};
|
||||
|
||||
use roc_can::expected::{Expected, PExpected};
|
||||
use roc_collections::all::{BumpMap, BumpMapDefault, Index, SendMap};
|
||||
use roc_collections::all::{BumpMap, BumpMapDefault, HumanIndex, SendMap};
|
||||
use roc_module::{
|
||||
ident::{Lowercase, TagName},
|
||||
symbol::Symbol,
|
||||
|
@ -163,7 +163,7 @@ pub fn constrain_expr<'a>(
|
|||
|
||||
let elem_expected = Expected::ForReason(
|
||||
Reason::ElemInList {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
list_elem_type.shallow_clone(),
|
||||
region,
|
||||
|
@ -339,7 +339,7 @@ pub fn constrain_expr<'a>(
|
|||
|
||||
let reason = Reason::FnArg {
|
||||
name: opt_symbol,
|
||||
arg_index: Index::zero_based(index),
|
||||
arg_index: HumanIndex::zero_based(index),
|
||||
};
|
||||
|
||||
let expected_arg = Expected::ForReason(reason, arg_type.shallow_clone(), region);
|
||||
|
@ -538,7 +538,7 @@ pub fn constrain_expr<'a>(
|
|||
name.clone(),
|
||||
arity,
|
||||
AnnotationSource::TypedIfBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
num_branches,
|
||||
region: ann_source.region(),
|
||||
},
|
||||
|
@ -559,7 +559,7 @@ pub fn constrain_expr<'a>(
|
|||
name,
|
||||
arity,
|
||||
AnnotationSource::TypedIfBranch {
|
||||
index: Index::zero_based(branches.len()),
|
||||
index: HumanIndex::zero_based(branches.len()),
|
||||
num_branches,
|
||||
region: ann_source.region(),
|
||||
},
|
||||
|
@ -596,7 +596,7 @@ pub fn constrain_expr<'a>(
|
|||
body,
|
||||
Expected::ForReason(
|
||||
Reason::IfBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
total_branches: branches.len(),
|
||||
},
|
||||
Type2::Variable(*expr_var),
|
||||
|
@ -616,7 +616,7 @@ pub fn constrain_expr<'a>(
|
|||
final_else_expr,
|
||||
Expected::ForReason(
|
||||
Reason::IfBranch {
|
||||
index: Index::zero_based(branches.len()),
|
||||
index: HumanIndex::zero_based(branches.len()),
|
||||
total_branches: branches.len() + 1,
|
||||
},
|
||||
Type2::Variable(*expr_var),
|
||||
|
@ -691,7 +691,7 @@ pub fn constrain_expr<'a>(
|
|||
when_branch,
|
||||
PExpected::ForReason(
|
||||
PReason::WhenMatch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
cond_type.shallow_clone(),
|
||||
pattern_region,
|
||||
|
@ -700,7 +700,7 @@ pub fn constrain_expr<'a>(
|
|||
name.clone(),
|
||||
*arity,
|
||||
AnnotationSource::TypedWhenBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
region: ann_source.region(),
|
||||
},
|
||||
typ.shallow_clone(),
|
||||
|
@ -733,14 +733,14 @@ pub fn constrain_expr<'a>(
|
|||
when_branch,
|
||||
PExpected::ForReason(
|
||||
PReason::WhenMatch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
cond_type.shallow_clone(),
|
||||
pattern_region,
|
||||
),
|
||||
Expected::ForReason(
|
||||
Reason::WhenBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
branch_type.shallow_clone(),
|
||||
// TODO: when_branch.value.region,
|
||||
|
@ -1065,7 +1065,7 @@ pub fn constrain_expr<'a>(
|
|||
|
||||
let reason = Reason::LowLevelOpArg {
|
||||
op: *op,
|
||||
arg_index: Index::zero_based(index),
|
||||
arg_index: HumanIndex::zero_based(index),
|
||||
};
|
||||
let expected_arg =
|
||||
Expected::ForReason(reason, arg_type.shallow_clone(), Region::zero());
|
||||
|
@ -1681,7 +1681,7 @@ fn constrain_tag_pattern<'a>(
|
|||
let expected = PExpected::ForReason(
|
||||
PReason::TagArg {
|
||||
tag_name: tag_name.clone(),
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
pattern_type,
|
||||
region,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::expected::{Expected, PExpected};
|
||||
use roc_collections::all::{MutSet, SendMap};
|
||||
use roc_collections::soa::{Index, Slice};
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_region::all::{Located, Region};
|
||||
use roc_region::all::{Loc, Region};
|
||||
use roc_types::types::{Category, PatternCategory, Type};
|
||||
use roc_types::{subs::Variable, types::VariableDetail};
|
||||
|
||||
|
@ -9,7 +9,7 @@ pub struct Constraints {
|
|||
constraints: Vec<Constraint>,
|
||||
types: Vec<Type>,
|
||||
variables: Vec<Variable>,
|
||||
def_types: Vec<(Symbol, Located<Index<Type>>)>,
|
||||
def_types: Vec<(Symbol, Loc<Index<Type>>)>,
|
||||
let_constraints: Vec<LetConstraint>,
|
||||
categories: Vec<Category>,
|
||||
pattern_categories: Vec<PatternCategory>,
|
||||
|
@ -18,6 +18,26 @@ pub struct Constraints {
|
|||
}
|
||||
|
||||
impl Constraints {
|
||||
pub const EMPTY_RECORD: Index<Type> = Index::new(0);
|
||||
pub const EMPTY_TAG_UNION: Index<Type> = Index::new(1);
|
||||
|
||||
pub const CATEGORY_RECORD: Index<Category> = Index::new(0);
|
||||
|
||||
pub fn push_type(&mut self, typ: Type) -> Index<Type> {
|
||||
match typ {
|
||||
Type::EmptyRec => Self::EMPTY_RECORD,
|
||||
Type::EmptyTagUnion => Self::EMPTY_TAG_UNION,
|
||||
other => Index::push_new(&mut self.types, other),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_category(&mut self, category: Category) -> Index<Category> {
|
||||
match category {
|
||||
Category::Record => Self::CATEGORY_RECORD,
|
||||
other => Index::push_new(&mut self.categories, other),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn equal_types(
|
||||
&mut self,
|
||||
typ: Type,
|
||||
|
@ -65,19 +85,18 @@ impl Constraints {
|
|||
Slice::new(start as _, length as _)
|
||||
}
|
||||
|
||||
fn def_types_slice<I>(&mut self, it: I) -> Slice<(Symbol, Located<Type>)>
|
||||
fn def_types_slice<I>(&mut self, it: I) -> Slice<(Symbol, Loc<Type>)>
|
||||
where
|
||||
I: IntoIterator<Item = (Symbol, Located<Type>)>,
|
||||
I: IntoIterator<Item = (Symbol, Loc<Type>)>,
|
||||
{
|
||||
let start = self.def_types.len();
|
||||
|
||||
for (symbol, loc_type) in it {
|
||||
let type_index = Index::new(self.types.len() as _);
|
||||
let Located { region, value } = loc_type;
|
||||
let Loc { region, value } = loc_type;
|
||||
self.types.push(value);
|
||||
|
||||
self.def_types
|
||||
.push((symbol, Located::at(region, type_index)));
|
||||
self.def_types.push((symbol, Loc::at(region, type_index)));
|
||||
}
|
||||
|
||||
let length = self.def_types.len() - start;
|
||||
|
@ -118,7 +137,7 @@ impl Constraints {
|
|||
where
|
||||
I1: IntoIterator<Item = Variable>,
|
||||
I2: IntoIterator<Item = Variable>,
|
||||
I3: IntoIterator<Item = (Symbol, Located<Type>)>,
|
||||
I3: IntoIterator<Item = (Symbol, Loc<Type>)>,
|
||||
{
|
||||
let defs_and_ret_constraint = Index::new(self.constraints.len() as _);
|
||||
|
||||
|
@ -163,60 +182,6 @@ pub enum Constraint {
|
|||
pub struct LetConstraint {
|
||||
pub rigid_vars: Slice<Variable>,
|
||||
pub flex_vars: Slice<Variable>,
|
||||
pub def_types: Slice<(Symbol, Located<Type>)>,
|
||||
pub def_types: Slice<(Symbol, Loc<Type>)>,
|
||||
pub defs_and_ret_constraint: Index<(Constraint, Constraint)>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Index<T> {
|
||||
index: u32,
|
||||
_marker: std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T> Index<T> {
|
||||
pub const fn new(index: u32) -> Self {
|
||||
Self {
|
||||
index,
|
||||
_marker: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Slice<T> {
|
||||
start: u32,
|
||||
length: u16,
|
||||
_marker: std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T> Default for Slice<T> {
|
||||
fn default() -> Self {
|
||||
Self::new(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Slice<T> {
|
||||
pub const fn new(start: u32, length: u16) -> Self {
|
||||
Self {
|
||||
start,
|
||||
length,
|
||||
_marker: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn len(&self) -> usize {
|
||||
self.length as _
|
||||
}
|
||||
|
||||
pub const fn is_empty(&self) -> bool {
|
||||
self.length == 0
|
||||
}
|
||||
|
||||
pub const fn indices(&self) -> std::ops::Range<usize> {
|
||||
self.start as usize..(self.start as usize + self.length as usize)
|
||||
}
|
||||
|
||||
pub fn into_iter(&self) -> impl Iterator<Item = Index<T>> {
|
||||
self.indices().map(|i| Index::new(i as _))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,13 +161,13 @@ where
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
pub struct Index(usize);
|
||||
pub struct HumanIndex(usize);
|
||||
|
||||
impl Index {
|
||||
pub const FIRST: Self = Index(0);
|
||||
impl HumanIndex {
|
||||
pub const FIRST: Self = HumanIndex(0);
|
||||
|
||||
pub fn zero_based(i: usize) -> Self {
|
||||
Index(i)
|
||||
HumanIndex(i)
|
||||
}
|
||||
|
||||
pub fn to_zero_based(self) -> usize {
|
||||
|
@ -175,7 +175,7 @@ impl Index {
|
|||
}
|
||||
|
||||
pub fn one_based(i: usize) -> Self {
|
||||
Index(i - 1)
|
||||
HumanIndex(i - 1)
|
||||
}
|
||||
|
||||
pub fn ordinal(self) -> std::string::String {
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
#![allow(clippy::large_enum_variant)]
|
||||
|
||||
pub mod all;
|
||||
pub mod soa;
|
||||
|
|
|
@ -11,6 +11,14 @@ impl<T> Index<T> {
|
|||
_marker: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_new(vector: &mut Vec<T>, value: T) -> Index<T> {
|
||||
let index = Self::new(vector.len() as _);
|
||||
|
||||
vector.push(value);
|
||||
|
||||
index
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -20,6 +28,16 @@ pub struct Slice<T> {
|
|||
_marker: std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T> Default for Slice<T> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
start: Default::default(),
|
||||
length: Default::default(),
|
||||
_marker: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Slice<T> {
|
||||
pub const fn new(start: u32, length: u16) -> Self {
|
||||
Self {
|
||||
|
|
|
@ -11,7 +11,7 @@ use roc_can::expected::PExpected;
|
|||
use roc_can::expr::Expr::{self, *};
|
||||
use roc_can::expr::{ClosureData, Field, WhenBranch};
|
||||
use roc_can::pattern::Pattern;
|
||||
use roc_collections::all::{ImMap, Index, MutSet, SendMap};
|
||||
use roc_collections::all::{HumanIndex, ImMap, MutSet, SendMap};
|
||||
use roc_module::ident::{Lowercase, TagName};
|
||||
use roc_module::symbol::{ModuleId, Symbol};
|
||||
use roc_region::all::{Loc, Region};
|
||||
|
@ -229,7 +229,7 @@ pub fn constrain_expr(
|
|||
for (index, loc_elem) in loc_elems.iter().enumerate() {
|
||||
let elem_expected = ForReason(
|
||||
Reason::ElemInList {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
list_elem_type.clone(),
|
||||
loc_elem.region,
|
||||
|
@ -293,7 +293,7 @@ pub fn constrain_expr(
|
|||
|
||||
let reason = Reason::FnArg {
|
||||
name: opt_symbol,
|
||||
arg_index: Index::zero_based(index),
|
||||
arg_index: HumanIndex::zero_based(index),
|
||||
};
|
||||
let expected_arg = ForReason(reason, arg_type.clone(), region);
|
||||
let arg_con = constrain_expr(env, loc_arg.region, &loc_arg.value, expected_arg);
|
||||
|
@ -462,7 +462,7 @@ pub fn constrain_expr(
|
|||
name.clone(),
|
||||
arity,
|
||||
AnnotationSource::TypedIfBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
num_branches,
|
||||
region: ann_source.region(),
|
||||
},
|
||||
|
@ -482,7 +482,7 @@ pub fn constrain_expr(
|
|||
name,
|
||||
arity,
|
||||
AnnotationSource::TypedIfBranch {
|
||||
index: Index::zero_based(branches.len()),
|
||||
index: HumanIndex::zero_based(branches.len()),
|
||||
num_branches,
|
||||
region: ann_source.region(),
|
||||
},
|
||||
|
@ -517,7 +517,7 @@ pub fn constrain_expr(
|
|||
&loc_body.value,
|
||||
ForReason(
|
||||
Reason::IfBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
total_branches: branches.len(),
|
||||
},
|
||||
Type::Variable(*branch_var),
|
||||
|
@ -534,7 +534,7 @@ pub fn constrain_expr(
|
|||
&final_else.value,
|
||||
ForReason(
|
||||
Reason::IfBranch {
|
||||
index: Index::zero_based(branches.len()),
|
||||
index: HumanIndex::zero_based(branches.len()),
|
||||
total_branches: branches.len() + 1,
|
||||
},
|
||||
Type::Variable(*branch_var),
|
||||
|
@ -592,7 +592,7 @@ pub fn constrain_expr(
|
|||
when_branch,
|
||||
PExpected::ForReason(
|
||||
PReason::WhenMatch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
cond_type.clone(),
|
||||
pattern_region,
|
||||
|
@ -601,7 +601,7 @@ pub fn constrain_expr(
|
|||
name.clone(),
|
||||
*arity,
|
||||
AnnotationSource::TypedWhenBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
region: ann_source.region(),
|
||||
},
|
||||
typ.clone(),
|
||||
|
@ -629,14 +629,14 @@ pub fn constrain_expr(
|
|||
when_branch,
|
||||
PExpected::ForReason(
|
||||
PReason::WhenMatch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
cond_type.clone(),
|
||||
pattern_region,
|
||||
),
|
||||
ForReason(
|
||||
Reason::WhenBranch {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
branch_type.clone(),
|
||||
when_branch.value.region,
|
||||
|
@ -1007,7 +1007,7 @@ pub fn constrain_expr(
|
|||
let mut add_arg = |index, arg_type: Type, arg| {
|
||||
let reason = Reason::LowLevelOpArg {
|
||||
op: *op,
|
||||
arg_index: Index::zero_based(index),
|
||||
arg_index: HumanIndex::zero_based(index),
|
||||
};
|
||||
let expected_arg = ForReason(reason, arg_type.clone(), Region::zero());
|
||||
let arg_con = constrain_expr(env, Region::zero(), arg, expected_arg);
|
||||
|
@ -1053,7 +1053,7 @@ pub fn constrain_expr(
|
|||
let mut add_arg = |index, arg_type: Type, arg| {
|
||||
let reason = Reason::ForeignCallArg {
|
||||
foreign_symbol: foreign_symbol.clone(),
|
||||
arg_index: Index::zero_based(index),
|
||||
arg_index: HumanIndex::zero_based(index),
|
||||
};
|
||||
let expected_arg = ForReason(reason, arg_type.clone(), Region::zero());
|
||||
let arg_con = constrain_expr(env, Region::zero(), arg, expected_arg);
|
||||
|
@ -1320,7 +1320,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint {
|
|||
|
||||
let pattern_expected = PExpected::ForReason(
|
||||
PReason::TypedArg {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
opt_name: opt_label,
|
||||
},
|
||||
pattern_type.clone(),
|
||||
|
@ -1687,7 +1687,7 @@ pub fn rec_defs_help(
|
|||
|
||||
let pattern_expected = PExpected::ForReason(
|
||||
PReason::TypedArg {
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
opt_name: opt_label,
|
||||
},
|
||||
pattern_type.clone(),
|
||||
|
|
|
@ -5,3 +5,4 @@ pub mod builtins;
|
|||
pub mod expr;
|
||||
pub mod module;
|
||||
pub mod pattern;
|
||||
pub mod soa_expr;
|
||||
|
|
|
@ -4,7 +4,7 @@ use roc_can::constraint::{Constraint, PresenceConstraint};
|
|||
use roc_can::expected::{Expected, PExpected};
|
||||
use roc_can::pattern::Pattern::{self, *};
|
||||
use roc_can::pattern::{DestructType, RecordDestruct};
|
||||
use roc_collections::all::{Index, SendMap};
|
||||
use roc_collections::all::{HumanIndex, SendMap};
|
||||
use roc_module::ident::Lowercase;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_region::all::{Loc, Region};
|
||||
|
@ -412,7 +412,7 @@ pub fn constrain_pattern(
|
|||
let expected = PExpected::ForReason(
|
||||
PReason::TagArg {
|
||||
tag_name: tag_name.clone(),
|
||||
index: Index::zero_based(index),
|
||||
index: HumanIndex::zero_based(index),
|
||||
},
|
||||
pattern_type,
|
||||
region,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use roc_collections::all::{Index, MutMap};
|
||||
use roc_collections::all::{HumanIndex, MutMap};
|
||||
use roc_module::ident::{Lowercase, TagIdIntType, TagName};
|
||||
use roc_region::all::Region;
|
||||
use roc_std::RocDec;
|
||||
|
@ -70,7 +70,7 @@ pub enum Error {
|
|||
Redundant {
|
||||
overall_region: Region,
|
||||
branch_region: Region,
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::ir::DestructType;
|
||||
use roc_collections::all::Index;
|
||||
use roc_collections::all::HumanIndex;
|
||||
use roc_exhaustive::{
|
||||
is_useful, Context, Ctor, Error, Guard, Literal, Pattern, RenderAs, TagId, Union,
|
||||
};
|
||||
|
@ -189,7 +189,7 @@ fn to_nonredundant_rows(
|
|||
return Err(Error::Redundant {
|
||||
overall_region,
|
||||
branch_region: region,
|
||||
index: Index::zero_based(checked_rows.len()),
|
||||
index: HumanIndex::zero_based(checked_rows.len()),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::pretty_print::Parens;
|
|||
use crate::subs::{
|
||||
GetSubsSlice, RecordFields, Subs, UnionTags, VarStore, Variable, VariableSubsSlice,
|
||||
};
|
||||
use roc_collections::all::{ImMap, ImSet, Index, MutSet, SendMap};
|
||||
use roc_collections::all::{HumanIndex, ImMap, ImSet, MutSet, SendMap};
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_module::called_via::CalledVia;
|
||||
use roc_module::ident::{ForeignSymbol, Ident, Lowercase, TagName};
|
||||
|
@ -1203,14 +1203,14 @@ pub struct TagUnionStructure<'a> {
|
|||
pub enum PReason {
|
||||
TypedArg {
|
||||
opt_name: Option<Symbol>,
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
},
|
||||
WhenMatch {
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
},
|
||||
TagArg {
|
||||
tag_name: TagName,
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
},
|
||||
PatternGuard,
|
||||
OptionalField,
|
||||
|
@ -1219,12 +1219,12 @@ pub enum PReason {
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum AnnotationSource {
|
||||
TypedIfBranch {
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
num_branches: usize,
|
||||
region: Region,
|
||||
},
|
||||
TypedWhenBranch {
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
region: Region,
|
||||
},
|
||||
TypedBody {
|
||||
|
@ -1246,7 +1246,7 @@ impl AnnotationSource {
|
|||
pub enum Reason {
|
||||
FnArg {
|
||||
name: Option<Symbol>,
|
||||
arg_index: Index,
|
||||
arg_index: HumanIndex,
|
||||
},
|
||||
FnCall {
|
||||
name: Option<Symbol>,
|
||||
|
@ -1254,28 +1254,28 @@ pub enum Reason {
|
|||
},
|
||||
LowLevelOpArg {
|
||||
op: LowLevel,
|
||||
arg_index: Index,
|
||||
arg_index: HumanIndex,
|
||||
},
|
||||
ForeignCallArg {
|
||||
foreign_symbol: ForeignSymbol,
|
||||
arg_index: Index,
|
||||
arg_index: HumanIndex,
|
||||
},
|
||||
FloatLiteral,
|
||||
IntLiteral,
|
||||
NumLiteral,
|
||||
StrInterpolation,
|
||||
WhenBranch {
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
},
|
||||
WhenGuard,
|
||||
ExpectCondition,
|
||||
IfCondition,
|
||||
IfBranch {
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
total_branches: usize,
|
||||
},
|
||||
ElemInList {
|
||||
index: Index,
|
||||
index: HumanIndex,
|
||||
},
|
||||
RecordUpdateValue(Lowercase),
|
||||
RecordUpdateKeys(Symbol, SendMap<Lowercase, Region>),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use roc_can::expected::{Expected, PExpected};
|
||||
use roc_collections::all::{Index, MutSet, SendMap};
|
||||
use roc_collections::all::{HumanIndex, MutSet, SendMap};
|
||||
use roc_module::called_via::{BinOp, CalledVia};
|
||||
use roc_module::ident::{Ident, IdentStr, Lowercase, TagName};
|
||||
use roc_module::symbol::Symbol;
|
||||
|
@ -350,7 +350,7 @@ fn to_expr_report<'b>(
|
|||
num_branches,
|
||||
..
|
||||
} if num_branches == 2 => alloc.concat(vec![
|
||||
alloc.keyword(if index == Index::FIRST {
|
||||
alloc.keyword(if index == HumanIndex::FIRST {
|
||||
"then"
|
||||
} else {
|
||||
"else"
|
||||
|
@ -1384,7 +1384,7 @@ fn to_pattern_report<'b>(
|
|||
found,
|
||||
expected_type,
|
||||
add_pattern_category(
|
||||
alloc,
|
||||
HumanIndexlloc,
|
||||
alloc.text("The first pattern is trying to match"),
|
||||
&category,
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue