Skip to content

Commit ca98055

Browse files
committed
---
yaml --- r: 12123 b: refs/heads/master c: 11610f9 h: refs/heads/master i: 12121: 39f6f74 12119: 9a91be4 v: v3
1 parent d1a2571 commit ca98055

File tree

6 files changed

+38
-4
lines changed

6 files changed

+38
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 21111660ca7dbd95f9b0ee8c651062a607fe6345
2+
refs/heads/master: 11610f9ca1a9da187c1b6f0d40ae2e369afd4fee
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/middle/typeck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,8 @@ mod collect {
934934
}
935935
ast_map::node_item(@{node: ast::item_class(_,its,_), _}, _) {
936936
let (_,ms) = split_class_items(its);
937-
// Handling all methods here
938-
let ps = ast_util::ignore_privacy(ms);
937+
// Only public methods need to be stored
938+
let ps = ast_util::public_methods(ms);
939939
store_methods::<@ast::method>(tcx, id, ps, {|m|
940940
ty_of_method(tcx, m_collect, m)});
941941
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mod kitties {
2+
3+
class cat {
4+
priv {
5+
let mutable meows : uint;
6+
fn nap() { uint::range(1u, 10000u) {|_i|}}
7+
}
8+
9+
let how_hungry : int;
10+
11+
new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
12+
}
13+
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// error-pattern:no public field or method with that name
2+
// xfail-fast
3+
// aux-build:cci_class.rs
4+
use cci_class;
5+
import cci_class::kitties::*;
6+
7+
fn main() {
8+
let nyan : cat = cat(52u, 99);
9+
assert (nyan.meows == 52u);
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// error-pattern:attempted access of field nap on type
2+
// xfail-fast
3+
// aux-build:cci_class_5.rs
4+
use cci_class_5;
5+
import cci_class_5::kitties::*;
6+
7+
fn main() {
8+
let nyan : cat = cat(52u, 99);
9+
nyan.nap();
10+
}

trunk/src/test/compile-fail/private-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern:Class doesn't have a public method named nap
1+
// error-pattern:attempted access of field nap on type
22
class cat {
33
priv {
44
let mutable meows : uint;

0 commit comments

Comments
 (0)