}
fn eq_ty(&@ty a, &@ty b) -> bool {
- ret a == b;
+ ret std::box::ptr_eq(a,b);
}
fn hash_ty(&@ty t) -> uint {
type mt = rec(t ty, ast::mutability mut);
-tag cached_ty {
- in_progress;
- done(t);
-}
-
// Contains information needed to resolve types and (in the future) look up
// the types of AST nodes.
type creader_cache = hashmap[tup(int,uint,uint),ty::t];
type_cache tcache,
creader_cache rcache,
hashmap[t,str] short_names_cache,
- hashmap[@ast::ty,cached_ty] ast_ty_to_ty_cache);
+ hashmap[@ast::ty,option::t[t]] ast_ty_to_ty_cache);
type ty_ctxt = ctxt; // Needed for disambiguation from unify::ctxt.
// Convert from method type to function type. Pretty easy; we just drop
short_names_cache =
map::mk_hashmap[ty::t,str](ty::hash_ty, ty::eq_ty),
ast_ty_to_ty_cache =
- map::mk_hashmap[@ast::ty,cached_ty](ast::hash_ty, ast::eq_ty));
+ map::mk_hashmap[@ast::ty,option::t[t]](ast::hash_ty, ast::eq_ty));
populate_type_store(cx);
ret cx;
// corresponding to a definition ID:
fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
alt (tcx.ast_ty_to_ty_cache.find(ast_ty)) {
- case (some[ty::cached_ty](ty::done(?ty))) { ret ty; }
- case (some[ty::cached_ty](ty::in_progress)) {
+ case (some[option::t[ty::t]](some[ty::t](?ty))) { ret ty; }
+ case (some[option::t[ty::t]](none)) {
tcx.sess.span_err(ast_ty.span, "illegal recursive type "
+ "(insert a tag in the cycle, if this is desired)");
}
- case (none[ty::cached_ty]) { } /* go on */
+ case (none[option::t[ty::t]]) { } /* go on */
}
- tcx.ast_ty_to_ty_cache.insert(ast_ty, ty::in_progress);
+ tcx.ast_ty_to_ty_cache.insert(ast_ty, none[ty::t]);
fn ast_arg_to_arg(&ty::ctxt tcx,
&ty_getter getter,
}
}
- tcx.ast_ty_to_ty_cache.insert(ast_ty, ty::done(typ));
+ tcx.ast_ty_to_ty_cache.insert(ast_ty, some(typ));
ret typ;
}
// error-pattern:illegal recursive type
type t1 = rec(int foo, t1 foolish);
-fn main() {}
\ No newline at end of file
+fn main() {}