Skip to content

Commit 74640a1

Browse files
docs: replace 'leaf types' with 'concrete types' (#56418)
Fixes #55044 --------- Co-authored-by: inkydragon <[email protected]>
1 parent 0249feb commit 74640a1

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

base/reflection.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ yielded by expanding the generators.
1515
1616
The keyword `debuginfo` controls the amount of code metadata present in the output.
1717
18-
Note that an error will be thrown if `types` are not leaf types when `generated` is
18+
Note that an error will be thrown if `types` are not concrete types when `generated` is
1919
`true` and any of the corresponding methods are an `@generated` method.
2020
"""
2121
function code_lowered(@nospecialize(f), @nospecialize(t=Tuple); generated::Bool=true, debuginfo::Symbol=:default)
@@ -37,7 +37,7 @@ function code_lowered(@nospecialize(f), @nospecialize(t=Tuple); generated::Bool=
3737
else
3838
error("Could not expand generator for `@generated` method ", m, ". ",
3939
"This can happen if the provided argument types (", t, ") are ",
40-
"not leaf types, but the `generated` argument is `true`.")
40+
"not concrete types, but the `generated` argument is `true`.")
4141
end
4242
else
4343
code = uncompressed_ir(m.def::Method)

base/runtime_internals.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ end
839839
"""
840840
isdispatchtuple(T)
841841
842-
Determine whether type `T` is a tuple "leaf type",
842+
Determine whether type `T` is a tuple of concrete types,
843843
meaning it could appear as a type signature in dispatch
844844
and has no subtypes (or supertypes) which could appear in a call.
845845
If `T` is not a type, then return `false`.
@@ -894,7 +894,7 @@ isconcretedispatch(@nospecialize t) = isconcretetype(t) && !iskindtype(t)
894894
using Core: has_free_typevars
895895

896896
# equivalent to isa(v, Type) && isdispatchtuple(Tuple{v}) || v === Union{}
897-
# and is thus perhaps most similar to the old (pre-1.0) `isleaftype` query
897+
# and is thus perhaps most similar to the old (pre-1.0) `isconcretetype` query
898898
function isdispatchelem(@nospecialize v)
899899
return (v === Bottom) || (v === typeof(Bottom)) || isconcretedispatch(v) ||
900900
(isType(v) && !has_free_typevars(v))

doc/src/manual/calling-c-and-fortran-code.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,17 @@ it to be freed prematurely.
276276

277277
First, let's review some relevant Julia type terminology:
278278

279-
| Syntax / Keyword | Example | Description |
280-
|:----------------------------- |:------------------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
281-
| `mutable struct` | `BitSet` | "Leaf Type" :: A group of related data that includes a type-tag, is managed by the Julia GC, and is defined by object-identity. The type parameters of a leaf type must be fully defined (no `TypeVars` are allowed) in order for the instance to be constructed. |
282-
| `abstract type` | `Any`, `AbstractArray{T, N}`, `Complex{T}` | "Super Type" :: A super-type (not a leaf-type) that cannot be instantiated, but can be used to describe a group of types. |
283-
| `T{A}` | `Vector{Int}` | "Type Parameter" :: A specialization of a type (typically used for dispatch or storage optimization). |
284-
| | | "TypeVar" :: The `T` in the type parameter declaration is referred to as a TypeVar (short for type variable). |
285-
| `primitive type` | `Int`, `Float64` | "Primitive Type" :: A type with no fields, but a size. It is stored and defined by-value. |
286-
| `struct` | `Pair{Int, Int}` | "Struct" :: A type with all fields defined to be constant. It is defined by-value, and may be stored with a type-tag. |
287-
| | `ComplexF64` (`isbits`) | "Is-Bits" :: A `primitive type`, or a `struct` type where all fields are other `isbits` types. It is defined by-value, and is stored without a type-tag. |
288-
| `struct ...; end` | `nothing` | "Singleton" :: a Leaf Type or Struct with no fields. |
289-
| `(...)` or `tuple(...)` | `(1, 2, 3)` | "Tuple" :: an immutable data-structure similar to an anonymous struct type, or a constant array. Represented as either an array or a struct. |
279+
| Syntax / Keyword | Example | Description |
280+
|:----------------------------- |:------------------------------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
281+
| `mutable struct` | `BitSet` | "Concrete Type" :: A group of related data that includes a type-tag, is managed by the Julia GC, and is defined by object-identity. The type parameters of a concrete type must be fully defined (no `TypeVars` are allowed) in order for the instance to be constructed. Also see [`isconcretetype`](@ref). |
282+
| `abstract type` | `Any`, `AbstractArray{T, N}`, `Complex{T}` | "Super Type" :: A super-type (not a concrete type) that cannot be instantiated, but can be used to describe a group of types. Also see [`isabstracttype`](@ref). |
283+
| `T{A}` | `Vector{Int}` | "Type Parameter" :: A specialization of a type (typically used for dispatch or storage optimization). |
284+
| | | "TypeVar" :: The `T` in the type parameter declaration is referred to as a TypeVar (short for type variable). |
285+
| `primitive type` | `Int`, `Float64` | "Primitive Type" :: A type with no fields, but a size. It is stored and defined by-value. |
286+
| `struct` | `Pair{Int, Int}` | "Struct" :: A type with all fields defined to be constant. It is defined by-value, and may be stored with a type-tag. |
287+
| | `ComplexF64` (`isbits`) | "Is-Bits" :: A `primitive type`, or a `struct` type where all fields are other `isbits` types. It is defined by-value, and is stored without a type-tag. |
288+
| `struct ...; end` | `nothing` | "Singleton" :: a concrete Type or Struct with no fields. |
289+
| `(...)` or `tuple(...)` | `(1, 2, 3)` | "Tuple" :: an immutable data-structure similar to an anonymous struct type, or a constant array. Represented as either an array or a struct. |
290290

291291
### [Bits Types](@id man-bits-types)
292292

@@ -626,7 +626,7 @@ For translating a C argument list to Julia:
626626
* argument value will be copied (passed by value)
627627
* `struct T` (including typedef to a struct)
628628

629-
* `T`, where `T` is a Julia leaf type
629+
* `T`, where `T` is a concrete Julia type
630630
* argument value will be copied (passed by value)
631631
* `void*`
632632

@@ -679,7 +679,7 @@ For translating a C return type to Julia:
679679
* argument value will be copied (returned by-value)
680680
* `struct T` (including typedef to a struct)
681681

682-
* `T`, where `T` is a Julia Leaf Type
682+
* `T`, where `T` is a concrete Julia Type
683683
* argument value will be copied (returned by-value)
684684
* `void*`
685685

doc/src/manual/performance-tips.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ or `nothing` if it is not found, a clear type instability. In order to make it e
805805
type instabilities that are likely to be important, `Union`s containing either `missing` or `nothing`
806806
are color highlighted in yellow, instead of red.
807807

808-
The following examples may help you interpret expressions marked as containing non-leaf types:
808+
The following examples may help you interpret expressions marked as containing non-concrete types:
809809

810810
* Function body starting with `Body::Union{T1,T2})`
811811
* Interpretation: function with unstable return type
@@ -821,7 +821,7 @@ The following examples may help you interpret expressions marked as containing n
821821
element accesses
822822

823823
* `Base.getfield(%%x, :(:data))::Array{Float64,N} where N`
824-
* Interpretation: getting a field that is of non-leaf type. In this case, the type of `x`, say `ArrayContainer`, had a
824+
* Interpretation: getting a field that is of non-concrete type. In this case, the type of `x`, say `ArrayContainer`, had a
825825
field `data::Array{T}`. But `Array` needs the dimension `N`, too, to be a concrete type.
826826
* Suggestion: use concrete types like `Array{T,3}` or `Array{T,N}`, where `N` is now a parameter
827827
of `ArrayContainer`

stdlib/InteractiveUtils/src/codeview.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ end
128128
129129
Prints lowered and type-inferred ASTs for the methods matching the given generic function
130130
and type signature to `io` which defaults to `stdout`. The ASTs are annotated in such a way
131-
as to cause "non-leaf" types which may be problematic for performance to be emphasized
131+
as to cause non-concrete types which may be problematic for performance to be emphasized
132132
(if color is available, displayed in red). This serves as a warning of potential type instability.
133133
134-
Not all non-leaf types are particularly problematic for performance, and the performance
134+
Not all non-concrete types are particularly problematic for performance, and the performance
135135
characteristics of a particular type is an implementation detail of the compiler.
136136
`code_warntype` will err on the side of coloring types red if they might be a performance
137137
concern, so some types may be colored red even if they do not impact performance.

0 commit comments

Comments
 (0)