Skip to content

Commit 28cbd54

Browse files
committed
Merge pull request #15368 from eschnett/eschnett/negative-shifts-overloads
Avoid overload ambiguities for shift operators during bootstrap
2 parents 4029e5b + 0bfe28a commit 28cbd54

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

base/int.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ trailing_ones(x::Integer) = trailing_zeros(~x)
170170
box(T,lshr_int(unbox(T,x),unbox(S,y)))
171171
# signed shift counts can shift in either direction
172172
# note: this early during bootstrap, `>=` is not yet available
173-
>>(x::BitInteger, y::BitSigned) =
173+
# note: we only define Int shift counts here; the generic case is handled later
174+
>>(x::BitInteger, y::Int) =
174175
0 <= y ? x >> unsigned(y) : x << unsigned(-y)
175-
<<(x::BitInteger, y::BitSigned) =
176+
<<(x::BitInteger, y::Int) =
176177
0 <= y ? x << unsigned(y) : x >> unsigned(-y)
177-
>>>(x::BitInteger, y::BitSigned) =
178+
>>>(x::BitInteger, y::Int) =
178179
0 <= y ? x >>> unsigned(y) : x << unsigned(-y)
179180

180181
## integer conversions ##

0 commit comments

Comments
 (0)