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.
87477e8c9c
tof54a33a293
b69ababf0f
.@ -1413,3 +1414,2 @@
Name = binary_to_list(NameBin),
Types2 = maps:put(Name, {[], contract}, Types),
Types3 = case maps:find(state, Next) of
Types2 = case IsContract of
Pet 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.
f54a33a293
to558c4879fa
558c4879fa
toe5d77ea1b2
77c30abf4a
to4e71d3215b
Rebased 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 true
bit though, something you pointed out a while ago.