mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Merge remote-tracking branch 'origin/trunk' into list-get
This commit is contained in:
commit
9cc9789738
3 changed files with 22 additions and 8 deletions
|
@ -371,9 +371,22 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
|
||||
// List module
|
||||
|
||||
// #getUnsafe : List elem, Int -> elem
|
||||
// get : List elem, Int -> Result elem [ IndexOutOfBounds ]*
|
||||
let index_out_of_bounds = SolvedType::TagUnion(
|
||||
vec![(TagName::Global("IndexOutOfBounds".into()), vec![])],
|
||||
Box::new(SolvedType::Wildcard),
|
||||
);
|
||||
|
||||
add_type(
|
||||
Symbol::LIST_GET_UNSAFE,
|
||||
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
|
||||
SolvedType::Func(
|
||||
vec![list_type(flex(TVAR1)), int_type()],
|
||||
Box::new(flex(TVAR1)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue