mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Remove obsolete hardcoded List.get types
This commit is contained in:
parent
034f1c916a
commit
d0da4bf926
2 changed files with 3 additions and 29 deletions
|
@ -371,22 +371,9 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
||||||
|
|
||||||
// List module
|
// List module
|
||||||
|
|
||||||
// get : List elem, Int -> Result elem [ OutOfBounds ]*
|
// #getUnsafe : List elem, Int -> elem
|
||||||
let index_out_of_bounds = SolvedType::TagUnion(
|
|
||||||
vec![(TagName::Global("OutOfBounds".into()), vec![])],
|
|
||||||
Box::new(SolvedType::Wildcard),
|
|
||||||
);
|
|
||||||
|
|
||||||
add_type(
|
add_type(
|
||||||
Symbol::LIST_GET,
|
Symbol::LIST_GET_UNSAFE,
|
||||||
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
|
|
||||||
SolvedType::Func(
|
SolvedType::Func(
|
||||||
vec![list_type(flex(TVAR1)), int_type()],
|
vec![list_type(flex(TVAR1)), int_type()],
|
||||||
Box::new(flex(TVAR1)),
|
Box::new(flex(TVAR1)),
|
||||||
|
|
|
@ -450,20 +450,7 @@ 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 [ OutOfBounds ]*
|
// #getUnsafe : List elem, Int -> elem
|
||||||
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)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
add_type(
|
add_type(
|
||||||
Symbol::LIST_GET_UNSAFE,
|
Symbol::LIST_GET_UNSAFE,
|
||||||
unique_function(vec![list_type(UVAR1, TVAR1), int_type(UVAR2)], flex(TVAR1)),
|
unique_function(vec![list_type(UVAR1, TVAR1), int_type(UVAR2)], flex(TVAR1)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue