Infer variance of types with respect to the region parameter.

A similar approach could be used for type parameters.

Fixes #2282.
This commit is contained in:
Niko Matsakis
2012-08-09 09:59:50 -07:00
parent 8185ede1fa
commit 511e7626ae
33 changed files with 720 additions and 232 deletions

View File

@@ -299,7 +299,20 @@ fn node_id_to_str(map: map, id: node_id, itr: ident_interner) -> ~str {
fmt!{"unknown node (id=%d)", id}
}
some(node_item(item, path)) => {
fmt!{"item %s (id=%?)", path_ident_to_str(*path, item.ident, itr), id}
let path_str = path_ident_to_str(*path, item.ident, itr);
let item_str = match item.node {
item_const(*) => ~"const",
item_fn(*) => ~"fn",
item_mod(*) => ~"mod",
item_foreign_mod(*) => ~"foreign mod",
item_ty(*) => ~"ty",
item_enum(*) => ~"enum",
item_class(*) => ~"class",
item_trait(*) => ~"trait",
item_impl(*) => ~"impl",
item_mac(*) => ~"macro"
};
fmt!("%s %s (id=%?)", item_str, path_str, id)
}
some(node_foreign_item(item, abi, path)) => {
fmt!{"foreign item %s with abi %? (id=%?)",