Merge pull request #156 from aeternity/fix-compiler-crash-bug

Fix bug with missing fields causing compiler crash
This commit is contained in:
Ulf Norell 2019-09-23 11:56:30 +02:00 committed by GitHub
commit a21715a657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1332,7 +1332,7 @@ infer_case(Env, Attrs, Pattern, ExprType, Branch, SwitchType) ->
end,
NewEnv = bind_vars([{Var, fresh_uvar(Ann)} || Var = {id, Ann, _} <- Vars], Env#env{ in_pattern = true }),
NewPattern = {typed, _, _, PatType} = infer_expr(NewEnv, Pattern),
NewBranch = check_expr(NewEnv, Branch, SwitchType),
NewBranch = check_expr(NewEnv#env{ in_pattern = false }, Branch, SwitchType),
unify(Env, PatType, ExprType, {case_pat, Pattern, PatType, ExprType}),
{'case', Attrs, NewPattern, NewBranch}.