Branch: Tag:

2018-03-25

2018-03-25 21:01:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Operators: Support cast to subtyped objects.

Casting a non-object value to a subtyped object now causes
the program in the subtype to be cloned with the value as
the single argument.

9190:   test_eval_error([[(string)class { mixed cast() { return UNDEFINED; } }();]])   test_eval_error([[(mapping)class { mixed cast() { return UNDEFINED; } }();]])    + test_any([[ +  // Cast to subtyped object. +  class A(int val) { +  int next() { return ++val; } +  } +  return ((object(A))17)->next(); + ]], 18) +    // testing @   test_equal(({1,2,3}),lambda(mixed ... x) { return x; }(@a()))   test_equal("foo"/"",lambda(mixed ... x) { return x; }(@a()))