Skip to content

Commit 135d7a0

Browse files
authored
Complex{<:OurRational} instead of Complex{OurRational} (#39934)
1 parent 901d270 commit 135d7a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/src/manual/constructors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ The first and most basic definition just makes `a ⊘ b` construct a `OurRationa
490490
is already a rational number, we construct a new rational for the resulting ratio slightly differently;
491491
this behavior is actually identical to division of a rational with an integer.
492492
Finally, applying
493-
`` to complex integral values creates an instance of `Complex{OurRational}` -- a complex
493+
`` to complex integral values creates an instance of `Complex{<:OurRational}` -- a complex
494494
number whose real and imaginary parts are rationals:
495495

496496
```jldoctest rational
@@ -499,12 +499,12 @@ julia> z = (1 + 2im) ⊘ (1 - 2im);
499499
julia> typeof(z)
500500
Complex{OurRational{Int64}}
501501
502-
julia> typeof(z) <: Complex{OurRational}
503-
false
502+
julia> typeof(z) <: Complex{<:OurRational}
503+
true
504504
```
505505

506506
Thus, although the `` operator usually returns an instance of `OurRational`, if either
507-
of its arguments are complex integers, it will return an instance of `Complex{OurRational}` instead.
507+
of its arguments are complex integers, it will return an instance of `Complex{<:OurRational}` instead.
508508
The interested reader should consider perusing the rest of [`rational.jl`](https://github.com/JuliaLang/julia/blob/master/base/rational.jl):
509509
it is short, self-contained, and implements an entire basic Julia type.
510510

0 commit comments

Comments
 (0)