Creator.k 488 B

123456789101112131415161718192021222324
  1. invoke {
  2. class A {
  3. init (x: Int) {
  4. do nothing
  5. }
  6. create (x: Int, y: Int) {
  7. return A(x * y)
  8. }
  9. create (x: Int, y: Int, z: Int) {
  10. return A(x * y * z)
  11. }
  12. create (x: Int) {
  13. // won't be called
  14. return A(-x)
  15. }
  16. unwrap () -> Int {
  17. return x
  18. }
  19. }
  20. assert A(2,3)->unwrap == 6
  21. assert A(2,3,5)->unwrap == 30
  22. assert A(9)->unwrap == 9
  23. }