Skip to content

Commit 95fa3ae

Browse files
committed
New binder::sneaky test
Apparently the code is actually correct. Hooray!
1 parent fb967fa commit 95fa3ae

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

poniescript/build/build_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ pub fn generate(tests_file: &mut File) {
4848
("binary/", "tuples"),
4949
("binary/", "err_class"),
5050

51+
("binder/", "sneaky"),
52+
5153
("cyclic/", "class_members_and_fun_thru_param"),
5254
("cyclic/", "err_class_members_and_fun_thru_param"),
5355
("cyclic/", "class_members_and_fun_thru_param_nocycle"),
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This test case is to make sure we don't try to have the Binder assign
2+
// Sneaker.sneak() to the call to sneaky.sneak() in do_sneak().
3+
//
4+
// In particular, the Binder should essentially never even attempt to handle
5+
// name resolution on an identifier bound to an expression with a dot.
6+
7+
class Sneaky {
8+
fun sneak() {
9+
print("I'm sneaky!");
10+
}
11+
}
12+
13+
class Sneaker {
14+
fun sneak() {
15+
print("I'm a sneaker!");
16+
}
17+
18+
var sneaky = new Sneaky{};
19+
20+
fun do_sneak() {
21+
sneaky.sneak();
22+
}
23+
}
24+
25+
fun init() {
26+
var s = new Sneaker{};
27+
s.do_sneak(); //! I'm sneaky!
28+
}

0 commit comments

Comments
 (0)