opendylan icon indicating copy to clipboard operation
opendylan copied to clipboard

No compiler warning for bad singleton dispatch

Open cgay opened this issue 4 years ago • 0 comments

https://play.opendylan.org/shared/fad09bebf972f561

define function foo (n == 0)
  list(n)
end;

format-out("%=\n", foo(0));   // good
format-out("%=\n", foo(1));   // bad, no warning
format-out("%=\n", foo(""));  // good, warning

So it appears there's no compile-time warning if the type of the argument (<integer>) matches the type of the singleton parameter (object-class(0)). Same for symbols so I assume it's a general problem and just hasn't been implemented yet.

There is, of course, a runtime error.

cgay avatar Jan 30 '21 06:01 cgay