Main.hx 274 B

123456789101112131415161718192021
  1. function main() {
  2. foo(new Foo());
  3. }
  4. function foo(foo:Null<Foo>) {
  5. (foo ?? throw "hello")[0]++;
  6. }
  7. abstract Foo(Int) {
  8. public function new() {
  9. this = 0;
  10. }
  11. @:op([]) function get(i:Int) {
  12. return this;
  13. }
  14. @:op([]) function set(i:Int, val:Int) {
  15. return this;
  16. }
  17. }