aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-06-30 21:01:28 -0700
committerGraydon Hoare <[email protected]>2010-06-30 21:01:28 -0700
commit0b252a96b1a69b7724cf3676e6a89c7134f5fe86 (patch)
treed817aa06fe53f2407889c9ff763ad83e3beff23f /src
parentAdd two move variants of "acceptable mismatches to recover from" when the mut... (diff)
downloadrust-0b252a96b1a69b7724cf3676e6a89c7134f5fe86.tar.xz
rust-0b252a96b1a69b7724cf3676e6a89c7134f5fe86.zip
De-duplicate code in get_resolved_ty, make recursive, add a case for tup.
Diffstat (limited to 'src')
-rw-r--r--src/boot/me/type.ml37
1 files changed, 9 insertions, 28 deletions
diff --git a/src/boot/me/type.ml b/src/boot/me/type.ml
index f8566d87..5e7d22ec 100644
--- a/src/boot/me/type.ml
+++ b/src/boot/me/type.ml
@@ -1528,42 +1528,23 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit =
| _ -> bug () "check_auto_tyvar: no slot defn"
in
- let get_resolved_ty tv id =
+ let rec get_resolved_ty tv id =
let ts = !(resolve_tyvar tv) in
match ts with
TYSPEC_resolved ([||], ty) -> ty
| TYSPEC_exterior tv ->
- begin
- match !(resolve_tyvar tv) with
- TYSPEC_resolved ([||], ty) ->
- (Ast.TY_exterior ty)
- | _ ->
- err (Some id)
- "unresolved exterior type in %s (%d)"
- (tyspec_to_str ts) (int_of_node id)
- end
+ Ast.TY_exterior (get_resolved_ty tv id)
| TYSPEC_mutable tv ->
- begin
- match !(resolve_tyvar tv) with
- TYSPEC_resolved ([||], ty) ->
- (Ast.TY_mutable ty)
- | _ ->
- err (Some id)
- "unresolved mutable type in %s (%d)"
- (tyspec_to_str ts) (int_of_node id)
- end
+ Ast.TY_mutable (get_resolved_ty tv id)
| TYSPEC_vector tv ->
- begin
- match !(resolve_tyvar tv) with
- TYSPEC_resolved ([||], ty) ->
- (Ast.TY_vec ty)
- | _ ->
- err (Some id)
- "unresolved vector-element type in %s (%d)"
- (tyspec_to_str ts) (int_of_node id)
- end
+ Ast.TY_vec (get_resolved_ty tv id)
+
+ | TYSPEC_tuple tvs ->
+ Ast.TY_tup
+ (Array.map
+ (fun tv -> get_resolved_ty tv id) tvs)
| _ -> err (Some id)
"unresolved type %s (%d)"