Remove obsolete hardcoded List.get types

This commit is contained in:
Richard Feldman 2020-04-25 07:03:16 -04:00
parent 034f1c916a
commit d0da4bf926
2 changed files with 3 additions and 29 deletions

View file

@ -371,22 +371,9 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
// List module
// get : List elem, Int -> Result elem [ OutOfBounds ]*
let index_out_of_bounds = SolvedType::TagUnion(
vec![(TagName::Global("OutOfBounds".into()), vec![])],
Box::new(SolvedType::Wildcard),
);
// #getUnsafe : List elem, Int -> elem
add_type(
Symbol::LIST_GET,
SolvedType::Func(
vec![list_type(flex(TVAR1)), int_type()],
Box::new(result_type(flex(TVAR1), index_out_of_bounds)),
),
);
add_type(
Symbol::LIST_GET_UNSAFE, // TODO remove this once we can code gen Result
Symbol::LIST_GET_UNSAFE,
SolvedType::Func(
vec![list_type(flex(TVAR1)), int_type()],
Box::new(flex(TVAR1)),

View file

@ -450,20 +450,7 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
unique_function(vec![list_type(UVAR1, TVAR1)], int_type(UVAR2)),
);
// get : List a, Int -> Result a [ OutOfBounds ]*
let index_out_of_bounds = SolvedType::TagUnion(
vec![(TagName::Global("OutOfBounds".into()), vec![])],
Box::new(SolvedType::Wildcard),
);
add_type(
Symbol::LIST_GET,
unique_function(
vec![list_type(UVAR1, TVAR1), int_type(UVAR2)],
result_type(UVAR3, flex(TVAR1), lift(UVAR4, index_out_of_bounds)),
),
);
// #getUnsafe : List elem, Int -> elem
add_type(
Symbol::LIST_GET_UNSAFE,
unique_function(vec![list_type(UVAR1, TVAR1), int_type(UVAR2)], flex(TVAR1)),