Fix dependency bug iface-did-of-impl resolving
By simply not resolving that def id until the typeck pass. Closes #1494
This commit is contained in:
parent
34d7f05292
commit
4c9c1cd199
@ -68,7 +68,6 @@ const tag_mod_impl: uint = 0x30u;
|
||||
|
||||
const tag_item_method: uint = 0x31u;
|
||||
const tag_impl_iface: uint = 0x32u;
|
||||
const tag_impl_iface_did: uint = 0x33u;
|
||||
|
||||
// discriminator value for variants
|
||||
const tag_disr_val: uint = 0x34u;
|
||||
|
@ -126,16 +126,6 @@ fn item_impl_iface(item: ebml::doc, tcx: ty::ctxt, cdata: cmd)
|
||||
result
|
||||
}
|
||||
|
||||
fn item_impl_iface_did(item: ebml::doc, cdata: cmd)
|
||||
-> option::t<ast::def_id> {
|
||||
let result = none;
|
||||
ebml::tagged_docs(item, tag_impl_iface_did) {|doc|
|
||||
let did = translate_def_id(cdata, parse_def_id(ebml::doc_data(doc)));
|
||||
result = some(did);
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
fn item_ty_param_bounds(item: ebml::doc, tcx: ty::ctxt, cdata: cmd)
|
||||
-> @[ty::param_bounds] {
|
||||
let bounds = [];
|
||||
@ -297,8 +287,7 @@ fn get_impls_for_mod(cdata: cmd, m_id: ast::node_id,
|
||||
let item = lookup_item(did.node, data), nm = item_name(item);
|
||||
if alt name { some(n) { n == nm } none. { true } } {
|
||||
let base_tps = item_ty_param_count(doc);
|
||||
let i_did = item_impl_iface_did(item, cdata);
|
||||
result += [@{did: did, iface_did: i_did, ident: nm,
|
||||
result += [@{did: did, ident: nm,
|
||||
methods: item_impl_methods(cdata, item, base_tps)}];
|
||||
}
|
||||
}
|
||||
|
@ -405,13 +405,6 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
|
||||
ebml::start_tag(ebml_w, tag_impl_iface);
|
||||
write_type(ecx, ebml_w, i_ty);
|
||||
ebml::end_tag(ebml_w);
|
||||
ebml::start_tag(ebml_w, tag_impl_iface_did);
|
||||
alt ty::struct(tcx, i_ty) {
|
||||
ty::ty_iface(did, _) {
|
||||
ebml_w.writer.write(str::bytes(def_to_str(did)));
|
||||
}
|
||||
}
|
||||
ebml::end_tag(ebml_w);
|
||||
}
|
||||
_ {}
|
||||
}
|
||||
|
@ -1825,8 +1825,7 @@ fn check_exports(e: @env) {
|
||||
// Impl resolution
|
||||
|
||||
type method_info = {did: def_id, n_tps: uint, ident: ast::ident};
|
||||
type _impl = {did: def_id, iface_did: option::t<def_id>,
|
||||
ident: ast::ident, methods: [@method_info]};
|
||||
type _impl = {did: def_id, ident: ast::ident, methods: [@method_info]};
|
||||
type iscopes = list<@[@_impl]>;
|
||||
|
||||
fn resolve_impls(e: @env, c: @ast::crate) {
|
||||
@ -1893,12 +1892,6 @@ fn find_impls_in_item(e: env, i: @ast::item, &impls: [@_impl],
|
||||
_ { true }
|
||||
} {
|
||||
impls += [@{did: local_def(i.id),
|
||||
iface_did: alt ifce {
|
||||
some(@{node: ast::ty_path(_, id), _}) {
|
||||
some(def_id_of_def(e.def_map.get(id)))
|
||||
}
|
||||
_ { none }
|
||||
},
|
||||
ident: i.ident,
|
||||
methods: vec::map(mthds, {|m|
|
||||
@{did: local_def(m.id),
|
||||
|
@ -2947,7 +2947,15 @@ mod dict {
|
||||
std::list::iter(isc) {|impls|
|
||||
if option::is_some(found) { ret; }
|
||||
for im in *impls {
|
||||
if im.iface_did == some(iface_id) {
|
||||
let match = alt ty::impl_iface(tcx, im.did) {
|
||||
some(ity) {
|
||||
alt ty::struct(tcx, ity) {
|
||||
ty::ty_iface(id, _) { id == iface_id }
|
||||
}
|
||||
}
|
||||
_ { false }
|
||||
};
|
||||
if match {
|
||||
let {n_tps, ty: self_ty} = impl_self_ty(tcx, im.did);
|
||||
let {vars, ty: self_ty} = if n_tps > 0u {
|
||||
bind_params(fcx, self_ty, n_tps)
|
||||
|
@ -31,7 +31,7 @@ native mod rustrt {
|
||||
}
|
||||
|
||||
// FIXME Kludge to work around issue #1494 . Simply import io::writer_util
|
||||
// when that is fixed.
|
||||
// after the next snapshot.
|
||||
impl writer_util for io::writer {
|
||||
fn write_str(s: str) { self.write(str::bytes(s)); }
|
||||
fn write_line(s: str) { self.write(str::bytes(s + "\n")); }
|
||||
|
Loading…
Reference in New Issue
Block a user