Skip to content

Commit 27fb3fe

Browse files
committed
stage2 run-pass test for #3753
1 parent 21cbc31 commit 27fb3fe

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/test/run-pass/issue-3753.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Issue #3656
2+
// Issue Name: pub method preceeded by attribute can't be parsed
3+
// Abstract: Visibility parsing failed when compiler parsing
4+
5+
struct Point {
6+
x: float,
7+
y: float
8+
}
9+
10+
pub enum Shape {
11+
Circle(Point, float),
12+
Rectangle(Point, Point)
13+
}
14+
15+
pub impl Shape {
16+
pub fn area(sh: Shape) -> float {
17+
match sh {
18+
Circle(_, size) => float::consts::pi * size * size,
19+
Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y)
20+
}
21+
}
22+
}
23+
24+
fn main(){
25+
let s = Circle(Point { x: 1f, y: 2f }, 3f);
26+
io::println(fmt!("%f", s.area(s)));
27+
}

0 commit comments

Comments
 (0)