Skip to content

Commit

Permalink
Resolve ambiguity in math test (#19739)
Browse files Browse the repository at this point in the history
when it runs on the same worker as test/ambiguous.jl

Clean up printing of ambiguities when the test fails
  • Loading branch information
tkelman authored Dec 29, 2016
1 parent 4d44668 commit 99fcb5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/ambiguous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ ambs = detect_ambiguities(Ambig5)
@test length(ambs) == 2

# Test that Core and Base are free of ambiguities
@test (x->(isempty(x) || println(x)))(detect_ambiguities(Core, Base; imported=true))
@test detect_ambiguities(Core, Base; imported=true) == []
# not using isempty so this prints more information when it fails

amb_1(::Int8, ::Int) = 1
amb_1(::Integer, x) = 2
Expand Down
1 change: 1 addition & 0 deletions test/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ module Test19626
+(a::MockQuantity, b::MockQuantity) = MockQuantity(a.val+b.val)
-(a::MockQuantity, b::MockQuantity) = MockQuantity(a.val-b.val)
*(a::MockQuantity, b::Number) = MockQuantity(a.val*b)
*(a::MockQuantity, b::Bool) = MockQuantity(a.val*b) # resolve ambiguity
abs(a::MockQuantity) = MockQuantity(abs(a.val))
isnan(a::MockQuantity) = isnan(a.val)
isinf(a::MockQuantity) = isinf(a.val)
Expand Down

0 comments on commit 99fcb5b

Please sign in to comment.