-
-
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
Adding a method for Tuple adds two methods to Tuple #55231
Comments
Not specific to tuples: struct U{P} end; struct V{P} end
U(::V) = nothing
(::Type{T})(::V) where {T<:U} = nothing
length(methods(U)) # 1
U(a, b) = nothing
length(methods(U)) # 2
U(a, b, c) = nothing
length(methods(U)) # 3
U(a, b, c, d) = nothing
length(methods(U)) # 4
U(a, b, c, d, e) = nothing
length(methods(U)) # 5
U(a, b, c, d, e, f) = nothing
length(methods(U)) # 7 julia> versioninfo()
Julia Version 1.12.0-DEV.896
Commit 24cfe6e2cc7 (2024-07-24 06:36 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
WORD_SIZE: 64
LLVM: libLLVM-17.0.6 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores) |
why did you add it seems the added method is but these have no subtypes anyway |
Looks like a bug in the query used by |
It isn't really a bug, but it is suboptimal. It is using the test |
Here's a fix, though currently without a test: https://github.com/JuliaLang/julia/compare/jn/55231 |
Could you use @nsajko's example above as a test for your change? Something like diff --git a/test/ambiguous.jl b/test/ambiguous.jl
index d6f69f21bc..4c323d7aee 100644
--- a/test/ambiguous.jl
+++ b/test/ambiguous.jl
@@ -447,4 +447,19 @@ cc46601(::Type{T}, x::Int) where {T<:AbstractString} = 7
@test length(methods(cc46601, Tuple{Type{<:Integer}, Integer})) == 2
@test length(Base.methods_including_ambiguous(cc46601, Tuple{Type{<:Integer}, Integer})) == 7
+# Issue #55231
+module M55231
+ using Test
+ struct U{P} end
+ struct V{P} end
+ U(::V) = nothing
+ (::Type{T})(::V) where {T<:U} = nothing
+ U(a, b) = nothing
+ U(a, b, c) = nothing
+ U(a, b, c, d) = nothing
+ U(a, b, c, d, e) = nothing
+ U(a, b, c, d, e, f) = nothing
+ @test length(methods(U)) == 6
+end
+
nothing |
You just need the first two and make sure neither is filtered out of this query, regardless of which order you define them in |
Some methods were filtered out based simply on visit order, which was not intentional, with the lim==-1 weak-edges mode. Fix #55231
Some methods were filtered out based simply on visit order, which was not intentional, with the lim==-1 weak-edges mode. Fix #55231
Some methods were filtered out based simply on visit order, which was not intentional, with the lim==-1 weak-edges mode. Fix JuliaLang#55231
I'm not sure if this is a problem, but we were surprised by it over at oxinabox/Tricks.jl#42. The following demonstrates the unexpected behavior:
EDIT: This is on Julia 1.10.4
The text was updated successfully, but these errors were encountered: