Do not consider ty_bot to be a "resolved type".

Fixes #2149. Fixes #2150. Fixes #2151.
This commit is contained in:
Niko Matsakis
2012-04-07 17:11:33 -07:00
parent 7aaa120bcc
commit 1e42c9a367
8 changed files with 51 additions and 8 deletions

View File

@@ -232,8 +232,10 @@ fn instantiate_path(fcx: @fn_ctxt, pth: @ast::path,
// Type tests
fn structurally_resolved_type(fcx: @fn_ctxt, sp: span, tp: ty::t) -> ty::t {
alt infer::resolve_type_structure(fcx.infcx, tp) {
result::ok(typ_s) { ret typ_s; }
result::err(_) {
// note: the bot type doesn't count as resolved; it's what we use when
// there is no information about a variable.
result::ok(t_s) if !ty::type_is_bot(t_s) { ret t_s; }
_ {
fcx.ccx.tcx.sess.span_fatal
(sp, "the type of this value must be known in this context");
}