Closed EvanKirshenbaum closed 8 months ago
This issue was referenced by the following commit before migration:
Ran into the same problem when testing out samples (#271). The following should fail:
s = an empty int sample;
s : add(3 ms);
but instead of failing (trying to convert the int sample to a time sample), it was similarly blowing the stack. It turns out that the problem is that a T
can be converted to a Maybe(T)
... and vice versa. When this is in the middle of a possible conversion path, we wind up converting a T
to an X
by converting a Maybe(T)
to an X
by converting a T
to an X
by ... and eventually crashing.
The solution I decided upon had two components:
_conversion_to()
and _find_conversion_to()
changed their return types from _Converter
to MissingOr[Converter]
, where a value of MISSING
means "I don't know that it won't work eventually, but this question is already on the stack, so there's no point in asking it again.Type
now has a class attribute _in_progress_conversion_searches
, which is a set of tuples of from/to types. In _find_conversion_to()
, before calling check_and_add()
to handle any possible intermediaries, it adds the current pair to it, and when its done, it removes the pair. At the beginning of _find_conversion_to()
, if the desired pair is in the set, it returns MISSING
, and in check_and_add()
, if either call to _conversion_to()
returns MISSING
, the middle candidate is skipped.I'm still not sure why the initial problem I was seeing with clicked pad's drop
didn't always fail, so it's possible that there was more that was going on there, but I haven't been able to make that infinitely regress since making this change, so I'm going to declare this done for now.
It doesn't happen always, but I'm finding that some of the time, if I bring up an
interactive wombat
and shift click on a pad to add a drop, if I then calld = clicked pad's drop
, I get aRecursionError
thrown trying to do a conversion.The stack at that point is
with the last three lines repeating and the stack ending with
The problem appears to be the check to see if the type of the expression
clicked pad's drop
is a binary state:but I can't see why that would be a problem.
var_type
should bemaybe drop
, and that shouldn't cause any sort of loop.Migrated from internal repository. Originally created by @EvanKirshenbaum on Jun 09, 2023 at 2:28 PM PDT. Closed on Jun 22, 2023 at 2:28 PM PDT.