Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
edit: I've tracked down the original problem from #75 and #71 to how
transformer
was implemented forPair
.TL;DR: transformer for Pair returned a tuple. This means that the types for a
Pair
field can go fromAny
to the concrete type of a value in theTuple
. This violates the assumptions ofhoist_type=true
. To fix the problem,Pair
is now treated as anUnorderedStruct
rather than as aDictType
.is it possible forisconcretetype
to fail duringhash_fields
: if so, what's an example that fails without the bufix???I don't think this is possible:isconcretetype
works so long ashash_fields / hash_elements
gets to visit the actual types of the original object: it normally sees all relevant, nested type parameters — problems arise whentransformer
causes a change in the inferred types andhost_type=true
isconcretetype(Vector{Any}) == true
causes some problems for StableHashTraits (#75). At the end of the day, to use the fast branch of hashing (with type hoisting) we need to know that the current type and all contained types (where containment is defined in terms ofStructType
) must be concrete to use the fast type-hashing branch.Because the code incorrectly usedbefore the current PR:isconcretetype
to use the fast branch, this means thatThis PR implementsis_fully_concrete
to check the contained types for concreteness, caching results to avoid visiting a Type structure repeatedly.FYI for @rasmushenningsson:is_fully_concrete
signalsUnion
as being non-concrete.StableHashTraits
handles union splitting for arrays only, but has not yet solved for the general case of fast hashing of generic, union-split data structures. (And this PR does not attempt to solve that problem.)Benchmarks
I've made a few QOL improvements to the benchmarks, and added a test for deeply nested type-unstable values. So these numbers are not perfectly comparable to the older tests (but what we see below looks a lot like the results for #58).