Fix coerce/3 when applied to namespace types, and type parameters inside record types. #1
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "spivee/coerce-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I also added some eunit tests right in the middle of the hz module, but these could be removed or moved as desired.
Variants were working by accident, since {variant, [{"VariantName", [Element]}]} had a similar enough form to the opaque types that would come from something like `type1(type2(int))`, but records were not working, since they have a different form. Now both are handled explicitly so that only the intended forms of each are handled.87477e8c9ctof54a33a293b69ababf0f.@ -1413,3 +1414,2 @@Name = binary_to_list(NameBin),Types2 = maps:put(Name, {[], contract}, Types),Types3 = case maps:find(state, Next) ofTypes2 = case IsContract ofPet peeve of mine in midwit Erlang: naming important transitions with numbers instead of what the transitions actually are or avoiding proper structure around the transitions themselves (tends to indicate foggy comprehension).
Can we come up with a more descriptive name than "Types2"?
In either case, the names (of the transition points or the functions involved) should tell us more about them.
Otherwise we need a book-sized set of descriptive comments.
Just like to point out that what @spivee did in the end there is great. Makes a "single decision at a time" much easier to see and reason about. Very nice.
f54a33a293to558c4879fa558c4879fatoe5d77ea1b277c30abf4ato4e71d3215bRebased onto 0.3.0, and the tests still pass. This should be good to go.
Proper coerce is going to lead to great outcomes downstream. Excellent!
@ -2143,0 +2225,4 @@false ->erlang:error({from_fate_failed, Sophia, SophiaActual})end,ok.OOC, what is the reason behind the erlang:error instead of a return tuple? Is there a reason for a non-local return?
The reason I ask is that there is a lot of serialization and bytecode library code that throws or errors, and it winds up complicating the calling code, which is sort of the opposite of the approach I tend to prefer (granted, sometimes it is annoying to actually play the return-tuple game).
You just told me out of context that this is for the benefit of eunit. Makes sense now. Thanks.
Yeah, it's just to crash eunit tests that aren't giving the correct results. I have fixed up the redundant
case A == B of truebit though, something you pointed out a while ago.