@@ -420,7 +420,8 @@ function typevar_tfunc(@nospecialize(n), @nospecialize(lb_arg), @nospecialize(ub
420
420
ub = Any
421
421
ub_certain = lb_certain = true
422
422
if isa (n, Const)
423
- isa (n. val, Symbol) || return Union{}
423
+ nval = n. val
424
+ isa (nval, Symbol) || return Union{}
424
425
if isa (lb_arg, Const)
425
426
lb = lb_arg. val
426
427
elseif isType (lb_arg)
@@ -437,7 +438,7 @@ function typevar_tfunc(@nospecialize(n), @nospecialize(lb_arg), @nospecialize(ub
437
438
else
438
439
return TypeVar
439
440
end
440
- tv = TypeVar (n . val , lb, ub)
441
+ tv = TypeVar (nval , lb, ub)
441
442
return PartialTypeVar (tv, lb_certain, ub_certain)
442
443
end
443
444
return TypeVar
@@ -1273,11 +1274,10 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
1273
1274
return Union{}
1274
1275
end
1275
1276
uw = unwrap_unionall (headtype)
1276
- isnamedtuple = isa (uw, DataType) && uw. name === _NAMEDTUPLE_NAME
1277
1277
uncertain = false
1278
1278
canconst = true
1279
1279
tparams = Any[]
1280
- outervars = Any []
1280
+ outervars = TypeVar []
1281
1281
varnamectr = 1
1282
1282
ua = headtype
1283
1283
for i = 1 : largs
@@ -1324,7 +1324,7 @@ function apply_type_tfunc(@nospecialize(headtypetype), @nospecialize args...)
1324
1324
# end
1325
1325
else
1326
1326
# Is this the second parameter to a NamedTuple?
1327
- if isnamedtuple && isa (ua, UnionAll) && uw. parameters[2 ] === ua. var
1327
+ if isa (uw, DataType) && uw . name === _NAMEDTUPLE_NAME && isa (ua, UnionAll) && uw. parameters[2 ] === ua. var
1328
1328
# If the names are known, keep the upper bound, but otherwise widen to Tuple.
1329
1329
# This is a widening heuristic to avoid keeping type information
1330
1330
# that's unlikely to be useful.
@@ -1510,9 +1510,11 @@ function _builtin_nothrow(@nospecialize(f), argtypes::Array{Any,1}, @nospecializ
1510
1510
# Additionally check element type compatibility
1511
1511
a = widenconst (argtypes[2 ])
1512
1512
# Check that we can determine the element type
1513
- (isa (a, DataType) && isa (a. parameters[1 ], Type)) || return false
1513
+ isa (a, DataType) || return false
1514
+ ap1 = a. parameters[1 ]
1515
+ isa (ap1, Type) || return false
1514
1516
# Check that the element type is compatible with the element we're assigning
1515
- ( argtypes[3 ] ⊑ a . parameters[ 1 ]) || return false
1517
+ argtypes[3 ] ⊑ ap1 || return false
1516
1518
return true
1517
1519
elseif f === arrayref || f === const_arrayref
1518
1520
return array_builtin_common_nothrow (argtypes, 3 )
@@ -1568,7 +1570,7 @@ function builtin_tfunction(interp::AbstractInterpreter, @nospecialize(f), argtyp
1568
1570
end
1569
1571
if isa (f, IntrinsicFunction)
1570
1572
if is_pure_intrinsic_infer (f) && _all (@nospecialize (a) -> isa (a, Const), argtypes)
1571
- argvals = anymap (a :: Const -> a . val, argtypes)
1573
+ argvals = anymap (@nospecialize (a) -> (a :: Const ) . val, argtypes)
1572
1574
try
1573
1575
return Const (f (argvals... ))
1574
1576
catch
0 commit comments