Skip to content

Commit

Permalink
Add another test for bound methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
munificent committed Dec 15, 2017
1 parent f23ddac commit 4b2648c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/field/get_and_set_method.lox
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Bound methods have identity equality.
class Foo {
method() {
print "method";
}
other() {
print "other";
}
}

var foo = Foo();
var method = foo.method;

// Setting a property shadows the instance method.
foo.method = foo.other;
foo.method(); // expect: other

// The old method handle still points to the original method.
method(); // expect: method

0 comments on commit 4b2648c

Please sign in to comment.