diff options
| author | Roy Frostig <[email protected]> | 2010-07-16 18:04:34 -0700 |
|---|---|---|
| committer | Roy Frostig <[email protected]> | 2010-07-16 18:04:34 -0700 |
| commit | c906759807dfe106c7c59f939c7be492b4f16d8f (patch) | |
| tree | 2f4218336824218c41315381863b59a81ea309c5 /src | |
| parent | Ensure that functions that should return a value do; issue 41 (diff) | |
| download | rust-c906759807dfe106c7c59f939c7be492b4f16d8f.tar.xz rust-c906759807dfe106c7c59f939c7be492b4f16d8f.zip | |
Fix IL translation of pattern-alt to allow a value of mutable/constrained type to be the subject of a pattern-alt.
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot/me/trans.ml | 6 | ||||
| -rw-r--r-- | src/boot/me/type.ml | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index 3d89d795..fec0d6ee 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -3961,7 +3961,7 @@ let trans_visitor | Ast.PAT_tag (lval, pats) -> let tag_name = tag_ctor_name_to_tag_name (lval_to_name lval) in let ty_tag = - match src_ty with + match strip_mutable_or_constrained_ty src_ty with Ast.TY_tag tag_ty -> tag_ty | Ast.TY_iso ti -> (ti.Ast.iso_group).(ti.Ast.iso_index) | _ -> bug cx "expected tag type" @@ -4009,8 +4009,8 @@ let trans_visitor | Ast.PAT_wild -> [] (* irrefutable *) in - let (lval_cell, lval_slot) = trans_lval at.Ast.alt_tag_lval in - let next_jumps = trans_pat pat lval_cell lval_slot in + let (lval_cell, lval_ty) = trans_lval at.Ast.alt_tag_lval in + let next_jumps = trans_pat pat lval_cell lval_ty in trans_block block; let last_jump = mark() in emit (Il.jmp Il.JMP Il.CodeNone); diff --git a/src/boot/me/type.ml b/src/boot/me/type.ml index 62ae1f67..14047f44 100644 --- a/src/boot/me/type.ml +++ b/src/boot/me/type.ml @@ -390,15 +390,16 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) = Ast.sprintf_ty ty | `Module items, Ast.COMP_named ((Ast.COMP_ident id) as name_comp) - | `Module items, Ast.COMP_named ((Ast.COMP_app (id, _)) - as name_comp) -> + | `Module items, Ast.COMP_named ((Ast.COMP_app (id, _)) + as name_comp) -> let mod_item = try Hashtbl.find items id with Not_found -> Common.bug () - "internal_check_ext_lval: ident not found in mod item" + "internal_check_ext_lval: ident %s not found in mod item" + id in let lty = internal_check_mod_item_decl |