Skip to content

Commit

Permalink
only expand if statements that declare new globals if they will be ex…
Browse files Browse the repository at this point in the history
…ecuted (#389)

this ensures that we only introduce package-local bindings for values
that we define in this package
  • Loading branch information
vtjnash authored and stevengj committed Jul 28, 2017
1 parent 097ba81 commit b566409
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,14 @@ if VERSION < v"0.6.0-dev.848"
end

# julia#18977
if !isdefined(Base, :xor)
@static if !isdefined(Base, :xor)
const xor = $
const = xor
export xor,
end

# julia#19246
if !isdefined(Base, :numerator)
@static if !isdefined(Base, :numerator)
const numerator = num
const denominator = den
export numerator, denominator
Expand All @@ -433,7 +433,7 @@ if !isdefined(Base, :iszero)
end

# julia #20407
if !isdefined(Base, :(>:))
@static if !isdefined(Base, :(>:))
const >: = let
_issupertype(a::ANY, b::ANY) = issubtype(b, a)
end
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ end
@test fma(3,4,5) == 3*4+5 == muladd(3,4,5)

if VERSION < v"0.5.0-dev+5271"
local s
# is_valid_utf32
s = utf32("abc")
@test isvalid(s)
Expand Down

0 comments on commit b566409

Please sign in to comment.