Skip to content

Commit eee1837

Browse files
committed
fix pretty crazy bug where Type{T}s were inferred as Ts
1 parent e395399 commit eee1837

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -638,19 +638,20 @@ function abstract_call(@nospecialize(f), fargs::Union{Tuple{},Vector{Any}}, argt
638638
if !isa(body, Type) && !isa(body, TypeVar)
639639
return Any
640640
end
641-
has_free_typevars(body) || return body
642-
if isa(argtypes[2], Const)
643-
tv = argtypes[2].val
644-
elseif isa(argtypes[2], PartialTypeVar)
645-
ptv = argtypes[2]
646-
tv = ptv.tv
647-
canconst = false
648-
else
649-
return Any
641+
if has_free_typevars(body)
642+
if isa(argtypes[2], Const)
643+
tv = argtypes[2].val
644+
elseif isa(argtypes[2], PartialTypeVar)
645+
ptv = argtypes[2]
646+
tv = ptv.tv
647+
canconst = false
648+
else
649+
return Any
650+
end
651+
!isa(tv, TypeVar) && return Any
652+
body = UnionAll(tv, body)
650653
end
651-
!isa(tv, TypeVar) && return Any
652-
theunion = UnionAll(tv, body)
653-
ret = canconst ? AbstractEvalConstant(theunion) : Type{theunion}
654+
ret = canconst ? AbstractEvalConstant(body) : Type{body}
654655
return ret
655656
end
656657
return Any

0 commit comments

Comments
 (0)