@@ -279,74 +279,6 @@ function supertypes(T::Type)
279
279
return S === T ? (T,) : (T, supertypes (S)... )
280
280
end
281
281
282
- # dumptype is for displaying abstract type hierarchies,
283
- # based on Jameson Nash's typetree.jl in https://github.com/JuliaArchive/Examples
284
- function dumptype (io:: IO , @nospecialize (x), n:: Int , indent)
285
- print (io, x)
286
- n == 0 && return # too deeply nested
287
- isa (x, DataType) && x. name. abstract && dumpsubtypes (io, x, Main, n, indent)
288
- nothing
289
- end
290
-
291
- directsubtype (a:: DataType , b:: DataType ) = supertype (a). name === b. name
292
- directsubtype (a:: UnionAll , b:: DataType ) = directsubtype (a. body, b)
293
- directsubtype (a:: Union , b:: DataType ) = directsubtype (a. a, b) || directsubtype (a. b, b)
294
- # Fallback to handle TypeVar's
295
- directsubtype (a, b:: DataType ) = false
296
- function dumpsubtypes (io:: IO , x:: DataType , m:: Module , n:: Int , indent)
297
- for s in names (m, all = true )
298
- if isdefined (m, s) && ! isdeprecated (m, s)
299
- t = getfield (m, s)
300
- if t === x || t === m
301
- continue
302
- elseif isa (t, Module) && nameof (t) === s && parentmodule (t) === m
303
- # recurse into primary module bindings
304
- dumpsubtypes (io, x, t, n, indent)
305
- elseif isa (t, UnionAll) && directsubtype (t:: UnionAll , x)
306
- dt = unwrap_unionall (t)
307
- println (io)
308
- if isa (dt, DataType) && dt. name. wrapper === t
309
- # primary type binding
310
- print (io, indent, " " )
311
- dumptype (io, dt, n - 1 , string (indent, " " ))
312
- else
313
- # aliases to types
314
- print (io, indent, " " , m, " ." , s, " {" )
315
- tvar_io:: IOContext = io
316
- tp = t
317
- while true
318
- show (tvar_io, tp. var)
319
- tvar_io = IOContext (tvar_io, :unionall_env => tp. var)
320
- tp = tp. body
321
- if isa (tp, UnionAll)
322
- print (io, " , " )
323
- else
324
- print (io, " } = " )
325
- break
326
- end
327
- end
328
- show (tvar_io, tp)
329
- end
330
- elseif isa (t, Union) && directsubtype (t:: Union , x)
331
- println (io)
332
- print (io, indent, " " , m, " ." , s, " = " , t)
333
- elseif isa (t, DataType) && directsubtype (t:: DataType , x)
334
- println (io)
335
- if t. name. module != = m || t. name. name != s
336
- # aliases to types
337
- print (io, indent, " " , m, " ." , s, " = " )
338
- show (io, t)
339
- else
340
- # primary type binding
341
- print (io, indent, " " )
342
- dumptype (io, t, n - 1 , string (indent, " " ))
343
- end
344
- end
345
- end
346
- end
347
- nothing
348
- end
349
-
350
282
# TODO : @deprecate peakflops to LinearAlgebra
351
283
export peakflops
352
284
"""
0 commit comments