File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,24 @@ function sptypes_from_meth_instance(linfo::MethodInstance)
145145 end
146146 if Any <: ub
147147 ty = Any
148+ # if this parameter came from arg::Type{T}, we know that T::Type
149+ sig = linfo. def. sig
150+ temp = sig
151+ for j = 1 : i- 1
152+ temp = temp. body
153+ end
154+ Pi = temp. var
155+ while temp isa UnionAll
156+ temp = temp. body
157+ end
158+ sigtypes = temp. parameters
159+ for j = 1 : length (sigtypes)
160+ tj = sigtypes[j]
161+ if isType (tj) && tj. parameters[1 ] === Pi
162+ ty = Type
163+ break
164+ end
165+ end
148166 else
149167 lb = v. lb
150168 while lb isa TypeVar
Original file line number Diff line number Diff line change @@ -2204,3 +2204,6 @@ _rttf_test(::Int128) = 0
22042204_call_rttf_test () = Core. Compiler. return_type (_rttf_test, Tuple{Any})
22052205@test Core. Compiler. return_type (_rttf_test, Tuple{Any}) === Int
22062206@test _call_rttf_test () === Int
2207+
2208+ f_with_Type_arg (:: Type{T} ) where {T} = T
2209+ @test Base. return_types (f_with_Type_arg, (Any,)) == Any[Type]
You can’t perform that action at this time.
0 commit comments