Skip to content

Commit 43328e2

Browse files
committed
---
yaml --- r: 14176 b: refs/heads/try c: 74d4e2a h: refs/heads/master v: v3
1 parent e4eba97 commit 43328e2

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: d01e7cd3406e612f363f95d44291839fc53640d1
5+
refs/heads/try: 74d4e2a32ed28bf2272b1ba3246246557ec6d987
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/comp/middle/typeck.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,25 +1589,25 @@ fn lookup_method(fcx: @fn_ctxt, expr: @ast::expr, node_id: ast::node_id,
15891589
let substs = substs, n_tps = vec::len(substs), n_tys = vec::len(tps);
15901590
let has_self = ty::type_has_params(fty);
15911591
if method_n_tps + n_tps > 0u {
1592-
if n_tys > 0u {
1592+
if n_tys == 0u || n_tys != method_n_tps {
15931593
if n_tys != method_n_tps {
1594-
tcx.sess.span_fatal
1594+
tcx.sess.span_err
15951595
(expr.span, "incorrect number of type \
15961596
parameters given for this method");
15971597

15981598
}
1599-
substs += tps;
1600-
} else {
16011599
substs += vec::init_fn(method_n_tps, {|_i|
16021600
ty::mk_var(tcx, next_ty_var_id(fcx))
16031601
});
1604-
};
1602+
} else {
1603+
substs += tps;
1604+
}
16051605
write_ty_substs(tcx, node_id, fty, substs);
1606-
} else if n_tys > 0u {
1607-
tcx.sess.span_fatal(expr.span,
1608-
"this method does not take type \
1609-
parameters");
16101606
} else {
1607+
if n_tys > 0u {
1608+
tcx.sess.span_err(expr.span, "this method does not take type \
1609+
parameters");
1610+
}
16111611
write_ty(tcx, node_id, fty);
16121612
}
16131613
if has_self && !option::is_none(self_sub) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
iface bar { fn dup() -> self; fn blah<X>(); }
2+
impl of bar for int { fn dup() -> int { self } fn blah<X>() {} }
3+
impl of bar for uint { fn dup() -> uint { self } fn blah<X>() {} }
4+
impl of bar for uint { fn dup() -> uint { self } fn blah<X>() {} }
5+
6+
fn main() {
7+
10.dup::<int>(); //! ERROR does not take type parameters
8+
10.blah::<int, int>(); //! ERROR incorrect number of type parameters
9+
10u.dup(); //! ERROR multiple applicable methods
10+
(10 as bar).dup(); //! ERROR contains a self type
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
iface foo { fn foo(); }
2+
3+
impl of foo for uint {} //! ERROR missing method `foo`
4+
5+
impl of foo for uint { fn foo() -> int {} } //! ERROR incompatible type
6+
7+
impl of int for uint { fn foo() {} } //! ERROR can only implement interface
8+
9+
fn main() {}

0 commit comments

Comments
 (0)