PEP 695: Edit for valid Julia Syntax (#3300)

This commit is contained in:
Mark Kittisopikul 2023-08-23 14:03:58 -04:00 committed by GitHub
parent 70cf21146c
commit c8336b7b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -1495,16 +1495,22 @@ upper and lower bounds on a type.
.. code-block:: julia
// Generic struct; type parameter with upper and lower bounds
struct StructA{T} where Int <: T <: Number
# Generic struct; type parameter with upper and lower bounds
# Valid for T in (Int64, Signed, Integer, Real, Number)
struct Container{Int <: T <: Number}
x::T
end
// Generic function
function func1{T <: Real}(v::Container{T})
# Generic function
function func1(v::Container{T}) where T <: Real end
// Alternate form of generic function
function func2(v::Container{T} where T <: Real)
# Alternate forms of generic function
function func2(v::Container{T} where T <: Real) end
function func3(v::Container{<: Real}) end
# Tuple types are covariant
# Valid for func4((2//3, 3.5))
function func4(t::Tuple{Real,Real}) end
Dart
----