You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importVecVecimportHashMapHashMap
two_sum (nums:VecI32) (target:I32):Maybe (Usz, Usz) =
complements:Ref (HashMapI32I32) = mut HashMap.empty ()
loop (i=0) ->
a = nums#i
b = target - a
match HashMap.get_entry complements b
|Some j ->Some (j, i)
|None->HashMap.insert complements a i
if i +1<Vec.len nums then
recur (i +1)
elseNone
Causes a panic:
⮞ env RUST_BACKTRACE=1 ante two_sum.an
thread 'main' panicked at src/types/typechecker.rs:543:9:
Recursion limit reached in occurs
stack backtrace:
0: std::panicking::begin_panic
1: ante::types::typechecker::occurs
2: ante::types::typechecker::typevars_match
3: ante::types::typechecker::occurs
4: ante::types::typechecker::typevars_match
5: ante::types::typechecker::occurs
6: ante::types::typechecker::typevars_match
7: ante::types::typechecker::occurs
8: ante::types::typechecker::typevars_match
9: ante::types::typechecker::occurs
10: ante::types::typechecker::typevars_match
11: ante::types::typechecker::occurs
12: ante::types::typechecker::typevars_match
13: ante::types::typechecker::occurs
14: ante::types::typechecker::typevars_match
15: ante::types::typechecker::occurs
16: ante::types::typechecker::typevars_match
17: ante::types::typechecker::occurs
18: ante::types::typechecker::typevars_match
19: ante::types::typechecker::occurs
20: ante::types::typechecker::typevars_match
21: ante::types::typechecker::occurs
22: ante::types::typechecker::typevars_match
23: ante::types::typechecker::occurs
24: ante::types::typechecker::typevars_match
25: ante::types::typechecker::occurs
26: ante::types::typechecker::occurs
27: ante::types::typechecker::typevars_match
28: ante::types::typechecker::occurs
29: ante::types::typechecker::occurs
30: ante::types::typechecker::try_unify_type_variable_with_bindings
31: ante::types::typechecker::try_unify_with_bindings
32: ante::types::typechecker::try_unify
33: ante::types::typechecker::bind_irrefutable_pattern
34: <ante::parser::ast::Definition as ante::types::typechecker::Inferable>::infer_impl
35: ante::types::typechecker::infer_nested_definition
36: <ante::parser::ast::Ast as ante::types::typechecker::Inferable>::infer_impl
37: <ante::parser::ast::FunctionCall as ante::types::typechecker::Inferable>::infer_impl
38: <ante::parser::ast::Match as ante::types::typechecker::Inferable>::infer_impl
39: <ante::parser::ast::Ast as ante::types::typechecker::Inferable>::infer_impl
40: ante::types::typechecker::infer
41: <ante::parser::ast::Ast as ante::types::typechecker::Inferable>::infer_impl
42: <ante::parser::ast::Definition as ante::types::typechecker::Inferable>::infer_impl
43: <ante::parser::ast::Ast as ante::types::typechecker::Inferable>::infer_impl
44: <ante::parser::ast::Match as ante::types::typechecker::Inferable>::infer_impl
45: <ante::parser::ast::Ast as ante::types::typechecker::Inferable>::infer_impl
46: <ante::parser::ast::Ast as ante::types::typechecker::Inferable>::infer_impl
47: <ante::parser::ast::Definition as ante::types::typechecker::Inferable>::infer_impl
48: <ante::parser::ast::Ast as ante::types::typechecker::Inferable>::infer_impl
49: ante::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fish: Job 1, 'env RUST_BACKTRACE=1 ante two_s…' terminated by signal SIGABRT (Abort)
The text was updated successfully, but these errors were encountered:
Code
two_sum.an
Causes a panic:
The text was updated successfully, but these errors were encountered: