Make IO.write() call toString on its argument.

This commit is contained in:
Bob Nystrom
2013-12-22 11:50:00 -08:00
parent 2ec01c558f
commit 7868287f89
6 changed files with 130 additions and 12 deletions
+12
View File
@@ -0,0 +1,12 @@
class Foo {
toString { return "Foo.toString" }
}
// Calls toString on argument.
IO.write(new Foo) // expect: Foo.toString
// Returns argument.
var result = IO.write(123) // expect: 123
IO.write(result == 123) // expect: true
// TODO: What if toString on argument doesn't return a string?