@@ -795,17 +795,13 @@ function getfield_tfunc(s00, name, order, boundscheck)
795795end
796796getfield_tfunc (@nospecialize (s00), @nospecialize (name)) = _getfield_tfunc (s00, name, false )
797797function _getfield_tfunc (@nospecialize (s00), @nospecialize (name), setfield:: Bool )
798- s = unwrap_unionall (s00)
799- if isa (s, Union)
800- return tmerge (getfield_tfunc (rewrap_unionall (s. a, s00), name),
801- getfield_tfunc (rewrap_unionall (s. b, s00), name))
802- elseif isa (s, Conditional)
798+ if isa (s00, Conditional)
803799 return Bottom # Bool has no fields
804- elseif isa (s , Const) || isconstType (s )
805- if ! isa (s , Const)
806- sv = s . parameters[1 ]
800+ elseif isa (s00 , Const) || isconstType (s00 )
801+ if ! isa (s00 , Const)
802+ sv = s00 . parameters[1 ]
807803 else
808- sv = s . val
804+ sv = s00 . val
809805 end
810806 if isa (name, Const)
811807 nv = name. val
@@ -845,11 +841,15 @@ function _getfield_tfunc(@nospecialize(s00), @nospecialize(name), setfield::Bool
845841 return unwrapva (s00. fields[nv])
846842 end
847843 end
844+ else
845+ s = unwrap_unionall (s00)
848846 end
849- if isType (s) || ! isa (s, DataType) || isabstracttype (s)
850- return Any
847+ if isa (s, Union)
848+ return tmerge (_getfield_tfunc (rewrap_unionall (s. a, s00), name, setfield),
849+ _getfield_tfunc (rewrap_unionall (s. b, s00), name, setfield))
851850 end
852- s = s:: DataType
851+ isa (s, DataType) || return Any
852+ isabstracttype (s) && return Any
853853 if s <: Tuple && ! (Int <: widenconst (name))
854854 return Bottom
855855 end
@@ -873,7 +873,7 @@ function _getfield_tfunc(@nospecialize(s00), @nospecialize(name), setfield::Bool
873873 if ! (_ts <: Tuple )
874874 return Any
875875 end
876- return getfield_tfunc (_ts, name)
876+ return _getfield_tfunc (_ts, name, setfield )
877877 end
878878 ftypes = datatype_fieldtypes (s)
879879 nf = length (ftypes)
0 commit comments