s/IndexOutOfBounds/OutOfBounds/g

This commit is contained in:
Richard Feldman 2020-04-22 08:32:31 -04:00
parent 632d4eca92
commit 9d37f7ae73
5 changed files with 20 additions and 8 deletions

View file

@ -377,9 +377,9 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
), ),
); );
// get : List elem, Int -> Result elem [ IndexOutOfBounds ]* // get : List elem, Int -> Result elem [ OutOfBounds ]*
let index_out_of_bounds = SolvedType::TagUnion( let index_out_of_bounds = SolvedType::TagUnion(
vec![(TagName::Global("IndexOutOfBounds".into()), vec![])], vec![(TagName::Global("OutOfBounds".into()), vec![])],
Box::new(SolvedType::Wildcard), Box::new(SolvedType::Wildcard),
); );

View file

@ -444,9 +444,9 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
unique_function(vec![list_type(UVAR1, TVAR1)], int_type(UVAR2)), unique_function(vec![list_type(UVAR1, TVAR1)], int_type(UVAR2)),
); );
// get : List a, Int -> Result a [ IndexOutOfBounds ]* // get : List a, Int -> Result a [ OutOfBounds ]*
let index_out_of_bounds = SolvedType::TagUnion( let index_out_of_bounds = SolvedType::TagUnion(
vec![(TagName::Global("IndexOutOfBounds".into()), vec![])], vec![(TagName::Global("OutOfBounds".into()), vec![])],
Box::new(SolvedType::Wildcard), Box::new(SolvedType::Wildcard),
); );

View file

@ -290,7 +290,7 @@ mod gen_builtins {
#[test] #[test]
fn head_int_list() { fn head_int_list() {
assert_evals_to!("List.getUnsafe [ 12, 9, 6, 3 ] 0", 12, i64); assert_evals_to!("List.get [ 12, 9, 6, 3 ] 0", (1, 12), (u64, i64));
} }
#[test] #[test]

View file

@ -2194,6 +2194,18 @@ mod test_solve {
); );
} }
#[test]
fn solve_list_get() {
infer_eq_without_problem(
indoc!(
r#"
List.get [ "a" ] 0
"#
),
"Result Str [ OutOfBounds ]*",
);
}
#[test] #[test]
fn type_more_general_than_signature() { fn type_more_general_than_signature() {
infer_eq_without_problem( infer_eq_without_problem(
@ -2292,7 +2304,7 @@ mod test_solve {
List.get [ 10, 9, 8, 7 ] 1 List.get [ 10, 9, 8, 7 ] 1
"# "#
), ),
"Result (Num *) [ IndexOutOfBounds ]*", "Result (Num *) [ OutOfBounds ]*",
); );
} }

View file

@ -1896,7 +1896,7 @@ mod test_uniq_solve {
|> List.get 2 |> List.get 2
"# "#
), ),
"Attr * (Result (Attr * (Num (Attr * *))) (Attr * [ IndexOutOfBounds ]*))", "Attr * (Result (Attr * (Num (Attr * *))) (Attr * [ OutOfBounds ]*))",
); );
} }
@ -1984,7 +1984,7 @@ mod test_uniq_solve {
{ p, q } { p, q }
"# "#
), ),
"Attr * (Attr * (List (Attr Shared a)) -> Attr * { p : (Attr * (Result (Attr Shared a) (Attr * [ IndexOutOfBounds ]*))), q : (Attr * (Result (Attr Shared a) (Attr * [ IndexOutOfBounds ]*))) })" "Attr * (Attr * (List (Attr Shared a)) -> Attr * { p : (Attr * (Result (Attr Shared a) (Attr * [ OutOfBounds ]*))), q : (Attr * (Result (Attr Shared a) (Attr * [ OutOfBounds ]*))) })"
); );
} }