-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: address issue #20882 #20889
RFC: address issue #20882 #20889
Changes from 3 commits
35b0543
08c6ccd
75c33fa
e228123
09e5b1b
032a0af
07bc45f
e703ae4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2904,8 +2904,11 @@ end | |
|
||
import Base.^ | ||
immutable PR20530; end | ||
immutable PR20889; x; end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these should be |
||
^(::PR20530, p::Int) = 1 | ||
^{p}(::PR20530, ::Type{Val{p}}) = 2 | ||
^(t::PR20889, b) = t.x + b | ||
^(t::PR20889, b::Integer) = t.x + b | ||
Base.literal_pow{p}(::PR20530, ::Type{Val{p}}, ::typeof(^)) = 2 | ||
@testset "literal powers" begin | ||
x = PR20530() | ||
p = 2 | ||
|
@@ -2923,6 +2926,12 @@ immutable PR20530; end | |
end | ||
end | ||
end | ||
@test PR20889(2)^3 == 5 | ||
end | ||
module M20889 # do we get the expected behavior without importing Base.^? | ||
immutable PR20889; x; end | ||
^(t::PR20889, b) = t.x + b | ||
Base.Test.@test PR20889(2)^3 == 5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no need for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to put these tests in a different module than the other tests because I'm explicitly testing for what happens when I do not import There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, right. Don't mind me then. |
||
end | ||
|
||
@testset "iszero" begin | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 'top' instead of 'Base.'
It'll essentially resolve to the same thing, but lets us avoid hard coding the name Bade in here, and let's someone override the default function (by calling a special function to declare their module also 'top')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks. I figured there might be some issue with the way I did that... I'll try it out.