File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 4848# 3. bitstype unions (`Union{Int, Float32}`, etc)
4949# these are stored contiguously and require a selector array (handled by us)
5050# As well as "mutable singleton" types like `Symbol` that use pointer-identity
51- @inline function check_eltype (name, T)
52- eltype_is_invalid = ! Base. allocatedinline (T) ||
53- (hasfieldcount (T) && any (! Base. allocatedinline, fieldtypes (T)))
54-
55- if eltype_is_invalid
51+
52+ function valid_leaftype (@nospecialize (T))
53+ Base. allocatedinline (T) || (Base. ismutabletype (T) && Base. datatype_fieldcount (T) == 0 )
54+ end
55+
56+ function valid_type (@nospecialize (T))
57+ if valid_leaftype (T)
58+ if hasfieldcount (T)
59+ return all (valid_type, fieldtypes (T))
60+ end
61+ return true
62+ end
63+ return false
64+ end
65+
66+ @inline function check_eltype (name, T)
67+ if ! valid_type (T)
5668 explanation = explain_eltype (T)
5769 error ("""
5870 $name only supports element types that are allocated inline.
You can’t perform that action at this time.
0 commit comments