Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADT argument in function header crashes compiler #269

Open
tim2CF opened this issue May 20, 2019 · 0 comments
Open

ADT argument in function header crashes compiler #269

tim2CF opened this issue May 20, 2019 · 0 comments

Comments

@tim2CF
Copy link

tim2CF commented May 20, 2019

type maybe 'a = Just 'a | Nothing

val (>>=) 'a 'b : fn (maybe 'a) (fn 'a -> maybe 'b) -> (maybe 'b)
let (>>=) (Nothing) _ = Nothing
let (>>=) (Just x) f = f x

code crashes compiler

== Compiling 1 Alpaca source files
Function: '(>>=)'/2
: internal error in sys_core_fold;
crash reason: {case_clause,{'EXIT',{{case_clause,{<<"pat_var_1">>,#{}}},
                      [{sys_core_fold,'-sub_add_scope/2-anonymous-0-',2,
                                      [{file,"sys_core_fold.erl"},
                                       {line,1521}]},
                       {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
                       {sys_core_fold,sub_add_scope,2,
                                      [{file,"sys_core_fold.erl"},
                                       {line,1521}]},
                       {sys_core_fold,pattern,3,
                                      [{file,"sys_core_fold.erl"},
                                       {line,1302}]},
                       {lists,mapfoldl,3,[{file,"lists.erl"},{line,1354}]},
                       {sys_core_fold,expr,3,
                                      [{file,"sys_core_fold.erl"},{line,301}]},
                       {sys_core_fold,find_fixpoint,3,
                                      [{file,"sys_core_fold.erl"},{line,141}]},
                       {sys_core_fold,function_1,1,
                                      [{file,"sys_core_fold.erl"},
                                       {line,127}]}]}}}

  in function  compile:'-select_passes/2-anonymous-2-'/3 (compile.erl, line 672)
  in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 396)
  in call from compile:fold_comp/4 (compile.erl, line 423)
  in call from compile:internal_comp/5 (compile.erl, line 407)
  in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 207)
  in call from compile:'-do_compile/2-anonymous-1-'/1 (compile.erl, line 223)
** (MatchError) no match of right hand side value: :error
    /Users/itkachuk/MYprojects/alpaca_mix_compiler/example/deps/alpaca/src/alpaca.erl:157: :alpaca.compile_module/2
    (stdlib) lists.erl:1239: :lists.map/2
    /Users/itkachuk/MYprojects/alpaca_mix_compiler/example/deps/alpaca/src/alpaca.erl:108: :alpaca.compile_phase_4/2
    lib/mix/tasks/compile.alpaca.ex:36: Mix.Tasks.Compile.Alpaca.do_run/3
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/tasks/compile.all.ex:68: Mix.Tasks.Compile.All.run_compiler/2
    (mix) lib/mix/tasks/compile.all.ex:52: Mix.Tasks.Compile.All.do_compile/4
    (mix) lib/mix/tasks/compile.all.ex:23: anonymous fn/1 in Mix.Tasks.Compile.All.run/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant