-
-
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
Ambiguity warning: false positive? #10174
Comments
You're right, the warning does not look necessary. |
I think this ambiguity is real? None of the two definitions seems to be more specific than the other one. |
I agree with Yichao.
|
Still a problem on current master. |
What's the problem? |
Only one case: julia> S = sprand(3,3,0.4)
3×3 sparse matrix with 3 Float64 nonzero entries:
[1, 1] = 0.470274
[3, 2] = 0.0942641
[3, 3] = 0.214061
julia> @test myf(S) == 0
Error During Test
Test threw an exception of type MethodError
Expression: myf(S) == 0
MethodError: myf(::SparseMatrixCSC{Float64,Int64}) is ambiguous. Candidates:
svec(Tuple{#myf,SparseMatrixCSC{Float64,Int64}},svec(),myf(x, y::Array...) at REPL[16]:1)
svec(Tuple{#myf,SparseMatrixCSC{Float64,Int64}},svec(),myf(x::SparseMatrixCSC, y::SparseMatrixCSC...) at REPL[15]:2)
in eval(::Module, ::Any) at ./boot.jl:230
ERROR: There was an error during testing
in record(::Base.Test.FallbackTestSet, ::Base.Test.Error) at ./test.jl:321
in do_test(::Base.Test.Threw, ::Expr) at ./test.jl:219
in eval(::Module, ::Any) at ./boot.jl:230
julia> @test myf(S, S) == 0
Test Passed
Expression: myf(S,S) == 0
Evaluated: 0 == 0
julia> @test myf("foo") == 1
Test Passed
Expression: myf("foo") == 1
Evaluated: 1 == 1
julia> @test myf("foo", zeros(2,2)) == 1
Test Passed
Expression: myf("foo",zeros(2,2)) == 1
Evaluated: 1 == 1
julia> @test myf(S, zeros(2,2)) == 1
Test Passed
Expression: myf(S,zeros(2,2)) == 1
Evaluated: 1 == 1 |
I guess I still think this is indeed ambiguous... not sure which way is better.... |
Fixed in 0.6. These aren't ambiguous --- the overlap is |
In the example bellow I get this warning, even though it seems to me that the two methods are not ambiguous. Am I missing something or is the compiler?
The text was updated successfully, but these errors were encountered: