@@ -299,6 +299,8 @@ function sizeof_nothrow(@nospecialize(x))
299299 x = x. val
300300 elseif isa (x, Conditional)
301301 return true
302+ else
303+ x = widenconst (x)
302304 end
303305 isconstType (x) && (x = x. parameters[1 ])
304306 if isa (x, Union)
@@ -325,13 +327,15 @@ function sizeof_tfunc(@nospecialize(x),)
325327 isa (x, Const) && return _const_sizeof (x. val)
326328 isa (x, Conditional) && return _const_sizeof (Bool)
327329 isconstType (x) && return _const_sizeof (x. parameters[1 ])
330+ x = widenconst (x)
328331 x != = DataType && isconcretetype (x) && return _const_sizeof (x)
329332 return Int
330333end
331334add_tfunc (Core. sizeof, 1 , 1 , sizeof_tfunc, 0 )
332335function nfields_tfunc (@nospecialize (x))
333336 isa (x, Const) && return Const (nfields (x. val))
334337 isa (x, Conditional) && return Const (0 )
338+ x = widenconst (x)
335339 if isa (x, DataType) && ! x. abstract && ! (x. name === Tuple. name && isvatuple (x))
336340 if ! (x. name === _NAMEDTUPLE_NAME && ! isconcretetype (x))
337341 return Const (length (x. types))
@@ -470,12 +474,14 @@ function isa_tfunc(@nospecialize(v), @nospecialize(tt))
470474 if isexact && isnotbrokensubtype (v, t)
471475 return Const (true )
472476 end
473- elseif isa (v, Const) || isa (v, Conditional) || isdispatchelem (v)
474- # this tests for knowledge of a leaftype appearing on the LHS
475- # (ensuring the isa is precise)
476- return Const (false )
477477 else
478+ if isa (v, Const) || isa (v, Conditional)
479+ # this and the `isdispatchelem` below test for knowledge of a
480+ # leaftype appearing on the LHS (ensuring the isa is precise)
481+ return Const (false )
482+ end
478483 v = widenconst (v)
484+ isdispatchelem (v) && return Const (false )
479485 if typeintersect (v, t) === Bottom
480486 # similar to `isnotbrokensubtype` check above, `typeintersect(v, t)`
481487 # can't be trusted for kind types so we do an extra check here
0 commit comments