@@ -1597,36 +1597,34 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
15971597 elseif ehead === :new
15981598 t = instanceof_tfunc (abstract_eval_value (interp, e. args[1 ], vtypes, sv))[1 ]
15991599 if isconcretetype (t) && ! ismutabletype (t)
1600- args = Vector {Any} (undef, length (e. args)- 1 )
1601- ats = Vector {Any} (undef, length (e . args) - 1 )
1600+ nargs = length (e. args) - 1
1601+ ats = Vector {Any} (undef, nargs )
16021602 local anyrefine = false
16031603 local allconst = true
16041604 for i = 2 : length (e. args)
16051605 at = widenconditional (abstract_eval_value (interp, e. args[i], vtypes, sv))
1606+ ft = fieldtype (t, i- 1 )
1607+ at = tmeet (at, ft)
16061608 if ! anyrefine
16071609 anyrefine = has_nontrivial_const_info (at) || # constant information
1608- at ⊏ fieldtype (t, i - 1 ) # just a type-level information, but more precise than the declared type
1610+ at ⋤ ft # just a type-level information, but more precise than the declared type
16091611 end
16101612 ats[i- 1 ] = at
16111613 if at === Bottom
16121614 t = Bottom
1613- anyrefine = allconst = false
1614- break
1615- elseif at isa Const
1616- if ! (at. val isa fieldtype (t, i - 1 ))
1617- t = Bottom
1618- anyrefine = allconst = false
1619- break
1620- end
1621- args[i- 1 ] = at. val
1622- else
1615+ @goto t_computed
1616+ elseif ! isa (at, Const)
16231617 allconst = false
16241618 end
16251619 end
16261620 # For now, don't allow partially initialized Const/PartialStruct
1627- if t != = Bottom && fieldcount (t) == length (ats)
1621+ if fieldcount (t) == nargs
16281622 if allconst
1629- t = Const (ccall (:jl_new_structv , Any, (Any, Ptr{Cvoid}, UInt32), t, args, length (args)))
1623+ argvals = Vector {Any} (undef, nargs)
1624+ for j in 1 : nargs
1625+ argvals[j] = (ats[j]:: Const ). val
1626+ end
1627+ t = Const (ccall (:jl_new_structv , Any, (Any, Ptr{Cvoid}, UInt32), t, argvals, nargs))
16301628 elseif anyrefine
16311629 t = PartialStruct (t, ats)
16321630 end
@@ -1718,6 +1716,7 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
17181716 else
17191717 t = abstract_eval_value_expr (interp, e, vtypes, sv)
17201718 end
1719+ @label t_computed
17211720 @assert ! isa (t, TypeVar) " unhandled TypeVar"
17221721 if isa (t, DataType) && isdefined (t, :instance )
17231722 # replace singleton types with their equivalent Const object
0 commit comments