@@ -1460,9 +1460,8 @@ fn check_expr_with(fcx: @fn_ctxt, expr: @ast::expr, expected: ty::t) -> bool {
1460
1460
ret check_expr_with_unifier ( fcx, expr, demand:: simple, expected) ;
1461
1461
}
1462
1462
1463
- // FIXME[impl] notice/resolve conflicts
1464
1463
fn lookup_method ( fcx : @fn_ctxt , isc : resolve:: iscopes ,
1465
- name : ast:: ident , ty : ty:: t )
1464
+ name : ast:: ident , ty : ty:: t , sp : span )
1466
1465
-> option:: t < { method: @resolve:: method_info, ids : [ int ] } > {
1467
1466
let result = none;
1468
1467
std:: list:: iter ( isc) { |impls|
@@ -1488,8 +1487,13 @@ fn lookup_method(fcx: @fn_ctxt, isc: resolve::iscopes,
1488
1487
} else { { ids: [ ] , ty: self_ty} } ;
1489
1488
alt unify:: unify ( fcx, ty, self_ty) {
1490
1489
ures_ok ( _) {
1491
- result = some ( { method: m, ids: ids} ) ;
1492
- ret;
1490
+ if option:: is_some ( result) {
1491
+ // FIXME[impl] score specificity to resolve ambiguity?
1492
+ fcx. ccx . tcx . sess . span_err (
1493
+ sp, "multiple applicable methods in scope" ) ;
1494
+ } else {
1495
+ result = some ( { method: m, ids: ids} ) ;
1496
+ }
1493
1497
}
1494
1498
_ { }
1495
1499
}
@@ -2159,7 +2163,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
2159
2163
}
2160
2164
if !handled {
2161
2165
let iscope = fcx. ccx . impl_map . get ( expr. id ) ;
2162
- alt lookup_method ( fcx, iscope, field, expr_t) {
2166
+ alt lookup_method ( fcx, iscope, field, expr_t, expr . span ) {
2163
2167
some ( { method, ids} ) {
2164
2168
let fty = if method. did . crate == ast:: local_crate {
2165
2169
alt tcx. items . get ( method. did . node ) {
0 commit comments